Documentation
¶
Index ¶
- type InternalIncusTarget
- func (t *InternalIncusTarget) CheckIncusAgent(ctx context.Context, instanceName string) error
- func (t *InternalIncusTarget) Connect(ctx context.Context) error
- func (t *InternalIncusTarget) CreateNewVM(ctx context.Context, instDef migration.Instance, apiDef incusAPI.InstancesPost, ...) (func(), error)
- func (t *InternalIncusTarget) CreateStoragePoolVolumeFromBackup(poolName string, backupFilePath string) ([]incus.Operation, error)
- func (t *InternalIncusTarget) CreateStoragePoolVolumeFromISO(poolName string, isoFilePath string) ([]incus.Operation, error)
- func (t *InternalIncusTarget) CreateVMDefinition(instanceDef migration.Instance, secretToken uuid.UUID, storagePool string, ...) (incusAPI.InstancesPost, error)
- func (t *InternalIncusTarget) DeleteVM(ctx context.Context, name string) error
- func (t *InternalIncusTarget) Disconnect(ctx context.Context) error
- func (t *InternalIncusTarget) DoBasicConnectivityCheck() (api.ExternalConnectivityStatus, *x509.Certificate)
- func (t *InternalIncusTarget) Exec(ctx context.Context, instanceName string, cmd []string) error
- func (t *InternalIncusTarget) GetInstance(name string) (*incusAPI.Instance, string, error)
- func (t *InternalIncusTarget) GetInstanceNames() ([]string, error)
- func (t *InternalIncusTarget) GetProperties() json.RawMessage
- func (t *InternalIncusTarget) GetStoragePoolVolumeNames(pool string) ([]string, error)
- func (t *InternalIncusTarget) IsWaitingForOIDCTokens() bool
- func (t *InternalIncusTarget) PushFile(instanceName string, file string, destDir string) error
- func (t *InternalIncusTarget) ReadyForMigration(ctx context.Context, targetProject string, ...) error
- func (t *InternalIncusTarget) SetClientTLSCredentials(key string, cert string) error
- func (t *InternalIncusTarget) SetPostMigrationVMConfig(ctx context.Context, i migration.Instance, allNetworks migration.Networks) error
- func (t *InternalIncusTarget) SetProject(project string) error
- func (t *InternalIncusTarget) StartVM(ctx context.Context, name string) error
- func (t *InternalIncusTarget) StopVM(ctx context.Context, 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) CreateStoragePoolVolumeFromBackup(pool string, isoFilePath string) ([]incus.Operation, 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) Exec(ctx context.Context, instanceName string, cmd []string) error
- func (t *InternalTarget) GetInstance(name string) (*api.Instance, string, error)
- func (t *InternalTarget) GetInstanceNames() ([]string, error)
- func (t *InternalTarget) GetName() string
- func (t *InternalTarget) GetProperties() json.RawMessage
- func (t *InternalTarget) GetStoragePoolVolumeNames(pool string) ([]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) SetPostMigrationVMConfig(i migration.Instance, allNetworks map[string]migration.Network) 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) 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) Connect ¶
func (t *InternalIncusTarget) Connect(ctx context.Context) error
func (*InternalIncusTarget) CreateNewVM ¶
func (*InternalIncusTarget) CreateStoragePoolVolumeFromBackup ¶
func (*InternalIncusTarget) CreateStoragePoolVolumeFromISO ¶
func (*InternalIncusTarget) CreateVMDefinition ¶
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) GetInstance ¶
func (*InternalIncusTarget) GetInstanceNames ¶
func (t *InternalIncusTarget) GetInstanceNames() ([]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) ReadyForMigration ¶
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, 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) 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) CreateStoragePoolVolumeFromBackup ¶
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) GetInstance ¶
func (*InternalTarget) GetInstanceNames ¶
func (t *InternalTarget) GetInstanceNames() ([]string, error)
func (*InternalTarget) GetName ¶
func (t *InternalTarget) GetName() string
func (*InternalTarget) GetProperties ¶
func (t *InternalTarget) GetProperties() json.RawMessage
func (*InternalTarget) GetStoragePoolVolumeNames ¶
func (t *InternalTarget) GetStoragePoolVolumeNames(pool string) ([]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) SetPostMigrationVMConfig ¶
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 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(i migration.Instance, allNetworks map[string]migration.Network) 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 // 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) }
Target interface definition for all migration manager targets.
Click to show internal directories.
Click to hide internal directories.