Documentation ¶
Index ¶
- func AddTaskServiceRoutes(handler *httpd.Handler, log *zap.Logger, svc taskmodel.TaskService) error
- func KapacitorUserFromContext(ctx context.Context) *auth.User
- func RemoveTaskServiceRoutes(handler *httpd.Handler) error
- func WithKapacitorUser(ctx context.Context, user auth.User) context.Context
- type Task
- type TaskHandler
- type TaskService
- func (t TaskService) CancelRun(ctx context.Context, taskID, runID platform.ID) error
- func (t TaskService) CreateTask(ctx context.Context, tc taskmodel.TaskCreate) (*taskmodel.Task, error)
- func (t TaskService) DeleteTask(ctx context.Context, id platform.ID) error
- func (t TaskService) FindLogs(ctx context.Context, filter taskmodel.LogFilter) ([]*taskmodel.Log, int, error)
- func (t TaskService) FindRunByID(ctx context.Context, taskID, runID platform.ID) (*taskmodel.Run, error)
- func (t TaskService) FindRuns(ctx context.Context, filter taskmodel.RunFilter) ([]*taskmodel.Run, int, error)
- func (t TaskService) FindTaskByID(ctx context.Context, id platform.ID) (*taskmodel.Task, error)
- func (t TaskService) FindTasks(ctx context.Context, filter taskmodel.TaskFilter) ([]*taskmodel.Task, int, error)
- func (t TaskService) ForceRun(ctx context.Context, taskID platform.ID, scheduledFor int64) (*taskmodel.Run, error)
- func (t TaskService) RetryRun(ctx context.Context, taskID, runID platform.ID) (*taskmodel.Run, error)
- func (t TaskService) UpdateTask(ctx context.Context, id platform.ID, upd taskmodel.TaskUpdate) (*taskmodel.Task, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTaskServiceRoutes ¶
func RemoveTaskServiceRoutes ¶
Types ¶
type Task ¶
type Task struct { ID platform.ID `json:"id"` OwnerUsername string `json:"ownerID"` UnusedOrgId string `json:"orgID"` Name string `json:"name"` Description string `json:"description,omitempty"` Status string `json:"status"` Flux string `json:"flux"` Every string `json:"every,omitempty"` Cron string `json:"cron,omitempty"` Offset string `json:"offset,omitempty"` LatestCompleted string `json:"latestCompleted,omitempty"` LastRunStatus string `json:"lastRunStatus,omitempty"` LastRunError string `json:"lastRunError,omitempty"` CreatedAt string `json:"createdAt,omitempty"` UpdatedAt string `json:"updatedAt,omitempty"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
Task is a package-specific Task format that preserves the expected format for the API, where time values are represented as strings
func NewFrontEndTask ¶
NewFrontEndTask converts a internal task type to a task that we want to display to users
type TaskHandler ¶
type TaskHandler struct { TaskService taskmodel.TaskService errors2.HTTPErrorHandler // contains filtered or unexported fields }
TaskHandler represents an HTTP API handler for tasks.
func (*TaskHandler) Handle ¶
func (h *TaskHandler) Handle(w http.ResponseWriter, r *http.Request, user auth.User)
func (*TaskHandler) HandlerFunc ¶
func (h *TaskHandler) HandlerFunc(method string, pattern string, handler func(w http.ResponseWriter, r *http.Request))
type TaskService ¶
TaskService connects to Influx via HTTP using tokens to manage tasks.
func (TaskService) CreateTask ¶
func (t TaskService) CreateTask(ctx context.Context, tc taskmodel.TaskCreate) (*taskmodel.Task, error)
CreateTask creates a new task.
func (TaskService) DeleteTask ¶
DeleteTask removes a task by ID and purges all associated data and scheduled runs.
func (TaskService) FindLogs ¶
func (t TaskService) FindLogs(ctx context.Context, filter taskmodel.LogFilter) ([]*taskmodel.Log, int, error)
FindLogs returns logs for a run.
func (TaskService) FindRunByID ¶
func (t TaskService) FindRunByID(ctx context.Context, taskID, runID platform.ID) (*taskmodel.Run, error)
FindRunByID returns a single run of a specific task.
func (TaskService) FindRuns ¶
func (t TaskService) FindRuns(ctx context.Context, filter taskmodel.RunFilter) ([]*taskmodel.Run, int, error)
FindRuns returns a list of runs that match a filter and the total count of returned runs.
func (TaskService) FindTaskByID ¶
FindTaskByID returns a single task
func (TaskService) FindTasks ¶
func (t TaskService) FindTasks(ctx context.Context, filter taskmodel.TaskFilter) ([]*taskmodel.Task, int, error)
FindTasks returns a list of tasks that match a filter (limit 100) and the total count of matching tasks.
func (TaskService) ForceRun ¶
func (t TaskService) ForceRun(ctx context.Context, taskID platform.ID, scheduledFor int64) (*taskmodel.Run, error)
ForceRun starts a run manually right now.
func (TaskService) RetryRun ¶
func (t TaskService) RetryRun(ctx context.Context, taskID, runID platform.ID) (*taskmodel.Run, error)
RetryRun creates and returns a new run (which is a retry of another run).
func (TaskService) UpdateTask ¶
func (t TaskService) UpdateTask(ctx context.Context, id platform.ID, upd taskmodel.TaskUpdate) (*taskmodel.Task, error)
UpdateTask updates a single task with changeset.