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 Details

    • createTask

      @Nonnull Task createTask(@Nonnull Task task)
      Creates a new task. The Task.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

      @Nonnull Task createTask(@Nonnull TaskCreateRequest taskCreateRequest)
      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. The Task.getFlux() is without a cron or a every repetition. The repetition is automatically append to the option statement.
      Parameters:
      name - description of the task
      flux - the Flux script to run for this task
      cron - 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. The Task.getFlux() is without a cron or a every repetition. The repetition is automatically append to the option statement.
      Parameters:
      name - description of the task
      flux - the Flux script to run for this task
      cron - 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"). The Task.getFlux() is without a cron or a every repetition. The repetition is automatically append to the option statement.
      Parameters:
      name - description of the task
      flux - the Flux script to run for this task
      every - a task repetition by duration expression
      organization - 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"). The Task.getFlux() is without a cron or a every repetition. The repetition is automatically append to the option statement.
      Parameters:
      name - description of the task
      flux - the Flux script to run for this task
      every - a task repetition by duration expression
      orgID - an id of the organization that owns this Task
      Returns:
      Task created
    • updateTask

      @Nonnull Task updateTask(@Nonnull Task task)
      Update a task. This will cancel all queued runs.
      Parameters:
      task - task update to apply
      Returns:
      task updated
    • updateTask

      @Nonnull Task updateTask(@Nonnull String taskID, @Nonnull TaskUpdateRequest request)
      Update a task. This will cancel all queued runs.
      Parameters:
      taskID - ID of task to get
      request - task update to apply
      Returns:
      task updated
    • deleteTask

      void deleteTask(@Nonnull Task task)
      Delete a task. Deletes a task and all associated records.
      Parameters:
      task - task to delete
    • deleteTask

      void deleteTask(@Nonnull String taskID)
      Delete a task. Deletes a task and all associated records.
      Parameters:
      taskID - ID of task to delete
    • cloneTask

      @Nonnull Task cloneTask(@Nonnull String taskID)
      Clone a task.
      Parameters:
      taskID - ID of task to clone
      Returns:
      cloned task
    • cloneTask

      @Nonnull Task cloneTask(@Nonnull Task task)
      Clone a task.
      Parameters:
      task - task to clone
      Returns:
      cloned task
    • findTaskByID

      @Nonnull Task findTaskByID(@Nonnull String taskID)
      Retrieve an task.
      Parameters:
      taskID - ID of task to get
      Returns:
      task details
    • findTasks

      @Nonnull List<Task> findTasks()
      Lists tasks, limit 100.
      Returns:
      A list of tasks
    • findTasksByUser

      @Nonnull List<Task> findTasksByUser(@Nonnull User user)
      Lists tasks, limit 100.
      Parameters:
      user - filter tasks to a specific user
      Returns:
      A list of tasks
    • findTasksByUserID

      @Nonnull List<Task> findTasksByUserID(@Nullable String userID)
      Lists tasks, limit 100.
      Parameters:
      userID - filter tasks to a specific user id
      Returns:
      A list of tasks
    • findTasksByOrganization

      @Nonnull List<Task> findTasksByOrganization(@Nonnull Organization organization)
      Lists tasks, limit 100.
      Parameters:
      organization - filter tasks to a specific organization
      Returns:
      A list of tasks
    • findTasksByOrganizationID

      @Nonnull List<Task> findTasksByOrganizationID(@Nullable String orgID)
      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 ID
      userID - filter tasks to a specific user id
      orgID - filter tasks to a specific organization id
      Returns:
      A list of tasks
    • findTasks

      @Nonnull List<Task> findTasks(@Nonnull TasksQuery query)
      Lists tasks, limit 100.
      Parameters:
      query - query params for task
      Returns:
      A list of tasks
    • findTasksStream

      @Nonnull Stream<Task> findTasksStream(@Nonnull TasksQuery query)
      Query tasks, automaticaly paged by given limit (default 100).
      Parameters:
      query - query params for task
      Returns:
      A list of tasks
    • getMembers

      @Nonnull List<ResourceMember> getMembers(@Nonnull String taskID)
      List all task members.
      Parameters:
      taskID - ID of the task
      Returns:
      return the list all task members
    • getMembers

      @Nonnull List<ResourceMember> getMembers(@Nonnull Task task)
      List all task members.
      Parameters:
      task - the task with members
      Returns:
      return the list all task members
    • addMember

      @Nonnull ResourceMember addMember(@Nonnull User member, @Nonnull Task task)
      Add task member.
      Parameters:
      member - the member of an task
      task - the task for the member
      Returns:
      created mapping
    • addMember

      @Nonnull ResourceMember addMember(@Nonnull String memberID, @Nonnull String taskID)
      Add task member.
      Parameters:
      memberID - the ID of a member
      taskID - the ID of a task
      Returns:
      created mapping
    • deleteMember

      void deleteMember(@Nonnull User member, @Nonnull Task task)
      Removes a member from an task.
      Parameters:
      member - the member of a task
      task - the task
    • deleteMember

      void deleteMember(@Nonnull String memberID, @Nonnull String taskID)
      Removes a member from an task.
      Parameters:
      memberID - the ID of a member
      taskID - the ID of a task
    • getOwners

      @Nonnull List<ResourceOwner> getOwners(@Nonnull Task task)
      List all task owners.
      Parameters:
      task - the task with owners
      Returns:
      return List all task owners
    • getOwners

      @Nonnull List<ResourceOwner> getOwners(@Nonnull String taskID)
      List all task owners.
      Parameters:
      taskID - ID of task to get owners
      Returns:
      return List all task owners
    • addOwner

      @Nonnull ResourceOwner addOwner(@Nonnull User owner, @Nonnull Task task)
      Add task owner.
      Parameters:
      owner - the owner of a task
      task - the task
      Returns:
      created mapping
    • addOwner

      @Nonnull ResourceOwner addOwner(@Nonnull String ownerID, @Nonnull String taskID)
      Add task owner.
      Parameters:
      ownerID - the ID of a owner
      taskID - the ID of a task
      Returns:
      created mapping
    • deleteOwner

      void deleteOwner(@Nonnull User owner, @Nonnull Task task)
      Removes an owner from an task.
      Parameters:
      owner - the owner of a task
      task - the task
    • deleteOwner

      void deleteOwner(@Nonnull String ownerID, @Nonnull String taskID)
      Removes an owner from an task.
      Parameters:
      ownerID - the ID of a owner
      taskID - the ID of a task
    • getRuns

      @Nonnull List<Run> getRuns(@Nonnull Task task)
      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 for
      afterTime - filter runs to those scheduled after this time
      beforeTime - filter runs to those scheduled before this time
      limit - the number of runs to return. Default value: 20.
      Returns:
      the list of run records for a task
    • getRuns

      @Nonnull List<Run> getRuns(@Nonnull String taskID)
      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 for
      afterTime - filter runs to those scheduled after this time
      beforeTime - filter runs to those scheduled before this time
      limit - the number of runs to return. Default value: 20.
      Returns:
      the list of run records for a task
    • getRun

      @Nonnull Run getRun(@Nonnull Run run)
      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

      @Nonnull Run getRun(@Nonnull String taskID, @Nonnull String runID)
      Retrieve a single run record for a task.
      Parameters:
      taskID - ID of task to get runs for
      runID - ID of run
      Returns:
      a single run record for a task
    • getRunLogs

      @Nonnull List<LogEvent> getRunLogs(@Nonnull Run run)
      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

      @Nonnull List<LogEvent> getRunLogs(@Nonnull String taskID, @Nonnull String runID)
      Retrieve all logs for a run.
      Parameters:
      taskID - ID of task to get logs for it
      runID - ID of run
      Returns:
      the list of all logs for a run
    • runManually

      @Nonnull Run runManually(@Nonnull Task task)
      Manually start a run of the task now overriding the current schedule.
      Parameters:
      task - the task to run
      Returns:
      Run scheduled to start
    • runManually

      @Nonnull Run runManually(@Nonnull String taskId, @Nonnull RunManually runManually)
      Manually start a run of the task now overriding the current schedule.
      Parameters:
      taskId - ID of task to run
      runManually - to specify time
      Returns:
      Run scheduled to start
    • retryRun

      @Nonnull Run retryRun(@Nonnull Run run)
      Retry a task run.
      Parameters:
      run - the run with a taskID and a runID to retry
      Returns:
      the executed run
    • retryRun

      @Nonnull Run retryRun(@Nonnull String taskID, @Nonnull String runID)
      Retry a task run.
      Parameters:
      taskID - ID of task to get runs for
      runID - ID of run
      Returns:
      the executed run
    • cancelRun

      void cancelRun(@Nonnull Run run)
      Cancels a currently running run.
      Parameters:
      run - the run with a taskID and a runID to cancel
    • cancelRun

      void cancelRun(@Nonnull String taskID, @Nonnull String runID)
      Cancels a currently running run.
      Parameters:
      taskID - ID of task
      runID - ID of run
    • getLogs

      @Nonnull List<LogEvent> getLogs(@Nonnull Task task)
      Retrieve all logs for a task.
      Parameters:
      task - task to get logs for
      Returns:
      the list of all logs for a task
    • getLogs

      @Nonnull List<LogEvent> getLogs(@Nonnull String taskID)
      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

      @Nonnull List<Label> getLabels(@Nonnull Task task)
      List all labels of a Task.
      Parameters:
      task - the Task with labels
      Returns:
      return List all labels of a Task.
    • getLabels

      @Nonnull List<Label> getLabels(@Nonnull String taskID)
      List all labels of a Task.
      Parameters:
      taskID - ID of Task to get labels
      Returns:
      return List all labels of a Task
    • addLabel

      @Nonnull LabelResponse addLabel(@Nonnull Label label, @Nonnull Task task)
      Add the Task label.
      Parameters:
      label - the label of a Task
      task - the bucket
      Returns:
      added label
    • addLabel

      @Nonnull LabelResponse addLabel(@Nonnull String labelID, @Nonnull String taskID)
      Add the Task label.
      Parameters:
      labelID - the ID of a label
      taskID - the ID of a Task
      Returns:
      added label
    • deleteLabel

      void deleteLabel(@Nonnull Label label, @Nonnull Task task)
      Removes a label from a Task.
      Parameters:
      label - the Label of a Task
      task - the Task
    • deleteLabel

      void deleteLabel(@Nonnull String labelID, @Nonnull String taskID)
      Removes a label from a bucket.
      Parameters:
      labelID - the ID of a label
      taskID - the ID of a task