Glossary.CreateCategoriesAsync 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
CreateCategoriesAsync(RequestContent, RequestContext) |
[Protocol Method] Create glossary category in bulk.
|
CreateCategoriesAsync(IEnumerable<AtlasGlossaryCategory>, CancellationToken) |
Create glossary category in bulk. |
CreateCategoriesAsync(RequestContent, RequestContext)
- Source:
- Glossary.cs
[Protocol Method] Create glossary category in bulk.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler CreateCategoriesAsync(IEnumerable<AtlasGlossaryCategory>, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> CreateCategoriesAsync (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateCategoriesAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.CreateCategoriesAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function CreateCategoriesAsync (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 CreateCategoriesAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Glossary client = new DataMapClient(endpoint, credential).GetGlossaryClient();
using RequestContent content = RequestContent.Create(new object[]
{
new object()
});
Response response = await client.CreateCategoriesAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result[0].ToString());
This sample shows how to call CreateCategoriesAsync with all request content and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Glossary client = new DataMapClient(endpoint, credential).GetGlossaryClient();
using RequestContent content = RequestContent.Create(new object[]
{
new
{
guid = "<guid>",
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>",
}
},
}
},
longDescription = "<longDescription>",
name = "<name>",
qualifiedName = "<qualifiedName>",
shortDescription = "<shortDescription>",
lastModifiedTS = "<lastModifiedTS>",
createTime = 1234L,
createdBy = "<createdBy>",
updateTime = 1234L,
updatedBy = "<updatedBy>",
anchor = new
{
displayText = "<displayText>",
glossaryGuid = "<glossaryGuid>",
relationGuid = "<relationGuid>",
},
childrenCategories = new object[]
{
new
{
categoryGuid = "<categoryGuid>",
description = "<description>",
displayText = "<displayText>",
parentCategoryGuid = "<parentCategoryGuid>",
relationGuid = "<relationGuid>",
}
},
terms = new object[]
{
new
{
description = "<description>",
displayText = "<displayText>",
expression = "<expression>",
relationGuid = "<relationGuid>",
status = "DRAFT",
steward = "<steward>",
termGuid = "<termGuid>",
}
},
}
});
Response response = await client.CreateCategoriesAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result[0].GetProperty("guid").ToString());
Console.WriteLine(result[0].GetProperty("classifications")[0].GetProperty("attributes").GetProperty("<key>").ToString());
Console.WriteLine(result[0].GetProperty("classifications")[0].GetProperty("typeName").ToString());
Console.WriteLine(result[0].GetProperty("classifications")[0].GetProperty("lastModifiedTS").ToString());
Console.WriteLine(result[0].GetProperty("classifications")[0].GetProperty("entityGuid").ToString());
Console.WriteLine(result[0].GetProperty("classifications")[0].GetProperty("entityStatus").ToString());
Console.WriteLine(result[0].GetProperty("classifications")[0].GetProperty("removePropagationsOnEntityDelete").ToString());
Console.WriteLine(result[0].GetProperty("classifications")[0].GetProperty("validityPeriods")[0].GetProperty("endTime").ToString());
Console.WriteLine(result[0].GetProperty("classifications")[0].GetProperty("validityPeriods")[0].GetProperty("startTime").ToString());
Console.WriteLine(result[0].GetProperty("classifications")[0].GetProperty("validityPeriods")[0].GetProperty("timeZone").ToString());
Console.WriteLine(result[0].GetProperty("longDescription").ToString());
Console.WriteLine(result[0].GetProperty("name").ToString());
Console.WriteLine(result[0].GetProperty("qualifiedName").ToString());
Console.WriteLine(result[0].GetProperty("shortDescription").ToString());
Console.WriteLine(result[0].GetProperty("lastModifiedTS").ToString());
Console.WriteLine(result[0].GetProperty("createTime").ToString());
Console.WriteLine(result[0].GetProperty("createdBy").ToString());
Console.WriteLine(result[0].GetProperty("updateTime").ToString());
Console.WriteLine(result[0].GetProperty("updatedBy").ToString());
Console.WriteLine(result[0].GetProperty("anchor").GetProperty("displayText").ToString());
Console.WriteLine(result[0].GetProperty("anchor").GetProperty("glossaryGuid").ToString());
Console.WriteLine(result[0].GetProperty("anchor").GetProperty("relationGuid").ToString());
Console.WriteLine(result[0].GetProperty("childrenCategories")[0].GetProperty("categoryGuid").ToString());
Console.WriteLine(result[0].GetProperty("childrenCategories")[0].GetProperty("description").ToString());
Console.WriteLine(result[0].GetProperty("childrenCategories")[0].GetProperty("displayText").ToString());
Console.WriteLine(result[0].GetProperty("childrenCategories")[0].GetProperty("parentCategoryGuid").ToString());
Console.WriteLine(result[0].GetProperty("childrenCategories")[0].GetProperty("relationGuid").ToString());
Console.WriteLine(result[0].GetProperty("parentCategory").GetProperty("categoryGuid").ToString());
Console.WriteLine(result[0].GetProperty("parentCategory").GetProperty("description").ToString());
Console.WriteLine(result[0].GetProperty("parentCategory").GetProperty("displayText").ToString());
Console.WriteLine(result[0].GetProperty("parentCategory").GetProperty("parentCategoryGuid").ToString());
Console.WriteLine(result[0].GetProperty("parentCategory").GetProperty("relationGuid").ToString());
Console.WriteLine(result[0].GetProperty("terms")[0].GetProperty("description").ToString());
Console.WriteLine(result[0].GetProperty("terms")[0].GetProperty("displayText").ToString());
Console.WriteLine(result[0].GetProperty("terms")[0].GetProperty("expression").ToString());
Console.WriteLine(result[0].GetProperty("terms")[0].GetProperty("relationGuid").ToString());
Console.WriteLine(result[0].GetProperty("terms")[0].GetProperty("status").ToString());
Console.WriteLine(result[0].GetProperty("terms")[0].GetProperty("steward").ToString());
Console.WriteLine(result[0].GetProperty("terms")[0].GetProperty("termGuid").ToString());
Applies to
CreateCategoriesAsync(IEnumerable<AtlasGlossaryCategory>, CancellationToken)
- Source:
- Glossary.cs
Create glossary category in bulk.
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Analytics.Purview.DataMap.AtlasGlossaryCategory>>> CreateCategoriesAsync (System.Collections.Generic.IEnumerable<Azure.Analytics.Purview.DataMap.AtlasGlossaryCategory> body, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateCategoriesAsync : seq<Azure.Analytics.Purview.DataMap.AtlasGlossaryCategory> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Analytics.Purview.DataMap.AtlasGlossaryCategory>>>
override this.CreateCategoriesAsync : seq<Azure.Analytics.Purview.DataMap.AtlasGlossaryCategory> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Analytics.Purview.DataMap.AtlasGlossaryCategory>>>
Public Overridable Function CreateCategoriesAsync (body As IEnumerable(Of AtlasGlossaryCategory), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of IReadOnlyList(Of AtlasGlossaryCategory)))
Parameters
An array of glossary category definitions to be created.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
body
is null.
Examples
This sample shows how to call CreateCategoriesAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Glossary client = new DataMapClient(endpoint, credential).GetGlossaryClient();
Response<IReadOnlyList<AtlasGlossaryCategory>> response = await client.CreateCategoriesAsync(new AtlasGlossaryCategory[]
{
new AtlasGlossaryCategory()
});
This sample shows how to call CreateCategoriesAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Glossary client = new DataMapClient(endpoint, credential).GetGlossaryClient();
Response<IReadOnlyList<AtlasGlossaryCategory>> response = await client.CreateCategoriesAsync(new AtlasGlossaryCategory[]
{
new AtlasGlossaryCategory
{
Guid = "<guid>",
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>",
}},
}},
LongDescription = "<longDescription>",
Name = "<name>",
QualifiedName = "<qualifiedName>",
ShortDescription = "<shortDescription>",
LastModifiedTS = "<lastModifiedTS>",
CreateTime = 1234L,
CreatedBy = "<createdBy>",
UpdateTime = 1234L,
UpdatedBy = "<updatedBy>",
Anchor = new AtlasGlossaryHeader
{
DisplayText = "<displayText>",
GlossaryGuid = "<glossaryGuid>",
RelationGuid = "<relationGuid>",
},
ChildrenCategories = {new AtlasRelatedCategoryHeader
{
CategoryGuid = "<categoryGuid>",
Description = "<description>",
DisplayText = "<displayText>",
ParentCategoryGuid = "<parentCategoryGuid>",
RelationGuid = "<relationGuid>",
}},
ParentCategory = default,
Terms = {new AtlasRelatedTermHeader
{
Description = "<description>",
DisplayText = "<displayText>",
Expression = "<expression>",
RelationGuid = "<relationGuid>",
Status = AtlasTermRelationshipStatus.Draft,
Steward = "<steward>",
TermGuid = "<termGuid>",
}},
}
});
Applies to
Azure SDK for .NET