Partilhar via


DocumentIntelligenceAdministrationClient.AuthorizeModelCopy Method

Definition

Overloads

AuthorizeModelCopy(AuthorizeCopyContent, CancellationToken)

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

AuthorizeModelCopy(RequestContent, RequestContext)

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

AuthorizeModelCopy(AuthorizeCopyContent, CancellationToken)

Source:
DocumentIntelligenceAdministrationClient.cs

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

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

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

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

Applies to

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