Share via


TypeDefinition.BatchUpdateAsync Method

Definition

Overloads

Name Description
BatchUpdateAsync(AtlasTypesDef, CancellationToken)

Update all types in bulk, changes detected in the type definitions would be persisted.

BatchUpdateAsync(RequestContent, RequestContext)

[Protocol Method] Update all types in bulk, changes detected in the type definitions would be persisted.

BatchUpdateAsync(AtlasTypesDef, CancellationToken)

Source:
TypeDefinition.cs

Update all types in bulk, changes detected in the type definitions would be persisted.

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

Parameters

body
AtlasTypesDef

Body parameter.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

body is null.

Examples

This sample shows how to call BatchUpdateAsync.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
TypeDefinition client = new DataMapClient(endpoint, credential).GetTypeDefinitionClient();

AtlasTypesDef body = new AtlasTypesDef
{
    ClassificationDefs = { },
    EntityDefs = {new AtlasEntityDef
    {
        Name = "azure_sql_server",
        TypeVersion = "1.0",
        AttributeDefs = {new AtlasAttributeDef
        {
            Cardinality = CardinalityValue.Set,
            IsIndexable = false,
            IsOptional = true,
            IsUnique = false,
            Name = "databases",
            TypeName = "array<azure_sql_db>",
        }},
        SuperTypes = {"azure_resource"},
    }, new AtlasEntityDef
    {
        Name = "azure_sql_db",
        TypeVersion = "1.0",
        AttributeDefs = {new AtlasAttributeDef
        {
            Cardinality = CardinalityValue.Single,
            Constraints = {new AtlasConstraintDef
            {
                Params =
                {
                    ["attribute"] = BinaryData.FromObjectAsJson("databases")
                },
                Type = "inverseRef",
            }},
            IsIndexable = false,
            IsOptional = false,
            IsUnique = false,
            Name = "server",
            TypeName = "azure_sql_server",
        }, new AtlasAttributeDef
        {
            Cardinality = CardinalityValue.Set,
            IsIndexable = false,
            IsOptional = true,
            IsUnique = false,
            Name = "schemas",
            TypeName = "array<azure_sql_schema>",
        }, new AtlasAttributeDef
        {
            Cardinality = CardinalityValue.Single,
            IsIndexable = false,
            IsOptional = true,
            IsUnique = false,
            Name = "collation",
            TypeName = "string",
        }, new AtlasAttributeDef
        {
            Cardinality = CardinalityValue.Single,
            IsIndexable = false,
            IsOptional = true,
            IsUnique = false,
            Name = "compatibilityLevel",
            TypeName = "int",
        }},
        SuperTypes = {"azure_resource"},
    }},
    EnumDefs = { },
    RelationshipDefs = {new AtlasRelationshipDef
    {
        Name = "azure_sql_server_databases",
        TypeVersion = "1.0",
        EndDef1 = new AtlasRelationshipEndDef
        {
            Cardinality = CardinalityValue.Set,
            IsContainer = true,
            IsLegacyAttribute = true,
            Name = "databases",
            Type = "azure_sql_server",
        },
        EndDef2 = new AtlasRelationshipEndDef
        {
            Cardinality = CardinalityValue.Single,
            IsContainer = false,
            IsLegacyAttribute = true,
            Name = "server",
            Type = "azure_sql_db",
        },
        RelationshipCategory = RelationshipCategory.Composition,
    }, new AtlasRelationshipDef
    {
        Name = "azure_sql_db_schemas",
        TypeVersion = "1.0",
        EndDef1 = new AtlasRelationshipEndDef
        {
            Cardinality = CardinalityValue.Set,
            IsContainer = true,
            IsLegacyAttribute = true,
            Name = "schemas",
            Type = "azure_sql_db",
        },
        EndDef2 = new AtlasRelationshipEndDef
        {
            Cardinality = CardinalityValue.Single,
            IsContainer = false,
            IsLegacyAttribute = true,
            Name = "db",
            Type = "azure_sql_schema",
        },
        RelationshipCategory = RelationshipCategory.Composition,
    }},
    StructDefs = { },
};
Response<AtlasTypesDef> response = await client.BatchUpdateAsync(body);

Applies to

BatchUpdateAsync(RequestContent, RequestContext)

Source:
TypeDefinition.cs

[Protocol Method] Update all types in bulk, changes detected in the type definitions would be persisted.

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

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
TypeDefinition client = new DataMapClient(endpoint, credential).GetTypeDefinitionClient();

using RequestContent content = RequestContent.Create(new
{
    enumDefs = Array.Empty<object>(),
    structDefs = Array.Empty<object>(),
    classificationDefs = Array.Empty<object>(),
    entityDefs = new object[]
    {
        new
        {
            name = "azure_sql_server",
            superTypes = new object[]
            {
                "azure_resource"
            },
            typeVersion = "1.0",
            attributeDefs = new object[]
            {
                new
                {
                    name = "databases",
                    typeName = "array<azure_sql_db>",
                    cardinality = "SET",
                    isIndexable = false,
                    isOptional = true,
                    isUnique = false,
                }
            },
        },
        new
        {
            name = "azure_sql_db",
            superTypes = new object[]
            {
                "azure_resource"
            },
            typeVersion = "1.0",
            attributeDefs = new object[]
            {
                new
                {
                    name = "server",
                    typeName = "azure_sql_server",
                    cardinality = "SINGLE",
                    constraints = new object[]
                    {
                        new Dictionary<string, object>
                        {
                            ["type"] = "inverseRef",
                            ["params"] = new
                            {
                                attribute = "databases",
                            }
                        }
                    },
                    isIndexable = false,
                    isOptional = false,
                    isUnique = false,
                },
                new
                {
                    name = "schemas",
                    typeName = "array<azure_sql_schema>",
                    cardinality = "SET",
                    isIndexable = false,
                    isOptional = true,
                    isUnique = false,
                },
                new
                {
                    name = "collation",
                    typeName = "string",
                    cardinality = "SINGLE",
                    isIndexable = false,
                    isOptional = true,
                    isUnique = false,
                },
                new
                {
                    name = "compatibilityLevel",
                    typeName = "int",
                    cardinality = "SINGLE",
                    isIndexable = false,
                    isOptional = true,
                    isUnique = false,
                }
            },
        }
    },
    relationshipDefs = new object[]
    {
        new
        {
            name = "azure_sql_server_databases",
            typeVersion = "1.0",
            relationshipCategory = "COMPOSITION",
            endDef1 = new
            {
                type = "azure_sql_server",
                name = "databases",
                isContainer = true,
                cardinality = "SET",
                isLegacyAttribute = true,
            },
            endDef2 = new
            {
                type = "azure_sql_db",
                name = "server",
                isContainer = false,
                cardinality = "SINGLE",
                isLegacyAttribute = true,
            },
        },
        new
        {
            name = "azure_sql_db_schemas",
            typeVersion = "1.0",
            relationshipCategory = "COMPOSITION",
            endDef1 = new
            {
                type = "azure_sql_db",
                name = "schemas",
                isContainer = true,
                cardinality = "SET",
                isLegacyAttribute = true,
            },
            endDef2 = new
            {
                type = "azure_sql_schema",
                name = "db",
                isContainer = false,
                cardinality = "SINGLE",
                isLegacyAttribute = true,
            },
        }
    },
});
Response response = await client.BatchUpdateAsync(content);

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

Applies to