Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Purview Workflow to 2023-10-01-preview #39833

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions sdk/purview/Azure.Analytics.Purview.Workflows/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Release History

## 1.0.0-beta.2 (Unreleased)
## 1.0.0-beta.2 (2023-11-15)

### Features Added

### Breaking Changes

### Bugs Fixed
- Add `/workflows/{id}/validate` API.
- Add admin query options to workflow / workflow run APIs.

### Other Changes

- Split `PurviewWorkflowServiceClient` into multiple clients by model.

## 1.0.0-beta.1 (2023-03-07)

### Features Added
Expand Down
8 changes: 4 additions & 4 deletions sdk/purview/Azure.Analytics.Purview.Workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ string username = Environment.GetEnvironmentVariable("Username");
string password = Environment.GetEnvironmentVariable("Password");

TokenCredential usernamePasswordCredential = new UsernamePasswordCredential(clientId,tenantId, username,password, null);
var client = new PurviewWorkflowServiceClient(endpoint, usernamePasswordCredential);
var client = new WorkflowsClient(endpoint, usernamePasswordCredential);
```

## Examples
Expand Down Expand Up @@ -62,15 +62,15 @@ Guid workflowId = Guid.NewGuid();

string workflow = "{\"name\":\"Create glossary term workflow\",\"description\":\"\",\"triggers\":[{\"type\":\"when_term_creation_is_requested\",\"underGlossaryHierarchy\":\"/glossaries/20031e20-b4df-4a66-a61d-1b0716f3fa48\"}],\"isEnabled\":true,\"actionDag\":{\"actions\":{\"Startandwaitforanapproval\":{\"type\":\"Approval\",\"inputs\":{\"parameters\":{\"approvalType\":\"PendingOnAll\",\"title\":\"ApprovalRequestforCreateGlossaryTerm\",\"assignedTo\":[\"eece94d9-0619-4669-bb8a-d6ecec5220bc\"]}},\"runAfter\":{}},\"Condition\":{\"type\":\"If\",\"expression\":{\"and\":[{\"equals\":[\"@outputs('Startandwaitforanapproval')['body/outcome']\",\"Approved\"]}]},\"actions\":{\"Createglossaryterm\":{\"type\":\"CreateTerm\",\"runAfter\":{}},\"Sendemailnotification\":{\"type\":\"EmailNotification\",\"inputs\":{\"parameters\":{\"emailSubject\":\"GlossaryTermCreate-APPROVED\",\"emailMessage\":\"YourrequestforGlossaryTerm@{triggerBody()['request']['term']['name']}isapproved.\",\"emailRecipients\":[\"@{triggerBody()['request']['requestor']}\"]}},\"runAfter\":{\"Createglossaryterm\":[\"Succeeded\"]}}},\"else\":{\"actions\":{\"Sendrejectemailnotification\":{\"type\":\"EmailNotification\",\"inputs\":{\"parameters\":{\"emailSubject\":\"GlossaryTermCreate-REJECTED\",\"emailMessage\":\"YourrequestforGlossaryTerm@{triggerBody()['request']['term']['name']}isrejected.\",\"emailRecipients\":[\"@{triggerBody()['request']['requestor']}\"]}},\"runAfter\":{}}}},\"runAfter\":{\"Startandwaitforanapproval\":[\"Succeeded\"]}}}}}";

Response createResult = await client.CreateOrReplaceWorkflowAsync(workflowId, RequestContent.Create(workflow));
Response createResult = await client.CreateOrReplaceAsync(workflowId, RequestContent.Create(workflow));
```

### Submit user requests

```C# Snippet:Azure_Analytics_Purview_Workflows_SubmitUserRequests
string request = "{\"operations\":[{\"type\":\"CreateTerm\",\"payload\":{\"glossaryTerm\":{\"name\":\"term\",\"anchor\":{\"glossaryGuid\":\"20031e20-b4df-4a66-a61d-1b0716f3fa48\"},\"status\":\"Approved\",\"nickName\":\"term\"}}}],\"comment\":\"Thanks!\"}";

Response submitResult = await client.SubmitUserRequestsAsync(RequestContent.Create(request));
Response submitResult = await client.SubmitAsync(RequestContent.Create(request));
```

### Approve workflow task
Expand All @@ -81,7 +81,7 @@ Guid taskId = new Guid("b129fe16-72d3-4994-9135-b997b9be46e0");

string request = "{\"comment\":\"Thanks!\"}";

Response approveResult = await client.ApproveApprovalTaskAsync(taskId, RequestContent.Create(request));
Response approveResult = await client.ApproveAsync(taskId, RequestContent.Create(request));
```

## Key concepts
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/purview/Azure.Analytics.Purview.Workflows",
"Tag": "net/purview/Azure.Analytics.Purview.Workflows_2a1bfc56ea"
"Tag": "net/purview/Azure.Analytics.Purview.Workflows_8546eb0d7f"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ string username = Environment.GetEnvironmentVariable("Username");
string password = Environment.GetEnvironmentVariable("Password");

TokenCredential usernamePasswordCredential = new UsernamePasswordCredential(clientId,tenantId, username,password, null);
var client = new PurviewWorkflowServiceClient(endpoint, usernamePasswordCredential);
var client = new WorkflowsClient(endpoint, usernamePasswordCredential);
```

