fleet/orbit/pkg/useraction/mdm_migration.go
Jahziel Villasana-Espinoza e0135fc568
fix: cleanup tasks for MDM migration updates (#21325)
> No issue, just cleanup  

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Manual QA for all new/changed functionality
- For Orbit and Fleet Desktop changes:
- [x] Orbit runs on macOS, Linux and Windows. Check if the orbit
feature/bugfix should only apply to one platform (`runtime.GOOS`).
- [x] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [x] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
2024-08-15 17:16:56 -04:00

51 lines
1.8 KiB
Go

package useraction
import (
"context"
"github.com/fleetdm/fleet/v4/server/fleet"
)
// MDMMigrator represents the minimum set of methods a migration must implement
// in order to be used by Fleet Desktop.
type MDMMigrator interface {
// CanRun indicates if the migrator is able to run, for example, for macOS it
// checks if the swiftDialog executable is present.
CanRun() bool
// SetProps sets/updates the props.
SetProps(MDMMigratorProps)
// Show displays the dialog if there's no other dialog running.
Show() error
// ShowInterval is used to display dialogs at an interval. It displays
// the dialog if there's no other dialog running and a given interval
// (defined by the migrator itself) has passed since the last time the
// dialog was shown.
ShowInterval() error
// Exit tries to stop any processes started by the migrator.
Exit()
// MigrationInProgress checks if the MDM migration is still in progress (i.e. the host is not
// yet fully enrolled in Fleet MDM). It returns the type of migration that is in progress, if any.
MigrationInProgress() (string, error)
// MarkMigrationCompleted marks the migration as completed. This is currently done by removing
// the migration file.
MarkMigrationCompleted() error
}
// MDMMigratorProps are props required to display the dialog. It's akin to the
// concept of props in UI frameworks like React.
type MDMMigratorProps struct {
OrgInfo fleet.DesktopOrgInfo
IsUnmanaged bool
// DisableTakeover is used to disable the blur and always on top features of the dialog.
DisableTakeover bool
}
// MDMMigratorHandler handles remote actions/callbacks that the migrator calls.
type MDMMigratorHandler interface {
NotifyRemote() error
ShowInstructions() error
}
type MDMOfflineWatcher interface {
ShowIfOffline(ctx context.Context) bool
}