EasmClient.GetTasksAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetTasksAsync(String, String, Nullable<Int32>, Nullable<Int32>, RequestContext) |
[Protocol Method] Retrieve a list of tasks for the provided search parameters.
|
GetTasksAsync(String, String, Nullable<Int32>, Nullable<Int32>, CancellationToken) |
Retrieve a list of tasks for the provided search parameters. |
GetTasksAsync(String, String, Nullable<Int32>, Nullable<Int32>, RequestContext)
- Source:
- EasmClient.cs
[Protocol Method] Retrieve a list of tasks for the provided search parameters.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetTasksAsync(String, String, Nullable<Int32>, Nullable<Int32>, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.AsyncPageable<BinaryData> GetTasksAsync (string filter, string orderby, int? skip, int? maxpagesize, Azure.RequestContext context);
abstract member GetTasksAsync : string * string * Nullable<int> * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetTasksAsync : string * string * Nullable<int> * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetTasksAsync (filter As String, orderby As String, skip As Nullable(Of Integer), maxpagesize As Nullable(Of Integer), context As RequestContext) As AsyncPageable(Of BinaryData)
Parameters
- filter
- String
Filter the result list using the given expression.
- orderby
- String
A list of expressions that specify the order of the returned resources.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The AsyncPageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.
Exceptions
Service returned a non-success status code.
Examples
This sample shows how to call GetTasksAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
await foreach (BinaryData item in client.GetTasksAsync(null, null, null, null, null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
}
This sample shows how to call GetTasksAsync with all parameters and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
await foreach (BinaryData item in client.GetTasksAsync("<filter>", "<orderby>", 1234, 1234, null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("startedAt").ToString());
Console.WriteLine(result.GetProperty("completedAt").ToString());
Console.WriteLine(result.GetProperty("lastPolledAt").ToString());
Console.WriteLine(result.GetProperty("state").ToString());
Console.WriteLine(result.GetProperty("phase").ToString());
Console.WriteLine(result.GetProperty("reason").ToString());
Console.WriteLine(result.GetProperty("metadata").GetProperty("<key>").ToString());
}
Applies to
GetTasksAsync(String, String, Nullable<Int32>, Nullable<Int32>, CancellationToken)
- Source:
- EasmClient.cs
Retrieve a list of tasks for the provided search parameters.
public virtual Azure.AsyncPageable<Azure.Analytics.Defender.Easm.TaskResource> GetTasksAsync (string filter = default, string orderby = default, int? skip = default, int? maxpagesize = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetTasksAsync : string * string * Nullable<int> * Nullable<int> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Analytics.Defender.Easm.TaskResource>
override this.GetTasksAsync : string * string * Nullable<int> * Nullable<int> * System.Threading.CancellationToken -> Azure.AsyncPageable<Azure.Analytics.Defender.Easm.TaskResource>
Public Overridable Function GetTasksAsync (Optional filter As String = Nothing, Optional orderby As String = Nothing, Optional skip As Nullable(Of Integer) = Nothing, Optional maxpagesize As Nullable(Of Integer) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As AsyncPageable(Of TaskResource)
Parameters
- filter
- String
Filter the result list using the given expression.
- orderby
- String
A list of expressions that specify the order of the returned resources.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Examples
This sample shows how to call GetTasksAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
await foreach (TaskResource item in client.GetTasksAsync())
{
}
This sample shows how to call GetTasksAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
await foreach (TaskResource item in client.GetTasksAsync(filter: "<filter>", orderby: "<orderby>", skip: 1234, maxpagesize: 1234))
{
}
Applies to
Azure SDK for .NET