Relationship.Update 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
Update(AtlasRelationship, CancellationToken) |
Update an existing relationship between entities. |
Update(RequestContent, RequestContext) |
[Protocol Method] Update an existing relationship between entities.
|
Update(AtlasRelationship, CancellationToken)
- Source:
- Relationship.cs
Update an existing relationship between entities.
public virtual Azure.Response<Azure.Analytics.Purview.DataMap.AtlasRelationship> Update (Azure.Analytics.Purview.DataMap.AtlasRelationship atlasRelationship, System.Threading.CancellationToken cancellationToken = default);
abstract member Update : Azure.Analytics.Purview.DataMap.AtlasRelationship * System.Threading.CancellationToken -> Azure.Response<Azure.Analytics.Purview.DataMap.AtlasRelationship>
override this.Update : Azure.Analytics.Purview.DataMap.AtlasRelationship * System.Threading.CancellationToken -> Azure.Response<Azure.Analytics.Purview.DataMap.AtlasRelationship>
Public Overridable Function Update (atlasRelationship As AtlasRelationship, Optional cancellationToken As CancellationToken = Nothing) As 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 Update.
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 = client.Update(atlasRelationship);
This sample shows how to call Update 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 = client.Update(atlasRelationship);
Applies to
Update(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 Update(AtlasRelationship, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response Update (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member Update : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.Update : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function Update (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 Update 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 = client.Update(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
This sample shows how to call Update 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 = client.Update(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