Documentation
¶
Index ¶
- type InternalIncusTarget
- func (t *InternalIncusTarget) Connect(ctx context.Context) error
- func (t *InternalIncusTarget) CreateNewVM(apiDef incusAPI.InstancesPost, storagePool string, bootISOImage string, ...) error
- func (t *InternalIncusTarget) CreateStoragePoolVolumeFromISO(pool string, isoFilePath string) (incus.Operation, error)
- func (t *InternalIncusTarget) CreateVMDefinition(instanceDef migration.Instance, sourceName string, storagePool string) incusAPI.InstancesPost
- func (t *InternalIncusTarget) DeleteVM(name string) error
- func (t *InternalIncusTarget) Disconnect(ctx context.Context) error
- func (t *InternalIncusTarget) DoBasicConnectivityCheck() (api.ExternalConnectivityStatus, *x509.Certificate)
- func (t *InternalIncusTarget) ExecWithoutWaiting(instanceName string, cmd []string) error
- func (t *InternalIncusTarget) GetInstance(name string) (*incusAPI.Instance, string, error)
- func (t *InternalIncusTarget) GetProperties() json.RawMessage
- func (t *InternalIncusTarget) GetStoragePoolVolume(pool string, volType string, name string) (*incusAPI.StorageVolume, string, error)
- func (t *InternalIncusTarget) IsWaitingForOIDCTokens() bool
- func (t *InternalIncusTarget) PushFile(instanceName string, file string, destDir string) error
- func (t *InternalIncusTarget) SetClientTLSCredentials(key string, cert string) error
- func (t *InternalIncusTarget) SetProject(project string) error
- func (t *InternalIncusTarget) StartVM(name string) error
- func (t *InternalIncusTarget) StopVM(name string, force bool) error
- func (t *InternalIncusTarget) UpdateInstance(name string, instanceDef incusAPI.InstancePut, ETag string) (incus.Operation, error)
- func (t *InternalIncusTarget) WithAdditionalRootCertificate(rootCert *x509.Certificate)
- type InternalTarget
- func (t *InternalTarget) Connect(ctx context.Context) error
- func (t *InternalTarget) CreateNewVM(apiDef incusAPI.InstancesPost, storagePool string, bootISOImage string, ...) error
- func (t *InternalTarget) CreateStoragePoolVolumeFromISO(pool string, isoFilePath string) (incus.Operation, error)
- func (t *InternalTarget) CreateVMDefinition(instanceDef migration.Instance, sourceName string, storagePool string) incusAPI.InstancesPost
- func (t *InternalTarget) DeleteVM(name string) error
- func (t *InternalTarget) Disconnect(ctx context.Context) error
- func (t *InternalTarget) DoBasicConnectivityCheck() (api.ExternalConnectivityStatus, *x509.Certificate)
- func (t *InternalTarget) ExecWithoutWaiting(instanceName string, cmd []string) error
- func (t *InternalTarget) GetDatabaseID() (int, error)
- func (t *InternalTarget) GetInstance(name string) (*api.Instance, string, error)
- func (t *InternalTarget) GetName() string
- func (t *InternalTarget) GetProperties() json.RawMessage
- func (t *InternalTarget) GetStoragePoolVolume(pool string, volType string, name string) (*incusAPI.StorageVolume, string, error)
- func (t *InternalTarget) IsConnected() bool
- func (t *InternalTarget) IsWaitingForOIDCTokens() bool
- func (t *InternalTarget) PushFile(instanceName string, file string, destDir string) error
- func (t *InternalTarget) SetClientTLSCredentials(key string, cert string) error
- func (t *InternalTarget) SetProject(project string) error
- func (t *InternalTarget) StartVM(name string) error
- func (t *InternalTarget) StopVM(name string, force bool) error
- func (t *InternalTarget) UpdateInstance(name string, instanceDef incusAPI.InstancePut, ETag string) (incus.Operation, error)
- func (t *InternalTarget) WithAdditionalRootCertificate(rootCert *x509.Certificate)
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InternalIncusTarget ¶
type InternalIncusTarget struct {
InternalTarget `yaml:",inline"`
api.IncusProperties `yaml:",inline"`
// contains filtered or unexported fields
}
func NewInternalIncusTargetFrom ¶
func NewInternalIncusTargetFrom(apiTarget api.Target) (*InternalIncusTarget, error)
func (*InternalIncusTarget) Connect ¶
func (t *InternalIncusTarget) Connect(ctx context.Context) error
func (*InternalIncusTarget) CreateNewVM ¶
func (t *InternalIncusTarget) CreateNewVM(apiDef incusAPI.InstancesPost, storagePool string, bootISOImage string, driversISOImage string) error
func (*InternalIncusTarget) CreateStoragePoolVolumeFromISO ¶
func (*InternalIncusTarget) CreateVMDefinition ¶
func (t *InternalIncusTarget) CreateVMDefinition(instanceDef migration.Instance, sourceName string, storagePool string) incusAPI.InstancesPost
func (*InternalIncusTarget) DeleteVM ¶
func (t *InternalIncusTarget) DeleteVM(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) ExecWithoutWaiting ¶
func (t *InternalIncusTarget) ExecWithoutWaiting(instanceName string, cmd []string) error
func (*InternalIncusTarget) GetInstance ¶
func (*InternalIncusTarget) GetProperties ¶
func (t *InternalIncusTarget) GetProperties() json.RawMessage
func (*InternalIncusTarget) GetStoragePoolVolume ¶
func (t *InternalIncusTarget) GetStoragePoolVolume(pool string, volType string, name string) (*incusAPI.StorageVolume, 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) SetProject ¶
func (t *InternalIncusTarget) SetProject(project string) error
func (*InternalIncusTarget) StartVM ¶
func (t *InternalIncusTarget) StartVM(name string) error
func (*InternalIncusTarget) StopVM ¶
func (t *InternalIncusTarget) StopVM(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 (*InternalTarget) CreateNewVM ¶
func (t *InternalTarget) CreateNewVM(apiDef incusAPI.InstancesPost, storagePool string, bootISOImage string, driversISOImage string) error
func (*InternalTarget) CreateStoragePoolVolumeFromISO ¶
func (*InternalTarget) CreateVMDefinition ¶
func (t *InternalTarget) CreateVMDefinition(instanceDef migration.Instance, sourceName string, storagePool string) incusAPI.InstancesPost
func (*InternalTarget) DeleteVM ¶
func (t *InternalTarget) DeleteVM(name string) error
func (*InternalTarget) Disconnect ¶
func (t *InternalTarget) Disconnect(ctx context.Context) error
func (*InternalTarget) DoBasicConnectivityCheck ¶
func (t *InternalTarget) DoBasicConnectivityCheck() (api.ExternalConnectivityStatus, *x509.Certificate)
func (*InternalTarget) ExecWithoutWaiting ¶
func (t *InternalTarget) ExecWithoutWaiting(instanceName string, cmd []string) error
func (*InternalTarget) GetDatabaseID ¶
func (t *InternalTarget) GetDatabaseID() (int, error)
func (*InternalTarget) GetInstance ¶
func (*InternalTarget) GetName ¶
func (t *InternalTarget) GetName() string
func (*InternalTarget) GetProperties ¶
func (t *InternalTarget) GetProperties() json.RawMessage
func (*InternalTarget) GetStoragePoolVolume ¶
func (t *InternalTarget) GetStoragePoolVolume(pool string, volType string, name string) (*incusAPI.StorageVolume, string, error)
func (*InternalTarget) IsConnected ¶
func (t *InternalTarget) IsConnected() bool
func (*InternalTarget) IsWaitingForOIDCTokens ¶
func (t *InternalTarget) IsWaitingForOIDCTokens() bool
func (*InternalTarget) PushFile ¶
func (t *InternalTarget) PushFile(instanceName string, file string, destDir string) error
func (*InternalTarget) SetClientTLSCredentials ¶
func (t *InternalTarget) SetClientTLSCredentials(key string, cert string) error
func (*InternalTarget) SetProject ¶
func (t *InternalTarget) SetProject(project string) error
func (*InternalTarget) StartVM ¶
func (t *InternalTarget) StartVM(name string) error
func (*InternalTarget) UpdateInstance ¶
func (t *InternalTarget) UpdateInstance(name string, instanceDef incusAPI.InstancePut, ETag string) (incus.Operation, error)
func (*InternalTarget) WithAdditionalRootCertificate ¶
func (t *InternalTarget) WithAdditionalRootCertificate(rootCert *x509.Certificate)
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 a unique ID for this target that can be used when interacting with the database.
//
// Attempting to get an ID for a freshly-created target that hasn't yet been added to the database
// via AddTarget() or retrieved via GetTarget()/GetAllTargets() will return an error.
GetDatabaseID() (int, error)
// 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
// Creates a VM definition for use with the Incus REST API.
CreateVMDefinition(instanceDef migration.Instance, sourceName string, storagePool string) incusAPI.InstancesPost
// Creates a new VM from the pre-populated API definition.
CreateNewVM(apiDef incusAPI.InstancesPost, storagePool string, bootISOImage string, driversISOImage string) error
// Deletes a VM.
DeleteVM(name string) error
// Starts a VM.
StartVM(name string) error
// Stops a VM.
StopVM(name string, force bool) error
// Push a file into a running instance.
PushFile(instanceName string, file string, destDir string) error
// Run a command within an instance and return immediately without waiting for it to complete.
ExecWithoutWaiting(instanceName string, cmd []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' GetStoragePoolVolume method.
GetStoragePoolVolume(pool string, volType string, name string) (*incusAPI.StorageVolume, string, error)
// Wrapper around Incus' CreateStoragePoolVolumeFromISO.
CreateStoragePoolVolumeFromISO(pool string, isoFilePath string) (incus.Operation, error)
}
Interface definition for all migration manager targets.
Click to show internal directories.
Click to hide internal directories.