1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
package lifecycle
import (
"github.com/lxc/incus/v6/internal/version"
"github.com/lxc/incus/v6/shared/api"
)
// Internal copy of the operation interface.
type operation interface {
ID() string
}
// OperationAction represents a lifecycle event action for operations.
type OperationAction string
// All supported lifecycle events for operations.
const (
OperationCancelled = OperationAction(api.EventLifecycleOperationCancelled)
)
// Event creates the lifecycle event for an action on an operation.
func (a OperationAction) Event(op operation, requestor *api.EventLifecycleRequestor, ctx map[string]any) api.EventLifecycle {
u := api.NewURL().Path(version.APIVersion, "operations", op.ID())
return api.EventLifecycle{
Action: string(a),
Source: u.String(),
Context: ctx,
Requestor: requestor,
}
}
|