Udostępnij za pośrednictwem


EasmClient.ValidateDiscoveryGroupAsync Method

Definition

Overloads

ValidateDiscoveryGroupAsync(DiscoveryGroupPayload, CancellationToken)

Validate a discovery group with a given groupName.

ValidateDiscoveryGroupAsync(RequestContent, RequestContext)

[Protocol Method] Validate a discovery group with a given groupName.

ValidateDiscoveryGroupAsync(DiscoveryGroupPayload, CancellationToken)

Source:
EasmClient.cs

Validate a discovery group with a given groupName.

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

Parameters

discoveryGroupPayload
DiscoveryGroupPayload

A request body used to create a discovery group.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

discoveryGroupPayload is null.

Examples

This sample shows how to call ValidateDiscoveryGroupAsync.

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

DiscoveryGroupPayload discoveryGroupPayload = new DiscoveryGroupPayload();
Response<ValidateResult> response = await client.ValidateDiscoveryGroupAsync(discoveryGroupPayload);

This sample shows how to call ValidateDiscoveryGroupAsync with all parameters.

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

DiscoveryGroupPayload discoveryGroupPayload = new DiscoveryGroupPayload
{
    Name = "<name>",
    Description = "<description>",
    Tier = "<tier>",
    FrequencyMilliseconds = 1234L,
    Seeds = {new DiscoverySource
    {
        Kind = DiscoverySourceKind.As,
        Name = "<name>",
    }},
    Names = { "<names>" },
    Excludes = { default },
    TemplateId = "<templateId>",
};
Response<ValidateResult> response = await client.ValidateDiscoveryGroupAsync(discoveryGroupPayload);

Applies to

ValidateDiscoveryGroupAsync(RequestContent, RequestContext)

Source:
EasmClient.cs

[Protocol Method] Validate a discovery group with a given groupName.

public virtual System.Threading.Tasks.Task<Azure.Response> ValidateDiscoveryGroupAsync (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member ValidateDiscoveryGroupAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.ValidateDiscoveryGroupAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function ValidateDiscoveryGroupAsync (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 ValidateDiscoveryGroupAsync 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.ValidateDiscoveryGroupAsync(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());

This sample shows how to call ValidateDiscoveryGroupAsync 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
{
    name = "<name>",
    description = "<description>",
    tier = "<tier>",
    frequencyMilliseconds = 1234L,
    seeds = new object[]
    {
        new
        {
            kind = "as",
            name = "<name>",
        }
    },
    names = new object[]
    {
        "<names>"
    },
    excludes = new object[]
    {
        null
    },
    templateId = "<templateId>",
});
Response response = await client.ValidateDiscoveryGroupAsync(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("value").ToString());

Applies to