Partilhar via


Relationship.GetRelationshipAsync Method

Definition

Overloads

GetRelationshipAsync(String, Nullable<Boolean>, RequestContext)

[Protocol Method] Get relationship information between entities by its GUID.

GetRelationshipAsync(String, Nullable<Boolean>, CancellationToken)

Get relationship information between entities by its GUID.

GetRelationshipAsync(String, Nullable<Boolean>, RequestContext)

Source:
Relationship.cs

[Protocol Method] Get relationship information between entities by its GUID.

public virtual System.Threading.Tasks.Task<Azure.Response> GetRelationshipAsync (string guid, bool? extendedInfo, Azure.RequestContext context);
abstract member GetRelationshipAsync : string * Nullable<bool> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetRelationshipAsync : string * Nullable<bool> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetRelationshipAsync (guid As String, extendedInfo As Nullable(Of Boolean), context As RequestContext) As Task(Of Response)

Parameters

guid
String

The globally unique identifier of the relationship.

extendedInfo
Nullable<Boolean>

Limits whether includes extended information.

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

guid is null.

guid is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call GetRelationshipAsync and parse the result.

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

Response response = await client.GetRelationshipAsync("<guid>", null, null);

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

This sample shows how to call GetRelationshipAsync with all parameters and parse the result.

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

Response response = await client.GetRelationshipAsync("<guid>", true, null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("attributes").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("typeName").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("lastModifiedTS").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("classificationNames")[0].ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("classifications")[0].GetProperty("attributes").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("classifications")[0].GetProperty("typeName").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("classifications")[0].GetProperty("lastModifiedTS").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("classifications")[0].GetProperty("entityGuid").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("classifications")[0].GetProperty("entityStatus").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("classifications")[0].GetProperty("removePropagationsOnEntityDelete").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("classifications")[0].GetProperty("validityPeriods")[0].GetProperty("endTime").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("classifications")[0].GetProperty("validityPeriods")[0].GetProperty("startTime").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("classifications")[0].GetProperty("validityPeriods")[0].GetProperty("timeZone").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("displayText").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("guid").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("isIncomplete").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("labels")[0].ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("meaningNames")[0].ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("meanings")[0].GetProperty("confidence").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("meanings")[0].GetProperty("createdBy").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("meanings")[0].GetProperty("description").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("meanings")[0].GetProperty("displayText").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("meanings")[0].GetProperty("expression").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("meanings")[0].GetProperty("relationGuid").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("meanings")[0].GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("meanings")[0].GetProperty("steward").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("meanings")[0].GetProperty("termGuid").ToString());
Console.WriteLine(result.GetProperty("referredEntities").GetProperty("<key>").GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("attributes").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("typeName").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("lastModifiedTS").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("createTime").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("createdBy").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("end1").GetProperty("guid").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("end1").GetProperty("typeName").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("end1").GetProperty("uniqueAttributes").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("end2").GetProperty("guid").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("end2").GetProperty("typeName").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("end2").GetProperty("uniqueAttributes").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("guid").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("homeId").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("label").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("provenanceType").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("updateTime").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("updatedBy").ToString());
Console.WriteLine(result.GetProperty("relationship").GetProperty("version").ToString());

Applies to

GetRelationshipAsync(String, Nullable<Boolean>, CancellationToken)

Source:
Relationship.cs

Get relationship information between entities by its GUID.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.AtlasRelationshipWithExtInfo>> GetRelationshipAsync (string guid, bool? extendedInfo = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetRelationshipAsync : string * Nullable<bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.AtlasRelationshipWithExtInfo>>
override this.GetRelationshipAsync : string * Nullable<bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.AtlasRelationshipWithExtInfo>>
Public Overridable Function GetRelationshipAsync (guid As String, Optional extendedInfo As Nullable(Of Boolean) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of AtlasRelationshipWithExtInfo))

Parameters

guid
String

The globally unique identifier of the relationship.

extendedInfo
Nullable<Boolean>

Limits whether includes extended information.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

guid is null.

guid is an empty string, and was expected to be non-empty.

Examples

This sample shows how to call GetRelationshipAsync.

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

Response<AtlasRelationshipWithExtInfo> response = await client.GetRelationshipAsync("<guid>");

This sample shows how to call GetRelationshipAsync with all parameters.

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

Response<AtlasRelationshipWithExtInfo> response = await client.GetRelationshipAsync("<guid>", extendedInfo: true);

Applies to