49 lines
956 B
Go
49 lines
956 B
Go
// Package target defines the application-facing seam implemented by configuration Targets.
|
|
package target
|
|
|
|
import (
|
|
"context"
|
|
|
|
"proxyctl/internal/profile"
|
|
)
|
|
|
|
// State is the detected state of a Target's actual configuration.
|
|
type State string
|
|
|
|
const (
|
|
Enabled State = "Enabled"
|
|
Disabled State = "Disabled"
|
|
External State = "External"
|
|
Drifted State = "Drifted"
|
|
)
|
|
|
|
type Description struct {
|
|
Name string
|
|
Summary string
|
|
Details string
|
|
}
|
|
|
|
type Availability struct {
|
|
Available bool
|
|
Evidence string
|
|
}
|
|
|
|
type Inspection struct {
|
|
State State
|
|
Evidence string
|
|
}
|
|
|
|
type OperationResult struct {
|
|
Inspection Inspection
|
|
Err error
|
|
}
|
|
|
|
// Target hides platform paths and commands from the application and TUI.
|
|
type Target interface {
|
|
ID() string
|
|
Description() Description
|
|
Availability(context.Context) Availability
|
|
Inspect(context.Context, *profile.Profile) Inspection
|
|
SetDesired(context.Context, bool, *profile.Profile) OperationResult
|
|
}
|