Share via


DocumentIntelligenceAdministrationClient.AuthorizeClassifierCopyAsync Method

Definition

Overloads

AuthorizeClassifierCopyAsync(AuthorizeClassifierCopyContent, CancellationToken)

Generates authorization to copy a document classifier to this location with specified classifierId and optional description.

AuthorizeClassifierCopyAsync(RequestContent, RequestContext)

[Protocol Method] Generates authorization to copy a document classifier to this location with specified classifierId and optional description.

AuthorizeClassifierCopyAsync(AuthorizeClassifierCopyContent, CancellationToken)

Source:
DocumentIntelligenceAdministrationClient.cs

Generates authorization to copy a document classifier to this location with specified classifierId and optional description.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.DocumentIntelligence.ClassifierCopyAuthorization>> AuthorizeClassifierCopyAsync (Azure.AI.DocumentIntelligence.AuthorizeClassifierCopyContent authorizeCopyRequest, System.Threading.CancellationToken cancellationToken = default);
abstract member AuthorizeClassifierCopyAsync : Azure.AI.DocumentIntelligence.AuthorizeClassifierCopyContent * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.DocumentIntelligence.ClassifierCopyAuthorization>>
override this.AuthorizeClassifierCopyAsync : Azure.AI.DocumentIntelligence.AuthorizeClassifierCopyContent * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.DocumentIntelligence.ClassifierCopyAuthorization>>
Public Overridable Function AuthorizeClassifierCopyAsync (authorizeCopyRequest As AuthorizeClassifierCopyContent, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of ClassifierCopyAuthorization))

Parameters

authorizeCopyRequest
AuthorizeClassifierCopyContent

Authorize copy request parameters.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

authorizeCopyRequest is null.

Examples

This sample shows how to call AuthorizeClassifierCopyAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);

AuthorizeClassifierCopyContent authorizeCopyRequest = new AuthorizeClassifierCopyContent("<classifierId>");
Response<ClassifierCopyAuthorization> response = await client.AuthorizeClassifierCopyAsync(authorizeCopyRequest);

This sample shows how to call AuthorizeClassifierCopyAsync with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);

AuthorizeClassifierCopyContent authorizeCopyRequest = new AuthorizeClassifierCopyContent("<classifierId>")
{
    Description = "<description>",
    Tags =
    {
        ["key"] = "<tags>"
    },
};
Response<ClassifierCopyAuthorization> response = await client.AuthorizeClassifierCopyAsync(authorizeCopyRequest);

Applies to

AuthorizeClassifierCopyAsync(RequestContent, RequestContext)

Source:
DocumentIntelligenceAdministrationClient.cs

[Protocol Method] Generates authorization to copy a document classifier to this location with specified classifierId and optional description.

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

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    classifierId = "<classifierId>",
});
Response response = await client.AuthorizeClassifierCopyAsync(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("targetResourceId").ToString());
Console.WriteLine(result.GetProperty("targetResourceRegion").ToString());
Console.WriteLine(result.GetProperty("targetClassifierId").ToString());
Console.WriteLine(result.GetProperty("targetClassifierLocation").ToString());
Console.WriteLine(result.GetProperty("accessToken").ToString());
Console.WriteLine(result.GetProperty("expirationDateTime").ToString());

This sample shows how to call AuthorizeClassifierCopyAsync with all request content and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
DocumentIntelligenceAdministrationClient client = new DocumentIntelligenceAdministrationClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    classifierId = "<classifierId>",
    description = "<description>",
    tags = new
    {
        key = "<tags>",
    },
});
Response response = await client.AuthorizeClassifierCopyAsync(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("targetResourceId").ToString());
Console.WriteLine(result.GetProperty("targetResourceRegion").ToString());
Console.WriteLine(result.GetProperty("targetClassifierId").ToString());
Console.WriteLine(result.GetProperty("targetClassifierLocation").ToString());
Console.WriteLine(result.GetProperty("accessToken").ToString());
Console.WriteLine(result.GetProperty("expirationDateTime").ToString());

Applies to