## Create a Workflow
Expand All @@ -25,7 +25,7 @@ Guid workflowId = Guid.NewGuid();

string workflow = "{\"name\":\"Create glossary term workflow\",\"description\":\"\",\"triggers\":[{\"type\":\"when_term_creation_is_requested\",\"underGlossaryHierarchy\":\"/glossaries/20031e20-b4df-4a66-a61d-1b0716f3fa48\"}],\"isEnabled\":true,\"actionDag\":{\"actions\":{\"Startandwaitforanapproval\":{\"type\":\"Approval\",\"inputs\":{\"parameters\":{\"approvalType\":\"PendingOnAll\",\"title\":\"ApprovalRequestforCreateGlossaryTerm\",\"assignedTo\":[\"eece94d9-0619-4669-bb8a-d6ecec5220bc\"]}},\"runAfter\":{}},\"Condition\":{\"type\":\"If\",\"expression\":{\"and\":[{\"equals\":[\"@outputs('Startandwaitforanapproval')['body/outcome']\",\"Approved\"]}]},\"actions\":{\"Createglossaryterm\":{\"type\":\"CreateTerm\",\"runAfter\":{}},\"Sendemailnotification\":{\"type\":\"EmailNotification\",\"inputs\":{\"parameters\":{\"emailSubject\":\"GlossaryTermCreate-APPROVED\",\"emailMessage\":\"YourrequestforGlossaryTerm@{triggerBody()['request']['term']['name']}isapproved.\",\"emailRecipients\":[\"@{triggerBody()['request']['requestor']}\"]}},\"runAfter\":{\"Createglossaryterm\":[\"Succeeded\"]}}},\"else\":{\"actions\":{\"Sendrejectemailnotification\":{\"type\":\"EmailNotification\",\"inputs\":{\"parameters\":{\"emailSubject\":\"GlossaryTermCreate-REJECTED\",\"emailMessage\":\"YourrequestforGlossaryTerm@{triggerBody()['request']['term']['name']}isrejected.\",\"emailRecipients\":[\"@{triggerBody()['request']['requestor']}\"]}},\"runAfter\":{}}}},\"runAfter\":{\"Startandwaitforanapproval\":[\"Succeeded\"]}}}}}";

Response createResult = await client.CreateOrReplaceWorkflowAsync(workflowId, RequestContent.Create(workflow));
Response createResult = await client.CreateOrReplaceAsync(workflowId, RequestContent.Create(workflow));
```

## Get a Workflow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ string username = Environment.GetEnvironmentVariable("Username");
string password = Environment.GetEnvironmentVariable("Password");

TokenCredential usernamePasswordCredential = new UsernamePasswordCredential(clientId,tenantId, username,password, null);
var client = new PurviewWorkflowServiceClient(endpoint, usernamePasswordCredential);
var client = new WorkflowsClient(endpoint, usernamePasswordCredential);
```

## Submit a user request

```C# Snippet:Azure_Analytics_Purview_Workflows_SubmitUserRequests
string request = "{\"operations\":[{\"type\":\"CreateTerm\",\"payload\":{\"glossaryTerm\":{\"name\":\"term\",\"anchor\":{\"glossaryGuid\":\"20031e20-b4df-4a66-a61d-1b0716f3fa48\"},\"status\":\"Approved\",\"nickName\":\"term\"}}}],\"comment\":\"Thanks!\"}";

Response submitResult = await client.SubmitUserRequestsAsync(RequestContent.Create(request));
Response submitResult = await client.SubmitAsync(RequestContent.Create(request));
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ string username = Environment.GetEnvironmentVariable("Username");
string password = Environment.GetEnvironmentVariable("Password");

TokenCredential usernamePasswordCredential = new UsernamePasswordCredential(clientId,tenantId, username,password, null);
var client = new PurviewWorkflowServiceClient(endpoint, usernamePasswordCredential);
var client = new WorkflowsClient(endpoint, usernamePasswordCredential);
```

## Approve workflow task
Expand All @@ -26,5 +26,5 @@ Guid taskId = new Guid("b129fe16-72d3-4994-9135-b997b9be46e0");

string request = "{\"comment\":\"Thanks!\"}";

Response approveResult = await client.ApproveApprovalTaskAsync(taskId, RequestContent.Create(request));
Response approveResult = await client.ApproveAsync(taskId, RequestContent.Create(request));
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ string username = Environment.GetEnvironmentVariable("Username");
string password = Environment.GetEnvironmentVariable("Password");

TokenCredential usernamePasswordCredential = new UsernamePasswordCredential(clientId,tenantId, username,password, null);
var client = new PurviewWorkflowServiceClient(endpoint, usernamePasswordCredential);
var client = new WorkflowsClient(endpoint, usernamePasswordCredential);
```

## Cancel a workflow run
Expand All @@ -26,5 +26,5 @@ Guid workflowRunId = new Guid("4f8d70c3-c09b-4e56-bfd1-8b86c79bd4d9");

string request = "{\"comment\":\"Thanks!\"}";

Response cancelResult = await client.CancelWorkflowRunAsync(workflowRunId, RequestContent.Create(request));
Response cancelResult = await client.CancelAsync(workflowRunId, RequestContent.Create(request));
```
Loading