你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Entity.AddClassificationAsync Method

Definition

Overloads

AddClassificationAsync(ClassificationAssociateConfig, CancellationToken)

Associate a classification to multiple entities in bulk.

AddClassificationAsync(RequestContent, RequestContext)

[Protocol Method] Associate a classification to multiple entities in bulk.

AddClassificationAsync(ClassificationAssociateConfig, CancellationToken)

Source:
Entity.cs

Associate a classification to multiple entities in bulk.

public virtual System.Threading.Tasks.Task<Azure.Response> AddClassificationAsync (Azure.Analytics.Purview.DataMap.ClassificationAssociateConfig classificationAssociateConfig, System.Threading.CancellationToken cancellationToken = default);
abstract member AddClassificationAsync : Azure.Analytics.Purview.DataMap.ClassificationAssociateConfig * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
override this.AddClassificationAsync : Azure.Analytics.Purview.DataMap.ClassificationAssociateConfig * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function AddClassificationAsync (classificationAssociateConfig As ClassificationAssociateConfig, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response)

Parameters

classificationAssociateConfig
ClassificationAssociateConfig

The request payload for classification association.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

classificationAssociateConfig is null.

Examples

This sample shows how to call AddClassificationAsync.

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

ClassificationAssociateConfig classificationAssociateConfig = new ClassificationAssociateConfig();
Response response = await client.AddClassificationAsync(classificationAssociateConfig);

This sample shows how to call AddClassificationAsync with all parameters.

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

ClassificationAssociateConfig classificationAssociateConfig = new ClassificationAssociateConfig
{
    Classification = new AtlasClassification
    {
        Attributes =
        {
            ["key"] = BinaryData.FromObjectAsJson(new object())
        },
        TypeName = "<typeName>",
        LastModifiedTS = "<lastModifiedTS>",
        EntityGuid = "<entityGuid>",
        EntityStatus = EntityStatus.Active,
        RemovePropagationsOnEntityDelete = true,
        ValidityPeriods = {new TimeBoundary
        {
            EndTime = "<endTime>",
            StartTime = "<startTime>",
            TimeZone = "<timeZone>",
        }},
    },
    EntityGuids = { "<entityGuids>" },
};
Response response = await client.AddClassificationAsync(classificationAssociateConfig);

Applies to

AddClassificationAsync(RequestContent, RequestContext)

Source:
Entity.cs

[Protocol Method] Associate a classification to multiple entities in bulk.

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

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

using RequestContent content = RequestContent.Create(new object());
Response response = await client.AddClassificationAsync(content);

Console.WriteLine(response.Status);

This sample shows how to call AddClassificationAsync with all request content.

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

using RequestContent content = RequestContent.Create(new
{
    classification = new
    {
        attributes = new
        {
            key = new object(),
        },
        typeName = "<typeName>",
        lastModifiedTS = "<lastModifiedTS>",
        entityGuid = "<entityGuid>",
        entityStatus = "ACTIVE",
        removePropagationsOnEntityDelete = true,
        validityPeriods = new object[]
        {
            new
            {
                endTime = "<endTime>",
                startTime = "<startTime>",
                timeZone = "<timeZone>",
            }
        },
    },
    entityGuids = new object[]
    {
        "<entityGuids>"
    },
});
Response response = await client.AddClassificationAsync(content);

Console.WriteLine(response.Status);

Applies to