target

package
v0.0.0-pre.5 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: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewTarget = func(t api.Target) (Target, error) {
	switch t.TargetType {
	case api.TARGETTYPE_INCUS:
		return newInternalIncusTargetFrom(t)
	default:
		return nil, fmt.Errorf("Unknown target type %q", t.TargetType)
	}
}

Functions

func CanPlaceInstance

func CanPlaceInstance(ctx context.Context, info *IncusDetails, placement api.Placement, inst api.Instance) error

Types

type IncusDetails

type IncusDetails struct {
	Name               string
	Projects           []string
	StoragePools       []string
	NetworksByProject  map[string][]string
	InstancesByProject map[string][]string
}

type InternalIncusTarget

type InternalIncusTarget struct {
	InternalTarget      `yaml:",inline"`
	api.IncusProperties `yaml:",inline"`
	// contains filtered or unexported fields
}

func (*InternalIncusTarget) CheckIncusAgent

func (t *InternalIncusTarget) CheckIncusAgent(ctx context.Context, instanceName string) error

CheckIncusAgent repeatedly calls Exec on the instance until the context errors out, or the exec succeeds.

func (*InternalIncusTarget) CleanupVM

func (t *InternalIncusTarget) CleanupVM(ctx context.Context, name string, requireWorkerVolume bool) error

CleanupVM fully deletes the VM and all of its volumes.

func (*InternalIncusTarget) Connect

func (t *InternalIncusTarget) Connect(ctx context.Context) error

func (*InternalIncusTarget) CreateNewVM

func (t *InternalIncusTarget) CreateNewVM(ctx context.Context, instDef migration.Instance, apiDef incusAPI.InstancesPost, placement api.Placement, bootISOImage string) (func(), error)

func (*InternalIncusTarget) CreateStoragePoolVolumeFromBackup

func (t *InternalIncusTarget) CreateStoragePoolVolumeFromBackup(poolName string, backupFilePath string) ([]incus.Operation, error)

func (*InternalIncusTarget) CreateStoragePoolVolumeFromISO

func (t *InternalIncusTarget) CreateStoragePoolVolumeFromISO(poolName string, isoFilePath string) ([]incus.Operation, error)

func (*InternalIncusTarget) CreateVMDefinition

func (t *InternalIncusTarget) CreateVMDefinition(instanceDef migration.Instance, usedNetworks migration.Networks, q migration.QueueEntry, fingerprint string, endpoint string) (incusAPI.InstancesPost, error)

func (*InternalIncusTarget) DeleteVM

func (t *InternalIncusTarget) DeleteVM(ctx context.Context, name string) error

func (*InternalIncusTarget) Disconnect

func (t *InternalIncusTarget) Disconnect(ctx context.Context) error

func (*InternalIncusTarget) DoBasicConnectivityCheck

func (t *InternalIncusTarget) DoBasicConnectivityCheck() (api.ExternalConnectivityStatus, *x509.Certificate)

func (*InternalIncusTarget) Exec

func (t *InternalIncusTarget) Exec(ctx context.Context, instanceName string, cmd []string) error

func (*InternalIncusTarget) GetDetails

func (t *InternalIncusTarget) GetDetails(ctx context.Context) (*IncusDetails, error)

GetDetails fetches top-level details about the entities that exist on the target.

func (*InternalIncusTarget) GetInstance

func (t *InternalIncusTarget) GetInstance(name string) (*incusAPI.Instance, string, error)

func (*InternalIncusTarget) GetInstanceNames

func (t *InternalIncusTarget) GetInstanceNames() ([]string, error)

func (*InternalIncusTarget) GetNetworkNames

func (t *InternalIncusTarget) GetNetworkNames() ([]string, error)

func (*InternalIncusTarget) GetProperties

func (t *InternalIncusTarget) GetProperties() json.RawMessage

func (*InternalIncusTarget) GetStoragePoolVolumeNames

func (t *InternalIncusTarget) GetStoragePoolVolumeNames(pool string) ([]string, error)

func (*InternalIncusTarget) IsWaitingForOIDCTokens

func (t *InternalIncusTarget) IsWaitingForOIDCTokens() bool

