DocumentIntelligenceAdministrationClient.AuthorizeModelCopyAsync Method

Definition

Overloads

AuthorizeModelCopyAsync(AuthorizeCopyContent, CancellationToken)

Generates authorization to copy a document model to this location with specified modelId and optional description.

AuthorizeModelCopyAsync(RequestContent, RequestContext)

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

AuthorizeModelCopyAsync(AuthorizeCopyContent, CancellationToken)

Source:
DocumentIntelligenceAdministrationClient.cs

Generates authorization to copy a document model to this location with specified modelId and optional description.

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

Parameters

authorizeCopyRequest
AuthorizeCopyContent

Authorize copy request parameters.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

authorizeCopyRequest is null.

Examples

This sample shows how to call AuthorizeModelCopyAsync.

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

AuthorizeCopyContent authorizeCopyRequest = new AuthorizeCopyContent("<modelId>");
Response<CopyAuthorization> response = await client.AuthorizeModelCopyAsync(authorizeCopyRequest);

This sample shows how to call AuthorizeModelCopyAsync with all parameters.

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

AuthorizeCopyContent authorizeCopyRequest = new AuthorizeCopyContent("<modelId>")
{
    Description = "<description>",
    Tags =
    {
        ["key"] = "<tags>"
    },
};
Response<CopyAuthorization> response = await client.AuthorizeModelCopyAsync(authorizeCopyRequest);

Applies to

AuthorizeModelCopyAsync(RequestContent, RequestContext)

Source:
DocumentIntelligenceAdministrationClient.cs

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

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

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

This sample shows how to call AuthorizeModelCopyAsync 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
{
    modelId = "<modelId>",
    description = "<description>",
    tags = new
    {
        key = "<tags>",
    },
});
Response response = await client.AuthorizeModelCopyAsync(content);

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

Applies to