Class TasksApi
Inheritance
Implements
Namespace: InfluxDB.Client
Assembly: InfluxDB.Client.dll
Syntax
public class TasksApi : object, ITasksApi
Constructors
TasksApi(TasksService)
Declaration
protected TasksApi(TasksService service)
Parameters
Type | Name | Description |
---|---|---|
Tasks |
service |
Methods
AddLabelAsync(Label, TaskType, CancellationToken)
Add a Task label.
Declaration
public Task<Label> AddLabelAsync(Label label, TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Label | label | the label of a Task |
Task |
task | a Task of a label |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Label> | added label |
AddLabelAsync(String, String, CancellationToken)
Add a Task label.
Declaration
public async Task<Label> AddLabelAsync(string labelId, string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
labelId | the ID of a label |
System. |
taskId | the ID of a Task |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Label> | added label |
AddMemberAsync(User, TaskType, CancellationToken)
Add a task member.
Declaration
public Task<ResourceMember> AddMemberAsync(User member, TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
User | member | the member of a task |
Task |
task | the task of a member |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Resource |
created mapping |
AddMemberAsync(String, String, CancellationToken)
Add a task member.
Declaration
public Task<ResourceMember> AddMemberAsync(string memberId, string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
memberId | the ID of a member |
System. |
taskId | the ID of a task |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Resource |
created mapping |
AddOwnerAsync(User, TaskType, CancellationToken)
Add a task owner.
Declaration
public Task<ResourceOwner> AddOwnerAsync(User owner, TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
User | owner | the owner of a task |
Task |
task | the task of a owner |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Resource |
created mapping |
AddOwnerAsync(String, String, CancellationToken)
Add a task owner.
Declaration
public Task<ResourceOwner> AddOwnerAsync(string ownerId, string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
ownerId | the ID of a owner |
System. |
taskId | the ID of a task |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Resource |
created mapping |
CancelRunAsync(Run, CancellationToken)
Cancels a currently running run.
Declaration
public Task CancelRunAsync(Run run, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Run | run | the run to cancel |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task |
CancelRunAsync(String, String, CancellationToken)
Cancels a currently running run.
Declaration
public Task CancelRunAsync(string taskId, string runId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of task with the run to cancel |
System. |
runId | ID of run to cancel |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task |
CloneTaskAsync(TaskType, CancellationToken)
Clone a task.
Declaration
public async Task<TaskType> CloneTaskAsync(TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Task |
task | task to clone |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Task |
cloned task |
CloneTaskAsync(String, CancellationToken)
Clone a task.
Declaration
public async Task<TaskType> CloneTaskAsync(string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of task to clone |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Task |
cloned task |
CreateTaskAsync(TaskCreateRequest, CancellationToken)
Create a new task.
Declaration
public Task<TaskType> CreateTaskAsync(TaskCreateRequest taskCreateRequest, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Task |
taskCreateRequest | task to create (required) |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Task |
Created Task |
CreateTaskAsync(TaskType, CancellationToken)
Creates a new task. The Task
option task = {
name: "mean",
every: 1h,
}
from(bucket:"metrics/autogen")
|> range(start:-task.every)
|> group(columns:["level"])
|> mean()
|> yield(name:"mean")
Declaration
public Task<TaskType> CreateTaskAsync(TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Task |
task | task to create (required) |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Task |
Created Task |
CreateTaskCronAsync(String, String, String, Organization, CancellationToken)
Creates a new task with task repetition by cron. The Flux is without a cron or a every repetition. The repetition is automatically append to the option statement.
Declaration
public Task<TaskType> CreateTaskCronAsync(string name, string flux, string cron, Organization organization, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | description of the task |
System. |
flux | the Flux script to run for this task |
System. |
cron | a task repetition schedule in the form '* * * * * *' |
Organization | organization | the organization that owns this Task |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Task |
CreateTaskCronAsync(String, String, String, String, CancellationToken)
Creates a new task with task repetition by cron. The Flux is without a cron or a every repetition. The repetition is automatically append to the option statement.
Declaration
public Task<TaskType> CreateTaskCronAsync(string name, string flux, string cron, string orgId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | description of the task |
System. |
flux | the Flux script to run for this task |
System. |
cron | a task repetition schedule in the form '* * * * * *' |
System. |
orgId | the organization ID that owns this Task |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Task |
CreateTaskEveryAsync(String, String, String, Organization, CancellationToken)
Creates a new task with task repetition by duration expression ("1h", "30s"). The Flux is without a cron or a every repetition. The repetition is automatically append to the option statement.
Declaration
public Task<TaskType> CreateTaskEveryAsync(string name, string flux, string every, Organization organization, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | description of the task |
System. |
flux | the Flux script to run for this task |
System. |
every | a task repetition by duration expression |
Organization | organization | the organization that owns this Task |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Task |
Created Task |
CreateTaskEveryAsync(String, String, String, String, CancellationToken)
Creates a new task with task repetition by duration expression ("1h", "30s"). The Flux is without a cron or a every repetition. The repetition is automatically append to the option statement.
Declaration
public Task<TaskType> CreateTaskEveryAsync(string name, string flux, string every, string orgId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | description of the task |
System. |
flux | the Flux script to run for this task |
System. |
every | a task repetition by duration expression |
System. |
orgId | the organization ID that owns this Task |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Task |
Created Task |
DeleteLabelAsync(Label, TaskType, CancellationToken)
Removes a label from a Task.
Declaration
public Task DeleteLabelAsync(Label label, TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Label | label | the label of a Task |
Task |
task | a Task of a owner |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task | delete has been accepted |
DeleteLabelAsync(String, String, CancellationToken)
Removes a label from a Task.
Declaration
public Task DeleteLabelAsync(string labelId, string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
labelId | the ID of a label |
System. |
taskId | the ID of a Task |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task | delete has been accepted |
DeleteMemberAsync(User, TaskType, CancellationToken)
Removes a member from a task.
Declaration
public Task DeleteMemberAsync(User member, TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
User | member | the member of a task |
Task |
task | the task of a member |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task | member removed |
DeleteMemberAsync(String, String, CancellationToken)
Removes a member from a task.
Declaration
public Task DeleteMemberAsync(string memberId, string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
memberId | the ID of a member |
System. |
taskId | the ID of a task |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task | member removed |
DeleteOwnerAsync(User, TaskType, CancellationToken)
Removes a owner from a task.
Declaration
public Task DeleteOwnerAsync(User owner, TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
User | owner | the owner of a task |
Task |
task | the task of a owner |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task | owner removed |
DeleteOwnerAsync(String, String, CancellationToken)
Removes a owner from a task.
Declaration
public Task DeleteOwnerAsync(string ownerId, string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
ownerId | the ID of a owner |
System. |
taskId | the ID of a task |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task | owner removed |
DeleteTaskAsync(TaskType, CancellationToken)
Delete a task.
Declaration
public Task DeleteTaskAsync(TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Task |
task | task to delete |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task | task deleted |
DeleteTaskAsync(String, CancellationToken)
Delete a task.
Declaration
public Task DeleteTaskAsync(string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of task to delete |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task | task deleted |
FindTaskByIdAsync(String, CancellationToken)
Retrieve a task.
Declaration
public Task<TaskType> FindTaskByIdAsync(string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of task to get |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Task |
task details |
FindTasksAsync(String, String, String, String, String, Nullable<Int32>, CancellationToken)
Lists tasks, limit 100.
Declaration
public async Task<List<TaskType>> FindTasksAsync(string afterId = null, string userId = null, string orgId = null, string org = null, string name = null, int? limit = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
afterId | returns tasks after specified ID |
System. |
userId | filter tasks to a specific user ID |
System. |
orgId | filter tasks to a specific organization ID |
System. |
org | Filter tasks to a specific organization name. (optional) |
System. |
name | Returns task with a specific name. (optional) |
System. |
limit | The number of tasks to return (optional, default to 100) |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Task |
A list of tasks |
FindTasksByOrganizationAsync(Organization, CancellationToken)
Lists tasks, limit 100.
Declaration
public Task<List<TaskType>> FindTasksByOrganizationAsync(Organization organization, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Organization | organization | filter tasks to a specific organization |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Task |
A list of tasks |
FindTasksByOrganizationIdAsync(String, CancellationToken)
Lists tasks, limit 100.
Declaration
public Task<List<TaskType>> FindTasksByOrganizationIdAsync(string orgId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
orgId | filter tasks to a specific organization ID |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Task |
A list of tasks |
FindTasksByUserAsync(User, CancellationToken)
Lists tasks, limit 100.
Declaration
public Task<List<TaskType>> FindTasksByUserAsync(User user, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
User | user | filter tasks to a specific user |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Task |
A list of tasks |
FindTasksByUserIdAsync(String, CancellationToken)
Lists tasks, limit 100.
Declaration
public Task<List<TaskType>> FindTasksByUserIdAsync(string userId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
userId | filter tasks to a specific user ID |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Task |
A list of tasks |
GetLabelsAsync(TaskType, CancellationToken)
List all labels of a Task.
Declaration
public Task<List<Label>> GetLabelsAsync(TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Task |
task | a Task of the labels |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Label>> | the List all labels of a Task |
GetLabelsAsync(String, CancellationToken)
List all labels of a Task.
Declaration
public async Task<List<Label>> GetLabelsAsync(string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of a Task to get labels |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Label>> | the List all labels of a Task |
GetLogsAsync(TaskType, CancellationToken)
Retrieve all logs for a task.
Declaration
public Task<List<LogEvent>> GetLogsAsync(TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Task |
task | task to get logs for |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Log |
the list of all logs for a task |
GetLogsAsync(String, CancellationToken)
Retrieve all logs for a task.
Declaration
public async Task<List<LogEvent>> GetLogsAsync(string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of task to get logs for |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Log |
the list of all logs for a task |
GetMembersAsync(TaskType, CancellationToken)
List all members of a task.
Declaration
public Task<List<ResourceMember>> GetMembersAsync(TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Task |
task | task of the members |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Resource |
the List all members of a task |
GetMembersAsync(String, CancellationToken)
List all members of a task.
Declaration
public async Task<List<ResourceMember>> GetMembersAsync(string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of task to get members |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Resource |
the List all members of a task |
GetOwnersAsync(TaskType, CancellationToken)
List all owners of a task.
Declaration
public Task<List<ResourceOwner>> GetOwnersAsync(TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Task |
task | task of the owners |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Resource |
the List all owners of a task |
GetOwnersAsync(String, CancellationToken)
List all owners of a task.
Declaration
public async Task<List<ResourceOwner>> GetOwnersAsync(string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of a task to get owners |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Resource |
the List all owners of a task |
GetRunAsync(String, String, CancellationToken)
Retrieve a single run record for a task.
Declaration
public Task<Run> GetRunAsync(string taskId, string runId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of task to get runs for |
System. |
runId | ID of run |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Run> | a single run record for a task |
GetRunLogsAsync(Run, CancellationToken)
Retrieve all logs for a run.
Declaration
public Task<List<LogEvent>> GetRunLogsAsync(Run run, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Run | run | the run to gets logs for it |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Log |
the list of all logs for a run |
GetRunLogsAsync(String, String, CancellationToken)
Retrieve all logs for a run.
Declaration
public async Task<List<LogEvent>> GetRunLogsAsync(string taskId, string runId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of task to get run logs for it |
System. |
runId | ID of run to get logs for it |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Log |
the list of all logs for a run |
GetRunsAsync(TaskType, CancellationToken)
Retrieve list of run records for a task.
Declaration
public Task<List<Run>> GetRunsAsync(TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Task |
task | task to get runs for |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Run>> | the list of run records for a task |
GetRunsAsync(TaskType, Nullable<DateTime>, Nullable<DateTime>, Nullable<Int32>, CancellationToken)
Retrieve list of run records for a task.
Declaration
public Task<List<Run>> GetRunsAsync(TaskType task, DateTime? afterTime, DateTime? beforeTime, int? limit, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Task |
task | task to get runs for |
System. |
afterTime | filter runs to those scheduled after this time |
System. |
beforeTime | filter runs to those scheduled before this time |
System. |
limit | the number of runs to return. Default value: 20. |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Run>> | the list of run records for a task |
GetRunsAsync(String, CancellationToken)
Retrieve list of run records for a task.
Declaration
public Task<List<Run>> GetRunsAsync(string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of task to get runs for |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Run>> | the list of run records for a task |
GetRunsAsync(String, Nullable<DateTime>, Nullable<DateTime>, Nullable<Int32>, CancellationToken)
Retrieve list of run records for a task.
Declaration
public async Task<List<Run>> GetRunsAsync(string taskId, DateTime? afterTime, DateTime? beforeTime, int? limit, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of task to get runs for |
System. |
afterTime | filter runs to those scheduled after this time |
System. |
beforeTime | filter runs to those scheduled before this time |
System. |
limit | the number of runs to return. Default value: 20. |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<Run>> | the list of run records for a task |
RetryRunAsync(Run, CancellationToken)
Retry a task run.
Declaration
public Task<Run> RetryRunAsync(Run run, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Run | run | the run to retry |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Run> | the executed run |
RetryRunAsync(String, String, CancellationToken)
Retry a task run.
Declaration
public Task<Run> RetryRunAsync(string taskId, string runId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of task with the run to retry |
System. |
runId | ID of run to retry |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Run> | the executed run |
UpdateTaskAsync(TaskType, CancellationToken)
Update a task. This will cancel all queued runs.
Declaration
public Task<TaskType> UpdateTaskAsync(TaskType task, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Task |
task | task update to apply |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Task |
task updated |
UpdateTaskAsync(String, TaskUpdateRequest, CancellationToken)
Update a task. This will cancel all queued runs.
Declaration
public Task<TaskType> UpdateTaskAsync(string taskId, TaskUpdateRequest request, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System. |
taskId | ID of task to get |
Task |
request | task update to apply |
Cancellation |
cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<Task |
task updated |