func (*InternalIncusTarget) PushFile

func (t *InternalIncusTarget) PushFile(instanceName string, file string, destDir string) error

func (*InternalIncusTarget) SetClientTLSCredentials

func (t *InternalIncusTarget) SetClientTLSCredentials(key string, cert string) error

func (*InternalIncusTarget) SetPostMigrationVMConfig

func (t *InternalIncusTarget) SetPostMigrationVMConfig(ctx context.Context, i migration.Instance, q migration.QueueEntry, allNetworks migration.Networks) error

SetPostMigrationVMConfig stops the target instance and applies post-migration configuration before restarting it.

func (*InternalIncusTarget) SetProject

func (t *InternalIncusTarget) SetProject(project string) error

func (*InternalIncusTarget) StartVM

func (t *InternalIncusTarget) StartVM(ctx context.Context, name string) error

func (*InternalIncusTarget) StopVM

func (t *InternalIncusTarget) StopVM(ctx context.Context, name string, force bool) error

func (*InternalIncusTarget) UpdateInstance

func (t *InternalIncusTarget) UpdateInstance(name string, instanceDef incusAPI.InstancePut, ETag string) (incus.Operation, error)

func (*InternalIncusTarget) WithAdditionalRootCertificate

func (t *InternalIncusTarget) WithAdditionalRootCertificate(rootCert *x509.Certificate)

type InternalTarget

type InternalTarget struct {
	api.Target `yaml:",inline"`
	// contains filtered or unexported fields
}

func NewInternalTarget

func NewInternalTarget(t api.Target, version string) InternalTarget

func (*InternalTarget) GetName

func (t *InternalTarget) GetName() string

func (*InternalTarget) IsConnected

func (t *InternalTarget) IsConnected() bool

type Target

type Target interface {
	// Connects to the target.
	//
	// Prior to calling Connect(), set any other configuration required, such as the client's TLS
	// credentials if not using OIDC authentication.
	//
	// Returns an error if unable to connect (unable to reach remote host, bad credentials, etc).
	Connect(ctx context.Context) error

	// Performs a basic HTTP connectivity test to the source.
	//
	// Returns a status flag indicating the status and if a TLS certificate error occurred a copy of the untrusted TLS certificate.
	DoBasicConnectivityCheck() (api.ExternalConnectivityStatus, *x509.Certificate)

	// Disconnects from the target.
	//
	// Returns an error if there was a problem disconnecting from the target.
	Disconnect(ctx context.Context) error

	// WithAdditionalRootCertificate accepts an additional certificate, which
	// is added to the default CertPool used to validate server certificates
	// while connecting to the Target using TLS.
	WithAdditionalRootCertificate(rootCert *x509.Certificate)

	// Sets the client TLS key and certificate to be used to authenticate with the target. Leave unset to
	// default to OIDC authentication.
	//
	// The key/cert pair can be generated with a command like
	// `openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:secp384r1 -sha384 -keyout "client.key" -nodes -out "client.crt" -days 365 -subj "/"`.
	// The resulting certificate can then be imported on the target instance with
	// `incus config trust add-certificate <client.crt>`.
	//
	// Returns an error if called while connected to a target.
	SetClientTLSCredentials(key string, cert string) error

	// Returns whether currently connected to the target or not.
	IsConnected() bool

	// Returns whether the target is waiting to complete OIDC authentication.
	IsWaitingForOIDCTokens() bool

	// Returns the human-readable name for this target.
	GetName() string

	// Returns the json-encoded type specific properties for this target.
	GetProperties() json.RawMessage

	// Selects the Incus project to use when performing actions on the target.
	//
	// Returns an error if called while disconnected from a target.
	SetProject(project string) error

	// SetPostMigrationVMConfig stops the target instance and applies post-migration configuration before restarting it.
	SetPostMigrationVMConfig(ctx context.Context, i migration.Instance, q migration.QueueEntry, allNetworks migration.Networks) error

	// Creates a VM definition for use with the Incus REST API.
	CreateVMDefinition(instanceDef migration.Instance, usedNetworks migration.Networks, q migration.QueueEntry, fingerprint string, endpoint string) (incusAPI.InstancesPost, error)

	// Creates a new VM from the pre-populated API definition.
	CreateNewVM(ctx context.Context, instDef migration.Instance, apiDef incusAPI.InstancesPost, placement api.Placement, bootISOImage string) (func(), error)

	// Deletes a VM.
	DeleteVM(ctx context.Context, name string) error

	// Starts a VM.
	StartVM(ctx context.Context, name string) error

	// Stops a VM.
	StopVM(ctx context.Context, name string, force bool) error

	// Push a file into a running instance.
	PushFile(instanceName string, file string, destDir string) error

	// Exec runs a command within an instance and wait for it to complete.
	Exec(ctx context.Context, instanceName string, cmd []string) error

	// Wrapper around Incus' GetInstanceNames method.
	GetInstanceNames() ([]string, error)

	// Wrapper around Incus' GetInstance method.
	GetInstance(name string) (*incusAPI.Instance, string, error)

	// Wrapper around Incus' UpdateInstance method.
	UpdateInstance(name string, instanceDef incusAPI.InstancePut, ETag string) (incus.Operation, error)

	// Wrapper around Incus' GetStoragePoolVolumeNames method.
	GetStoragePoolVolumeNames(pool string) ([]string, error)

	// Wrapper around Incus' CreateStoragePoolVolumeFromBackup.
	CreateStoragePoolVolumeFromBackup(poolName string, backupFilePath string) ([]incus.Operation, error)

	// Wrapper around Incus' CreateStoragePoolVolumeFromISO.
	CreateStoragePoolVolumeFromISO(pool string, isoFilePath string) ([]incus.Operation, error)

	// CheckIncusAgent repeatedly calls Exec on the instance until the context errors out, or the exec succeeds.
	CheckIncusAgent(ctx context.Context, instanceName string) error

	// CleanupVM fully deletes the VM and all of its volumes. If requireWorkerVolume is true, the worker volume must be present for the VM to be cleaned up.
	CleanupVM(ctx context.Context, name string, requireWorkerVolume bool) error

	// GetDetails fetches top-level details about the entities that exist on the target.
	GetDetails(ctx context.Context) (*IncusDetails, error)
}

