EasmClient.GetSummaryAsync 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
GetSummaryAsync(ReportAssetSummaryPayload, CancellationToken) |
Get asset summary details for the summary request. |
GetSummaryAsync(RequestContent, RequestContext) |
[Protocol Method] Get asset summary details for the summary request.
|
GetSummaryAsync(ReportAssetSummaryPayload, CancellationToken)
- Source:
- EasmClient.cs
Get asset summary details for the summary request.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Defender.Easm.ReportAssetSummaryResult>> GetSummaryAsync (Azure.Analytics.Defender.Easm.ReportAssetSummaryPayload reportAssetSummaryPayload, System.Threading.CancellationToken cancellationToken = default);
abstract member GetSummaryAsync : Azure.Analytics.Defender.Easm.ReportAssetSummaryPayload * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Defender.Easm.ReportAssetSummaryResult>>
override this.GetSummaryAsync : Azure.Analytics.Defender.Easm.ReportAssetSummaryPayload * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Defender.Easm.ReportAssetSummaryResult>>
Public Overridable Function GetSummaryAsync (reportAssetSummaryPayload As ReportAssetSummaryPayload, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of ReportAssetSummaryResult))
Parameters
- reportAssetSummaryPayload
- ReportAssetSummaryPayload
A request body used to retrieve summary asset information. One and only one collection of summary identifiers must be provided: filters, metrics, or metricCategories.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
reportAssetSummaryPayload
is null.
Examples
This sample shows how to call GetSummaryAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
ReportAssetSummaryPayload reportAssetSummaryPayload = new ReportAssetSummaryPayload();
Response<ReportAssetSummaryResult> response = await client.GetSummaryAsync(reportAssetSummaryPayload);
This sample shows how to call GetSummaryAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
ReportAssetSummaryPayload reportAssetSummaryPayload = new ReportAssetSummaryPayload
{
MetricCategories = { "<metricCategories>" },
Metrics = { "<metrics>" },
Filters = { "<filters>" },
GroupBy = "<groupBy>",
SegmentBy = "<segmentBy>",
LabelName = "<labelName>",
};
Response<ReportAssetSummaryResult> response = await client.GetSummaryAsync(reportAssetSummaryPayload);
Applies to
GetSummaryAsync(RequestContent, RequestContext)
- Source:
- EasmClient.cs
[Protocol Method] Get asset summary details for the summary request.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetSummaryAsync(ReportAssetSummaryPayload, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> GetSummaryAsync (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member GetSummaryAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetSummaryAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetSummaryAsync (content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)
Parameters
- content
- RequestContent
The content to send as the body of the request.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
content
is null.
Service returned a non-success status code.
Examples
This sample shows how to call GetSummaryAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new object());
Response response = await client.GetSummaryAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
This sample shows how to call GetSummaryAsync with all request content and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
metricCategories = new object[]
{
"<metricCategories>"
},
metrics = new object[]
{
"<metrics>"
},
filters = new object[]
{
"<filters>"
},
groupBy = "<groupBy>",
segmentBy = "<segmentBy>",
labelName = "<labelName>",
});
Response response = await client.GetSummaryAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("displayName").ToString());
Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("description").ToString());
Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("updatedAt").ToString());
Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("metricCategory").ToString());
Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("metric").ToString());
Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("filter").ToString());
Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("labelName").ToString());
Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("count").ToString());
Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("link").ToString());
Applies to
Azure SDK for .NET