Package com.influxdb.client
Interface TasksApi
@ThreadSafe
public interface TasksApi
The client of the InfluxDB 2.x that implement Task HTTP API endpoint.
- Author:
- Jakub Bednar (bednar@github) (11/09/2018 07:54)
-
Method Summary
Modifier and TypeMethodDescriptionAdd the Task label.Add the Task label.Add task member.Add task member.Add task owner.Add task owner.void
Cancels a currently running run.void
Cancels a currently running run.Clone a task.Clone a task.createTask
(Task task) Creates a new task.createTask
(TaskCreateRequest taskCreateRequest) Create a new task.createTaskCron
(String name, String flux, String cron, Organization organization) Creates a new task with task repetition by cron.createTaskCron
(String name, String flux, String cron, String orgID) Creates a new task with task repetition by cron.createTaskEvery
(String name, String flux, String every, Organization organization) Creates a new task with task repetition by duration expression ("1h", "30s").createTaskEvery
(String name, String flux, String every, String orgID) Creates a new task with task repetition by duration expression ("1h", "30s").void
deleteLabel
(Label label, Task task) Removes a label from a Task.void
deleteLabel
(String labelID, String taskID) Removes a label from a bucket.void
deleteMember
(User member, Task task) Removes a member from an task.void
deleteMember
(String memberID, String taskID) Removes a member from an task.void
deleteOwner
(User owner, Task task) Removes an owner from an task.void
deleteOwner
(String ownerID, String taskID) Removes an owner from an task.void
deleteTask
(Task task) Delete a task.void
deleteTask
(String taskID) Delete a task.findTaskByID
(String taskID) Retrieve an task.Lists tasks, limit 100.findTasks
(TasksQuery query) Lists tasks, limit 100.Lists tasks, limit 100.findTasksByOrganization
(Organization organization) Lists tasks, limit 100.findTasksByOrganizationID
(String orgID) Lists tasks, limit 100.findTasksByUser
(User user) Lists tasks, limit 100.findTasksByUserID
(String userID) Lists tasks, limit 100.findTasksStream
(TasksQuery query) Query tasks, automaticaly paged by given limit (default 100).List all labels of a Task.List all labels of a Task.Retrieve all logs for a task.Retrieve all logs for a task.getMembers
(Task task) List all task members.getMembers
(String taskID) List all task members.List all task owners.List all task owners.Retrieve a single run record for a task.Retrieve a single run record for a task.getRunLogs
(Run run) Retrieve all logs for a run.getRunLogs
(String taskID, String runID) Retrieve all logs for a run.Retrieve list of run records for a task.getRuns
(Task task, OffsetDateTime afterTime, OffsetDateTime beforeTime, Integer limit) Retrieve list of run records for a task.Retrieve list of run records for a task.getRuns
(String taskID, OffsetDateTime afterTime, OffsetDateTime beforeTime, Integer limit) Retrieve list of run records for a task.Retry a task run.Retry a task run.runManually
(Task task) Manually start a run of the task now overriding the current schedule.runManually
(String taskId, RunManually runManually) Manually start a run of the task now overriding the current schedule.updateTask
(Task task) Update a task.updateTask
(String taskID, TaskUpdateRequest request) Update a task.
-
Method Details
-
createTask
Creates a new task. TheTask.getFlux()
has to have defined a cron or a every repetition by the option statement.Flux example:
option task = { name: "mean", every: 1h, } from(bucket:"metrics/autogen") |> range(start:-task.every) |> group(columns:["level"]) |> mean() |> yield(name:"mean")
- Parameters:
task
- the task to create- Returns:
- Task created
-
createTask
Create a new task.- Parameters:
taskCreateRequest
- task to create (required)- Returns:
- Task created
-
createTaskCron
@Nonnull Task createTaskCron(@Nonnull String name, @Nonnull String flux, @Nonnull String cron, @Nonnull Organization organization) Creates a new task with task repetition by cron. TheTask.getFlux()
is without a cron or a every repetition. The repetition is automatically append to the option statement.- Parameters:
name
- description of the taskflux
- the Flux script to run for this taskcron
- a task repetition schedule in the form '* * * * * *'organization
- the organization that owns this Task- Returns:
- Task created
-
createTaskCron
@Nonnull Task createTaskCron(@Nonnull String name, @Nonnull String flux, @Nonnull String cron, @Nonnull String orgID) Creates a new task with task repetition by cron. TheTask.getFlux()
is without a cron or a every repetition. The repetition is automatically append to the option statement.- Parameters:
name
- description of the taskflux
- the Flux script to run for this taskcron
- a task repetition schedule in the form '* * * * * *'orgID
- an id of the organization that owns this Task- Returns:
- Task created
-
createTaskEvery
@Nonnull Task createTaskEvery(@Nonnull String name, @Nonnull String flux, @Nonnull String every, @Nonnull Organization organization) Creates a new task with task repetition by duration expression ("1h", "30s"). TheTask.getFlux()
is without a cron or a every repetition. The repetition is automatically append to the option statement.- Parameters:
name
- description of the taskflux
- the Flux script to run for this taskevery
- a task repetition by duration expressionorganization
- the organization that owns this Task- Returns:
- Task created
-
createTaskEvery
@Nonnull Task createTaskEvery(@Nonnull String name, @Nonnull String flux, @Nonnull String every, @Nonnull String orgID) Creates a new task with task repetition by duration expression ("1h", "30s"). TheTask.getFlux()
is without a cron or a every repetition. The repetition is automatically append to the option statement.- Parameters:
name
- description of the taskflux
- the Flux script to run for this taskevery
- a task repetition by duration expressionorgID
- an id of the organization that owns this Task- Returns:
- Task created
-
updateTask
Update a task. This will cancel all queued runs.- Parameters:
task
- task update to apply- Returns:
- task updated
-
updateTask
Update a task. This will cancel all queued runs.- Parameters:
taskID
- ID of task to getrequest
- task update to apply- Returns:
- task updated
-
deleteTask
Delete a task. Deletes a task and all associated records.- Parameters:
task
- task to delete
-
deleteTask
Delete a task. Deletes a task and all associated records.- Parameters:
taskID
- ID of task to delete
-
cloneTask
Clone a task.- Parameters:
taskID
- ID of task to clone- Returns:
- cloned task
-
cloneTask
Clone a task.- Parameters:
task
- task to clone- Returns:
- cloned task
-
findTaskByID
Retrieve an task.- Parameters:
taskID
- ID of task to get- Returns:
- task details
-
findTasks
Lists tasks, limit 100.- Returns:
- A list of tasks
-
findTasksByUser
Lists tasks, limit 100.- Parameters:
user
- filter tasks to a specific user- Returns:
- A list of tasks
-
findTasksByUserID
Lists tasks, limit 100.- Parameters:
userID
- filter tasks to a specific user id- Returns:
- A list of tasks
-
findTasksByOrganization
Lists tasks, limit 100.- Parameters:
organization
- filter tasks to a specific organization- Returns:
- A list of tasks
-
findTasksByOrganizationID
Lists tasks, limit 100.- Parameters:
orgID
- filter tasks to a specific organization id- Returns:
- A list of tasks
-
findTasks
@Nonnull List<Task> findTasks(@Nullable String afterID, @Nullable String userID, @Nullable String orgID) Lists tasks, limit 100.- Parameters:
afterID
- returns tasks after specified IDuserID
- filter tasks to a specific user idorgID
- filter tasks to a specific organization id- Returns:
- A list of tasks
-
findTasks
Lists tasks, limit 100.- Parameters:
query
- query params for task- Returns:
- A list of tasks
-
findTasksStream
Query tasks, automaticaly paged by given limit (default 100).- Parameters:
query
- query params for task- Returns:
- A list of tasks
-
getMembers
List all task members.- Parameters:
taskID
- ID of the task- Returns:
- return the list all task members
-
getMembers
List all task members.- Parameters:
task
- the task with members- Returns:
- return the list all task members
-
addMember
Add task member.- Parameters:
member
- the member of an tasktask
- the task for the member- Returns:
- created mapping
-
addMember
Add task member.- Parameters:
memberID
- the ID of a membertaskID
- the ID of a task- Returns:
- created mapping
-
deleteMember
Removes a member from an task.- Parameters:
member
- the member of a tasktask
- the task
-
deleteMember
Removes a member from an task.- Parameters:
memberID
- the ID of a membertaskID
- the ID of a task
-
getOwners
List all task owners.- Parameters:
task
- the task with owners- Returns:
- return List all task owners
-
getOwners
List all task owners.- Parameters:
taskID
- ID of task to get owners- Returns:
- return List all task owners
-
addOwner
Add task owner.- Parameters:
owner
- the owner of a tasktask
- the task- Returns:
- created mapping
-
addOwner
Add task owner.- Parameters:
ownerID
- the ID of a ownertaskID
- the ID of a task- Returns:
- created mapping
-
deleteOwner
Removes an owner from an task.- Parameters:
owner
- the owner of a tasktask
- the task
-
deleteOwner
Removes an owner from an task.- Parameters:
ownerID
- the ID of a ownertaskID
- the ID of a task
-
getRuns
Retrieve list of run records for a task.- Parameters:
task
- task to get runs for- Returns:
- the list of run records for a task
-
getRuns
@Nonnull List<Run> getRuns(@Nonnull Task task, @Nullable OffsetDateTime afterTime, @Nullable OffsetDateTime beforeTime, @Nullable Integer limit) Retrieve list of run records for a task.- Parameters:
task
- task to get runs forafterTime
- filter runs to those scheduled after this timebeforeTime
- filter runs to those scheduled before this timelimit
- the number of runs to return. Default value: 20.- Returns:
- the list of run records for a task
-
getRuns
Retrieve list of run records for a task.- Parameters:
taskID
- ID of task to get runs for- Returns:
- the list of run records for a task
-
getRuns
@Nonnull List<Run> getRuns(@Nonnull String taskID, @Nullable OffsetDateTime afterTime, @Nullable OffsetDateTime beforeTime, @Nullable Integer limit) Retrieve list of run records for a task.- Parameters:
taskID
- ID of task to get runs forafterTime
- filter runs to those scheduled after this timebeforeTime
- filter runs to those scheduled before this timelimit
- the number of runs to return. Default value: 20.- Returns:
- the list of run records for a task
-
getRun
Retrieve a single run record for a task.- Parameters:
run
- the run with a taskID and a runID- Returns:
- a single run record for a task
-
getRun
Retrieve a single run record for a task.- Parameters:
taskID
- ID of task to get runs forrunID
- ID of run- Returns:
- a single run record for a task
-
getRunLogs
Retrieve all logs for a run.- Parameters:
run
- the run with a taskID and a runID- Returns:
- the list of all logs for a run
-
getRunLogs
Retrieve all logs for a run.- Parameters:
taskID
- ID of task to get logs for itrunID
- ID of run- Returns:
- the list of all logs for a run
-
runManually
Manually start a run of the task now overriding the current schedule.- Parameters:
task
- the task to run- Returns:
- Run scheduled to start
-
runManually
Manually start a run of the task now overriding the current schedule.- Parameters:
taskId
- ID of task to runrunManually
- to specify time- Returns:
- Run scheduled to start
-
retryRun
Retry a task run.- Parameters:
run
- the run with a taskID and a runID to retry- Returns:
- the executed run
-
retryRun
Retry a task run.- Parameters:
taskID
- ID of task to get runs forrunID
- ID of run- Returns:
- the executed run
-
cancelRun
Cancels a currently running run.- Parameters:
run
- the run with a taskID and a runID to cancel
-
cancelRun
Cancels a currently running run.- Parameters:
taskID
- ID of taskrunID
- ID of run
-
getLogs
Retrieve all logs for a task.- Parameters:
task
- task to get logs for- Returns:
- the list of all logs for a task
-
getLogs
Retrieve all logs for a task.- Parameters:
taskID
- ID of task to get logs for- Returns:
- the list of all logs for a task
-
getLabels
List all labels of a Task.- Parameters:
task
- the Task with labels- Returns:
- return List all labels of a Task.
-
getLabels
List all labels of a Task.- Parameters:
taskID
- ID of Task to get labels- Returns:
- return List all labels of a Task
-
addLabel
Add the Task label.- Parameters:
label
- the label of a Tasktask
- the bucket- Returns:
- added label
-
addLabel
Add the Task label.- Parameters:
labelID
- the ID of a labeltaskID
- the ID of a Task- Returns:
- added label
-
deleteLabel
Removes a label from a Task.- Parameters:
label
- the Label of a Tasktask
- the Task
-
deleteLabel
Removes a label from a bucket.- Parameters:
labelID
- the ID of a labeltaskID
- the ID of a task
-