Documentation
¶
Index ¶
- Variables
- func NewBatchService(repo BatchRepo, instance InstanceService, source SourceService) batchService
- func NewInstanceService(repo InstanceRepo, source SourceService, opts ...InstanceServiceOption) instanceService
- func NewNetworkService(repo NetworkRepo) networkService
- func NewQueueService(batch BatchService, instance InstanceService, source SourceService) queueService
- func NewSourceService(repo SourceRepo) sourceService
- func NewTargetService(repo TargetRepo) targetService
- func NewValidationErrf(format string, a ...any) error
- type Batch
- type BatchRepo
- type BatchService
- type Batches
- type ErrValidation
- type Instance
- type InstanceFilterable
- type InstanceOverride
- type InstanceRepo
- type InstanceService
- type InstanceServiceOption
- type Instances
- type Network
- type NetworkRepo
- type NetworkService
- type Networks
- type QueueEntries
- type QueueEntry
- type QueueService
- type Source
- func (s Source) GetExternalConnectivityStatus() api.ExternalConnectivityStatus
- func (s Source) GetServerCertificate() *x509.Certificate
- func (s Source) GetTrustedServerCertificateFingerprint() string
- func (s *Source) SetExternalConnectivityStatus(status api.ExternalConnectivityStatus)
- func (s *Source) SetServerCertificate(cert *x509.Certificate)
- func (s Source) ToAPI() api.Source
- func (s Source) Validate() error
- type SourceEndpoint
- type SourceRepo
- type SourceService
- type Sources
- type Target
- func (t Target) GetEndpoint() string
- func (t Target) GetExternalConnectivityStatus() api.ExternalConnectivityStatus
- func (t Target) GetServerCertificate() *x509.Certificate
- func (t Target) GetTrustedServerCertificateFingerprint() string
- func (t *Target) SetExternalConnectivityStatus(status api.ExternalConnectivityStatus)
- func (t *Target) SetOIDCTokens(tokens *oidc.Tokens[*oidc.IDTokenClaims])
- func (t *Target) SetServerCertificate(cert *x509.Certificate)
- func (t Target) ToAPI() api.Target
- func (t Target) Validate() error
- type TargetEndpoint
- type TargetRepo
- type TargetService
- type Targets
- type WorkerCommand
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewBatchService ¶
func NewBatchService(repo BatchRepo, instance InstanceService, source SourceService) batchService
func NewInstanceService ¶
func NewInstanceService(repo InstanceRepo, source SourceService, opts ...InstanceServiceOption) instanceService
func NewNetworkService ¶
func NewNetworkService(repo NetworkRepo) networkService
func NewQueueService ¶
func NewQueueService(batch BatchService, instance InstanceService, source SourceService) queueService
func NewSourceService ¶
func NewSourceService(repo SourceRepo) sourceService
func NewTargetService ¶
func NewTargetService(repo TargetRepo) targetService
func NewValidationErrf ¶
Types ¶
type Batch ¶
type Batch struct {
ID int64
Name string `db:"primary=yes"`
Target string `db:"join=targets.name"`
TargetProject string
Status api.BatchStatusType
StatusMessage string
StoragePool string
IncludeExpression string
MigrationWindowStart time.Time
MigrationWindowEnd time.Time
}
func (Batch) CanBeModified ¶
func (Batch) CompileIncludeExpression ¶
func (b Batch) CompileIncludeExpression(i InstanceFilterable) (*vm.Program, error)
func (Batch) InstanceMatchesCriteria ¶
type BatchRepo ¶
type BatchRepo interface {
Create(ctx context.Context, batch Batch) (int64, error)
GetAll(ctx context.Context) (Batches, error)
GetAllByState(ctx context.Context, status api.BatchStatusType) (Batches, error)
GetAllNames(ctx context.Context) ([]string, error)
GetAllNamesByState(ctx context.Context, status api.BatchStatusType) ([]string, error)
GetByName(ctx context.Context, name string) (*Batch, error)
Update(ctx context.Context, name string, batch Batch) error
Rename(ctx context.Context, oldName string, newName string) error
DeleteByName(ctx context.Context, name string) error
}
type BatchService ¶
type BatchService interface {
Create(ctx context.Context, batch Batch) (Batch, error)
GetAll(ctx context.Context) (Batches, error)
GetAllByState(ctx context.Context, status api.BatchStatusType) (Batches, error)
GetAllNames(ctx context.Context) ([]string, error)
GetAllNamesByState(ctx context.Context, status api.BatchStatusType) ([]string, error)
GetByName(ctx context.Context, name string) (*Batch, error)
Update(ctx context.Context, name string, batch *Batch) error
UpdateInstancesAssignedToBatch(ctx context.Context, batch Batch) error
UpdateStatusByName(ctx context.Context, name string, status api.BatchStatusType, statusMessage string) (*Batch, error)
Rename(ctx context.Context, oldName string, newName string) error
DeleteByName(ctx context.Context, name string) error
StartBatchByName(ctx context.Context, name string) error
StopBatchByName(ctx context.Context, name string) error
}
type ErrValidation ¶
type ErrValidation string
func (ErrValidation) Error ¶
func (e ErrValidation) Error() string
type Instance ¶
type Instance struct {
ID int64
UUID uuid.UUID `db:"primary=yes"`
MigrationStatus api.MigrationStatusType
MigrationStatusMessage string
LastUpdateFromSource time.Time
LastUpdateFromWorker time.Time
Source string `db:"join=sources.name"`
Batch *string `db:"leftjoin=batches.name"`
NeedsDiskImport bool
SecretToken uuid.UUID
Overrides *InstanceOverride `db:"ignore"`
Properties api.InstanceProperties `db:"marshal=json"`
}
func (Instance) CanBeModified ¶
func (Instance) GetName ¶
GetName 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 Location property.
func (*Instance) GetOSType ¶
GetOSType returns the OS type, as determined from https://dp-downloads.broadcom.com/api-content/apis/API_VWSA_001/8.0U3/html/ReferenceGuides/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html
func (Instance) IsMigrating ¶
func (Instance) ToFilterable ¶
func (i Instance) ToFilterable(s Source) InstanceFilterable
type InstanceFilterable ¶
type InstanceFilterable struct {
api.InstanceProperties
MigrationStatus api.MigrationStatusType
MigrationStatusMessage string
LastUpdateFromSource time.Time
Source string
SourceType api.SourceType
}
type InstanceOverride ¶
type InstanceOverride struct {
Properties api.InstancePropertiesConfigurable `db:"marshal=json"`
ID int64
UUID uuid.UUID `db:"primary=yes"`
LastUpdate time.Time
Comment string
DisableMigration bool
}
func (InstanceOverride) ToAPI ¶
func (o InstanceOverride) ToAPI() api.InstanceOverride
func (InstanceOverride) Validate ¶
func (o InstanceOverride) Validate() error
type InstanceRepo ¶
type InstanceRepo interface {
Create(ctx context.Context, instance Instance) (int64, error)
GetAll(ctx context.Context) (Instances, error)
GetAllByState(ctx context.Context, status ...api.MigrationStatusType) (Instances, error)
GetAllByBatch(ctx context.Context, batch string) (Instances, error)
GetAllByBatchAndState(ctx context.Context, batch string, status api.MigrationStatusType) (Instances, error)
GetAllBySource(ctx context.Context, source string) (Instances, error)
GetAllUUIDs(ctx context.Context) ([]uuid.UUID, error)
GetAllUnassigned(ctx context.Context) (Instances, error)
GetByUUID(ctx context.Context, id uuid.UUID) (*Instance, error)
Update(ctx context.Context, instance Instance) error
DeleteByUUID(ctx context.Context, id uuid.UUID) error
// Overrides
CreateOverrides(ctx context.Context, overrides InstanceOverride) (int64, error)
GetOverridesByUUID(ctx context.Context, id uuid.UUID) (*InstanceOverride, error)
DeleteOverridesByUUID(ctx context.Context, id uuid.UUID) error
UpdateOverrides(ctx context.Context, overrides InstanceOverride) error
}
type InstanceService ¶
type InstanceService interface {
Create(ctx context.Context, instance Instance) (Instance, error)
GetAll(ctx context.Context, withOverrides bool) (Instances, error)
GetAllByState(ctx context.Context, withOverrides bool, statuses ...api.MigrationStatusType) (Instances, error)
GetAllByBatch(ctx context.Context, batch string, withOverrides bool) (Instances, error)
GetAllByBatchAndState(ctx context.Context, batch string, status api.MigrationStatusType, withOverrides bool) (Instances, error)
GetAllBySource(ctx context.Context, source string, withOverrides bool) (Instances, error)
GetAllUUIDs(ctx context.Context) ([]uuid.UUID, error)
GetAllUnassigned(ctx context.Context, withOverrides bool) (Instances, error)
GetByUUID(ctx context.Context, id uuid.UUID, withOverrides bool) (*Instance, error)
UnassignFromBatch(ctx context.Context, id uuid.UUID) error
Update(ctx context.Context, instance *Instance) error
UpdateStatusByUUID(ctx context.Context, i uuid.UUID, status api.MigrationStatusType, statusMessage string, needsDiskImport bool, workerUpdate bool) (*Instance, error)
ProcessWorkerUpdate(ctx context.Context, id uuid.UUID, workerResponseTypeArg api.WorkerResponseType, statusMessage string) (Instance, error)
DeleteByUUID(ctx context.Context, id uuid.UUID) error
// Overrride
CreateOverrides(ctx context.Context, overrides InstanceOverride) (InstanceOverride, error)
GetOverridesByUUID(ctx context.Context, id uuid.UUID) (*InstanceOverride, error)
DeleteOverridesByUUID(ctx context.Context, id uuid.UUID) error
UpdateOverrides(ctx context.Context, overrides *InstanceOverride) error
}
type InstanceServiceOption ¶
type InstanceServiceOption func(s *instanceService)
type Network ¶
type NetworkRepo ¶
type NetworkRepo interface {
Create(ctx context.Context, network Network) (int64, error)
GetAll(ctx context.Context) (Networks, error)
GetAllNames(ctx context.Context) ([]string, error)
GetByName(ctx context.Context, name string) (*Network, error)
Update(ctx context.Context, network Network) error
Rename(ctx context.Context, oldName string, newName string) error
DeleteByName(ctx context.Context, name string) error
}
type NetworkService ¶
type NetworkService interface {
Create(ctx context.Context, network Network) (Network, error)
GetAll(ctx context.Context) (Networks, error)
GetAllNames(ctx context.Context) ([]string, error)
GetByName(ctx context.Context, name string) (*Network, error)
Update(ctx context.Context, network *Network) error
DeleteByName(ctx context.Context, name string) error
}
type QueueEntries ¶
type QueueEntries []QueueEntry
type QueueEntry ¶
type QueueService ¶
type Source ¶
type Source struct {
ID int64
Name string `db:"primary=yes"`
SourceType api.SourceType
Properties json.RawMessage
EndpointFunc func(api.Source) (SourceEndpoint, error) `json:"-" db:"ignore"`
}
func (Source) GetExternalConnectivityStatus ¶
func (s Source) GetExternalConnectivityStatus() api.ExternalConnectivityStatus
func (Source) GetServerCertificate ¶
func (s Source) GetServerCertificate() *x509.Certificate
func (Source) GetTrustedServerCertificateFingerprint ¶
func (*Source) SetExternalConnectivityStatus ¶
func (s *Source) SetExternalConnectivityStatus(status api.ExternalConnectivityStatus)
func (*Source) SetServerCertificate ¶
func (s *Source) SetServerCertificate(cert *x509.Certificate)
type SourceEndpoint ¶
type SourceEndpoint interface {
Connect(ctx context.Context) error
DoBasicConnectivityCheck() (api.ExternalConnectivityStatus, *x509.Certificate)
}
type SourceRepo ¶
type SourceRepo interface {
Create(ctx context.Context, source Source) (int64, error)
GetAll(ctx context.Context) (Sources, error)
GetAllNames(ctx context.Context) ([]string, error)
GetByName(ctx context.Context, name string) (*Source, error)
Update(ctx context.Context, name string, source Source) error
Rename(ctx context.Context, oldName string, newName string) error
DeleteByName(ctx context.Context, name string) error
}
type SourceService ¶
type SourceService interface {
Create(ctx context.Context, source Source) (Source, error)
GetAll(ctx context.Context) (Sources, error)
GetAllNames(ctx context.Context) ([]string, error)
GetByName(ctx context.Context, name string) (*Source, error)
Update(ctx context.Context, name string, source *Source, instanceService InstanceService) error
DeleteByName(ctx context.Context, name string, instanceService InstanceService) error
}
type Target ¶
type Target struct {
ID int64
Name string `db:"primary=yes"`
TargetType api.TargetType
Properties json.RawMessage
EndpointFunc func(api.Target) (TargetEndpoint, error) `json:"-" db:"ignore"`
}
func (Target) GetEndpoint ¶
func (Target) GetExternalConnectivityStatus ¶
func (t Target) GetExternalConnectivityStatus() api.ExternalConnectivityStatus
func (Target) GetServerCertificate ¶
func (t Target) GetServerCertificate() *x509.Certificate
func (Target) GetTrustedServerCertificateFingerprint ¶
func (*Target) SetExternalConnectivityStatus ¶
func (t *Target) SetExternalConnectivityStatus(status api.ExternalConnectivityStatus)
func (*Target) SetOIDCTokens ¶
func (t *Target) SetOIDCTokens(tokens *oidc.Tokens[*oidc.IDTokenClaims])
func (*Target) SetServerCertificate ¶
func (t *Target) SetServerCertificate(cert *x509.Certificate)
type TargetEndpoint ¶
type TargetEndpoint interface {
Connect(ctx context.Context) error
DoBasicConnectivityCheck() (api.ExternalConnectivityStatus, *x509.Certificate)
IsWaitingForOIDCTokens() bool
}
type TargetRepo ¶
type TargetRepo interface {
Create(ctx context.Context, target Target) (int64, error)
GetAll(ctx context.Context) (Targets, error)
GetAllNames(ctx context.Context) ([]string, error)
GetByName(ctx context.Context, name string) (*Target, error)
Update(ctx context.Context, name string, target Target) error
Rename(ctx context.Context, oldName string, newName string) error
DeleteByName(ctx context.Context, name string) error
}
type TargetService ¶
type TargetService interface {
Create(ctx context.Context, target Target) (Target, error)
GetAll(ctx context.Context) (Targets, error)
GetAllNames(ctx context.Context) ([]string, error)
GetByName(ctx context.Context, name string) (*Target, error)
Update(ctx context.Context, name string, target *Target) error
DeleteByName(ctx context.Context, name string) error
}
type WorkerCommand ¶
type WorkerCommand struct {
Command api.WorkerCommandType
Location string
SourceType api.SourceType
Source Source
OS string
OSVersion string
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.