Target interface definition for all migration manager targets.

type TargetMock

type TargetMock struct {
	// CheckIncusAgentFunc mocks the CheckIncusAgent method.
	CheckIncusAgentFunc func(ctx context.Context, instanceName string) error

	// CleanupVMFunc mocks the CleanupVM method.
	CleanupVMFunc func(ctx context.Context, name string, requireWorkerVolume bool) error

	// ConnectFunc mocks the Connect method.
	ConnectFunc func(ctx context.Context) error

	// CreateNewVMFunc mocks the CreateNewVM method.
	CreateNewVMFunc func(ctx context.Context, instDef migration.Instance, apiDef incusAPI.InstancesPost, placement api.Placement, bootISOImage string) (func(), error)

	// CreateStoragePoolVolumeFromBackupFunc mocks the CreateStoragePoolVolumeFromBackup method.
	CreateStoragePoolVolumeFromBackupFunc func(poolName string, backupFilePath string) ([]incus.Operation, error)

	// CreateStoragePoolVolumeFromISOFunc mocks the CreateStoragePoolVolumeFromISO method.
	CreateStoragePoolVolumeFromISOFunc func(pool string, isoFilePath string) ([]incus.Operation, error)

	// CreateVMDefinitionFunc mocks the CreateVMDefinition method.
	CreateVMDefinitionFunc func(instanceDef migration.Instance, usedNetworks migration.Networks, q migration.QueueEntry, fingerprint string, endpoint string) (incusAPI.InstancesPost, error)

	// DeleteVMFunc mocks the DeleteVM method.
	DeleteVMFunc func(ctx context.Context, name string) error

	// DisconnectFunc mocks the Disconnect method.
	DisconnectFunc func(ctx context.Context) error

	// DoBasicConnectivityCheckFunc mocks the DoBasicConnectivityCheck method.
	DoBasicConnectivityCheckFunc func() (api.ExternalConnectivityStatus, *x509.Certificate)

	// ExecFunc mocks the Exec method.
	ExecFunc func(ctx context.Context, instanceName string, cmd []string) error

	// GetDetailsFunc mocks the GetDetails method.
	GetDetailsFunc func(ctx context.Context) (*IncusDetails, error)

	// GetInstanceFunc mocks the GetInstance method.
	GetInstanceFunc func(name string) (*incusAPI.Instance, string, error)

	// GetInstanceNamesFunc mocks the GetInstanceNames method.
	GetInstanceNamesFunc func() ([]string, error)

	// GetNameFunc mocks the GetName method.
	GetNameFunc func() string

	// GetPropertiesFunc mocks the GetProperties method.
	GetPropertiesFunc func() json.RawMessage

	// GetStoragePoolVolumeNamesFunc mocks the GetStoragePoolVolumeNames method.
	GetStoragePoolVolumeNamesFunc func(pool string) ([]string, error)

	// IsConnectedFunc mocks the IsConnected method.
	IsConnectedFunc func() bool

	// IsWaitingForOIDCTokensFunc mocks the IsWaitingForOIDCTokens method.
	IsWaitingForOIDCTokensFunc func() bool

	// PushFileFunc mocks the PushFile method.
	PushFileFunc func(instanceName string, file string, destDir string) error

	// SetClientTLSCredentialsFunc mocks the SetClientTLSCredentials method.
	SetClientTLSCredentialsFunc func(key string, cert string) error

	// SetPostMigrationVMConfigFunc mocks the SetPostMigrationVMConfig method.
	SetPostMigrationVMConfigFunc func(ctx context.Context, i migration.Instance, q migration.QueueEntry, allNetworks migration.Networks) error

	// SetProjectFunc mocks the SetProject method.
	SetProjectFunc func(project string) error

	// StartVMFunc mocks the StartVM method.
	StartVMFunc func(ctx context.Context, name string) error

	// StopVMFunc mocks the StopVM method.
	StopVMFunc func(ctx context.Context, name string, force bool) error

	// UpdateInstanceFunc mocks the UpdateInstance method.
	UpdateInstanceFunc func(name string, instanceDef incusAPI.InstancePut, ETag string) (incus.Operation, error)

	// WithAdditionalRootCertificateFunc mocks the WithAdditionalRootCertificate method.
	WithAdditionalRootCertificateFunc func(rootCert *x509.Certificate)
	// contains filtered or unexported fields
}

