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 |
---|---|---|
TasksService | 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 |
TaskType | task | a Task of a label |
CancellationToken | 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.String | labelId | the ID of a label |
System.String | taskId | the ID of a Task |
CancellationToken | 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 |
TaskType | task | the task of a member |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<ResourceMember> | 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.String | memberId | the ID of a member |
System.String | taskId | the ID of a task |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<ResourceMember> | 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 |
TaskType | task | the task of a owner |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<ResourceOwner> | 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.String | ownerId | the ID of a owner |
System.String | taskId | the ID of a task |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<ResourceOwner> | 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 |
CancellationToken | 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.String | taskId | ID of task with the run to cancel |
System.String | runId | ID of run to cancel |
CancellationToken | 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 |
---|---|---|
TaskType | task | task to clone |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<TaskType> | cloned task |
CloneTaskAsync(String, CancellationToken)
Clone a task.
Declaration
public async Task<TaskType> CloneTaskAsync(string taskId, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | taskId | ID of task to clone |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<TaskType> | cloned task |
CreateTaskAsync(TaskCreateRequest, CancellationToken)
Create a new task.
Declaration
public Task<TaskType> CreateTaskAsync(TaskCreateRequest taskCreateRequest, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TaskCreateRequest | taskCreateRequest | task to create (required) |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<TaskType> | Created Task |
CreateTaskAsync(TaskType, CancellationToken)
Creates a new task. The TaskType has to have defined a cron or a every repetition
by the option statement.
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 |
---|---|---|
TaskType | task | task to create (required) |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<TaskType> | 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.String | name | description of the task |
System.String | flux | the Flux script to run for this task |
System.String | cron | a task repetition schedule in the form '* * * * * *' |
Organization | organization | the organization that owns this Task |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<TaskType> |
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.String | name | description of the task |
System.String | flux | the Flux script to run for this task |
System.String | cron | a task repetition schedule in the form '* * * * * *' |
System.String | orgId | the organization ID that owns this Task |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<TaskType> |
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.String | name | description of the task |
System.String | flux | the Flux script to run for this task |
System.String | every | a task repetition by duration expression |
Organization | organization | the organization that owns this Task |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<TaskType> | 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.String | name | description of the task |
System.String | flux | the Flux script to run for this task |
System.String | every | a task repetition by duration expression |
System.String | orgId | the organization ID that owns this Task |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<TaskType> | 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 |
TaskType | task | a Task of a owner |
CancellationToken | 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.String | labelId | the ID of a label |
System.String | taskId | the ID of a Task |
CancellationToken | 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 |
TaskType | task | the task of a member |
CancellationToken | 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.String | memberId | the ID of a member |
System.String | taskId | the ID of a task |
CancellationToken | 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 |
TaskType | task | the task of a owner |
CancellationToken | 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.String | ownerId | the ID of a owner |
System.String | taskId | the ID of a task |
CancellationToken | 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 |
---|---|---|
TaskType | task | task to delete |
CancellationToken | 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.String | taskId | ID of task to delete |
CancellationToken | 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.String | taskId | ID of task to get |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<TaskType> | 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.String | afterId | returns tasks after specified ID |
System.String | userId | filter tasks to a specific user ID |
System.String | orgId | filter tasks to a specific organization ID |
System.String | org | Filter tasks to a specific organization name. (optional) |
System.String | name | Returns task with a specific name. (optional) |
System.Nullable<System.Int32> | limit | The number of tasks to return (optional, default to 100) |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<TaskType>> | 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 |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<TaskType>> | 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.String | orgId | filter tasks to a specific organization ID |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<TaskType>> | 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 |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<TaskType>> | 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.String | userId | filter tasks to a specific user ID |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<TaskType>> | 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 |
---|---|---|
TaskType | task | a Task of the labels |
CancellationToken | 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.String | taskId | ID of a Task to get labels |
CancellationToken | 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 |
---|---|---|
TaskType | task | task to get logs for |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<LogEvent>> | 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.String | taskId | ID of task to get logs for |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<LogEvent>> | 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 |
---|---|---|
TaskType | task | task of the members |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<ResourceMember>> | 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.String | taskId | ID of task to get members |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<ResourceMember>> | 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 |
---|---|---|
TaskType | task | task of the owners |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<ResourceOwner>> | 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.String | taskId | ID of a task to get owners |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<ResourceOwner>> | 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.String | taskId | ID of task to get runs for |
System.String | runId | ID of run |
CancellationToken | 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 |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<LogEvent>> | 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.String | taskId | ID of task to get run logs for it |
System.String | runId | ID of run to get logs for it |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<List<LogEvent>> | 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 |
---|---|---|
TaskType | task | task to get runs for |
CancellationToken | 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 |
---|---|---|
TaskType | task | task to get runs for |
System.Nullable<DateTime> | afterTime | filter runs to those scheduled after this time |
System.Nullable<DateTime> | beforeTime | filter runs to those scheduled before this time |
System.Nullable<System.Int32> | limit | the number of runs to return. Default value: 20. |
CancellationToken | 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.String | taskId | ID of task to get runs for |
CancellationToken | 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.String | taskId | ID of task to get runs for |
System.Nullable<DateTime> | afterTime | filter runs to those scheduled after this time |
System.Nullable<DateTime> | beforeTime | filter runs to those scheduled before this time |
System.Nullable<System.Int32> | limit | the number of runs to return. Default value: 20. |
CancellationToken | 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 |
CancellationToken | 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.String | taskId | ID of task with the run to retry |
System.String | runId | ID of run to retry |
CancellationToken | 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 |
---|---|---|
TaskType | task | task update to apply |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<TaskType> | 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.String | taskId | ID of task to get |
TaskUpdateRequest | request | task update to apply |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<TaskType> | task updated |