Share via


TypeDefinition.BatchUpdate Method

Definition

Overloads

Name Description
BatchUpdate(RequestContent, RequestContext)

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

BatchUpdate(AtlasTypesDef, CancellationToken)

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

BatchUpdate(RequestContent, RequestContext)

Source:
TypeDefinition.cs

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

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

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

Applies to

BatchUpdate(AtlasTypesDef, CancellationToken)

Source:
TypeDefinition.cs

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

public virtual Azure.Response<Azure.Analytics.Purview.DataMap.AtlasTypesDef> BatchUpdate(Azure.Analytics.Purview.DataMap.AtlasTypesDef body, System.Threading.CancellationToken cancellationToken = default);
abstract member BatchUpdate : Azure.Analytics.Purview.DataMap.AtlasTypesDef * System.Threading.CancellationToken -> Azure.Response<Azure.Analytics.Purview.DataMap.AtlasTypesDef>
override this.BatchUpdate : Azure.Analytics.Purview.DataMap.AtlasTypesDef * System.Threading.CancellationToken -> Azure.Response<Azure.Analytics.Purview.DataMap.AtlasTypesDef>
Public Overridable Function BatchUpdate (body As AtlasTypesDef, Optional cancellationToken As CancellationToken = Nothing) As 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 BatchUpdate.

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 = client.BatchUpdate(body);

Applies to