TargetMock is a mock implementation of Target.

func TestSomethingThatUsesTarget(t *testing.T) {

	// make and configure a mocked Target
	mockedTarget := &TargetMock{
		CheckIncusAgentFunc: func(ctx context.Context, instanceName string) error {
			panic("mock out the CheckIncusAgent method")
		},
		CleanupVMFunc: func(ctx context.Context, name string, requireWorkerVolume bool) error {
			panic("mock out the CleanupVM method")
		},
		ConnectFunc: func(ctx context.Context) error {
			panic("mock out the Connect method")
		},
		CreateNewVMFunc: func(ctx context.Context, instDef migration.Instance, apiDef incusAPI.InstancesPost, placement api.Placement, bootISOImage string) (func(), error) {
			panic("mock out the CreateNewVM method")
		},
		CreateStoragePoolVolumeFromBackupFunc: func(poolName string, backupFilePath string) ([]incus.Operation, error) {
			panic("mock out the CreateStoragePoolVolumeFromBackup method")
		},
		CreateStoragePoolVolumeFromISOFunc: func(pool string, isoFilePath string) ([]incus.Operation, error) {
			panic("mock out the CreateStoragePoolVolumeFromISO method")
		},
		CreateVMDefinitionFunc: func(instanceDef migration.Instance, usedNetworks migration.Networks, q migration.QueueEntry, fingerprint string, endpoint string) (incusAPI.InstancesPost, error) {
			panic("mock out the CreateVMDefinition method")
		},
		DeleteVMFunc: func(ctx context.Context, name string) error {
			panic("mock out the DeleteVM method")
		},
		DisconnectFunc: func(ctx context.Context) error {
			panic("mock out the Disconnect method")
		},
		DoBasicConnectivityCheckFunc: func() (api.ExternalConnectivityStatus, *x509.Certificate) {
			panic("mock out the DoBasicConnectivityCheck method")
		},
		ExecFunc: func(ctx context.Context, instanceName string, cmd []string) error {
			panic("mock out the Exec method")
		},
		GetDetailsFunc: func(ctx context.Context) (*IncusDetails, error) {
			panic("mock out the GetDetails method")
		},
		GetInstanceFunc: func(name string) (*incusAPI.Instance, string, error) {
			panic("mock out the GetInstance method")
		},
		GetInstanceNamesFunc: func() ([]string, error) {
			panic("mock out the GetInstanceNames method")
		},
		GetNameFunc: func() string {
			panic("mock out the GetName method")
		},
		GetPropertiesFunc: func() json.RawMessage {
			panic("mock out the GetProperties method")
		},
		GetStoragePoolVolumeNamesFunc: func(pool string) ([]string, error) {
			panic("mock out the GetStoragePoolVolumeNames method")
		},
		IsConnectedFunc: func() bool {
			panic("mock out the IsConnected method")
		},
		IsWaitingForOIDCTokensFunc: func() bool {
			panic("mock out the IsWaitingForOIDCTokens method")
		},
		PushFileFunc: func(instanceName string, file string, destDir string) error {
			panic("mock out the PushFile method")
		},
		SetClientTLSCredentialsFunc: func(key string, cert string) error {
			panic("mock out the SetClientTLSCredentials method")
		},
		SetPostMigrationVMConfigFunc: func(ctx context.Context, i migration.Instance, q migration.QueueEntry, allNetworks migration.Networks) error {
			panic("mock out the SetPostMigrationVMConfig method")
		},
		SetProjectFunc: func(project string) error {
			panic("mock out the SetProject method")
		},
		StartVMFunc: func(ctx context.Context, name string) error {
			panic("mock out the StartVM method")
		},
		StopVMFunc: func(ctx context.Context, name string, force bool) error {
			panic("mock out the StopVM method")
		},
		UpdateInstanceFunc: func(name string, instanceDef incusAPI.InstancePut, ETag string) (incus.Operation, error) {
			panic("mock out the UpdateInstance method")
		},
		WithAdditionalRootCertificateFunc: func(rootCert *x509.Certificate)  {
			panic("mock out the WithAdditionalRootCertificate method")
		},
	}

	// use mockedTarget in code that requires Target
	// and then make assertions.

}

