From 082df4837182d13bcdc1de3e456adc50858baf8a Mon Sep 17 00:00:00 2001 From: Weiran Wu Date: Wed, 8 Nov 2023 14:55:02 +0800 Subject: [PATCH 1/3] Update Purview Workflow to 2023-10-01-preview --- .../CHANGELOG.md | 9 +- .../README.md | 8 +- ...lytics.Purview.Workflows.netstandard2.0.cs | 142 +- .../assets.json | 2 +- .../samples/Sample1_Workflows.md | 4 +- .../samples/Sample2_SubmitUserRequests.md | 4 +- .../samples/Sample3_WorkflowTasks.md | 4 +- .../samples/Sample4_WorkflowRuns.md | 4 +- ...PurviewWorkflowsClientBuilderExtensions.cs | 150 +- .../src/Generated/ApprovalClient.cs | 244 ++++ .../src/Generated/Docs/ApprovalClient.xml | 117 ++ .../Docs/PurviewWorkflowServiceClient.xml | 1157 --------------- .../src/Generated/Docs/TaskStatusClient.xml | 69 + .../src/Generated/Docs/UserRequestsClient.xml | 121 ++ .../src/Generated/Docs/WorkflowClient.xml | 401 +++++ .../src/Generated/Docs/WorkflowRunClient.xml | 143 ++ .../src/Generated/Docs/WorkflowRunsClient.xml | 91 ++ .../src/Generated/Docs/WorkflowTaskClient.xml | 177 +++ .../Generated/Docs/WorkflowTasksClient.xml | 111 ++ .../src/Generated/Docs/WorkflowsClient.xml | 89 ++ .../Generated/PurviewWorkflowServiceClient.cs | 1290 ----------------- .../PurviewWorkflowServiceClientOptions.cs | 10 +- .../src/Generated/TaskStatusClient.cs | 155 ++ .../src/Generated/UserRequestsClient.cs | 151 ++ .../src/Generated/WorkflowClient.cs | 401 +++++ .../src/Generated/WorkflowRunClient.cs | 233 +++ .../src/Generated/WorkflowRunsClient.cs | 180 +++ .../src/Generated/WorkflowTaskClient.cs | 232 +++ .../src/Generated/WorkflowTasksClient.cs | 198 +++ .../src/Generated/WorkflowsClient.cs | 137 ++ .../src/autorest.md | 10 +- .../Samples/Samples_ApprovalClient.cs | 144 ++ .../Samples_PurviewWorkflowServiceClient.cs | 192 +-- .../Samples/Samples_TaskStatusClient.cs | 90 ++ .../Samples/Samples_UserRequestsClient.cs | 143 ++ .../Samples/Samples_WorkflowClient.cs | 441 ++++++ .../Samples/Samples_WorkflowRunClient.cs | 171 +++ .../Samples/Samples_WorkflowRunsClient.cs | 112 ++ .../Samples/Samples_WorkflowTaskClient.cs | 205 +++ .../Samples/Samples_WorkflowTasksClient.cs | 132 ++ .../Samples/Samples_WorkflowsClient.cs | 110 ++ .../tests/Samples/Sample1_HelloWorld.cs | 8 +- .../Samples/Sample2_SubmitUserRequests.cs | 4 +- .../tests/Samples/Sample3_WorkflowTasks.cs | 4 +- .../tests/Samples/Sample4_WorkflowRuns.cs | 4 +- .../tests/WorkflowsClientTest.cs | 34 +- .../tests/WorkflowsClientTestBase.cs | 48 +- 47 files changed, 5252 insertions(+), 2634 deletions(-) create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/ApprovalClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/ApprovalClient.xml delete mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/PurviewWorkflowServiceClient.xml create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/TaskStatusClient.xml create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/UserRequestsClient.xml create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowClient.xml create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowRunClient.xml create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowRunsClient.xml create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowTaskClient.xml create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowTasksClient.xml create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowsClient.xml delete mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/PurviewWorkflowServiceClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/TaskStatusClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/UserRequestsClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowRunClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowRunsClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowTaskClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowTasksClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowsClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_ApprovalClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_TaskStatusClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_UserRequestsClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowRunClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowRunsClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowTaskClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowTasksClient.cs create mode 100644 sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowsClient.cs diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/CHANGELOG.md b/sdk/purview/Azure.Analytics.Purview.Workflows/CHANGELOG.md index ef854e05dad1..5725040141da 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/CHANGELOG.md +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/CHANGELOG.md @@ -1,15 +1,20 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.2 (2023-10-26) ### Features Added +- Add `/workflows/{id}/validate` API. +- Add admin query options to workflow / workflow run APIs. + ### Breaking Changes -### Bugs Fixed +- Split `PurviewWorkflowServiceClient` into multiple clients by model. ### Other Changes +- Update descriptions of some APIs. + ## 1.0.0-beta.1 (2023-03-07) ### Features Added diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/README.md b/sdk/purview/Azure.Analytics.Purview.Workflows/README.md index b6eb30d127b6..322397a7cb94 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/README.md +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/README.md @@ -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 @@ -62,7 +62,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)); ``` ### Submit user requests @@ -70,7 +70,7 @@ Response createResult = await client.CreateOrReplaceWorkflowAsync(workflowId, Re ```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 @@ -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 diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/api/Azure.Analytics.Purview.Workflows.netstandard2.0.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/api/Azure.Analytics.Purview.Workflows.netstandard2.0.cs index cc135fcd8632..8104c8a92ab5 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/api/Azure.Analytics.Purview.Workflows.netstandard2.0.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/api/Azure.Analytics.Purview.Workflows.netstandard2.0.cs @@ -1,54 +1,128 @@ namespace Azure.Analytics.Purview.Workflows { - public partial class PurviewWorkflowServiceClient - { - protected PurviewWorkflowServiceClient() { } - public PurviewWorkflowServiceClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } - public PurviewWorkflowServiceClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions options) { } - public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response ApproveApprovalTask(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task ApproveApprovalTaskAsync(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response CancelWorkflowRun(System.Guid workflowRunId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task CancelWorkflowRunAsync(System.Guid workflowRunId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response CreateOrReplaceWorkflow(System.Guid workflowId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrReplaceWorkflowAsync(System.Guid workflowId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response DeleteWorkflow(System.Guid workflowId, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeleteWorkflowAsync(System.Guid workflowId, Azure.RequestContext context = null) { throw null; } + public partial class ApprovalClient + { + protected ApprovalClient() { } + public ApprovalClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public ApprovalClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response Approve(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task ApproveAsync(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response Reject(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task RejectAsync(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + } + public partial class PurviewWorkflowServiceClientOptions : Azure.Core.ClientOptions + { + public PurviewWorkflowServiceClientOptions(Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions.ServiceVersion version = Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions.ServiceVersion.V2023_10_01_Preview) { } + public enum ServiceVersion + { + V2023_10_01_Preview = 1, + } + } + public partial class TaskStatusClient + { + protected TaskStatusClient() { } + public TaskStatusClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public TaskStatusClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response Update(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task UpdateAsync(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + } + public partial class UserRequestsClient + { + protected UserRequestsClient() { } + public UserRequestsClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public UserRequestsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response Submit(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task SubmitAsync(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + } + public partial class WorkflowClient + { + protected WorkflowClient() { } + public WorkflowClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public WorkflowClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateOrReplace(System.Guid workflowId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrReplaceAsync(System.Guid workflowId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response Delete(System.Guid workflowId, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(System.Guid workflowId, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response GetWorkflow(System.Guid workflowId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task GetWorkflowAsync(System.Guid workflowId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response Validate(System.Guid workflowId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task ValidateAsync(System.Guid workflowId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + } + public partial class WorkflowRunClient + { + protected WorkflowRunClient() { } + public WorkflowRunClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public WorkflowRunClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response Cancel(System.Guid workflowRunId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task CancelAsync(System.Guid workflowRunId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response GetWorkflowRun(System.Guid workflowRunId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task GetWorkflowRunAsync(System.Guid workflowRunId, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetWorkflowRuns(string timeWindow, string orderby, System.Collections.Generic.IEnumerable runStatuses, System.Collections.Generic.IEnumerable workflowIds, int? maxpagesize, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetWorkflowRunsAsync(string timeWindow, string orderby, System.Collections.Generic.IEnumerable runStatuses, System.Collections.Generic.IEnumerable workflowIds, int? maxpagesize, Azure.RequestContext context) { throw null; } + } + public partial class WorkflowRunsClient + { + protected WorkflowRunsClient() { } + public WorkflowRunsClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public WorkflowRunsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Pageable GetWorkflowRuns(string viewMode, string timeWindow, string orderby, System.Collections.Generic.IEnumerable runStatuses, System.Collections.Generic.IEnumerable workflowIds, System.Collections.Generic.IEnumerable requestors, int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetWorkflowRunsAsync(string viewMode, string timeWindow, string orderby, System.Collections.Generic.IEnumerable runStatuses, System.Collections.Generic.IEnumerable workflowIds, System.Collections.Generic.IEnumerable requestors, int? maxpagesize, Azure.RequestContext context) { throw null; } + } + public partial class WorkflowsClient + { + protected WorkflowsClient() { } + public WorkflowsClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public WorkflowsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } public virtual Azure.Pageable GetWorkflows(Azure.RequestContext context) { throw null; } public virtual Azure.AsyncPageable GetWorkflowsAsync(Azure.RequestContext context) { throw null; } + } + public partial class WorkflowTaskClient + { + protected WorkflowTaskClient() { } + public WorkflowTaskClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public WorkflowTaskClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } public virtual Azure.Response GetWorkflowTask(System.Guid taskId, Azure.RequestContext context) { throw null; } public virtual System.Threading.Tasks.Task GetWorkflowTaskAsync(System.Guid taskId, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetWorkflowTasks(string viewMode, System.Collections.Generic.IEnumerable workflowIds, string timeWindow, int? maxpagesize, string orderby, System.Collections.Generic.IEnumerable taskTypes, System.Collections.Generic.IEnumerable taskStatuses, string workflowNameKeyword, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetWorkflowTasksAsync(string viewMode, System.Collections.Generic.IEnumerable workflowIds, string timeWindow, int? maxpagesize, string orderby, System.Collections.Generic.IEnumerable taskTypes, System.Collections.Generic.IEnumerable taskStatuses, string workflowNameKeyword, Azure.RequestContext context) { throw null; } - public virtual Azure.Response ReassignWorkflowTask(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task ReassignWorkflowTaskAsync(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response RejectApprovalTask(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task RejectApprovalTaskAsync(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response SubmitUserRequests(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task SubmitUserRequestsAsync(Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response UpdateTaskStatus(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task UpdateTaskStatusAsync(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response Reassign(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task ReassignAsync(System.Guid taskId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } } - public partial class PurviewWorkflowServiceClientOptions : Azure.Core.ClientOptions + public partial class WorkflowTasksClient { - public PurviewWorkflowServiceClientOptions(Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions.ServiceVersion version = Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions.ServiceVersion.V2022_05_01_Preview) { } - public enum ServiceVersion - { - V2022_05_01_Preview = 1, - } + protected WorkflowTasksClient() { } + public WorkflowTasksClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public WorkflowTasksClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Workflows.PurviewWorkflowServiceClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Pageable GetWorkflowTasks(string viewMode, System.Collections.Generic.IEnumerable workflowIds, string timeWindow, int? maxpagesize, string orderby, System.Collections.Generic.IEnumerable taskTypes, System.Collections.Generic.IEnumerable taskStatuses, System.Collections.Generic.IEnumerable requestors, System.Collections.Generic.IEnumerable assignees, string workflowNameKeyword, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetWorkflowTasksAsync(string viewMode, System.Collections.Generic.IEnumerable workflowIds, string timeWindow, int? maxpagesize, string orderby, System.Collections.Generic.IEnumerable taskTypes, System.Collections.Generic.IEnumerable taskStatuses, System.Collections.Generic.IEnumerable requestors, System.Collections.Generic.IEnumerable assignees, string workflowNameKeyword, Azure.RequestContext context) { throw null; } } } namespace Microsoft.Extensions.Azure { public static partial class AnalyticsPurviewWorkflowsClientBuilderExtensions { - public static Azure.Core.Extensions.IAzureClientBuilder AddPurviewWorkflowServiceClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } - public static Azure.Core.Extensions.IAzureClientBuilder AddPurviewWorkflowServiceClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddApprovalClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddApprovalClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddTaskStatusClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddTaskStatusClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddUserRequestsClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddUserRequestsClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWorkflowClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWorkflowClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWorkflowRunClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWorkflowRunClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWorkflowRunsClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWorkflowRunsClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWorkflowsClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWorkflowsClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWorkflowTaskClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWorkflowTaskClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWorkflowTasksClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWorkflowTasksClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/assets.json b/sdk/purview/Azure.Analytics.Purview.Workflows/assets.json index 351f89a15496..d136ac009351 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/assets.json +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/assets.json @@ -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" } diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample1_Workflows.md b/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample1_Workflows.md index 318be06d6ab2..c1d1107f6b98 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample1_Workflows.md +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample1_Workflows.md @@ -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 @@ -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 diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample2_SubmitUserRequests.md b/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample2_SubmitUserRequests.md index a33dfa109503..9b7d16a4e391 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample2_SubmitUserRequests.md +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample2_SubmitUserRequests.md @@ -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); ``` ## Submit a user request @@ -23,5 +23,5 @@ var client = new PurviewWorkflowServiceClient(endpoint, usernamePasswordCredenti ```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)); ``` diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample3_WorkflowTasks.md b/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample3_WorkflowTasks.md index e445d385814f..eb643abb4eee 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample3_WorkflowTasks.md +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample3_WorkflowTasks.md @@ -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 @@ -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)); ``` diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample4_WorkflowRuns.md b/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample4_WorkflowRuns.md index 9680626a9380..240affdde5c7 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample4_WorkflowRuns.md +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/samples/Sample4_WorkflowRuns.md @@ -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 @@ -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)); ``` diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/AnalyticsPurviewWorkflowsClientBuilderExtensions.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/AnalyticsPurviewWorkflowsClientBuilderExtensions.cs index e17f715c674b..1dc56e7a48c4 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/AnalyticsPurviewWorkflowsClientBuilderExtensions.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/AnalyticsPurviewWorkflowsClientBuilderExtensions.cs @@ -11,25 +11,161 @@ namespace Microsoft.Extensions.Azure { - /// Extension methods to add to client builder. + /// Extension methods to add , , , , , , , , to client builder. public static partial class AnalyticsPurviewWorkflowsClientBuilderExtensions { - /// Registers a instance. + /// Registers a instance. /// The builder to register with. /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. - public static IAzureClientBuilder AddPurviewWorkflowServiceClient(this TBuilder builder, Uri endpoint) + public static IAzureClientBuilder AddWorkflowsClient(this TBuilder builder, Uri endpoint) where TBuilder : IAzureClientFactoryBuilderWithCredential { - return builder.RegisterClientFactory((options, cred) => new PurviewWorkflowServiceClient(endpoint, cred, options)); + return builder.RegisterClientFactory((options, cred) => new WorkflowsClient(endpoint, cred, options)); } - /// Registers a instance. + /// Registers a instance. + /// The builder to register with. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + public static IAzureClientBuilder AddWorkflowClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new WorkflowClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + public static IAzureClientBuilder AddUserRequestsClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new UserRequestsClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + public static IAzureClientBuilder AddWorkflowRunsClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new WorkflowRunsClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + public static IAzureClientBuilder AddWorkflowRunClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new WorkflowRunClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + public static IAzureClientBuilder AddWorkflowTasksClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new WorkflowTasksClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + public static IAzureClientBuilder AddWorkflowTaskClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new WorkflowTaskClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + public static IAzureClientBuilder AddApprovalClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new ApprovalClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + public static IAzureClientBuilder AddTaskStatusClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new TaskStatusClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddWorkflowsClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddWorkflowClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddUserRequestsClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddWorkflowRunsClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddWorkflowRunClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddWorkflowTasksClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddWorkflowTaskClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddApprovalClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + /// Registers a instance. /// The builder to register with. /// The configuration values. - public static IAzureClientBuilder AddPurviewWorkflowServiceClient(this TBuilder builder, TConfiguration configuration) + public static IAzureClientBuilder AddTaskStatusClient(this TBuilder builder, TConfiguration configuration) where TBuilder : IAzureClientFactoryBuilderWithConfiguration { - return builder.RegisterClientFactory(configuration); + return builder.RegisterClientFactory(configuration); } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/ApprovalClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/ApprovalClient.cs new file mode 100644 index 000000000000..d0e460971d7c --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/ApprovalClient.cs @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Workflows +{ + // Data plane generated client. + /// The Approval service client. + public partial class ApprovalClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of ApprovalClient for mocking. + protected ApprovalClient() + { + } + + /// Initializes a new instance of ApprovalClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public ApprovalClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new PurviewWorkflowServiceClientOptions()) + { + } + + /// Initializes a new instance of ApprovalClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public ApprovalClient(Uri endpoint, TokenCredential credential, PurviewWorkflowServiceClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new PurviewWorkflowServiceClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// + /// [Protocol Method] Approve an approval. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The task id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task ApproveAsync(Guid taskId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ApprovalClient.Approve"); + scope.Start(); + try + { + using HttpMessage message = CreateApproveRequest(taskId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Approve an approval. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The task id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Approve(Guid taskId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ApprovalClient.Approve"); + scope.Start(); + try + { + using HttpMessage message = CreateApproveRequest(taskId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Reject an approval. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The task id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task RejectAsync(Guid taskId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ApprovalClient.Reject"); + scope.Start(); + try + { + using HttpMessage message = CreateRejectRequest(taskId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Reject an approval. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The task id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Reject(Guid taskId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ApprovalClient.Reject"); + scope.Start(); + try + { + using HttpMessage message = CreateRejectRequest(taskId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateApproveRequest(Guid taskId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflowtasks/", false); + uri.AppendPath(taskId, true); + uri.AppendPath("/approve-approval", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateRejectRequest(Guid taskId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflowtasks/", false); + uri.AppendPath(taskId, true); + uri.AppendPath("/reject-approval", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/ApprovalClient.xml b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/ApprovalClient.xml new file mode 100644 index 000000000000..dc213df85f29 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/ApprovalClient.xml @@ -0,0 +1,117 @@ + + + + + +This sample shows how to call ApproveAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +ApprovalClient client = new ApprovalClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.ApproveAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call ApproveAsync with all parameters and request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +ApprovalClient client = new ApprovalClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + comment = "", +}); +Response response = await client.ApproveAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call Approve. +"); +TokenCredential credential = new DefaultAzureCredential(); +ApprovalClient client = new ApprovalClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.Approve(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call Approve with all parameters and request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +ApprovalClient client = new ApprovalClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + comment = "", +}); +Response response = client.Approve(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call RejectAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +ApprovalClient client = new ApprovalClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.RejectAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call RejectAsync with all parameters and request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +ApprovalClient client = new ApprovalClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + comment = "", +}); +Response response = await client.RejectAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call Reject. +"); +TokenCredential credential = new DefaultAzureCredential(); +ApprovalClient client = new ApprovalClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.Reject(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call Reject with all parameters and request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +ApprovalClient client = new ApprovalClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + comment = "", +}); +Response response = client.Reject(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> + + + \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/PurviewWorkflowServiceClient.xml b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/PurviewWorkflowServiceClient.xml deleted file mode 100644 index 5b0152278dd0..000000000000 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/PurviewWorkflowServiceClient.xml +++ /dev/null @@ -1,1157 +0,0 @@ - - - - - -This sample shows how to call GetWorkflowAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = await client.GetWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("actionDag").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("isEnabled").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -]]> -This sample shows how to call GetWorkflowAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = await client.GetWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("actionDag").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); -Console.WriteLine(result.GetProperty("createdTime").ToString()); -Console.WriteLine(result.GetProperty("createdBy").ToString()); -Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); -Console.WriteLine(result.GetProperty("updatedBy").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("isEnabled").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -]]> - - - -This sample shows how to call GetWorkflow and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = client.GetWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("actionDag").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("isEnabled").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -]]> -This sample shows how to call GetWorkflow with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = client.GetWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("actionDag").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); -Console.WriteLine(result.GetProperty("createdTime").ToString()); -Console.WriteLine(result.GetProperty("createdBy").ToString()); -Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); -Console.WriteLine(result.GetProperty("updatedBy").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("isEnabled").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -]]> - - - -This sample shows how to call CreateOrReplaceWorkflowAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - triggers = new object[] - { - new - { - type = "when_term_creation_is_requested", - } - }, - name = "", - isEnabled = true, - description = "", -}); -Response response = await client.CreateOrReplaceWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("actionDag").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("isEnabled").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -]]> -This sample shows how to call CreateOrReplaceWorkflowAsync with all parameters and request content and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - triggers = new object[] - { - new - { - type = "when_term_creation_is_requested", - underGlossaryHierarchy = "", - underCollection = "", - underGlossary = "", - } - }, - name = "", - isEnabled = true, - description = "", - actionDag = new object(), -}); -Response response = await client.CreateOrReplaceWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("actionDag").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); -Console.WriteLine(result.GetProperty("createdTime").ToString()); -Console.WriteLine(result.GetProperty("createdBy").ToString()); -Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); -Console.WriteLine(result.GetProperty("updatedBy").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("isEnabled").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -]]> - - - -This sample shows how to call CreateOrReplaceWorkflow and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - triggers = new object[] - { - new - { - type = "when_term_creation_is_requested", - } - }, - name = "", - isEnabled = true, - description = "", -}); -Response response = client.CreateOrReplaceWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("actionDag").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("isEnabled").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -]]> -This sample shows how to call CreateOrReplaceWorkflow with all parameters and request content and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - triggers = new object[] - { - new - { - type = "when_term_creation_is_requested", - underGlossaryHierarchy = "", - underCollection = "", - underGlossary = "", - } - }, - name = "", - isEnabled = true, - description = "", - actionDag = new object(), -}); -Response response = client.CreateOrReplaceWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("actionDag").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); -Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); -Console.WriteLine(result.GetProperty("createdTime").ToString()); -Console.WriteLine(result.GetProperty("createdBy").ToString()); -Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); -Console.WriteLine(result.GetProperty("updatedBy").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("isEnabled").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -]]> - - - -This sample shows how to call DeleteWorkflowAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = await client.DeleteWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call DeleteWorkflowAsync with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = await client.DeleteWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call DeleteWorkflow. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = client.DeleteWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call DeleteWorkflow with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = client.DeleteWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call SubmitUserRequestsAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - operations = new object[] - { - new - { - type = "CreateTerm", - payload = new object(), - } - }, -}); -Response response = await client.SubmitUserRequestsAsync(content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("requestId").ToString()); -Console.WriteLine(result.GetProperty("requestor").ToString()); -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call SubmitUserRequestsAsync with all request content and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - operations = new object[] - { - new - { - type = "CreateTerm", - payload = new object(), - } - }, - comment = "", -}); -Response response = await client.SubmitUserRequestsAsync(content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("requestId").ToString()); -Console.WriteLine(result.GetProperty("requestor").ToString()); -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString()); -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("workflowRunIds")[0].ToString()); -Console.WriteLine(result.GetProperty("comment").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> - - - -This sample shows how to call SubmitUserRequests and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - operations = new object[] - { - new - { - type = "CreateTerm", - payload = new object(), - } - }, -}); -Response response = client.SubmitUserRequests(content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("requestId").ToString()); -Console.WriteLine(result.GetProperty("requestor").ToString()); -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call SubmitUserRequests with all request content and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - operations = new object[] - { - new - { - type = "CreateTerm", - payload = new object(), - } - }, - comment = "", -}); -Response response = client.SubmitUserRequests(content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("requestId").ToString()); -Console.WriteLine(result.GetProperty("requestor").ToString()); -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString()); -Console.WriteLine(result.GetProperty("operations")[0].GetProperty("workflowRunIds")[0].ToString()); -Console.WriteLine(result.GetProperty("comment").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> - - - -This sample shows how to call GetWorkflowRunAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = await client.GetWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("actionDag").ToString()); -Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString()); -Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString()); -]]> -This sample shows how to call GetWorkflowRunAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = await client.GetWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("workflowId").ToString()); -Console.WriteLine(result.GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("requestor").ToString()); -Console.WriteLine(result.GetProperty("userRequestId").ToString()); -Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); -Console.WriteLine(result.GetProperty("runPayload").GetProperty("payload").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("endTime").ToString()); -Console.WriteLine(result.GetProperty("cancelTime").ToString()); -Console.WriteLine(result.GetProperty("cancelComment").ToString()); -Console.WriteLine(result.GetProperty("actionDag").ToString()); -Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString()); -Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString()); -]]> - - - -This sample shows how to call GetWorkflowRun and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = client.GetWorkflowRun(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("actionDag").ToString()); -Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString()); -Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString()); -]]> -This sample shows how to call GetWorkflowRun with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = client.GetWorkflowRun(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("workflowId").ToString()); -Console.WriteLine(result.GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("requestor").ToString()); -Console.WriteLine(result.GetProperty("userRequestId").ToString()); -Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); -Console.WriteLine(result.GetProperty("runPayload").GetProperty("payload").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("endTime").ToString()); -Console.WriteLine(result.GetProperty("cancelTime").ToString()); -Console.WriteLine(result.GetProperty("cancelComment").ToString()); -Console.WriteLine(result.GetProperty("actionDag").ToString()); -Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString()); -Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString()); -]]> - - - -This sample shows how to call CancelWorkflowRunAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new object()); -Response response = await client.CancelWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call CancelWorkflowRunAsync with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - comment = "", -}); -Response response = await client.CancelWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call CancelWorkflowRun. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new object()); -Response response = client.CancelWorkflowRun(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call CancelWorkflowRun with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - comment = "", -}); -Response response = client.CancelWorkflowRun(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call GetWorkflowTaskAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = await client.GetWorkflowTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("workflowRunId").ToString()); -Console.WriteLine(result.GetProperty("workflowId").ToString()); -Console.WriteLine(result.GetProperty("requestor").ToString()); -Console.WriteLine(result.GetProperty("createdTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); -Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); -]]> -This sample shows how to call GetWorkflowTaskAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = await client.GetWorkflowTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("title").ToString()); -Console.WriteLine(result.GetProperty("workflowRunId").ToString()); -Console.WriteLine(result.GetProperty("workflowId").ToString()); -Console.WriteLine(result.GetProperty("requestor").ToString()); -Console.WriteLine(result.GetProperty("createdTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); -Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); -Console.WriteLine(result.GetProperty("payload").GetProperty("payload").ToString()); -Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("lastRemindTime").ToString()); -Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("nextRemindTime").ToString()); -Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("reminderSettings").ToString()); -Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("lastExpiryNotificationTime").ToString()); -Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("nextExpiryNotificationTime").ToString()); -Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expiryTime").ToString()); -Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("expireAfter").ToString()); -Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("notifyOnExpiration")[0].ToString()); -]]> - - - -This sample shows how to call GetWorkflowTask and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = client.GetWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("workflowRunId").ToString()); -Console.WriteLine(result.GetProperty("workflowId").ToString()); -Console.WriteLine(result.GetProperty("requestor").ToString()); -Console.WriteLine(result.GetProperty("createdTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); -Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); -]]> -This sample shows how to call GetWorkflowTask with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -Response response = client.GetWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("title").ToString()); -Console.WriteLine(result.GetProperty("workflowRunId").ToString()); -Console.WriteLine(result.GetProperty("workflowId").ToString()); -Console.WriteLine(result.GetProperty("requestor").ToString()); -Console.WriteLine(result.GetProperty("createdTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); -Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); -Console.WriteLine(result.GetProperty("payload").GetProperty("payload").ToString()); -Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("lastRemindTime").ToString()); -Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("nextRemindTime").ToString()); -Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("reminderSettings").ToString()); -Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("lastExpiryNotificationTime").ToString()); -Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("nextExpiryNotificationTime").ToString()); -Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expiryTime").ToString()); -Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("expireAfter").ToString()); -Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("notifyOnExpiration")[0].ToString()); -]]> - - - -This sample shows how to call ApproveApprovalTaskAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new object()); -Response response = await client.ApproveApprovalTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call ApproveApprovalTaskAsync with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - comment = "", -}); -Response response = await client.ApproveApprovalTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call ApproveApprovalTask. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new object()); -Response response = client.ApproveApprovalTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call ApproveApprovalTask with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - comment = "", -}); -Response response = client.ApproveApprovalTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call RejectApprovalTaskAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new object()); -Response response = await client.RejectApprovalTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call RejectApprovalTaskAsync with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - comment = "", -}); -Response response = await client.RejectApprovalTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call RejectApprovalTask. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new object()); -Response response = client.RejectApprovalTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call RejectApprovalTask with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - comment = "", -}); -Response response = client.RejectApprovalTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call ReassignWorkflowTaskAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new object()); -Response response = await client.ReassignWorkflowTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call ReassignWorkflowTaskAsync with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - reassignments = new object[] - { - new - { - reassignFrom = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", - reassignTo = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", - } - }, -}); -Response response = await client.ReassignWorkflowTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call ReassignWorkflowTask. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new object()); -Response response = client.ReassignWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call ReassignWorkflowTask with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - reassignments = new object[] - { - new - { - reassignFrom = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", - reassignTo = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", - } - }, -}); -Response response = client.ReassignWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call UpdateTaskStatusAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - newStatus = "NotStarted", -}); -Response response = await client.UpdateTaskStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call UpdateTaskStatusAsync with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - newStatus = "NotStarted", - comment = "", -}); -Response response = await client.UpdateTaskStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call UpdateTaskStatus. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - newStatus = "NotStarted", -}); -Response response = client.UpdateTaskStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call UpdateTaskStatus with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - newStatus = "NotStarted", - comment = "", -}); -Response response = client.UpdateTaskStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call GetWorkflowsAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -await foreach (BinaryData item in client.GetWorkflowsAsync(null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("isEnabled").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); -} -]]> -This sample shows how to call GetWorkflowsAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -await foreach (BinaryData item in client.GetWorkflowsAsync(null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); - Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); - Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); - Console.WriteLine(result.GetProperty("updatedBy").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("isEnabled").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); -} -]]> - - - -This sample shows how to call GetWorkflows and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -foreach (BinaryData item in client.GetWorkflows(null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("isEnabled").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); -} -]]> -This sample shows how to call GetWorkflows with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -foreach (BinaryData item in client.GetWorkflows(null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); - Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); - Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("createdBy").ToString()); - Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); - Console.WriteLine(result.GetProperty("updatedBy").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("isEnabled").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); -} -]]> - - - -This sample shows how to call GetWorkflowRunsAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -await foreach (BinaryData item in client.GetWorkflowRunsAsync(null, null, null, null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("workflowId").ToString()); - Console.WriteLine(result.GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("requestor").ToString()); - Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); -} -]]> -This sample shows how to call GetWorkflowRunsAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -await foreach (BinaryData item in client.GetWorkflowRunsAsync("1d", "status desc", new string[] { "InProgress" }, new string[] { "" }, 1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("workflowId").ToString()); - Console.WriteLine(result.GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("requestor").ToString()); - Console.WriteLine(result.GetProperty("userRequestId").ToString()); - Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("endTime").ToString()); - Console.WriteLine(result.GetProperty("cancelTime").ToString()); - Console.WriteLine(result.GetProperty("cancelComment").ToString()); -} -]]> - - - -This sample shows how to call GetWorkflowRuns and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -foreach (BinaryData item in client.GetWorkflowRuns(null, null, null, null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("workflowId").ToString()); - Console.WriteLine(result.GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("requestor").ToString()); - Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); -} -]]> -This sample shows how to call GetWorkflowRuns with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -foreach (BinaryData item in client.GetWorkflowRuns("1d", "status desc", new string[] { "InProgress" }, new string[] { "" }, 1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("workflowId").ToString()); - Console.WriteLine(result.GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("requestor").ToString()); - Console.WriteLine(result.GetProperty("userRequestId").ToString()); - Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("endTime").ToString()); - Console.WriteLine(result.GetProperty("cancelTime").ToString()); - Console.WriteLine(result.GetProperty("cancelComment").ToString()); -} -]]> - - - -This sample shows how to call GetWorkflowTasksAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -await foreach (BinaryData item in client.GetWorkflowTasksAsync(null, null, null, null, null, null, null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("workflowRunId").ToString()); - Console.WriteLine(result.GetProperty("workflowId").ToString()); - Console.WriteLine(result.GetProperty("requestor").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); - Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); -} -]]> -This sample shows how to call GetWorkflowTasksAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -await foreach (BinaryData item in client.GetWorkflowTasksAsync("", new string[] { "" }, "1d", 1234, "status desc", new string[] { "Approval" }, new string[] { "InProgress" }, "", null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("title").ToString()); - Console.WriteLine(result.GetProperty("workflowRunId").ToString()); - Console.WriteLine(result.GetProperty("workflowId").ToString()); - Console.WriteLine(result.GetProperty("requestor").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); - Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); - Console.WriteLine(result.GetProperty("payload").GetProperty("payload").ToString()); - Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("lastRemindTime").ToString()); - Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("nextRemindTime").ToString()); - Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("reminderSettings").ToString()); - Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("lastExpiryNotificationTime").ToString()); - Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("nextExpiryNotificationTime").ToString()); - Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expiryTime").ToString()); - Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("expireAfter").ToString()); - Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("notifyOnExpiration")[0].ToString()); -} -]]> - - - -This sample shows how to call GetWorkflowTasks and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -foreach (BinaryData item in client.GetWorkflowTasks(null, null, null, null, null, null, null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("workflowRunId").ToString()); - Console.WriteLine(result.GetProperty("workflowId").ToString()); - Console.WriteLine(result.GetProperty("requestor").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); - Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); -} -]]> -This sample shows how to call GetWorkflowTasks with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); - -foreach (BinaryData item in client.GetWorkflowTasks("", new string[] { "" }, "1d", 1234, "status desc", new string[] { "Approval" }, new string[] { "InProgress" }, "", null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("title").ToString()); - Console.WriteLine(result.GetProperty("workflowRunId").ToString()); - Console.WriteLine(result.GetProperty("workflowId").ToString()); - Console.WriteLine(result.GetProperty("requestor").ToString()); - Console.WriteLine(result.GetProperty("createdTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); - Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); - Console.WriteLine(result.GetProperty("payload").GetProperty("payload").ToString()); - Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("lastRemindTime").ToString()); - Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("nextRemindTime").ToString()); - Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("reminderSettings").ToString()); - Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("lastExpiryNotificationTime").ToString()); - Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("nextExpiryNotificationTime").ToString()); - Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expiryTime").ToString()); - Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("expireAfter").ToString()); - Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("notifyOnExpiration")[0].ToString()); -} -]]> - - - \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/TaskStatusClient.xml b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/TaskStatusClient.xml new file mode 100644 index 000000000000..e93ed3712b0d --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/TaskStatusClient.xml @@ -0,0 +1,69 @@ + + + + + +This sample shows how to call UpdateAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +TaskStatusClient client = new TaskStatusClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + newStatus = "NotStarted", +}); +Response response = await client.UpdateAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call UpdateAsync with all parameters and request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +TaskStatusClient client = new TaskStatusClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + newStatus = "NotStarted", + comment = "", +}); +Response response = await client.UpdateAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call Update. +"); +TokenCredential credential = new DefaultAzureCredential(); +TaskStatusClient client = new TaskStatusClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + newStatus = "NotStarted", +}); +Response response = client.Update(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call Update with all parameters and request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +TaskStatusClient client = new TaskStatusClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + newStatus = "NotStarted", + comment = "", +}); +Response response = client.Update(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> + + + \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/UserRequestsClient.xml b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/UserRequestsClient.xml new file mode 100644 index 000000000000..0d397ab8bbc2 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/UserRequestsClient.xml @@ -0,0 +1,121 @@ + + + + + +This sample shows how to call SubmitAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +UserRequestsClient client = new UserRequestsClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + operations = new object[] + { + new + { + type = "CreateTerm", + payload = new object(), + } + }, +}); +Response response = await client.SubmitAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("requestId").ToString()); +Console.WriteLine(result.GetProperty("requestor").ToString()); +Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +]]> +This sample shows how to call SubmitAsync with all request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +UserRequestsClient client = new UserRequestsClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + operations = new object[] + { + new + { + type = "CreateTerm", + payload = new object(), + } + }, + comment = "", +}); +Response response = await client.SubmitAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("requestId").ToString()); +Console.WriteLine(result.GetProperty("requestor").ToString()); +Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString()); +Console.WriteLine(result.GetProperty("operations")[0].GetProperty("workflowRunIds")[0].ToString()); +Console.WriteLine(result.GetProperty("comment").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +]]> + + + +This sample shows how to call Submit and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +UserRequestsClient client = new UserRequestsClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + operations = new object[] + { + new + { + type = "CreateTerm", + payload = new object(), + } + }, +}); +Response response = client.Submit(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("requestId").ToString()); +Console.WriteLine(result.GetProperty("requestor").ToString()); +Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +]]> +This sample shows how to call Submit with all request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +UserRequestsClient client = new UserRequestsClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + operations = new object[] + { + new + { + type = "CreateTerm", + payload = new object(), + } + }, + comment = "", +}); +Response response = client.Submit(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("requestId").ToString()); +Console.WriteLine(result.GetProperty("requestor").ToString()); +Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString()); +Console.WriteLine(result.GetProperty("operations")[0].GetProperty("workflowRunIds")[0].ToString()); +Console.WriteLine(result.GetProperty("comment").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +]]> + + + \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowClient.xml b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowClient.xml new file mode 100644 index 000000000000..3a3c47a8f384 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowClient.xml @@ -0,0 +1,401 @@ + + + + + +This sample shows how to call GetWorkflowAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +Response response = await client.GetWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("actionDag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("isEnabled").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +]]> +This sample shows how to call GetWorkflowAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +Response response = await client.GetWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("actionDag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); +Console.WriteLine(result.GetProperty("createdTime").ToString()); +Console.WriteLine(result.GetProperty("createdBy").ToString()); +Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); +Console.WriteLine(result.GetProperty("updatedBy").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("isEnabled").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +]]> + + + +This sample shows how to call GetWorkflow and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +Response response = client.GetWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("actionDag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("isEnabled").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +]]> +This sample shows how to call GetWorkflow with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +Response response = client.GetWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("actionDag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); +Console.WriteLine(result.GetProperty("createdTime").ToString()); +Console.WriteLine(result.GetProperty("createdBy").ToString()); +Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); +Console.WriteLine(result.GetProperty("updatedBy").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("isEnabled").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +]]> + + + +This sample shows how to call CreateOrReplaceAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + triggers = new object[] + { + new + { + type = "when_term_creation_is_requested", + } + }, + name = "", + isEnabled = true, + description = "", +}); +Response response = await client.CreateOrReplaceAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("actionDag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("isEnabled").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +]]> +This sample shows how to call CreateOrReplaceAsync with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + triggers = new object[] + { + new + { + type = "when_term_creation_is_requested", + underGlossaryHierarchy = "", + underCollection = "", + underGlossary = "", + } + }, + name = "", + isEnabled = true, + description = "", + actionDag = new object(), +}); +Response response = await client.CreateOrReplaceAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("actionDag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); +Console.WriteLine(result.GetProperty("createdTime").ToString()); +Console.WriteLine(result.GetProperty("createdBy").ToString()); +Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); +Console.WriteLine(result.GetProperty("updatedBy").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("isEnabled").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +]]> + + + +This sample shows how to call CreateOrReplace and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + triggers = new object[] + { + new + { + type = "when_term_creation_is_requested", + } + }, + name = "", + isEnabled = true, + description = "", +}); +Response response = client.CreateOrReplace(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("actionDag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("isEnabled").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +]]> +This sample shows how to call CreateOrReplace with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + triggers = new object[] + { + new + { + type = "when_term_creation_is_requested", + underGlossaryHierarchy = "", + underCollection = "", + underGlossary = "", + } + }, + name = "", + isEnabled = true, + description = "", + actionDag = new object(), +}); +Response response = client.CreateOrReplace(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("actionDag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); +Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); +Console.WriteLine(result.GetProperty("createdTime").ToString()); +Console.WriteLine(result.GetProperty("createdBy").ToString()); +Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); +Console.WriteLine(result.GetProperty("updatedBy").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("isEnabled").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +]]> + + + +This sample shows how to call DeleteAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +Response response = await client.DeleteAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +Response response = await client.DeleteAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call Delete. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +Response response = client.Delete(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call Delete with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +Response response = client.Delete(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call ValidateAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + triggers = new object[] + { + new + { + type = "when_term_creation_is_requested", + } + }, + name = "", + isEnabled = true, + description = "", +}); +Response response = await client.ValidateAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].GetProperty("severity").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("message").ToString()); +]]> +This sample shows how to call ValidateAsync with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + triggers = new object[] + { + new + { + type = "when_term_creation_is_requested", + underGlossaryHierarchy = "", + underCollection = "", + underGlossary = "", + } + }, + name = "", + isEnabled = true, + description = "", + actionDag = new object(), +}); +Response response = await client.ValidateAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].GetProperty("severity").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("actionName").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("parameterKey").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("message").ToString()); +]]> + + + +This sample shows how to call Validate and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + triggers = new object[] + { + new + { + type = "when_term_creation_is_requested", + } + }, + name = "", + isEnabled = true, + description = "", +}); +Response response = client.Validate(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].GetProperty("severity").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("message").ToString()); +]]> +This sample shows how to call Validate with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowClient client = new WorkflowClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + triggers = new object[] + { + new + { + type = "when_term_creation_is_requested", + underGlossaryHierarchy = "", + underCollection = "", + underGlossary = "", + } + }, + name = "", + isEnabled = true, + description = "", + actionDag = new object(), +}); +Response response = client.Validate(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("value")[0].GetProperty("severity").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("actionName").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("parameterKey").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("message").ToString()); +]]> + + + \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowRunClient.xml b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowRunClient.xml new file mode 100644 index 000000000000..3f2712d2b6f0 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowRunClient.xml @@ -0,0 +1,143 @@ + + + + + +This sample shows how to call GetWorkflowRunAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + +Response response = await client.GetWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("actionDag").ToString()); +Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString()); +Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString()); +]]> +This sample shows how to call GetWorkflowRunAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + +Response response = await client.GetWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("workflowId").ToString()); +Console.WriteLine(result.GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("requestor").ToString()); +Console.WriteLine(result.GetProperty("userRequestId").ToString()); +Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); +Console.WriteLine(result.GetProperty("runPayload").GetProperty("payload").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("cancelTime").ToString()); +Console.WriteLine(result.GetProperty("cancelComment").ToString()); +Console.WriteLine(result.GetProperty("actionDag").ToString()); +Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString()); +Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString()); +]]> + + + +This sample shows how to call GetWorkflowRun and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + +Response response = client.GetWorkflowRun(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("actionDag").ToString()); +Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString()); +Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString()); +]]> +This sample shows how to call GetWorkflowRun with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + +Response response = client.GetWorkflowRun(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("workflowId").ToString()); +Console.WriteLine(result.GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("requestor").ToString()); +Console.WriteLine(result.GetProperty("userRequestId").ToString()); +Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); +Console.WriteLine(result.GetProperty("runPayload").GetProperty("payload").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("cancelTime").ToString()); +Console.WriteLine(result.GetProperty("cancelComment").ToString()); +Console.WriteLine(result.GetProperty("actionDag").ToString()); +Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString()); +Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString()); +]]> + + + +This sample shows how to call CancelAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.CancelAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call CancelAsync with all parameters and request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + comment = "", +}); +Response response = await client.CancelAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call Cancel. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.Cancel(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call Cancel with all parameters and request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + comment = "", +}); +Response response = client.Cancel(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> + + + \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowRunsClient.xml b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowRunsClient.xml new file mode 100644 index 000000000000..e1233dd16ed9 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowRunsClient.xml @@ -0,0 +1,91 @@ + + + + + +This sample shows how to call GetWorkflowRunsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential); + +await foreach (BinaryData item in client.GetWorkflowRunsAsync(null, null, null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); +} +]]> +This sample shows how to call GetWorkflowRunsAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential); + +await foreach (BinaryData item in client.GetWorkflowRunsAsync("", "1d", "status desc", new string[] { "InProgress" }, new string[] { "" }, new string[] { "" }, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("userRequestId").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("cancelTime").ToString()); + Console.WriteLine(result.GetProperty("cancelComment").ToString()); +} +]]> + + + +This sample shows how to call GetWorkflowRuns and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential); + +foreach (BinaryData item in client.GetWorkflowRuns(null, null, null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); +} +]]> +This sample shows how to call GetWorkflowRuns with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential); + +foreach (BinaryData item in client.GetWorkflowRuns("", "1d", "status desc", new string[] { "InProgress" }, new string[] { "" }, new string[] { "" }, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("userRequestId").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("cancelTime").ToString()); + Console.WriteLine(result.GetProperty("cancelComment").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowTaskClient.xml b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowTaskClient.xml new file mode 100644 index 000000000000..65800517add6 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowTaskClient.xml @@ -0,0 +1,177 @@ + + + + + +This sample shows how to call GetWorkflowTaskAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + +Response response = await client.GetWorkflowTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("workflowRunId").ToString()); +Console.WriteLine(result.GetProperty("workflowId").ToString()); +Console.WriteLine(result.GetProperty("requestor").ToString()); +Console.WriteLine(result.GetProperty("createdTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); +Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); +]]> +This sample shows how to call GetWorkflowTaskAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + +Response response = await client.GetWorkflowTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("title").ToString()); +Console.WriteLine(result.GetProperty("workflowRunId").ToString()); +Console.WriteLine(result.GetProperty("workflowId").ToString()); +Console.WriteLine(result.GetProperty("requestor").ToString()); +Console.WriteLine(result.GetProperty("createdTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); +Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); +Console.WriteLine(result.GetProperty("payload").GetProperty("payload").ToString()); +Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("lastRemindTime").ToString()); +Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("nextRemindTime").ToString()); +Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("reminderSettings").ToString()); +Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("lastExpiryNotificationTime").ToString()); +Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("nextExpiryNotificationTime").ToString()); +Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expiryTime").ToString()); +Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("expireAfter").ToString()); +Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("notifyOnExpiration")[0].ToString()); +]]> + + + +This sample shows how to call GetWorkflowTask and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + +Response response = client.GetWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("workflowRunId").ToString()); +Console.WriteLine(result.GetProperty("workflowId").ToString()); +Console.WriteLine(result.GetProperty("requestor").ToString()); +Console.WriteLine(result.GetProperty("createdTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); +Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); +]]> +This sample shows how to call GetWorkflowTask with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + +Response response = client.GetWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("title").ToString()); +Console.WriteLine(result.GetProperty("workflowRunId").ToString()); +Console.WriteLine(result.GetProperty("workflowId").ToString()); +Console.WriteLine(result.GetProperty("requestor").ToString()); +Console.WriteLine(result.GetProperty("createdTime").ToString()); +Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); +Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); +Console.WriteLine(result.GetProperty("payload").GetProperty("payload").ToString()); +Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("lastRemindTime").ToString()); +Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("nextRemindTime").ToString()); +Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("reminderSettings").ToString()); +Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("lastExpiryNotificationTime").ToString()); +Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("nextExpiryNotificationTime").ToString()); +Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expiryTime").ToString()); +Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("expireAfter").ToString()); +Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("notifyOnExpiration")[0].ToString()); +]]> + + + +This sample shows how to call ReassignAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.ReassignAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call ReassignAsync with all parameters and request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + reassignments = new object[] + { + new + { + reassignFrom = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", + reassignTo = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", + } + }, +}); +Response response = await client.ReassignAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call Reassign. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.Reassign(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call Reassign with all parameters and request content. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + reassignments = new object[] + { + new + { + reassignFrom = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", + reassignTo = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", + } + }, +}); +Response response = client.Reassign(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + +Console.WriteLine(response.Status); +]]> + + + \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowTasksClient.xml b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowTasksClient.xml new file mode 100644 index 000000000000..25f3b255e127 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowTasksClient.xml @@ -0,0 +1,111 @@ + + + + + +This sample shows how to call GetWorkflowTasksAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential); + +await foreach (BinaryData item in client.GetWorkflowTasksAsync(null, null, null, null, null, null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowRunId").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); +} +]]> +This sample shows how to call GetWorkflowTasksAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential); + +await foreach (BinaryData item in client.GetWorkflowTasksAsync("", new string[] { "" }, "1d", 1234, "status desc", new string[] { "Approval" }, new string[] { "InProgress" }, new string[] { "" }, new string[] { "" }, "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("title").ToString()); + Console.WriteLine(result.GetProperty("workflowRunId").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("payload").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("lastRemindTime").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("nextRemindTime").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("reminderSettings").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("lastExpiryNotificationTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("nextExpiryNotificationTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expiryTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("expireAfter").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("notifyOnExpiration")[0].ToString()); +} +]]> + + + +This sample shows how to call GetWorkflowTasks and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential); + +foreach (BinaryData item in client.GetWorkflowTasks(null, null, null, null, null, null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowRunId").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); +} +]]> +This sample shows how to call GetWorkflowTasks with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential); + +foreach (BinaryData item in client.GetWorkflowTasks("", new string[] { "" }, "1d", 1234, "status desc", new string[] { "Approval" }, new string[] { "InProgress" }, new string[] { "" }, new string[] { "" }, "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("title").ToString()); + Console.WriteLine(result.GetProperty("workflowRunId").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("payload").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("lastRemindTime").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("nextRemindTime").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("reminderSettings").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("lastExpiryNotificationTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("nextExpiryNotificationTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expiryTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("expireAfter").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("notifyOnExpiration")[0].ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowsClient.xml b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowsClient.xml new file mode 100644 index 000000000000..de5c808e65d0 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/Docs/WorkflowsClient.xml @@ -0,0 +1,89 @@ + + + + + +This sample shows how to call GetWorkflowsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowsClient client = new WorkflowsClient(endpoint, credential); + +await foreach (BinaryData item in client.GetWorkflowsAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); +} +]]> +This sample shows how to call GetWorkflowsAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowsClient client = new WorkflowsClient(endpoint, credential); + +await foreach (BinaryData item in client.GetWorkflowsAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("createdBy").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("updatedBy").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); +} +]]> + + + +This sample shows how to call GetWorkflows and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowsClient client = new WorkflowsClient(endpoint, credential); + +foreach (BinaryData item in client.GetWorkflows(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); +} +]]> +This sample shows how to call GetWorkflows with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +WorkflowsClient client = new WorkflowsClient(endpoint, credential); + +foreach (BinaryData item in client.GetWorkflows(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("createdBy").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("updatedBy").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/PurviewWorkflowServiceClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/PurviewWorkflowServiceClient.cs deleted file mode 100644 index 6bf788ef290a..000000000000 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/PurviewWorkflowServiceClient.cs +++ /dev/null @@ -1,1290 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.Analytics.Purview.Workflows -{ - // Data plane generated client. - /// The PurviewWorkflowService service client. - public partial class PurviewWorkflowServiceClient - { - private static readonly string[] AuthorizationScopes = new string[] { "https://purview.azure.net/.default" }; - private readonly TokenCredential _tokenCredential; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// The ClientDiagnostics is used to provide tracing support for the client library. - internal ClientDiagnostics ClientDiagnostics { get; } - - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline => _pipeline; - - /// Initializes a new instance of PurviewWorkflowServiceClient for mocking. - protected PurviewWorkflowServiceClient() - { - } - - /// Initializes a new instance of PurviewWorkflowServiceClient. - /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. - /// A credential used to authenticate to an Azure Service. - /// or is null. - public PurviewWorkflowServiceClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new PurviewWorkflowServiceClientOptions()) - { - } - - /// Initializes a new instance of PurviewWorkflowServiceClient. - /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - /// or is null. - public PurviewWorkflowServiceClient(Uri endpoint, TokenCredential credential, PurviewWorkflowServiceClientOptions options) - { - Argument.AssertNotNull(endpoint, nameof(endpoint)); - Argument.AssertNotNull(credential, nameof(credential)); - options ??= new PurviewWorkflowServiceClientOptions(); - - ClientDiagnostics = new ClientDiagnostics(options, true); - _tokenCredential = credential; - _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); - _endpoint = endpoint; - _apiVersion = options.Version; - } - - /// - /// [Protocol Method] Get a specific workflow. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The workflow id. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetWorkflowAsync(Guid workflowId, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.GetWorkflow"); - scope.Start(); - try - { - using HttpMessage message = CreateGetWorkflowRequest(workflowId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Get a specific workflow. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The workflow id. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetWorkflow(Guid workflowId, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.GetWorkflow"); - scope.Start(); - try - { - using HttpMessage message = CreateGetWorkflowRequest(workflowId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Create or replace a workflow. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The workflow id. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task CreateOrReplaceWorkflowAsync(Guid workflowId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.CreateOrReplaceWorkflow"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateOrReplaceWorkflowRequest(workflowId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Create or replace a workflow. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The workflow id. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response CreateOrReplaceWorkflow(Guid workflowId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.CreateOrReplaceWorkflow"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateOrReplaceWorkflowRequest(workflowId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Delete a workflow. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The workflow id. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task DeleteWorkflowAsync(Guid workflowId, RequestContext context = null) - { - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.DeleteWorkflow"); - scope.Start(); - try - { - using HttpMessage message = CreateDeleteWorkflowRequest(workflowId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Delete a workflow. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The workflow id. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response DeleteWorkflow(Guid workflowId, RequestContext context = null) - { - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.DeleteWorkflow"); - scope.Start(); - try - { - using HttpMessage message = CreateDeleteWorkflowRequest(workflowId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Submit a user request for requestor, a user request describes user ask to do operation(s) on Purview. If any workflow's trigger matches with an operation in request, a run of the workflow is created. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task SubmitUserRequestsAsync(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.SubmitUserRequests"); - scope.Start(); - try - { - using HttpMessage message = CreateSubmitUserRequestsRequest(content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Submit a user request for requestor, a user request describes user ask to do operation(s) on Purview. If any workflow's trigger matches with an operation in request, a run of the workflow is created. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response SubmitUserRequests(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.SubmitUserRequests"); - scope.Start(); - try - { - using HttpMessage message = CreateSubmitUserRequestsRequest(content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Get a workflow run. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The workflow run id. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetWorkflowRunAsync(Guid workflowRunId, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.GetWorkflowRun"); - scope.Start(); - try - { - using HttpMessage message = CreateGetWorkflowRunRequest(workflowRunId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Get a workflow run. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The workflow run id. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetWorkflowRun(Guid workflowRunId, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.GetWorkflowRun"); - scope.Start(); - try - { - using HttpMessage message = CreateGetWorkflowRunRequest(workflowRunId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Cancel a workflow run. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The workflow run id. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task CancelWorkflowRunAsync(Guid workflowRunId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.CancelWorkflowRun"); - scope.Start(); - try - { - using HttpMessage message = CreateCancelWorkflowRunRequest(workflowRunId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Cancel a workflow run. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The workflow run id. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response CancelWorkflowRun(Guid workflowRunId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.CancelWorkflowRun"); - scope.Start(); - try - { - using HttpMessage message = CreateCancelWorkflowRunRequest(workflowRunId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Get a workflow task. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The task id. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetWorkflowTaskAsync(Guid taskId, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.GetWorkflowTask"); - scope.Start(); - try - { - using HttpMessage message = CreateGetWorkflowTaskRequest(taskId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Get a workflow task. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The task id. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetWorkflowTask(Guid taskId, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.GetWorkflowTask"); - scope.Start(); - try - { - using HttpMessage message = CreateGetWorkflowTaskRequest(taskId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Approve an approval task. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The task id. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task ApproveApprovalTaskAsync(Guid taskId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.ApproveApprovalTask"); - scope.Start(); - try - { - using HttpMessage message = CreateApproveApprovalTaskRequest(taskId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Approve an approval task. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The task id. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response ApproveApprovalTask(Guid taskId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.ApproveApprovalTask"); - scope.Start(); - try - { - using HttpMessage message = CreateApproveApprovalTaskRequest(taskId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Reject an approval task. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The task id. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task RejectApprovalTaskAsync(Guid taskId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.RejectApprovalTask"); - scope.Start(); - try - { - using HttpMessage message = CreateRejectApprovalTaskRequest(taskId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Reject an approval task. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The task id. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response RejectApprovalTask(Guid taskId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.RejectApprovalTask"); - scope.Start(); - try - { - using HttpMessage message = CreateRejectApprovalTaskRequest(taskId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Reassign a workflow task. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The task id. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task ReassignWorkflowTaskAsync(Guid taskId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.ReassignWorkflowTask"); - scope.Start(); - try - { - using HttpMessage message = CreateReassignWorkflowTaskRequest(taskId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Reassign a workflow task. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The task id. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response ReassignWorkflowTask(Guid taskId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.ReassignWorkflowTask"); - scope.Start(); - try - { - using HttpMessage message = CreateReassignWorkflowTaskRequest(taskId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Update the status of a workflow task request. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The task id. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task UpdateTaskStatusAsync(Guid taskId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.UpdateTaskStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateUpdateTaskStatusRequest(taskId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Update the status of a workflow task request. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The task id. - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response UpdateTaskStatus(Guid taskId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("PurviewWorkflowServiceClient.UpdateTaskStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateUpdateTaskStatusRequest(taskId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] List all workflows. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetWorkflowsAsync(RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkflowsRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkflowsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PurviewWorkflowServiceClient.GetWorkflows", "value", "nextLink", context); - } - - /// - /// [Protocol Method] List all workflows. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetWorkflows(RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkflowsRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkflowsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PurviewWorkflowServiceClient.GetWorkflows", "value", "nextLink", context); - } - - /// - /// [Protocol Method] List workflow runs. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Time window of filtering items. Allowed values: "1d" | "7d" | "30d" | "90d". - /// The key word which used to sort the results. Allowed values: "status desc" | "status asc" | "requestor desc" | "requestor asc" | "startTime desc" | "startTime asc" | "createdTime desc" | "createdTime asc". - /// Filter workflow runs by workflow run status. - /// Filter items by workflow id list. - /// The maximum page size to get the items at one time. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetWorkflowRunsAsync(string timeWindow, string orderby, IEnumerable runStatuses, IEnumerable workflowIds, int? maxpagesize, RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkflowRunsRequest(timeWindow, orderby, runStatuses, workflowIds, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkflowRunsNextPageRequest(nextLink, timeWindow, orderby, runStatuses, workflowIds, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PurviewWorkflowServiceClient.GetWorkflowRuns", "value", "nextLink", context); - } - - /// - /// [Protocol Method] List workflow runs. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Time window of filtering items. Allowed values: "1d" | "7d" | "30d" | "90d". - /// The key word which used to sort the results. Allowed values: "status desc" | "status asc" | "requestor desc" | "requestor asc" | "startTime desc" | "startTime asc" | "createdTime desc" | "createdTime asc". - /// Filter workflow runs by workflow run status. - /// Filter items by workflow id list. - /// The maximum page size to get the items at one time. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetWorkflowRuns(string timeWindow, string orderby, IEnumerable runStatuses, IEnumerable workflowIds, int? maxpagesize, RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkflowRunsRequest(timeWindow, orderby, runStatuses, workflowIds, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkflowRunsNextPageRequest(nextLink, timeWindow, orderby, runStatuses, workflowIds, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PurviewWorkflowServiceClient.GetWorkflowRuns", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Get all workflow tasks. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// To filter user's sent, received or history workflow tasks. - /// Filter items by workflow id list. - /// Time window of filtering items. Allowed values: "1d" | "7d" | "30d" | "90d". - /// The maximum page size to get the items at one time. - /// The key word which used to sort the results. Allowed values: "status desc" | "status asc" | "requestor desc" | "requestor asc" | "startTime desc" | "startTime asc" | "createdTime desc" | "createdTime asc". - /// Filter items by workflow task type. - /// Filter workflow tasks by status. - /// The key word which could used to filter workflow item with related workflow. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetWorkflowTasksAsync(string viewMode, IEnumerable workflowIds, string timeWindow, int? maxpagesize, string orderby, IEnumerable taskTypes, IEnumerable taskStatuses, string workflowNameKeyword, RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkflowTasksRequest(viewMode, workflowIds, timeWindow, maxpagesize, orderby, taskTypes, taskStatuses, workflowNameKeyword, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkflowTasksNextPageRequest(nextLink, viewMode, workflowIds, timeWindow, maxpagesize, orderby, taskTypes, taskStatuses, workflowNameKeyword, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PurviewWorkflowServiceClient.GetWorkflowTasks", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Get all workflow tasks. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// To filter user's sent, received or history workflow tasks. - /// Filter items by workflow id list. - /// Time window of filtering items. Allowed values: "1d" | "7d" | "30d" | "90d". - /// The maximum page size to get the items at one time. - /// The key word which used to sort the results. Allowed values: "status desc" | "status asc" | "requestor desc" | "requestor asc" | "startTime desc" | "startTime asc" | "createdTime desc" | "createdTime asc". - /// Filter items by workflow task type. - /// Filter workflow tasks by status. - /// The key word which could used to filter workflow item with related workflow. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetWorkflowTasks(string viewMode, IEnumerable workflowIds, string timeWindow, int? maxpagesize, string orderby, IEnumerable taskTypes, IEnumerable taskStatuses, string workflowNameKeyword, RequestContext context) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkflowTasksRequest(viewMode, workflowIds, timeWindow, maxpagesize, orderby, taskTypes, taskStatuses, workflowNameKeyword, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkflowTasksNextPageRequest(nextLink, viewMode, workflowIds, timeWindow, maxpagesize, orderby, taskTypes, taskStatuses, workflowNameKeyword, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PurviewWorkflowServiceClient.GetWorkflowTasks", "value", "nextLink", context); - } - - internal HttpMessage CreateGetWorkflowsRequest(RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/workflows", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetWorkflowRequest(Guid workflowId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/workflows/", false); - uri.AppendPath(workflowId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateCreateOrReplaceWorkflowRequest(Guid workflowId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/workflows/", false); - uri.AppendPath(workflowId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateDeleteWorkflowRequest(Guid workflowId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier204); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/workflows/", false); - uri.AppendPath(workflowId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateSubmitUserRequestsRequest(RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/userrequests", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetWorkflowRunsRequest(string timeWindow, string orderby, IEnumerable runStatuses, IEnumerable workflowIds, int? maxpagesize, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/workflowruns", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (timeWindow != null) - { - uri.AppendQuery("timeWindow", timeWindow, true); - } - if (orderby != null) - { - uri.AppendQuery("orderby", orderby, true); - } - if (runStatuses != null && Optional.IsCollectionDefined(runStatuses)) - { - uri.AppendQueryDelimited("runStatuses", runStatuses, ",", true); - } - if (workflowIds != null && Optional.IsCollectionDefined(workflowIds)) - { - uri.AppendQueryDelimited("workflowIds", workflowIds, ",", true); - } - if (maxpagesize != null) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetWorkflowRunRequest(Guid workflowRunId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/workflowruns/", false); - uri.AppendPath(workflowRunId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateCancelWorkflowRunRequest(Guid workflowRunId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/workflowruns/", false); - uri.AppendPath(workflowRunId, true); - uri.AppendPath("/cancel", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetWorkflowTasksRequest(string viewMode, IEnumerable workflowIds, string timeWindow, int? maxpagesize, string orderby, IEnumerable taskTypes, IEnumerable taskStatuses, string workflowNameKeyword, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/workflowtasks", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (viewMode != null) - { - uri.AppendQuery("viewMode", viewMode, true); - } - if (workflowIds != null && Optional.IsCollectionDefined(workflowIds)) - { - uri.AppendQueryDelimited("workflowIds", workflowIds, ",", true); - } - if (timeWindow != null) - { - uri.AppendQuery("timeWindow", timeWindow, true); - } - if (maxpagesize != null) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); - } - if (orderby != null) - { - uri.AppendQuery("orderby", orderby, true); - } - if (taskTypes != null && Optional.IsCollectionDefined(taskTypes)) - { - uri.AppendQueryDelimited("taskTypes", taskTypes, ",", true); - } - if (taskStatuses != null && Optional.IsCollectionDefined(taskStatuses)) - { - uri.AppendQueryDelimited("taskStatuses", taskStatuses, ",", true); - } - if (workflowNameKeyword != null) - { - uri.AppendQuery("workflowNameKeyword", workflowNameKeyword, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetWorkflowTaskRequest(Guid taskId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/workflowtasks/", false); - uri.AppendPath(taskId, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateApproveApprovalTaskRequest(Guid taskId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/workflowtasks/", false); - uri.AppendPath(taskId, true); - uri.AppendPath("/approve-approval", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateRejectApprovalTaskRequest(Guid taskId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/workflowtasks/", false); - uri.AppendPath(taskId, true); - uri.AppendPath("/reject-approval", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateReassignWorkflowTaskRequest(Guid taskId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/workflowtasks/", false); - uri.AppendPath(taskId, true); - uri.AppendPath("/reassign", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateUpdateTaskStatusRequest(Guid taskId, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendPath("/workflowtasks/", false); - uri.AppendPath(taskId, true); - uri.AppendPath("/change-task-status", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetWorkflowsNextPageRequest(string nextLink, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetWorkflowRunsNextPageRequest(string nextLink, string timeWindow, string orderby, IEnumerable runStatuses, IEnumerable workflowIds, int? maxpagesize, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetWorkflowTasksNextPageRequest(string nextLink, string viewMode, IEnumerable workflowIds, string timeWindow, int? maxpagesize, string orderby, IEnumerable taskTypes, IEnumerable taskStatuses, string workflowNameKeyword, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/workflow", false); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - private static ResponseClassifier _responseClassifier204; - private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); - } -} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/PurviewWorkflowServiceClientOptions.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/PurviewWorkflowServiceClientOptions.cs index ddec7a058f57..168e2499da61 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/PurviewWorkflowServiceClientOptions.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/PurviewWorkflowServiceClientOptions.cs @@ -10,16 +10,16 @@ namespace Azure.Analytics.Purview.Workflows { - /// Client options for PurviewWorkflowServiceClient. + /// Client options for PurviewWorkflowService library clients. public partial class PurviewWorkflowServiceClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V2022_05_01_Preview; + private const ServiceVersion LatestVersion = ServiceVersion.V2023_10_01_Preview; /// The version of the service to use. public enum ServiceVersion { - /// Service version "2022-05-01-preview". - V2022_05_01_Preview = 1, + /// Service version "2023-10-01-preview". + V2023_10_01_Preview = 1, } internal string Version { get; } @@ -29,7 +29,7 @@ public PurviewWorkflowServiceClientOptions(ServiceVersion version = LatestVersio { Version = version switch { - ServiceVersion.V2022_05_01_Preview => "2022-05-01-preview", + ServiceVersion.V2023_10_01_Preview => "2023-10-01-preview", _ => throw new NotSupportedException() }; } diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/TaskStatusClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/TaskStatusClient.cs new file mode 100644 index 000000000000..695b726fd91d --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/TaskStatusClient.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Workflows +{ + // Data plane generated client. + /// The TaskStatus service client. + public partial class TaskStatusClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of TaskStatusClient for mocking. + protected TaskStatusClient() + { + } + + /// Initializes a new instance of TaskStatusClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public TaskStatusClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new PurviewWorkflowServiceClientOptions()) + { + } + + /// Initializes a new instance of TaskStatusClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public TaskStatusClient(Uri endpoint, TokenCredential credential, PurviewWorkflowServiceClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new PurviewWorkflowServiceClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// + /// [Protocol Method] Update the status of a workflow task request. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The task id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task UpdateAsync(Guid taskId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("TaskStatusClient.Update"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateRequest(taskId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Update the status of a workflow task request. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The task id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Update(Guid taskId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("TaskStatusClient.Update"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateRequest(taskId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateUpdateRequest(Guid taskId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflowtasks/", false); + uri.AppendPath(taskId, true); + uri.AppendPath("/change-task-status", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/UserRequestsClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/UserRequestsClient.cs new file mode 100644 index 000000000000..a240b2b3ac36 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/UserRequestsClient.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Workflows +{ + // Data plane generated client. + /// The UserRequests service client. + public partial class UserRequestsClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of UserRequestsClient for mocking. + protected UserRequestsClient() + { + } + + /// Initializes a new instance of UserRequestsClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public UserRequestsClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new PurviewWorkflowServiceClientOptions()) + { + } + + /// Initializes a new instance of UserRequestsClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public UserRequestsClient(Uri endpoint, TokenCredential credential, PurviewWorkflowServiceClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new PurviewWorkflowServiceClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// + /// [Protocol Method] Submit a user request for requestor, a user request describes user ask to do operation(s) on Purview. If any workflow's trigger matches with an operation in request, a run of the workflow is created. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task SubmitAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("UserRequestsClient.Submit"); + scope.Start(); + try + { + using HttpMessage message = CreateSubmitRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Submit a user request for requestor, a user request describes user ask to do operation(s) on Purview. If any workflow's trigger matches with an operation in request, a run of the workflow is created. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Submit(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("UserRequestsClient.Submit"); + scope.Start(); + try + { + using HttpMessage message = CreateSubmitRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateSubmitRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/userrequests", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowClient.cs new file mode 100644 index 000000000000..0de1c9a14ecc --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowClient.cs @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Workflows +{ + // Data plane generated client. + /// The Workflow service client. + public partial class WorkflowClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of WorkflowClient for mocking. + protected WorkflowClient() + { + } + + /// Initializes a new instance of WorkflowClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public WorkflowClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new PurviewWorkflowServiceClientOptions()) + { + } + + /// Initializes a new instance of WorkflowClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public WorkflowClient(Uri endpoint, TokenCredential credential, PurviewWorkflowServiceClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new PurviewWorkflowServiceClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// + /// [Protocol Method] Get a specific workflow. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The workflow id. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetWorkflowAsync(Guid workflowId, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("WorkflowClient.GetWorkflow"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWorkflowRequest(workflowId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get a specific workflow. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The workflow id. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetWorkflow(Guid workflowId, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("WorkflowClient.GetWorkflow"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWorkflowRequest(workflowId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create or replace a workflow. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The workflow id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateOrReplaceAsync(Guid workflowId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("WorkflowClient.CreateOrReplace"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrReplaceRequest(workflowId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create or replace a workflow. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The workflow id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateOrReplace(Guid workflowId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("WorkflowClient.CreateOrReplace"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrReplaceRequest(workflowId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Delete a workflow. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The workflow id. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteAsync(Guid workflowId, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("WorkflowClient.Delete"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteRequest(workflowId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Delete a workflow. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The workflow id. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Delete(Guid workflowId, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("WorkflowClient.Delete"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteRequest(workflowId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Validate a workflow. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The workflow id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task ValidateAsync(Guid workflowId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("WorkflowClient.Validate"); + scope.Start(); + try + { + using HttpMessage message = CreateValidateRequest(workflowId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Validate a workflow. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The workflow id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Validate(Guid workflowId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("WorkflowClient.Validate"); + scope.Start(); + try + { + using HttpMessage message = CreateValidateRequest(workflowId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateGetWorkflowRequest(Guid workflowId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflows/", false); + uri.AppendPath(workflowId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrReplaceRequest(Guid workflowId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflows/", false); + uri.AppendPath(workflowId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteRequest(Guid workflowId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflows/", false); + uri.AppendPath(workflowId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateValidateRequest(Guid workflowId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflows/", false); + uri.AppendPath(workflowId, true); + uri.AppendPath("/validate", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier204; + private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowRunClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowRunClient.cs new file mode 100644 index 000000000000..de55650216ec --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowRunClient.cs @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Workflows +{ + // Data plane generated client. + /// The WorkflowRun service client. + public partial class WorkflowRunClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of WorkflowRunClient for mocking. + protected WorkflowRunClient() + { + } + + /// Initializes a new instance of WorkflowRunClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public WorkflowRunClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new PurviewWorkflowServiceClientOptions()) + { + } + + /// Initializes a new instance of WorkflowRunClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public WorkflowRunClient(Uri endpoint, TokenCredential credential, PurviewWorkflowServiceClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new PurviewWorkflowServiceClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// + /// [Protocol Method] Get a workflow run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The workflow run id. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetWorkflowRunAsync(Guid workflowRunId, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("WorkflowRunClient.GetWorkflowRun"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWorkflowRunRequest(workflowRunId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get a workflow run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The workflow run id. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetWorkflowRun(Guid workflowRunId, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("WorkflowRunClient.GetWorkflowRun"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWorkflowRunRequest(workflowRunId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Cancel a workflow run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The workflow run id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CancelAsync(Guid workflowRunId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("WorkflowRunClient.Cancel"); + scope.Start(); + try + { + using HttpMessage message = CreateCancelRequest(workflowRunId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Cancel a workflow run. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The workflow run id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Cancel(Guid workflowRunId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("WorkflowRunClient.Cancel"); + scope.Start(); + try + { + using HttpMessage message = CreateCancelRequest(workflowRunId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateGetWorkflowRunRequest(Guid workflowRunId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflowruns/", false); + uri.AppendPath(workflowRunId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCancelRequest(Guid workflowRunId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflowruns/", false); + uri.AppendPath(workflowRunId, true); + uri.AppendPath("/cancel", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowRunsClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowRunsClient.cs new file mode 100644 index 000000000000..c3e62488c1d5 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowRunsClient.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Workflows +{ + // Data plane generated client. + /// The WorkflowRuns service client. + public partial class WorkflowRunsClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of WorkflowRunsClient for mocking. + protected WorkflowRunsClient() + { + } + + /// Initializes a new instance of WorkflowRunsClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public WorkflowRunsClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new PurviewWorkflowServiceClientOptions()) + { + } + + /// Initializes a new instance of WorkflowRunsClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public WorkflowRunsClient(Uri endpoint, TokenCredential credential, PurviewWorkflowServiceClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new PurviewWorkflowServiceClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// + /// [Protocol Method] List workflow runs. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// To filter user's workflow runs or view as admin. + /// Time window of filtering items. Allowed values: "1d" | "7d" | "30d" | "90d". + /// The key word which used to sort the results. Allowed values: "status desc" | "status asc" | "requestor desc" | "requestor asc" | "startTime desc" | "startTime asc" | "createdTime desc" | "createdTime asc". + /// Filter workflow runs by workflow run status. + /// Filter items by workflow id list. + /// Requestors' ids to filter. + /// The maximum page size to get the items at one time. The default value is 100. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetWorkflowRunsAsync(string viewMode, string timeWindow, string orderby, IEnumerable runStatuses, IEnumerable workflowIds, IEnumerable requestors, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkflowRunsRequest(viewMode, timeWindow, orderby, runStatuses, workflowIds, requestors, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkflowRunsNextPageRequest(nextLink, viewMode, timeWindow, orderby, runStatuses, workflowIds, requestors, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "WorkflowRunsClient.GetWorkflowRuns", "value", "nextLink", context); + } + + /// + /// [Protocol Method] List workflow runs. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// To filter user's workflow runs or view as admin. + /// Time window of filtering items. Allowed values: "1d" | "7d" | "30d" | "90d". + /// The key word which used to sort the results. Allowed values: "status desc" | "status asc" | "requestor desc" | "requestor asc" | "startTime desc" | "startTime asc" | "createdTime desc" | "createdTime asc". + /// Filter workflow runs by workflow run status. + /// Filter items by workflow id list. + /// Requestors' ids to filter. + /// The maximum page size to get the items at one time. The default value is 100. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetWorkflowRuns(string viewMode, string timeWindow, string orderby, IEnumerable runStatuses, IEnumerable workflowIds, IEnumerable requestors, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkflowRunsRequest(viewMode, timeWindow, orderby, runStatuses, workflowIds, requestors, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkflowRunsNextPageRequest(nextLink, viewMode, timeWindow, orderby, runStatuses, workflowIds, requestors, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "WorkflowRunsClient.GetWorkflowRuns", "value", "nextLink", context); + } + + internal HttpMessage CreateGetWorkflowRunsRequest(string viewMode, string timeWindow, string orderby, IEnumerable runStatuses, IEnumerable workflowIds, IEnumerable requestors, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflowruns", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (viewMode != null) + { + uri.AppendQuery("viewMode", viewMode, true); + } + if (timeWindow != null) + { + uri.AppendQuery("timeWindow", timeWindow, true); + } + if (orderby != null) + { + uri.AppendQuery("orderby", orderby, true); + } + if (runStatuses != null && Optional.IsCollectionDefined(runStatuses)) + { + uri.AppendQueryDelimited("runStatuses", runStatuses, ",", true); + } + if (workflowIds != null && Optional.IsCollectionDefined(workflowIds)) + { + uri.AppendQueryDelimited("workflowIds", workflowIds, ",", true); + } + if (requestors != null && Optional.IsCollectionDefined(requestors)) + { + uri.AppendQueryDelimited("requestors", requestors, ",", true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetWorkflowRunsNextPageRequest(string nextLink, string viewMode, string timeWindow, string orderby, IEnumerable runStatuses, IEnumerable workflowIds, IEnumerable requestors, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowTaskClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowTaskClient.cs new file mode 100644 index 000000000000..af2d17b8a585 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowTaskClient.cs @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Workflows +{ + // Data plane generated client. + /// The WorkflowTask service client. + public partial class WorkflowTaskClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of WorkflowTaskClient for mocking. + protected WorkflowTaskClient() + { + } + + /// Initializes a new instance of WorkflowTaskClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public WorkflowTaskClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new PurviewWorkflowServiceClientOptions()) + { + } + + /// Initializes a new instance of WorkflowTaskClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public WorkflowTaskClient(Uri endpoint, TokenCredential credential, PurviewWorkflowServiceClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new PurviewWorkflowServiceClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// + /// [Protocol Method] Get a workflow task. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The task id. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetWorkflowTaskAsync(Guid taskId, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("WorkflowTaskClient.GetWorkflowTask"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWorkflowTaskRequest(taskId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get a workflow task. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The task id. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetWorkflowTask(Guid taskId, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("WorkflowTaskClient.GetWorkflowTask"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWorkflowTaskRequest(taskId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Reassign a workflow task. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The task id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task ReassignAsync(Guid taskId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("WorkflowTaskClient.Reassign"); + scope.Start(); + try + { + using HttpMessage message = CreateReassignRequest(taskId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Reassign a workflow task. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The task id. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response Reassign(Guid taskId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("WorkflowTaskClient.Reassign"); + scope.Start(); + try + { + using HttpMessage message = CreateReassignRequest(taskId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateGetWorkflowTaskRequest(Guid taskId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflowtasks/", false); + uri.AppendPath(taskId, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateReassignRequest(Guid taskId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflowtasks/", false); + uri.AppendPath(taskId, true); + uri.AppendPath("/reassign", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowTasksClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowTasksClient.cs new file mode 100644 index 000000000000..f29c3249f935 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowTasksClient.cs @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Workflows +{ + // Data plane generated client. + /// The WorkflowTasks service client. + public partial class WorkflowTasksClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of WorkflowTasksClient for mocking. + protected WorkflowTasksClient() + { + } + + /// Initializes a new instance of WorkflowTasksClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public WorkflowTasksClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new PurviewWorkflowServiceClientOptions()) + { + } + + /// Initializes a new instance of WorkflowTasksClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public WorkflowTasksClient(Uri endpoint, TokenCredential credential, PurviewWorkflowServiceClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new PurviewWorkflowServiceClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// + /// [Protocol Method] Get all workflow tasks. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// To filter user's sent, received or history workflow tasks. + /// Filter items by workflow id list. + /// Time window of filtering items. Allowed values: "1d" | "7d" | "30d" | "90d". + /// The maximum page size to get the items at one time. The default value is 100. + /// The key word which used to sort the results. Allowed values: "status desc" | "status asc" | "requestor desc" | "requestor asc" | "startTime desc" | "startTime asc" | "createdTime desc" | "createdTime asc". + /// Filter items by workflow task type. + /// Filter workflow tasks by status. + /// Requestors' ids to filter. + /// Assignees' ids to filter. + /// The key word which could used to filter workflow item with related workflow. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetWorkflowTasksAsync(string viewMode, IEnumerable workflowIds, string timeWindow, int? maxpagesize, string orderby, IEnumerable taskTypes, IEnumerable taskStatuses, IEnumerable requestors, IEnumerable assignees, string workflowNameKeyword, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkflowTasksRequest(viewMode, workflowIds, timeWindow, maxpagesize, orderby, taskTypes, taskStatuses, requestors, assignees, workflowNameKeyword, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkflowTasksNextPageRequest(nextLink, viewMode, workflowIds, timeWindow, maxpagesize, orderby, taskTypes, taskStatuses, requestors, assignees, workflowNameKeyword, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "WorkflowTasksClient.GetWorkflowTasks", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Get all workflow tasks. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// To filter user's sent, received or history workflow tasks. + /// Filter items by workflow id list. + /// Time window of filtering items. Allowed values: "1d" | "7d" | "30d" | "90d". + /// The maximum page size to get the items at one time. The default value is 100. + /// The key word which used to sort the results. Allowed values: "status desc" | "status asc" | "requestor desc" | "requestor asc" | "startTime desc" | "startTime asc" | "createdTime desc" | "createdTime asc". + /// Filter items by workflow task type. + /// Filter workflow tasks by status. + /// Requestors' ids to filter. + /// Assignees' ids to filter. + /// The key word which could used to filter workflow item with related workflow. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetWorkflowTasks(string viewMode, IEnumerable workflowIds, string timeWindow, int? maxpagesize, string orderby, IEnumerable taskTypes, IEnumerable taskStatuses, IEnumerable requestors, IEnumerable assignees, string workflowNameKeyword, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkflowTasksRequest(viewMode, workflowIds, timeWindow, maxpagesize, orderby, taskTypes, taskStatuses, requestors, assignees, workflowNameKeyword, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkflowTasksNextPageRequest(nextLink, viewMode, workflowIds, timeWindow, maxpagesize, orderby, taskTypes, taskStatuses, requestors, assignees, workflowNameKeyword, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "WorkflowTasksClient.GetWorkflowTasks", "value", "nextLink", context); + } + + internal HttpMessage CreateGetWorkflowTasksRequest(string viewMode, IEnumerable workflowIds, string timeWindow, int? maxpagesize, string orderby, IEnumerable taskTypes, IEnumerable taskStatuses, IEnumerable requestors, IEnumerable assignees, string workflowNameKeyword, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflowtasks", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (viewMode != null) + { + uri.AppendQuery("viewMode", viewMode, true); + } + if (workflowIds != null && Optional.IsCollectionDefined(workflowIds)) + { + uri.AppendQueryDelimited("workflowIds", workflowIds, ",", true); + } + if (timeWindow != null) + { + uri.AppendQuery("timeWindow", timeWindow, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + if (orderby != null) + { + uri.AppendQuery("orderby", orderby, true); + } + if (taskTypes != null && Optional.IsCollectionDefined(taskTypes)) + { + uri.AppendQueryDelimited("taskTypes", taskTypes, ",", true); + } + if (taskStatuses != null && Optional.IsCollectionDefined(taskStatuses)) + { + uri.AppendQueryDelimited("taskStatuses", taskStatuses, ",", true); + } + if (requestors != null && Optional.IsCollectionDefined(requestors)) + { + uri.AppendQueryDelimited("requestors", requestors, ",", true); + } + if (assignees != null && Optional.IsCollectionDefined(assignees)) + { + uri.AppendQueryDelimited("assignees", assignees, ",", true); + } + if (workflowNameKeyword != null) + { + uri.AppendQuery("workflowNameKeyword", workflowNameKeyword, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetWorkflowTasksNextPageRequest(string nextLink, string viewMode, IEnumerable workflowIds, string timeWindow, int? maxpagesize, string orderby, IEnumerable taskTypes, IEnumerable taskStatuses, IEnumerable requestors, IEnumerable assignees, string workflowNameKeyword, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowsClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowsClient.cs new file mode 100644 index 000000000000..6a8287702c1b --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/Generated/WorkflowsClient.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Purview.Workflows +{ + // Data plane generated client. + /// The Workflows service client. + public partial class WorkflowsClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://purview.azure.net/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of WorkflowsClient for mocking. + protected WorkflowsClient() + { + } + + /// Initializes a new instance of WorkflowsClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public WorkflowsClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new PurviewWorkflowServiceClientOptions()) + { + } + + /// Initializes a new instance of WorkflowsClient. + /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public WorkflowsClient(Uri endpoint, TokenCredential credential, PurviewWorkflowServiceClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new PurviewWorkflowServiceClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// + /// [Protocol Method] List all workflows. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetWorkflowsAsync(RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkflowsRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkflowsNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "WorkflowsClient.GetWorkflows", "value", "nextLink", context); + } + + /// + /// [Protocol Method] List all workflows. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetWorkflows(RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkflowsRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkflowsNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "WorkflowsClient.GetWorkflows", "value", "nextLink", context); + } + + internal HttpMessage CreateGetWorkflowsRequest(RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendPath("/workflows", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetWorkflowsNextPageRequest(string nextLink, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/workflow", false); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/src/autorest.md b/sdk/purview/Azure.Analytics.Purview.Workflows/src/autorest.md index 156f85b41c9b..cde9e738e415 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/src/autorest.md +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/src/autorest.md @@ -7,8 +7,16 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml input-file: -- https://github.com/Azure/azure-rest-api-specs/blob/3a1ca5a2130250382e65e4585d8e88bfab6d93e4/specification/purview/data-plane/Azure.Analytics.Purview.Workflow/preview/2022-05-01-preview/purviewWorkflow.json +- https://github.com/Azure/azure-rest-api-specs/blob/afa158ef56a05f6603924f4a493817cec332b113/specification/purview/data-plane/Azure.Analytics.Purview.Workflow/preview/2023-10-01-preview/purviewWorkflow.json security: AADToken security-scopes: https://purview.azure.net/.default ``` + + + + + + + + diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_ApprovalClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_ApprovalClient.cs new file mode 100644 index 000000000000..fa77eee7f7ac --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_ApprovalClient.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Analytics.Purview.Workflows; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Analytics.Purview.Workflows.Samples +{ + public partial class Samples_ApprovalClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Approve_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ApprovalClient client = new ApprovalClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.Approve(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Approve_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ApprovalClient client = new ApprovalClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.ApproveAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Approve_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ApprovalClient client = new ApprovalClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + comment = "", + }); + Response response = client.Approve(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Approve_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ApprovalClient client = new ApprovalClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + comment = "", + }); + Response response = await client.ApproveAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Reject_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ApprovalClient client = new ApprovalClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.Reject(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Reject_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ApprovalClient client = new ApprovalClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.RejectAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Reject_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ApprovalClient client = new ApprovalClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + comment = "", + }); + Response response = client.Reject(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Reject_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ApprovalClient client = new ApprovalClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + comment = "", + }); + Response response = await client.RejectAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_PurviewWorkflowServiceClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_PurviewWorkflowServiceClient.cs index 7b37cc4747ba..01788a4300c0 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_PurviewWorkflowServiceClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_PurviewWorkflowServiceClient.cs @@ -25,7 +25,7 @@ public void Example_GetWorkflow_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowClient client = new WorkflowClient(endpoint, credential); Response response = client.GetWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); @@ -44,7 +44,7 @@ public async Task Example_GetWorkflow_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowClient client = new WorkflowClient(endpoint, credential); Response response = await client.GetWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); @@ -63,7 +63,7 @@ public void Example_GetWorkflow_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowClient client = new WorkflowClient(endpoint, credential); Response response = client.GetWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); @@ -89,7 +89,7 @@ public async Task Example_GetWorkflow_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowClient client = new WorkflowClient(endpoint, credential); Response response = await client.GetWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); @@ -115,7 +115,7 @@ public void Example_CreateOrReplaceWorkflow_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowClient client = new WorkflowClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { @@ -130,7 +130,7 @@ public void Example_CreateOrReplaceWorkflow_ShortVersion() isEnabled = true, description = "", }); - Response response = client.CreateOrReplaceWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = client.CreateOrReplace(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("actionDag").ToString()); @@ -147,7 +147,7 @@ public async Task Example_CreateOrReplaceWorkflow_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowClient client = new WorkflowClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { @@ -162,7 +162,7 @@ public async Task Example_CreateOrReplaceWorkflow_ShortVersion_Async() isEnabled = true, description = "", }); - Response response = await client.CreateOrReplaceWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = await client.CreateOrReplaceAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("actionDag").ToString()); @@ -179,7 +179,7 @@ public void Example_CreateOrReplaceWorkflow_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowClient client = new WorkflowClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { @@ -198,7 +198,7 @@ public void Example_CreateOrReplaceWorkflow_AllParameters() description = "", actionDag = new object(), }); - Response response = client.CreateOrReplaceWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = client.CreateOrReplace(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("actionDag").ToString()); @@ -222,7 +222,7 @@ public async Task Example_CreateOrReplaceWorkflow_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowClient client = new WorkflowClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { @@ -241,7 +241,7 @@ public async Task Example_CreateOrReplaceWorkflow_AllParameters_Async() description = "", actionDag = new object(), }); - Response response = await client.CreateOrReplaceWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = await client.CreateOrReplaceAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("actionDag").ToString()); @@ -265,9 +265,9 @@ public void Example_DeleteWorkflow_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowClient client = new WorkflowClient(endpoint, credential); - Response response = client.DeleteWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + Response response = client.Delete(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); Console.WriteLine(response.Status); } @@ -278,9 +278,9 @@ public async Task Example_DeleteWorkflow_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowClient client = new WorkflowClient(endpoint, credential); - Response response = await client.DeleteWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + Response response = await client.DeleteAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); Console.WriteLine(response.Status); } @@ -291,9 +291,9 @@ public void Example_DeleteWorkflow_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowClient client = new WorkflowClient(endpoint, credential); - Response response = client.DeleteWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + Response response = client.Delete(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); Console.WriteLine(response.Status); } @@ -304,9 +304,9 @@ public async Task Example_DeleteWorkflow_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowClient client = new WorkflowClient(endpoint, credential); - Response response = await client.DeleteWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + Response response = await client.DeleteAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); Console.WriteLine(response.Status); } @@ -317,7 +317,7 @@ public void Example_SubmitUserRequests_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + UserRequestsClient client = new UserRequestsClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { @@ -330,7 +330,7 @@ public void Example_SubmitUserRequests_ShortVersion() } }, }); - Response response = client.SubmitUserRequests(content); + Response response = client.Submit(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("requestId").ToString()); @@ -346,7 +346,7 @@ public async Task Example_SubmitUserRequests_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + UserRequestsClient client = new UserRequestsClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { @@ -359,7 +359,7 @@ public async Task Example_SubmitUserRequests_ShortVersion_Async() } }, }); - Response response = await client.SubmitUserRequestsAsync(content); + Response response = await client.SubmitAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("requestId").ToString()); @@ -375,7 +375,7 @@ public void Example_SubmitUserRequests_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + UserRequestsClient client = new UserRequestsClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { @@ -389,7 +389,7 @@ public void Example_SubmitUserRequests_AllParameters() }, comment = "", }); - Response response = client.SubmitUserRequests(content); + Response response = client.Submit(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("requestId").ToString()); @@ -407,7 +407,7 @@ public async Task Example_SubmitUserRequests_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + UserRequestsClient client = new UserRequestsClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { @@ -421,7 +421,7 @@ public async Task Example_SubmitUserRequests_AllParameters_Async() }, comment = "", }); - Response response = await client.SubmitUserRequestsAsync(content); + Response response = await client.SubmitAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("requestId").ToString()); @@ -439,7 +439,7 @@ public void Example_GetWorkflowRun_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); Response response = client.GetWorkflowRun(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); @@ -455,7 +455,7 @@ public async Task Example_GetWorkflowRun_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); Response response = await client.GetWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); @@ -471,7 +471,7 @@ public void Example_GetWorkflowRun_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); Response response = client.GetWorkflowRun(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); @@ -499,7 +499,7 @@ public async Task Example_GetWorkflowRun_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); Response response = await client.GetWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); @@ -527,10 +527,10 @@ public void Example_CancelWorkflowRun_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); using RequestContent content = RequestContent.Create(new object()); - Response response = client.CancelWorkflowRun(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = client.Cancel(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -541,10 +541,10 @@ public async Task Example_CancelWorkflowRun_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); using RequestContent content = RequestContent.Create(new object()); - Response response = await client.CancelWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = await client.CancelAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -555,13 +555,13 @@ public void Example_CancelWorkflowRun_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { comment = "", }); - Response response = client.CancelWorkflowRun(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = client.Cancel(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -572,13 +572,13 @@ public async Task Example_CancelWorkflowRun_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { comment = "", }); - Response response = await client.CancelWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = await client.CancelAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -589,7 +589,7 @@ public void Example_GetWorkflowTask_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); Response response = client.GetWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); @@ -611,7 +611,7 @@ public async Task Example_GetWorkflowTask_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); Response response = await client.GetWorkflowTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); @@ -633,7 +633,7 @@ public void Example_GetWorkflowTask_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); Response response = client.GetWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); @@ -665,7 +665,7 @@ public async Task Example_GetWorkflowTask_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); Response response = await client.GetWorkflowTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); @@ -697,10 +697,10 @@ public void Example_ApproveApprovalTask_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + ApprovalClient client = new ApprovalClient(endpoint, credential); using RequestContent content = RequestContent.Create(new object()); - Response response = client.ApproveApprovalTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = client.Approve(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -711,10 +711,10 @@ public async Task Example_ApproveApprovalTask_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + ApprovalClient client = new ApprovalClient(endpoint, credential); using RequestContent content = RequestContent.Create(new object()); - Response response = await client.ApproveApprovalTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = await client.ApproveAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -725,13 +725,13 @@ public void Example_ApproveApprovalTask_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + ApprovalClient client = new ApprovalClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { comment = "", }); - Response response = client.ApproveApprovalTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = client.Approve(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -742,13 +742,13 @@ public async Task Example_ApproveApprovalTask_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + ApprovalClient client = new ApprovalClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { comment = "", }); - Response response = await client.ApproveApprovalTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = await client.ApproveAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -759,10 +759,10 @@ public void Example_RejectApprovalTask_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + ApprovalClient client = new ApprovalClient(endpoint, credential); using RequestContent content = RequestContent.Create(new object()); - Response response = client.RejectApprovalTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = client.Reject(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -773,10 +773,10 @@ public async Task Example_RejectApprovalTask_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + ApprovalClient client = new ApprovalClient(endpoint, credential); using RequestContent content = RequestContent.Create(new object()); - Response response = await client.RejectApprovalTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = await client.RejectAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -787,13 +787,13 @@ public void Example_RejectApprovalTask_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + ApprovalClient client = new ApprovalClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { comment = "", }); - Response response = client.RejectApprovalTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = client.Reject(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -804,13 +804,13 @@ public async Task Example_RejectApprovalTask_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + ApprovalClient client = new ApprovalClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { comment = "", }); - Response response = await client.RejectApprovalTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = await client.RejectAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -821,10 +821,10 @@ public void Example_ReassignWorkflowTask_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); using RequestContent content = RequestContent.Create(new object()); - Response response = client.ReassignWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = client.Reassign(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -835,10 +835,10 @@ public async Task Example_ReassignWorkflowTask_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); using RequestContent content = RequestContent.Create(new object()); - Response response = await client.ReassignWorkflowTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = await client.ReassignAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -849,7 +849,7 @@ public void Example_ReassignWorkflowTask_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { @@ -862,7 +862,7 @@ public void Example_ReassignWorkflowTask_AllParameters() } }, }); - Response response = client.ReassignWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = client.Reassign(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -873,7 +873,7 @@ public async Task Example_ReassignWorkflowTask_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { @@ -886,7 +886,7 @@ public async Task Example_ReassignWorkflowTask_AllParameters_Async() } }, }); - Response response = await client.ReassignWorkflowTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = await client.ReassignAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -897,13 +897,13 @@ public void Example_UpdateTaskStatus_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + TaskStatusClient client = new TaskStatusClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { newStatus = "NotStarted", }); - Response response = client.UpdateTaskStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = client.Update(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -914,13 +914,13 @@ public async Task Example_UpdateTaskStatus_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + TaskStatusClient client = new TaskStatusClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { newStatus = "NotStarted", }); - Response response = await client.UpdateTaskStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = await client.UpdateAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -931,14 +931,14 @@ public void Example_UpdateTaskStatus_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + TaskStatusClient client = new TaskStatusClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { newStatus = "NotStarted", comment = "", }); - Response response = client.UpdateTaskStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = client.Update(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -949,14 +949,14 @@ public async Task Example_UpdateTaskStatus_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + TaskStatusClient client = new TaskStatusClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { newStatus = "NotStarted", comment = "", }); - Response response = await client.UpdateTaskStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + Response response = await client.UpdateAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); Console.WriteLine(response.Status); } @@ -967,7 +967,7 @@ public void Example_GetWorkflows_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowsClient client = new WorkflowsClient(endpoint, credential); foreach (BinaryData item in client.GetWorkflows(null)) { @@ -986,7 +986,7 @@ public async Task Example_GetWorkflows_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowsClient client = new WorkflowsClient(endpoint, credential); await foreach (BinaryData item in client.GetWorkflowsAsync(null)) { @@ -1005,7 +1005,7 @@ public void Example_GetWorkflows_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowsClient client = new WorkflowsClient(endpoint, credential); foreach (BinaryData item in client.GetWorkflows(null)) { @@ -1031,7 +1031,7 @@ public async Task Example_GetWorkflows_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowsClient client = new WorkflowsClient(endpoint, credential); await foreach (BinaryData item in client.GetWorkflowsAsync(null)) { @@ -1057,9 +1057,9 @@ public void Example_GetWorkflowRuns_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential); - foreach (BinaryData item in client.GetWorkflowRuns(null, null, null, null, null, null)) + foreach (BinaryData item in client.GetWorkflowRuns(null, null, null, null, null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -1078,9 +1078,9 @@ public async Task Example_GetWorkflowRuns_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential); - await foreach (BinaryData item in client.GetWorkflowRunsAsync(null, null, null, null, null, null)) + await foreach (BinaryData item in client.GetWorkflowRunsAsync(null, null, null, null, null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -1099,9 +1099,9 @@ public void Example_GetWorkflowRuns_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential); - foreach (BinaryData item in client.GetWorkflowRuns("1d", "status desc", new string[] { "InProgress" }, new string[] { "" }, 1234, null)) + foreach (BinaryData item in client.GetWorkflowRuns("", "1d", "status desc", new string[] { "InProgress" }, new string[] { "" }, new string[] { "" }, 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -1124,9 +1124,9 @@ public async Task Example_GetWorkflowRuns_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential); - await foreach (BinaryData item in client.GetWorkflowRunsAsync("1d", "status desc", new string[] { "InProgress" }, new string[] { "" }, 1234, null)) + await foreach (BinaryData item in client.GetWorkflowRunsAsync("", "1d", "status desc", new string[] { "InProgress" }, new string[] { "" }, new string[] { "" }, 1234, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -1149,9 +1149,9 @@ public void Example_GetWorkflowTasks_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential); - foreach (BinaryData item in client.GetWorkflowTasks(null, null, null, null, null, null, null, null, null)) + foreach (BinaryData item in client.GetWorkflowTasks(null, null, null, null, null, null, null, null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("type").ToString()); @@ -1172,9 +1172,9 @@ public async Task Example_GetWorkflowTasks_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential); - await foreach (BinaryData item in client.GetWorkflowTasksAsync(null, null, null, null, null, null, null, null, null)) + await foreach (BinaryData item in client.GetWorkflowTasksAsync(null, null, null, null, null, null, null, null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("type").ToString()); @@ -1195,9 +1195,9 @@ public void Example_GetWorkflowTasks_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential); - foreach (BinaryData item in client.GetWorkflowTasks("", new string[] { "" }, "1d", 1234, "status desc", new string[] { "Approval" }, new string[] { "InProgress" }, "", null)) + foreach (BinaryData item in client.GetWorkflowTasks("", new string[] { "" }, "1d", 1234, "status desc", new string[] { "Approval" }, new string[] { "InProgress" }, new string[] { "" }, new string[] { "" }, "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("type").ToString()); @@ -1228,9 +1228,9 @@ public async Task Example_GetWorkflowTasks_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - PurviewWorkflowServiceClient client = new PurviewWorkflowServiceClient(endpoint, credential); + WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential); - await foreach (BinaryData item in client.GetWorkflowTasksAsync("", new string[] { "" }, "1d", 1234, "status desc", new string[] { "Approval" }, new string[] { "InProgress" }, "", null)) + await foreach (BinaryData item in client.GetWorkflowTasksAsync("", new string[] { "" }, "1d", 1234, "status desc", new string[] { "Approval" }, new string[] { "" }, new string[] { "" }, new string[] { "InProgress" }, "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("type").ToString()); diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_TaskStatusClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_TaskStatusClient.cs new file mode 100644 index 000000000000..eda19657e779 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_TaskStatusClient.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Analytics.Purview.Workflows; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Analytics.Purview.Workflows.Samples +{ + public partial class Samples_TaskStatusClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Update_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + TaskStatusClient client = new TaskStatusClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + newStatus = "NotStarted", + }); + Response response = client.Update(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Update_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + TaskStatusClient client = new TaskStatusClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + newStatus = "NotStarted", + }); + Response response = await client.UpdateAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Update_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + TaskStatusClient client = new TaskStatusClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + newStatus = "NotStarted", + comment = "", + }); + Response response = client.Update(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Update_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + TaskStatusClient client = new TaskStatusClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + newStatus = "NotStarted", + comment = "", + }); + Response response = await client.UpdateAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_UserRequestsClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_UserRequestsClient.cs new file mode 100644 index 000000000000..57e4d69b42a1 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_UserRequestsClient.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Analytics.Purview.Workflows; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Analytics.Purview.Workflows.Samples +{ + public partial class Samples_UserRequestsClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Submit_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + UserRequestsClient client = new UserRequestsClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + operations = new object[] + { +new +{ +type = "CreateTerm", +payload = new object(), +} + }, + }); + Response response = client.Submit(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("requestId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Submit_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + UserRequestsClient client = new UserRequestsClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + operations = new object[] + { +new +{ +type = "CreateTerm", +payload = new object(), +} + }, + }); + Response response = await client.SubmitAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("requestId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Submit_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + UserRequestsClient client = new UserRequestsClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + operations = new object[] + { +new +{ +type = "CreateTerm", +payload = new object(), +} + }, + comment = "", + }); + Response response = client.Submit(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("requestId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString()); + Console.WriteLine(result.GetProperty("operations")[0].GetProperty("workflowRunIds")[0].ToString()); + Console.WriteLine(result.GetProperty("comment").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Submit_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + UserRequestsClient client = new UserRequestsClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + operations = new object[] + { +new +{ +type = "CreateTerm", +payload = new object(), +} + }, + comment = "", + }); + Response response = await client.SubmitAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("requestId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("operations")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("operations")[0].GetProperty("payload").ToString()); + Console.WriteLine(result.GetProperty("operations")[0].GetProperty("workflowRunIds")[0].ToString()); + Console.WriteLine(result.GetProperty("comment").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowClient.cs new file mode 100644 index 000000000000..77393f1037f6 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowClient.cs @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Analytics.Purview.Workflows; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Analytics.Purview.Workflows.Samples +{ + public partial class Samples_WorkflowClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkflow_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + Response response = client.GetWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("actionDag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkflow_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + Response response = await client.GetWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("actionDag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkflow_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + Response response = client.GetWorkflow(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("actionDag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("createdBy").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("updatedBy").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkflow_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + Response response = await client.GetWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("actionDag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("createdBy").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("updatedBy").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplace_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + triggers = new object[] + { +new +{ +type = "when_term_creation_is_requested", +} + }, + name = "", + isEnabled = true, + description = "", + }); + Response response = client.CreateOrReplace(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("actionDag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateOrReplace_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + triggers = new object[] + { +new +{ +type = "when_term_creation_is_requested", +} + }, + name = "", + isEnabled = true, + description = "", + }); + Response response = await client.CreateOrReplaceAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("actionDag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplace_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + triggers = new object[] + { +new +{ +type = "when_term_creation_is_requested", +underGlossaryHierarchy = "", +underCollection = "", +underGlossary = "", +} + }, + name = "", + isEnabled = true, + description = "", + actionDag = new object(), + }); + Response response = client.CreateOrReplace(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("actionDag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("createdBy").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("updatedBy").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateOrReplace_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + triggers = new object[] + { +new +{ +type = "when_term_creation_is_requested", +underGlossaryHierarchy = "", +underCollection = "", +underGlossary = "", +} + }, + name = "", + isEnabled = true, + description = "", + actionDag = new object(), + }); + Response response = await client.CreateOrReplaceAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("actionDag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("createdBy").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("updatedBy").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Delete_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + Response response = client.Delete(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Delete_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + Response response = await client.DeleteAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Delete_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + Response response = client.Delete(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Delete_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + Response response = await client.DeleteAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Validate_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + triggers = new object[] + { +new +{ +type = "when_term_creation_is_requested", +} + }, + name = "", + isEnabled = true, + description = "", + }); + Response response = client.Validate(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].GetProperty("severity").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("message").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Validate_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + triggers = new object[] + { +new +{ +type = "when_term_creation_is_requested", +} + }, + name = "", + isEnabled = true, + description = "", + }); + Response response = await client.ValidateAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].GetProperty("severity").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("message").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Validate_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + triggers = new object[] + { +new +{ +type = "when_term_creation_is_requested", +underGlossaryHierarchy = "", +underCollection = "", +underGlossary = "", +} + }, + name = "", + isEnabled = true, + description = "", + actionDag = new object(), + }); + Response response = client.Validate(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].GetProperty("severity").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("actionName").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("parameterKey").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("message").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Validate_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowClient client = new WorkflowClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + triggers = new object[] + { +new +{ +type = "when_term_creation_is_requested", +underGlossaryHierarchy = "", +underCollection = "", +underGlossary = "", +} + }, + name = "", + isEnabled = true, + description = "", + actionDag = new object(), + }); + Response response = await client.ValidateAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].GetProperty("severity").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("actionName").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("location").GetProperty("parameterKey").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("message").ToString()); + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowRunClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowRunClient.cs new file mode 100644 index 000000000000..53d6c25508fb --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowRunClient.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Analytics.Purview.Workflows; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Analytics.Purview.Workflows.Samples +{ + public partial class Samples_WorkflowRunClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkflowRun_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + + Response response = client.GetWorkflowRun(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("actionDag").ToString()); + Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString()); + Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkflowRun_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + + Response response = await client.GetWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("actionDag").ToString()); + Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString()); + Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkflowRun_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + + Response response = client.GetWorkflowRun(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("userRequestId").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("payload").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("cancelTime").ToString()); + Console.WriteLine(result.GetProperty("cancelComment").ToString()); + Console.WriteLine(result.GetProperty("actionDag").ToString()); + Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString()); + Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkflowRun_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + + Response response = await client.GetWorkflowRunAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("userRequestId").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("payload").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("cancelTime").ToString()); + Console.WriteLine(result.GetProperty("cancelComment").ToString()); + Console.WriteLine(result.GetProperty("actionDag").ToString()); + Console.WriteLine(result.GetProperty("detail").GetProperty("runInput").ToString()); + Console.WriteLine(result.GetProperty("detail").GetProperty("actions").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Cancel_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.Cancel(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Cancel_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.CancelAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Cancel_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + comment = "", + }); + Response response = client.Cancel(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Cancel_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowRunClient client = new WorkflowRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + comment = "", + }); + Response response = await client.CancelAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowRunsClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowRunsClient.cs new file mode 100644 index 000000000000..6bee19bc19bf --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowRunsClient.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Analytics.Purview.Workflows; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Analytics.Purview.Workflows.Samples +{ + public partial class Samples_WorkflowRunsClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkflowRuns_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential); + + foreach (BinaryData item in client.GetWorkflowRuns(null, null, null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkflowRuns_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetWorkflowRunsAsync(null, null, null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkflowRuns_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential); + + foreach (BinaryData item in client.GetWorkflowRuns("", "1d", "status desc", new string[] { "InProgress" }, new string[] { "" }, new string[] { "" }, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("userRequestId").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("cancelTime").ToString()); + Console.WriteLine(result.GetProperty("cancelComment").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkflowRuns_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetWorkflowRunsAsync("", "1d", "status desc", new string[] { "InProgress" }, new string[] { "" }, new string[] { "" }, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("userRequestId").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("cancelTime").ToString()); + Console.WriteLine(result.GetProperty("cancelComment").ToString()); + } + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowTaskClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowTaskClient.cs new file mode 100644 index 000000000000..cb859a6e8ca8 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowTaskClient.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Analytics.Purview.Workflows; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Analytics.Purview.Workflows.Samples +{ + public partial class Samples_WorkflowTaskClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkflowTask_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + + Response response = client.GetWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowRunId").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkflowTask_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + + Response response = await client.GetWorkflowTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowRunId").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkflowTask_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + + Response response = client.GetWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("title").ToString()); + Console.WriteLine(result.GetProperty("workflowRunId").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("payload").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("lastRemindTime").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("nextRemindTime").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("reminderSettings").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("lastExpiryNotificationTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("nextExpiryNotificationTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expiryTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("expireAfter").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("notifyOnExpiration")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkflowTask_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + + Response response = await client.GetWorkflowTaskAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("title").ToString()); + Console.WriteLine(result.GetProperty("workflowRunId").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("payload").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("lastRemindTime").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("nextRemindTime").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("reminderSettings").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("lastExpiryNotificationTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("nextExpiryNotificationTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expiryTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("expireAfter").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("notifyOnExpiration")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Reassign_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.Reassign(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Reassign_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.ReassignAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Reassign_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + reassignments = new object[] + { +new +{ +reassignFrom = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", +reassignTo = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", +} + }, + }); + Response response = client.Reassign(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Reassign_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + reassignments = new object[] + { +new +{ +reassignFrom = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", +reassignTo = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", +} + }, + }); + Response response = await client.ReassignAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), content); + + Console.WriteLine(response.Status); + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowTasksClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowTasksClient.cs new file mode 100644 index 000000000000..bbe7dd48b640 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowTasksClient.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Analytics.Purview.Workflows; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Analytics.Purview.Workflows.Samples +{ + public partial class Samples_WorkflowTasksClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkflowTasks_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential); + + foreach (BinaryData item in client.GetWorkflowTasks(null, null, null, null, null, null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowRunId").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkflowTasks_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential); + + await foreach (BinaryData item in client.GetWorkflowTasksAsync(null, null, null, null, null, null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("workflowRunId").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkflowTasks_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential); + + foreach (BinaryData item in client.GetWorkflowTasks("", new string[] { "" }, "1d", 1234, "status desc", new string[] { "Approval" }, new string[] { "InProgress" }, new string[] { "" }, new string[] { "" }, "", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("title").ToString()); + Console.WriteLine(result.GetProperty("workflowRunId").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("payload").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("lastRemindTime").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("nextRemindTime").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("reminderSettings").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("lastExpiryNotificationTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("nextExpiryNotificationTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expiryTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("expireAfter").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("notifyOnExpiration")[0].ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkflowTasks_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential); + + await foreach (BinaryData item in client.GetWorkflowTasksAsync("", new string[] { "" }, "1d", 1234, "status desc", new string[] { "Approval" }, new string[] { "InProgress" }, new string[] { "" }, new string[] { "" }, "", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("title").ToString()); + Console.WriteLine(result.GetProperty("workflowRunId").ToString()); + Console.WriteLine(result.GetProperty("workflowId").ToString()); + Console.WriteLine(result.GetProperty("requestor").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString()); + Console.WriteLine(result.GetProperty("payload").GetProperty("payload").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("lastRemindTime").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("nextRemindTime").ToString()); + Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("reminderSettings").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("lastExpiryNotificationTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("nextExpiryNotificationTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expiryTime").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("expireAfter").ToString()); + Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("notifyOnExpiration")[0].ToString()); + } + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowsClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowsClient.cs new file mode 100644 index 000000000000..5b2b05567b55 --- /dev/null +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowsClient.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Analytics.Purview.Workflows; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Analytics.Purview.Workflows.Samples +{ + public partial class Samples_WorkflowsClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkflows_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowsClient client = new WorkflowsClient(endpoint, credential); + + foreach (BinaryData item in client.GetWorkflows(null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkflows_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowsClient client = new WorkflowsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetWorkflowsAsync(null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkflows_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowsClient client = new WorkflowsClient(endpoint, credential); + + foreach (BinaryData item in client.GetWorkflows(null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("createdBy").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("updatedBy").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkflows_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + WorkflowsClient client = new WorkflowsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetWorkflowsAsync(null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString()); + Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString()); + Console.WriteLine(result.GetProperty("createdTime").ToString()); + Console.WriteLine(result.GetProperty("createdBy").ToString()); + Console.WriteLine(result.GetProperty("lastUpdateTime").ToString()); + Console.WriteLine(result.GetProperty("updatedBy").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("isEnabled").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + } + } +} diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample1_HelloWorld.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample1_HelloWorld.cs index 56609aad066f..1bbcd097e9cf 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample1_HelloWorld.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample1_HelloWorld.cs @@ -27,7 +27,7 @@ public async Task CreateWorkflowClient() 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); #endregion //Perform an operation @@ -53,14 +53,14 @@ public async Task CreateWorkflow() string password = Environment.GetEnvironmentVariable("Password"); TokenCredential usernamePasswordCredential = new UsernamePasswordCredential(clientId, tenantId, username, password, null); - var client = new PurviewWorkflowServiceClient(endpoint, usernamePasswordCredential); + var client = new WorkflowClient(endpoint, usernamePasswordCredential); #region Snippet:Azure_Analytics_Purview_Workflows_CreateWorkflow 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)); #endregion @@ -80,7 +80,7 @@ public async Task GetWorkflow() string password = Environment.GetEnvironmentVariable("Password"); TokenCredential usernamePasswordCredential = new UsernamePasswordCredential(clientId, tenantId, username, password, null); - var client = new PurviewWorkflowServiceClient(endpoint, usernamePasswordCredential); + var client = new WorkflowClient(endpoint, usernamePasswordCredential); #region Snippet:Azure_Analytics_Purview_Workflows_GetWorkflow // This workflowId represents an existing workflow. The id can be obtained by calling CreateOrReplaceWorkflowAsync API or list workflows by calling GetWorkflowsAsync API. diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample2_SubmitUserRequests.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample2_SubmitUserRequests.cs index 1ed5085c05ca..456a79aad802 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample2_SubmitUserRequests.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample2_SubmitUserRequests.cs @@ -26,13 +26,13 @@ public async Task SubmitUserRequest() string password = Environment.GetEnvironmentVariable("Password"); TokenCredential usernamePasswordCredential = new UsernamePasswordCredential(clientId,tenantId, username,password, null); - var client = new PurviewWorkflowServiceClient(endpoint, usernamePasswordCredential); + var client = new UserRequestsClient(endpoint, usernamePasswordCredential); #region 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)); #endregion diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample3_WorkflowTasks.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample3_WorkflowTasks.cs index e47e9a7f0778..fd629ba62b1d 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample3_WorkflowTasks.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample3_WorkflowTasks.cs @@ -26,7 +26,7 @@ public async Task ApproveWorkflowTask() string password = Environment.GetEnvironmentVariable("Password"); TokenCredential usernamePasswordCredential = new UsernamePasswordCredential(clientId,tenantId, username,password, null); - var client = new PurviewWorkflowServiceClient(endpoint, usernamePasswordCredential); + var client = new ApprovalClient(endpoint, usernamePasswordCredential); #region Snippet:Azure_Analytics_Purview_Workflows_ApproveWorkflowTask @@ -35,7 +35,7 @@ public async Task ApproveWorkflowTask() string request = "{\"comment\":\"Thanks!\"}"; - Response approveResult = await client.ApproveApprovalTaskAsync(taskId, RequestContent.Create(request)); + Response approveResult = await client.ApproveAsync(taskId, RequestContent.Create(request)); #endregion diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample4_WorkflowRuns.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample4_WorkflowRuns.cs index c17fcad2a2f9..b4a51f0a20e4 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample4_WorkflowRuns.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Samples/Sample4_WorkflowRuns.cs @@ -26,7 +26,7 @@ public async Task CancelWorkflowRun() string password = Environment.GetEnvironmentVariable("Password"); TokenCredential usernamePasswordCredential = new UsernamePasswordCredential(clientId,tenantId, username,password, null); - var client = new PurviewWorkflowServiceClient(endpoint, usernamePasswordCredential); + var client = new WorkflowRunClient(endpoint, usernamePasswordCredential); #region Snippet:Azure_Analytics_Purview_Workflows_CancelWorkflowRun // This workflowRunId represents an existing workflow run. The id can be obtained by calling GetWorkflowRunsAsync API. @@ -34,7 +34,7 @@ public async Task CancelWorkflowRun() string request = "{\"comment\":\"Thanks!\"}"; - Response cancelResult = await client.CancelWorkflowRunAsync(workflowRunId, RequestContent.Create(request)); + Response cancelResult = await client.CancelAsync(workflowRunId, RequestContent.Create(request)); #endregion diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/WorkflowsClientTest.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/WorkflowsClientTest.cs index 4f3777e7148d..9cffbb59cfb0 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/WorkflowsClientTest.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/WorkflowsClientTest.cs @@ -23,11 +23,11 @@ public async Task CreateWorkflow() { var client = GetWorkflowClient(); - Guid workflowId = new Guid("c504f8ad-c0d6-4e76-ada8-33a0d3cccba7"); + Guid workflowId = new Guid("e3467b48-a9d8-11ed-afa1-0242ac120002"); - 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\"]}}}}}"; + string workflow = "{\"name\":\"Create glossary term workflow\",\"description\":\"\",\"triggers\":[{\"type\":\"when_term_creation_is_requested\",\"underGlossaryHierarchy\":\"/glossaries/5dae5e5b-5aa6-48f1-9e46-26fe7328de71\"}],\"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')['outcome']}\",\"Approved\"]}]},\"actions\":{\"Createglossaryterm\":{\"type\":\"CreateTerm\",\"runAfter\":{}},\"Sendemailnotification\":{\"type\":\"EmailNotification\",\"inputs\":{\"parameters\":{\"emailSubject\":\"GlossaryTermCreate-APPROVED\",\"emailMessage\":\"YourrequestforGlossaryTerm@{runInput()['term']['name']}isapproved.\",\"emailRecipients\":[\"@{runInput()['requestor']}\"]}},\"runAfter\":{\"Createglossaryterm\":[\"Succeeded\"]}}},\"else\":{\"actions\":{\"Sendrejectemailnotification\":{\"type\":\"EmailNotification\",\"inputs\":{\"parameters\":{\"emailSubject\":\"GlossaryTermCreate-REJECTED\",\"emailMessage\":\"YourrequestforGlossaryTerm@{runInput()['term']['name']}isrejected.\",\"emailRecipients\":[\"@{runInput()['requestor']}\"]}},\"runAfter\":{}}}},\"runAfter\":{\"Startandwaitforanapproval\":[\"Succeeded\"]}}}}}"; - Response createResult = await client.CreateOrReplaceWorkflowAsync(workflowId, RequestContent.Create(workflow)); + Response createResult = await client.CreateOrReplaceAsync(workflowId, RequestContent.Create(workflow)); using var createJsonDocument = JsonDocument.Parse(GetContentFromResponse(createResult)); JsonElement createBodyJson = createJsonDocument.RootElement; @@ -38,20 +38,20 @@ public async Task CreateWorkflow() [RecordedTest] public async Task ListWorkflow() { - var client = GetWorkflowClient(); + var client = GetWorkflowsClient(); var workflowsList = client.GetWorkflowsAsync(new()).GetAsyncEnumerator(); await workflowsList.MoveNextAsync(); using var workflowsListJsonDocument = JsonDocument.Parse(workflowsList.Current); JsonElement listBodyJson = workflowsListJsonDocument.RootElement; await workflowsList.DisposeAsync(); - Assert.AreEqual("Delete glossary term", listBodyJson.GetProperty("name").ToString()); + Assert.NotNull(listBodyJson); } [RecordedTest] public async Task GetWorkflow() { var client = GetWorkflowClient(); - Guid workflowId = new Guid("8af1ecae-16ee-4b2d-8972-00d611dd2f99"); + Guid workflowId = new Guid("e3467b48-a9d8-11ed-afa1-0242ac120002"); Response getResult = await client.GetWorkflowAsync(workflowId, new()); using var jsonDocument = JsonDocument.Parse(GetContentFromResponse(getResult)); JsonElement getBodyJson = jsonDocument.RootElement; @@ -63,33 +63,33 @@ public async Task DeleteWorkflow() { var client = GetWorkflowClient(); - Guid workflowId = new Guid("5ec07661-0111-4264-aed8-2a335773a831"); + Guid workflowId = new Guid("3f7a14f2-c9cd-4fe4-96df-ed3447256118"); - Response deleteResult = await client.DeleteWorkflowAsync(workflowId); + Response deleteResult = await client.DeleteAsync(workflowId); Assert.AreEqual(204, deleteResult.Status); } [RecordedTest] public async Task SubmitUserRequest() { - var client = GetWorkflowClient(); + var client = GetUserRequestsClient(); - string request = "{\"operations\":[{\"type\":\"CreateTerm\",\"payload\":{\"glossaryTerm\":{\"name\":\"term\",\"anchor\":{\"glossaryGuid\":\"20031e20-b4df-4a66-a61d-1b0716f3fa48\"},\"status\":\"Approved\",\"nickName\":\"term\"}}}],\"comment\":\"Thanks!\"}"; + string request = "{\"operations\":[{\"type\":\"CreateTerm\",\"payload\":{\"glossaryTerm\":{\"name\":\"term\",\"anchor\":{\"glossaryGuid\":\"5dae5e5b-5aa6-48f1-9e46-26fe7328de71\"},\"status\":\"Approved\",\"nickName\":\"term\"}}}],\"comment\":\"Thanks!\"}"; - Response submitResult = await client.SubmitUserRequestsAsync(RequestContent.Create(request)); + Response submitResult = await client.SubmitAsync(RequestContent.Create(request)); Assert.AreEqual(200, submitResult.Status); } [RecordedTest] public async Task CancelWorkflowRuns() { - var client = GetWorkflowClient(); + var client = GetWorkflowRunClient(); - Guid workflowRunId = new Guid("d77281b4-2af3-4bc5-8d2f-14a2b63fa33d"); + Guid workflowRunId = new Guid("27022a5a-accd-4c91-baf5-33297b2a12ba"); string request = "{\"comment\":\"Thanks!\"}"; - Response cancelResult = await client.CancelWorkflowRunAsync(workflowRunId, RequestContent.Create(request)); + Response cancelResult = await client.CancelAsync(workflowRunId, RequestContent.Create(request)); Assert.AreEqual(200, cancelResult.Status); } @@ -97,13 +97,13 @@ public async Task CancelWorkflowRuns() [RecordedTest] public async Task ApproveWorkflowTask() { - var client = GetWorkflowClient(); + var client = GetApprovalClient(); - Guid taskId = new Guid("507d9e8a-e5c4-41db-ace5-358961e0bfeb"); + Guid taskId = new Guid("ca7a1483-3635-4822-aa7d-9291f7d32f4c"); string request = "{\"comment\":\"Thanks!\"}"; - Response approveResult = await client.ApproveApprovalTaskAsync(taskId, RequestContent.Create(request)); + Response approveResult = await client.ApproveAsync(taskId, RequestContent.Create(request)); Assert.AreEqual(200, approveResult.Status); } diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/WorkflowsClientTestBase.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/WorkflowsClientTestBase.cs index 44379e975fb6..c37ef12e2eb3 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/WorkflowsClientTestBase.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/WorkflowsClientTestBase.cs @@ -16,7 +16,7 @@ public WorkflowsClientTestBase(bool isAsync, RecordedTestMode? mode = default) : { } - public PurviewWorkflowServiceClient GetWorkflowClient() + public WorkflowClient GetWorkflowClient() { var httpHandler = new HttpClientHandler(); httpHandler.ServerCertificateCustomValidationCallback = (_, _, _, _) => @@ -24,7 +24,51 @@ public PurviewWorkflowServiceClient GetWorkflowClient() return true; }; var options = new PurviewWorkflowServiceClientOptions { Transport = new HttpClientTransport(httpHandler) }; - return InstrumentClient(new PurviewWorkflowServiceClient(TestEnvironment.Endpoint, TestEnvironment.UsernamePasswordCredential, InstrumentClientOptions(options))); + return InstrumentClient(new WorkflowClient(TestEnvironment.Endpoint, TestEnvironment.UsernamePasswordCredential, InstrumentClientOptions(options))); + } + + public WorkflowsClient GetWorkflowsClient() + { + var httpHandler = new HttpClientHandler(); + httpHandler.ServerCertificateCustomValidationCallback = (_, _, _, _) => + { + return true; + }; + var options = new PurviewWorkflowServiceClientOptions { Transport = new HttpClientTransport(httpHandler) }; + return InstrumentClient(new WorkflowsClient(TestEnvironment.Endpoint, TestEnvironment.UsernamePasswordCredential, InstrumentClientOptions(options))); + } + + public UserRequestsClient GetUserRequestsClient() + { + var httpHandler = new HttpClientHandler(); + httpHandler.ServerCertificateCustomValidationCallback = (_, _, _, _) => + { + return true; + }; + var options = new PurviewWorkflowServiceClientOptions { Transport = new HttpClientTransport(httpHandler) }; + return InstrumentClient(new UserRequestsClient(TestEnvironment.Endpoint, TestEnvironment.UsernamePasswordCredential, InstrumentClientOptions(options))); + } + + public WorkflowRunClient GetWorkflowRunClient() + { + var httpHandler = new HttpClientHandler(); + httpHandler.ServerCertificateCustomValidationCallback = (_, _, _, _) => + { + return true; + }; + var options = new PurviewWorkflowServiceClientOptions { Transport = new HttpClientTransport(httpHandler) }; + return InstrumentClient(new WorkflowRunClient(TestEnvironment.Endpoint, TestEnvironment.UsernamePasswordCredential, InstrumentClientOptions(options))); + } + + public ApprovalClient GetApprovalClient() + { + var httpHandler = new HttpClientHandler(); + httpHandler.ServerCertificateCustomValidationCallback = (_, _, _, _) => + { + return true; + }; + var options = new PurviewWorkflowServiceClientOptions { Transport = new HttpClientTransport(httpHandler) }; + return InstrumentClient(new ApprovalClient(TestEnvironment.Endpoint, TestEnvironment.UsernamePasswordCredential, InstrumentClientOptions(options))); } } } From cef48e0e8e337c2139d861de3db38fef188bf379 Mon Sep 17 00:00:00 2001 From: Weiran Wu Date: Wed, 8 Nov 2023 15:06:52 +0800 Subject: [PATCH 2/3] Update Purview Workflow generated files --- .../tests/Generated/Samples/Samples_WorkflowRunsClient.cs | 2 ++ .../tests/Generated/Samples/Samples_WorkflowTasksClient.cs | 2 ++ .../tests/Generated/Samples/Samples_WorkflowsClient.cs | 1 + 3 files changed, 5 insertions(+) diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowRunsClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowRunsClient.cs index 6bee19bc19bf..726d862f4c43 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowRunsClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowRunsClient.cs @@ -6,8 +6,10 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; +using Azure; using Azure.Analytics.Purview.Workflows; using Azure.Core; using Azure.Identity; diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowTasksClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowTasksClient.cs index bbe7dd48b640..77c827cf9522 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowTasksClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowTasksClient.cs @@ -6,8 +6,10 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; +using Azure; using Azure.Analytics.Purview.Workflows; using Azure.Core; using Azure.Identity; diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowsClient.cs b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowsClient.cs index 5b2b05567b55..5cb2c9b11549 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowsClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/tests/Generated/Samples/Samples_WorkflowsClient.cs @@ -8,6 +8,7 @@ using System; using System.Text.Json; using System.Threading.Tasks; +using Azure; using Azure.Analytics.Purview.Workflows; using Azure.Core; using Azure.Identity; From e550fc0dd9d16bd940eb19c5fd8f11b0fcd2b5fb Mon Sep 17 00:00:00 2001 From: Weiran Wu Date: Wed, 15 Nov 2023 11:37:16 +0800 Subject: [PATCH 3/3] Update Purview Workflow changelog --- .../Azure.Analytics.Purview.Workflows/CHANGELOG.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sdk/purview/Azure.Analytics.Purview.Workflows/CHANGELOG.md b/sdk/purview/Azure.Analytics.Purview.Workflows/CHANGELOG.md index 5725040141da..cba366600f10 100644 --- a/sdk/purview/Azure.Analytics.Purview.Workflows/CHANGELOG.md +++ b/sdk/purview/Azure.Analytics.Purview.Workflows/CHANGELOG.md @@ -1,19 +1,15 @@ # Release History -## 1.0.0-beta.2 (2023-10-26) +## 1.0.0-beta.2 (2023-11-15) ### Features Added - Add `/workflows/{id}/validate` API. - Add admin query options to workflow / workflow run APIs. -### Breaking Changes - -- Split `PurviewWorkflowServiceClient` into multiple clients by model. - ### Other Changes -- Update descriptions of some APIs. +- Split `PurviewWorkflowServiceClient` into multiple clients by model. ## 1.0.0-beta.1 (2023-03-07)