Documentation
¶
Index ¶
- Constants
- func ContextWithAuth(ctx context.Context, auth AuthContext) context.Context
- func ContextWithSystem(ctx context.Context) context.Context
- func IsSystemInitiated(ctx context.Context) bool
- type Action
- type AuthContext
- type AuthorizeRequest
- type AuthorizeResponse
- type DispatchRequest
- type DispatchResponse
- type EnrichRequest
- type EnrichResponse
- type Plugin
- type PropletInfo
- type PropletSelectRequest
- type PropletSelectResponse
- type Registry
- type TaskEvent
- type TaskInfo
Constants ¶
View Source
const SystemUserID = "system"
Variables ¶
This section is empty.
Functions ¶
func ContextWithAuth ¶
func ContextWithAuth(ctx context.Context, auth AuthContext) context.Context
ContextWithAuth stores an AuthContext in ctx.
func ContextWithSystem ¶
ContextWithSystem marks ctx as originating from an internal system trigger (cron scheduler, workflow coordinator). The returned context carries a system AuthContext so plugins can identify the caller.
func IsSystemInitiated ¶
IsSystemInitiated reports whether ctx was created by ContextWithSystem.
Types ¶
type AuthContext ¶
type AuthContext struct {
UserID string `json:"user_id,omitempty"`
Token string `json:"-"`
Action Action `json:"action"`
}
func AuthFromContext ¶
func AuthFromContext(ctx context.Context) AuthContext
AuthFromContext retrieves the AuthContext stored by ContextWithAuth. Returns a zero-value AuthContext when none is present.
type AuthorizeRequest ¶
type AuthorizeRequest struct {
Context AuthContext `json:"context"`
Task TaskInfo `json:"task"`
}
type AuthorizeResponse ¶
type DispatchRequest ¶
type DispatchRequest struct {
Context AuthContext `json:"context"`
Task TaskInfo `json:"task"`
Proplet PropletInfo `json:"proplet"`
}
type DispatchResponse ¶
type EnrichRequest ¶
type EnrichRequest struct {
Context AuthContext `json:"context"`
Task TaskInfo `json:"task"`
}
type EnrichResponse ¶
type Plugin ¶
type Plugin interface {
Name() string
Authorize(ctx context.Context, req AuthorizeRequest) (AuthorizeResponse, error)
Enrich(ctx context.Context, req EnrichRequest) (EnrichResponse, error)
OnBeforePropletSelect(ctx context.Context, req PropletSelectRequest) (PropletSelectResponse, error)
OnBeforeDispatch(ctx context.Context, req DispatchRequest) (DispatchResponse, error)
OnTaskStart(ctx context.Context, evt TaskEvent) error
OnTaskComplete(ctx context.Context, evt TaskEvent) error
Close(ctx context.Context) error
}
type PropletInfo ¶
type PropletSelectRequest ¶
type PropletSelectRequest struct {
Context AuthContext `json:"context"`
Task TaskInfo `json:"task"`
}
type PropletSelectResponse ¶
type TaskInfo ¶
type TaskInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Kind string `json:"kind,omitempty"`
ImageURL string `json:"image_url,omitempty"`
Inputs []string `json:"inputs,omitempty"`
CLIArgs []string `json:"cli_args,omitempty"`
Env map[string]string `json:"env,omitempty"`
PropletID string `json:"proplet_id,omitempty"`
Priority int `json:"priority,omitempty"`
Daemon bool `json:"daemon,omitempty"`
Encrypted bool `json:"encrypted,omitempty"`
CreatedAt time.Time `json:"created_at,omitzero"`
}
func NewTaskInfo ¶
NewTaskInfo converts a task.Task to the TaskInfo passed to plugins.
Click to show internal directories.
Click to hide internal directories.