func (*TargetMock) CheckIncusAgent

func (mock *TargetMock) CheckIncusAgent(ctx context.Context, instanceName string) error

CheckIncusAgent calls CheckIncusAgentFunc.

func (*TargetMock) CheckIncusAgentCalls

func (mock *TargetMock) CheckIncusAgentCalls() []struct {
	Ctx          context.Context
	InstanceName string
}

CheckIncusAgentCalls gets all the calls that were made to CheckIncusAgent. Check the length with:

len(mockedTarget.CheckIncusAgentCalls())

func (*TargetMock) CleanupVM

func (mock *TargetMock) CleanupVM(ctx context.Context, name string, requireWorkerVolume bool) error

CleanupVM calls CleanupVMFunc.

func (*TargetMock) CleanupVMCalls

func (mock *TargetMock) CleanupVMCalls() []struct {
	Ctx                 context.Context
	Name                string
	RequireWorkerVolume bool
}

CleanupVMCalls gets all the calls that were made to CleanupVM. Check the length with:

len(mockedTarget.CleanupVMCalls())

func (*TargetMock) Connect

func (mock *TargetMock) Connect(ctx context.Context) error

Connect calls ConnectFunc.

func (*TargetMock) ConnectCalls

func (mock *TargetMock) ConnectCalls() []struct {
	Ctx context.Context
}

ConnectCalls gets all the calls that were made to Connect. Check the length with:

len(mockedTarget.ConnectCalls())

func (*TargetMock) CreateNewVM

func (mock *TargetMock) CreateNewVM(ctx context.Context, instDef migration.Instance, apiDef incusAPI.InstancesPost, placement api.Placement, bootISOImage string) (func(), error)

CreateNewVM calls CreateNewVMFunc.

func (*TargetMock) CreateNewVMCalls

