TypeDefinition.BatchCreate Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| BatchCreate(AtlasTypesDef, CancellationToken) |
Create all atlas type definitions in bulk. Please avoid recreating existing types. |
| BatchCreate(RequestContent, RequestContext) |
[Protocol Method] Create all atlas type definitions in bulk. Please avoid recreating existing types.
|
BatchCreate(AtlasTypesDef, CancellationToken)
- Source:
- TypeDefinition.cs
Create all atlas type definitions in bulk. Please avoid recreating existing types.
public virtual Azure.Response<Azure.Analytics.Purview.DataMap.AtlasTypesDef> BatchCreate(Azure.Analytics.Purview.DataMap.AtlasTypesDef body, System.Threading.CancellationToken cancellationToken = default);
abstract member BatchCreate : Azure.Analytics.Purview.DataMap.AtlasTypesDef * System.Threading.CancellationToken -> Azure.Response<Azure.Analytics.Purview.DataMap.AtlasTypesDef>
override this.BatchCreate : Azure.Analytics.Purview.DataMap.AtlasTypesDef * System.Threading.CancellationToken -> Azure.Response<Azure.Analytics.Purview.DataMap.AtlasTypesDef>
Public Overridable Function BatchCreate (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 BatchCreate.
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_example",
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"},
}},
EnumDefs = { },
RelationshipDefs = { },
StructDefs = { },
};
Response<AtlasTypesDef> response = client.BatchCreate(body);
This sample shows how to call BatchCreate.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
TypeDefinition client = new DataMapClient(endpoint, credential).GetTypeDefinitionClient();
AtlasTypesDef body = new AtlasTypesDef
{
BusinessMetadataDefs = {new AtlasBusinessMetadataDef
{
Description = "",
Name = "myBizMetadata1",
AttributeDefs = {new AtlasAttributeDef
{
Cardinality = CardinalityValue.Single,
IsIndexable = true,
IsOptional = true,
IsUnique = false,
Name = "bizAttr1",
Options =
{
["maxStrLength"] = "50",
["applicableEntityTypes"] = "[\"Path\"]"
},
TypeName = "string",
}},
}},
ClassificationDefs = { },
EntityDefs = { },
EnumDefs = { },
RelationshipDefs = { },
StructDefs = { },
};
Response<AtlasTypesDef> response = client.BatchCreate(body);
Applies to
BatchCreate(RequestContent, RequestContext)
- Source:
- TypeDefinition.cs
[Protocol Method] Create all atlas type definitions in bulk. Please avoid recreating existing types.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler BatchCreate(AtlasTypesDef, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response BatchCreate(Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member BatchCreate : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.BatchCreate : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function BatchCreate (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 BatchCreate 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_example",
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,
}
},
}
},
relationshipDefs = Array.Empty<object>(),
});
Response response = client.BatchCreate(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
This sample shows how to call BatchCreate 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 = Array.Empty<object>(),
relationshipDefs = Array.Empty<object>(),
businessMetadataDefs = new object[]
{
new
{
name = "myBizMetadata1",
description = "",
attributeDefs = new object[]
{
new
{
name = "bizAttr1",
typeName = "string",
isOptional = true,
cardinality = "SINGLE",
isUnique = false,
isIndexable = true,
options = new
{
maxStrLength = "50",
applicableEntityTypes = "[\"Path\"]",
},
}
},
}
},
});
Response response = client.BatchCreate(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());