EasmClient.GetAssetResourceAsync Method

Definition

Overloads

GetAssetResourceAsync(String, RequestContext)

[Protocol Method] Retrieve an asset by assetId.

GetAssetResourceAsync(String, CancellationToken)

Retrieve an asset by assetId.

GetAssetResourceAsync(String, RequestContext)

Source:
EasmClient.cs

[Protocol Method] Retrieve an asset by assetId.

public virtual System.Threading.Tasks.Task<Azure.Response> GetAssetResourceAsync (string assetId, Azure.RequestContext context);
abstract member GetAssetResourceAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetAssetResourceAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetAssetResourceAsync (assetId As String, context As RequestContext) As Task(Of Response)

Parameters

assetId
String

The system generated unique id for the resource.

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

assetId is null.

assetId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call GetAssetResourceAsync and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);

Response response = await client.GetAssetResourceAsync("<assetId>", null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("kind").ToString());
Console.WriteLine(result.GetProperty("id").ToString());

This sample shows how to call GetAssetResourceAsync 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);

Response response = await client.GetAssetResourceAsync("<assetId>", null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("kind").ToString());
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("displayName").ToString());
Console.WriteLine(result.GetProperty("uuid").ToString());
Console.WriteLine(result.GetProperty("createdDate").ToString());
Console.WriteLine(result.GetProperty("updatedDate").ToString());
Console.WriteLine(result.GetProperty("state").ToString());
Console.WriteLine(result.GetProperty("externalId").ToString());
Console.WriteLine(result.GetProperty("labels")[0].ToString());
Console.WriteLine(result.GetProperty("wildcard").ToString());
Console.WriteLine(result.GetProperty("discoGroupName").ToString());
Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("displayName").ToString());
Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("kind").ToString());
Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("reason").ToString());
Console.WriteLine(result.GetProperty("reason").ToString());

Applies to

GetAssetResourceAsync(String, CancellationToken)

Source:
EasmClient.cs

Retrieve an asset by assetId.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Defender.Easm.AssetResource>> GetAssetResourceAsync (string assetId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAssetResourceAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Defender.Easm.AssetResource>>
override this.GetAssetResourceAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Defender.Easm.AssetResource>>
Public Overridable Function GetAssetResourceAsync (assetId As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of AssetResource))

Parameters

assetId
String

The system generated unique id for the resource.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

assetId is null.

assetId is an empty string, and was expected to be non-empty.

Examples

This sample shows how to call GetAssetResourceAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);

Response<AssetResource> response = await client.GetAssetResourceAsync("<assetId>");

This sample shows how to call GetAssetResourceAsync with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);

Response<AssetResource> response = await client.GetAssetResourceAsync("<assetId>");

Applies to