func (mock *TargetMock) CreateNewVMCalls() []struct {
	Ctx          context.Context
	InstDef      migration.Instance
	ApiDef       incusAPI.InstancesPost
	Placement    api.Placement
	BootISOImage string
}

CreateNewVMCalls gets all the calls that were made to CreateNewVM. Check the length with:

len(mockedTarget.CreateNewVMCalls())

func (*TargetMock) CreateStoragePoolVolumeFromBackup

func (mock *TargetMock) CreateStoragePoolVolumeFromBackup(poolName string, backupFilePath string) ([]incus.Operation, error)

CreateStoragePoolVolumeFromBackup calls CreateStoragePoolVolumeFromBackupFunc.

func (*TargetMock) CreateStoragePoolVolumeFromBackupCalls

func (mock *TargetMock) CreateStoragePoolVolumeFromBackupCalls() []struct {
	PoolName       string
	BackupFilePath string
}

CreateStoragePoolVolumeFromBackupCalls gets all the calls that were made to CreateStoragePoolVolumeFromBackup. Check the length with:

len(mockedTarget.CreateStoragePoolVolumeFromBackupCalls())

func (*TargetMock) CreateStoragePoolVolumeFromISO

func (mock *TargetMock) CreateStoragePoolVolumeFromISO(pool string, isoFilePath string) ([]incus.Operation, error)

CreateStoragePoolVolumeFromISO calls CreateStoragePoolVolumeFromISOFunc.

func (*TargetMock) CreateStoragePoolVolumeFromISOCalls

func (mock *TargetMock) CreateStoragePoolVolumeFromISOCalls() []struct {
	Pool        string
	IsoFilePath string
}

CreateStoragePoolVolumeFromISOCalls gets all the calls that were made to CreateStoragePoolVolumeFromISO. Check the length with:

len(mockedTarget.CreateStoragePoolVolumeFromISOCalls())

func (*TargetMock) CreateVMDefinition

func (mock *TargetMock) CreateVMDefinition(instanceDef migration.Instance, usedNetworks migration.Networks, q migration.QueueEntry, fingerprint string, endpoint string) (incusAPI.InstancesPost, error)

CreateVMDefinition calls CreateVMDefinitionFunc.

func (*TargetMock) CreateVMDefinitionCalls

func (mock *TargetMock) CreateVMDefinitionCalls() []struct {
	InstanceDef  migration.Instance
	UsedNetworks migration.Networks
	Q            migration.QueueEntry
	Fingerprint  string
	Endpoint     string
}

CreateVMDefinitionCalls gets all the calls that were made to CreateVMDefinition. Check the length with:

len(mockedTarget.CreateVMDefinitionCalls())

func (*TargetMock) DeleteVM

func (mock *TargetMock) DeleteVM(ctx context.Context, name string) error

DeleteVM calls DeleteVMFunc.

func (*TargetMock) DeleteVMCalls

func (mock *TargetMock) DeleteVMCalls() []struct {
	Ctx  context.Context
	Name string
}

DeleteVMCalls gets all the calls that were made to DeleteVM. Check the length with:

len(mockedTarget.DeleteVMCalls())

func (*TargetMock) Disconnect

func (mock *TargetMock) Disconnect(ctx context.Context) error

Disconnect calls DisconnectFunc.

func (*TargetMock) DisconnectCalls

func (mock *TargetMock) DisconnectCalls() []struct {
	Ctx context.Context
}

DisconnectCalls gets all the calls that were made to Disconnect. Check the length with:

len(mockedTarget.DisconnectCalls())

func (*TargetMock) DoBasicConnectivityCheck

func (mock *TargetMock) DoBasicConnectivityCheck() (api.ExternalConnectivityStatus, *x509.Certificate)

DoBasicConnectivityCheck calls DoBasicConnectivityCheckFunc.

func (*TargetMock) DoBasicConnectivityCheckCalls

func (mock *TargetMock) DoBasicConnectivityCheckCalls() []struct {
}

DoBasicConnectivityCheckCalls gets all the calls that were made to DoBasicConnectivityCheck. Check the length with:

len(mockedTarget.DoBasicConnectivityCheckCalls())

func (*TargetMock) Exec

