Share via


DocumentIntelligenceAdministrationClient.AuthorizeClassifierCopy Method

Definition

Overloads

AuthorizeClassifierCopy(AuthorizeClassifierCopyContent, CancellationToken)

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

AuthorizeClassifierCopy(RequestContent, RequestContext)

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

AuthorizeClassifierCopy(AuthorizeClassifierCopyContent, CancellationToken)

Source:
DocumentIntelligenceAdministrationClient.cs

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

public virtual Azure.Response<Azure.AI.DocumentIntelligence.ClassifierCopyAuthorization> AuthorizeClassifierCopy (Azure.AI.DocumentIntelligence.AuthorizeClassifierCopyContent authorizeCopyRequest, System.Threading.CancellationToken cancellationToken = default);
abstract member AuthorizeClassifierCopy : Azure.AI.DocumentIntelligence.AuthorizeClassifierCopyContent * System.Threading.CancellationToken -> Azure.Response<Azure.AI.DocumentIntelligence.ClassifierCopyAuthorization>
override this.AuthorizeClassifierCopy : Azure.AI.DocumentIntelligence.AuthorizeClassifierCopyContent * System.Threading.CancellationToken -> Azure.Response<Azure.AI.DocumentIntelligence.ClassifierCopyAuthorization>
Public Overridable Function AuthorizeClassifierCopy (authorizeCopyRequest As AuthorizeClassifierCopyContent, Optional cancellationToken As CancellationToken = Nothing) As 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 AuthorizeClassifierCopy.

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 = client.AuthorizeClassifierCopy(authorizeCopyRequest);

This sample shows how to call AuthorizeClassifierCopy 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 = client.AuthorizeClassifierCopy(authorizeCopyRequest);

Applies to

AuthorizeClassifierCopy(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 Azure.Response AuthorizeClassifierCopy (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member AuthorizeClassifierCopy : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.AuthorizeClassifierCopy : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function AuthorizeClassifierCopy (content As RequestContent, Optional context As RequestContext = Nothing) As 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 AuthorizeClassifierCopy 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 = client.AuthorizeClassifierCopy(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 AuthorizeClassifierCopy 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 = client.AuthorizeClassifierCopy(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