Relationship.UpdateAsync 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
UpdateAsync(AtlasRelationship, CancellationToken) |
Update an existing relationship between entities. |
UpdateAsync(RequestContent, RequestContext) |
[Protocol Method] Update an existing relationship between entities.
|
UpdateAsync(AtlasRelationship, CancellationToken)
- Source:
- Relationship.cs
Update an existing relationship between entities.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.AtlasRelationship>> UpdateAsync (Azure.Analytics.Purview.DataMap.AtlasRelationship atlasRelationship, System.Threading.CancellationToken cancellationToken = default);
abstract member UpdateAsync : Azure.Analytics.Purview.DataMap.AtlasRelationship * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.AtlasRelationship>>
override this.UpdateAsync : Azure.Analytics.Purview.DataMap.AtlasRelationship * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Purview.DataMap.AtlasRelationship>>
Public Overridable Function UpdateAsync (atlasRelationship As AtlasRelationship, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of AtlasRelationship))
Parameters
- atlasRelationship
- AtlasRelationship
Atlas relationship instance.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
atlasRelationship
is null.
Examples
This sample shows how to call UpdateAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Relationship client = new DataMapClient(endpoint, credential).GetRelationshipClient();
AtlasRelationship atlasRelationship = new AtlasRelationship();
Response<AtlasRelationship> response = await client.UpdateAsync(atlasRelationship);
This sample shows how to call UpdateAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Relationship client = new DataMapClient(endpoint, credential).GetRelationshipClient();
AtlasRelationship atlasRelationship = new AtlasRelationship
{
Attributes =
{
["key"] = BinaryData.FromObjectAsJson(new object())
},
TypeName = "<typeName>",
LastModifiedTS = "<lastModifiedTS>",
CreateTime = 1234L,
CreatedBy = "<createdBy>",
End1 = new AtlasObjectId
{
Guid = "<guid>",
TypeName = "<typeName>",
UniqueAttributes =
{
["key"] = BinaryData.FromObjectAsJson(new object())
},
},
End2 = default,
Guid = "<guid>",
HomeId = "<homeId>",
Label = "<label>",
ProvenanceType = 1234,
Status = StatusAtlasRelationship.Active,
UpdateTime = 1234L,
UpdatedBy = "<updatedBy>",
Version = 1234L,
};
Response<AtlasRelationship> response = await client.UpdateAsync(atlasRelationship);
Applies to
UpdateAsync(RequestContent, RequestContext)
- Source:
- Relationship.cs
[Protocol Method] Update an existing relationship between entities.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler UpdateAsync(AtlasRelationship, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> UpdateAsync (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member UpdateAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.UpdateAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function UpdateAsync (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 UpdateAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Relationship client = new DataMapClient(endpoint, credential).GetRelationshipClient();
using RequestContent content = RequestContent.Create(new object());
Response response = await client.UpdateAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
This sample shows how to call UpdateAsync with all request content and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Relationship client = new DataMapClient(endpoint, credential).GetRelationshipClient();
using RequestContent content = RequestContent.Create(new
{
attributes = new
{
key = new object(),
},
typeName = "<typeName>",
lastModifiedTS = "<lastModifiedTS>",
createTime = 1234L,
createdBy = "<createdBy>",
end1 = new
{
guid = "<guid>",
typeName = "<typeName>",
uniqueAttributes = new
{
key = new object(),
},
},
guid = "<guid>",
homeId = "<homeId>",
label = "<label>",
provenanceType = 1234,
status = "ACTIVE",
updateTime = 1234L,
updatedBy = "<updatedBy>",
version = 1234L,
});
Response response = await client.UpdateAsync(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("attributes").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("typeName").ToString());
Console.WriteLine(result.GetProperty("lastModifiedTS").ToString());
Console.WriteLine(result.GetProperty("createTime").ToString());
Console.WriteLine(result.GetProperty("createdBy").ToString());
Console.WriteLine(result.GetProperty("end1").GetProperty("guid").ToString());
Console.WriteLine(result.GetProperty("end1").GetProperty("typeName").ToString());
Console.WriteLine(result.GetProperty("end1").GetProperty("uniqueAttributes").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("end2").GetProperty("guid").ToString());
Console.WriteLine(result.GetProperty("end2").GetProperty("typeName").ToString());
Console.WriteLine(result.GetProperty("end2").GetProperty("uniqueAttributes").GetProperty("<key>").ToString());
Console.WriteLine(result.GetProperty("guid").ToString());
Console.WriteLine(result.GetProperty("homeId").ToString());
Console.WriteLine(result.GetProperty("label").ToString());
Console.WriteLine(result.GetProperty("provenanceType").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("updateTime").ToString());
Console.WriteLine(result.GetProperty("updatedBy").ToString());
Console.WriteLine(result.GetProperty("version").ToString());
Applies to
Azure SDK for .NET