func (mock *TargetMock) Exec(ctx context.Context, instanceName string, cmd []string) error

Exec calls ExecFunc.

func (*TargetMock) ExecCalls

func (mock *TargetMock) ExecCalls() []struct {
	Ctx          context.Context
	InstanceName string
	Cmd          []string
}

ExecCalls gets all the calls that were made to Exec. Check the length with:

len(mockedTarget.ExecCalls())

func (*TargetMock) GetDetails

func (mock *TargetMock) GetDetails(ctx context.Context) (*IncusDetails, error)

GetDetails calls GetDetailsFunc.

func (*TargetMock) GetDetailsCalls

func (mock *TargetMock) GetDetailsCalls() []struct {
	Ctx context.Context
}

GetDetailsCalls gets all the calls that were made to GetDetails. Check the length with:

len(mockedTarget.GetDetailsCalls())

func (*TargetMock) GetInstance

func (mock *TargetMock) GetInstance(name string) (*incusAPI.Instance, string, error)

GetInstance calls GetInstanceFunc.

func (*TargetMock) GetInstanceCalls

func (mock *TargetMock) GetInstanceCalls() []struct {
	Name string
}

GetInstanceCalls gets all the calls that were made to GetInstance. Check the length with:

len(mockedTarget.GetInstanceCalls())

func (*TargetMock) GetInstanceNames

func (mock *TargetMock) GetInstanceNames() ([]string, error)

GetInstanceNames calls GetInstanceNamesFunc.

func (*TargetMock) GetInstanceNamesCalls

func (mock *TargetMock) GetInstanceNamesCalls() []struct {
}

GetInstanceNamesCalls gets all the calls that were made to GetInstanceNames. Check the length with:

len(mockedTarget.GetInstanceNamesCalls())

func (*TargetMock) GetName

func (mock *TargetMock) GetName() string

GetName calls GetNameFunc.

func (*TargetMock) GetNameCalls

func (mock *TargetMock) GetNameCalls() []struct {
}

GetNameCalls gets all the calls that were made to GetName. Check the length with:

len(mockedTarget.GetNameCalls())

func (*TargetMock) GetProperties

func (mock *TargetMock) GetProperties() json.RawMessage

GetProperties calls GetPropertiesFunc.

func (*TargetMock) GetPropertiesCalls

func (mock *TargetMock) GetPropertiesCalls() []struct {
}

GetPropertiesCalls gets all the calls that were made to GetProperties. Check the length with:

len(mockedTarget.GetPropertiesCalls())

func (*TargetMock) GetStoragePoolVolumeNames

func (mock *TargetMock) GetStoragePoolVolumeNames(pool string) ([]string, error)

GetStoragePoolVolumeNames calls GetStoragePoolVolumeNamesFunc.

func (*TargetMock) GetStoragePoolVolumeNamesCalls

func (mock *TargetMock) GetStoragePoolVolumeNamesCalls() []struct {
	Pool string
}

GetStoragePoolVolumeNamesCalls gets all the calls that were made to GetStoragePoolVolumeNames. Check the length with:

len(mockedTarget.GetStoragePoolVolumeNamesCalls())

func (*TargetMock) IsConnected

func (mock *TargetMock) IsConnected() bool

IsConnected calls IsConnectedFunc.

func (*TargetMock) IsConnectedCalls

func (mock *TargetMock) IsConnectedCalls() []struct {
}

IsConnectedCalls gets all the calls that were made to IsConnected. Check the length with:

len(mockedTarget.IsConnectedCalls())

func (*TargetMock) IsWaitingForOIDCTokens

func (mock *TargetMock) IsWaitingForOIDCTokens() bool

IsWaitingForOIDCTokens calls IsWaitingForOIDCTokensFunc.

func (*TargetMock) IsWaitingForOIDCTokensCalls

func (mock *TargetMock) IsWaitingForOIDCTokensCalls() []struct {
}

IsWaitingForOIDCTokensCalls gets all the calls that were made to IsWaitingForOIDCTokens. Check the length with:

len(mockedTarget.IsWaitingForOIDCTokensCalls())

func (*TargetMock) PushFile

func (mock *TargetMock) PushFile(instanceName string, file string, destDir string) error

