Partilhar via


Entity.BatchSetClassificationsAsync Method

Definition

Overloads

BatchSetClassificationsAsync(AtlasEntityHeaders, CancellationToken)

Set classifications on entities in bulk.

BatchSetClassificationsAsync(RequestContent, RequestContext)

[Protocol Method] Set classifications on entities in bulk.

BatchSetClassificationsAsync(AtlasEntityHeaders, CancellationToken)

Source:
Entity.cs

Set classifications on entities in bulk.

public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<string>>> BatchSetClassificationsAsync (Azure.Analytics.Purview.DataMap.AtlasEntityHeaders atlasEntityHeaders, System.Threading.CancellationToken cancellationToken = default);
abstract member BatchSetClassificationsAsync : Azure.Analytics.Purview.DataMap.AtlasEntityHeaders * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<string>>>
override this.BatchSetClassificationsAsync : Azure.Analytics.Purview.DataMap.AtlasEntityHeaders * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<string>>>
Public Overridable Function BatchSetClassificationsAsync (atlasEntityHeaders As AtlasEntityHeaders, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of IReadOnlyList(Of String)))

Parameters

atlasEntityHeaders
AtlasEntityHeaders

An instance of an entity header map.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

atlasEntityHeaders is null.

Examples

This sample shows how to call BatchSetClassificationsAsync.

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

AtlasEntityHeaders atlasEntityHeaders = new AtlasEntityHeaders();
Response<IReadOnlyList<string>> response = await client.BatchSetClassificationsAsync(atlasEntityHeaders);

This sample shows how to call BatchSetClassificationsAsync with all parameters.

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

AtlasEntityHeaders atlasEntityHeaders = new AtlasEntityHeaders
{
    GuidHeaderMap =
    {
        ["key"] = new AtlasEntityHeader
        {
            Attributes =
            {
                ["key"] = BinaryData.FromObjectAsJson(new object())
            },
            TypeName = "<typeName>",
            LastModifiedTS = "<lastModifiedTS>",
            ClassificationNames = {"<classificationNames>"},
            Classifications = {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>",
                }},
            }},
            DisplayText = "<displayText>",
            Guid = "<guid>",
            IsIncomplete = true,
            Labels = {"<labels>"},
            MeaningNames = {"<meaningNames>"},
            Meanings = {new AtlasTermAssignmentHeader
            {
                Confidence = 1234,
                CreatedBy = "<createdBy>",
                Description = "<description>",
                DisplayText = "<displayText>",
                Expression = "<expression>",
                RelationGuid = Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"),
                Status = AtlasTermAssignmentStatus.Discovered,
                Steward = "<steward>",
                TermGuid = Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"),
            }},
            Status = EntityStatus.Active,
        }
    },
};
Response<IReadOnlyList<string>> response = await client.BatchSetClassificationsAsync(atlasEntityHeaders);

Applies to

BatchSetClassificationsAsync(RequestContent, RequestContext)

Source:
Entity.cs

[Protocol Method] Set classifications on entities in bulk.

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

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.BatchSetClassificationsAsync(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result[0].ToString());

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

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
{
    guidHeaderMap = new
    {
        key = new
        {
            attributes = new
            {
                key = new object(),
            },
            typeName = "<typeName>",
            lastModifiedTS = "<lastModifiedTS>",
            classificationNames = new object[]
            {
                "<classificationNames>"
            },
            classifications = new object[]
            {
                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>",
                        }
                    },
                }
            },
            displayText = "<displayText>",
            guid = "<guid>",
            isIncomplete = true,
            labels = new object[]
            {
                "<labels>"
            },
            meaningNames = new object[]
            {
                "<meaningNames>"
            },
            meanings = new object[]
            {
                new
                {
                    confidence = 1234,
                    createdBy = "<createdBy>",
                    description = "<description>",
                    displayText = "<displayText>",
                    expression = "<expression>",
                    relationGuid = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a",
                    status = "DISCOVERED",
                    steward = "<steward>",
                    termGuid = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a",
                }
            },
            status = "ACTIVE",
        },
    },
});
Response response = await client.BatchSetClassificationsAsync(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result[0].ToString());

Applies to