PushFile calls PushFileFunc.

func (*TargetMock) PushFileCalls

func (mock *TargetMock) PushFileCalls() []struct {
	InstanceName string
	File         string
	DestDir      string
}

PushFileCalls gets all the calls that were made to PushFile. Check the length with:

len(mockedTarget.PushFileCalls())

func (*TargetMock) SetClientTLSCredentials

func (mock *TargetMock) SetClientTLSCredentials(key string, cert string) error

SetClientTLSCredentials calls SetClientTLSCredentialsFunc.

func (*TargetMock) SetClientTLSCredentialsCalls

func (mock *TargetMock) SetClientTLSCredentialsCalls() []struct {
	Key  string
	Cert string
}

SetClientTLSCredentialsCalls gets all the calls that were made to SetClientTLSCredentials. Check the length with:

len(mockedTarget.SetClientTLSCredentialsCalls())

func (*TargetMock) SetPostMigrationVMConfig

func (mock *TargetMock) SetPostMigrationVMConfig(ctx context.Context, i migration.Instance, q migration.QueueEntry, allNetworks migration.Networks) error

SetPostMigrationVMConfig calls SetPostMigrationVMConfigFunc.

func (*TargetMock) SetPostMigrationVMConfigCalls

func (mock *TargetMock) SetPostMigrationVMConfigCalls() []struct {
	Ctx         context.Context
	I           migration.Instance
	Q           migration.QueueEntry
	AllNetworks migration.Networks
}

SetPostMigrationVMConfigCalls gets all the calls that were made to SetPostMigrationVMConfig. Check the length with:

len(mockedTarget.SetPostMigrationVMConfigCalls())

func (*TargetMock) SetProject

func (mock *TargetMock) SetProject(project string) error

SetProject calls SetProjectFunc.

func (*TargetMock) SetProjectCalls

func (mock *TargetMock) SetProjectCalls() []struct {
	Project string
}

SetProjectCalls gets all the calls that were made to SetProject. Check the length with:

len(mockedTarget.SetProjectCalls())

func (*TargetMock) StartVM

func (mock *TargetMock) StartVM(ctx context.Context, name string) error

StartVM calls StartVMFunc.

func (*TargetMock) StartVMCalls

func (mock *TargetMock) StartVMCalls() []struct {
	Ctx  context.Context
	Name string
}

StartVMCalls gets all the calls that were made to StartVM. Check the length with:

len(mockedTarget.StartVMCalls())

func (*TargetMock) StopVM

func (mock *TargetMock) StopVM(ctx context.Context, name string, force bool) error

StopVM calls StopVMFunc.

func (*TargetMock) StopVMCalls

func (mock *TargetMock) StopVMCalls() []struct {
	Ctx   context.Context
	Name  string
	Force bool
}

StopVMCalls gets all the calls that were made to StopVM. Check the length with:

len(mockedTarget.StopVMCalls())

func (*TargetMock) UpdateInstance

func (mock *TargetMock) UpdateInstance(name string, instanceDef incusAPI.InstancePut, ETag string) (incus.Operation, error)

UpdateInstance calls UpdateInstanceFunc.

func (*TargetMock) UpdateInstanceCalls

func (mock *TargetMock) UpdateInstanceCalls() []struct {
	Name        string
	InstanceDef incusAPI.InstancePut
	ETag        string
}

UpdateInstanceCalls gets all the calls that were made to UpdateInstance. Check the length with:

len(mockedTarget.UpdateInstanceCalls())

func (*TargetMock) WithAdditionalRootCertificate

func (mock *TargetMock) WithAdditionalRootCertificate(rootCert *x509.Certificate)

WithAdditionalRootCertificate calls WithAdditionalRootCertificateFunc.

func (*TargetMock) WithAdditionalRootCertificateCalls

func (mock *TargetMock) WithAdditionalRootCertificateCalls() []struct {
	RootCert *x509.Certificate
}

WithAdditionalRootCertificateCalls gets all the calls that were made to WithAdditionalRootCertificate. Check the length with:

len(mockedTarget.WithAdditionalRootCertificateCalls())

Jump to

Keyboard shortcuts

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