@azure-rest/purview-workflow 1.0.0-alpha.20250108.1 → 1.0.0-alpha.20250109.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -19
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Use the client library for Purview Workflow to:
|
|
|
22
22
|
|
|
23
23
|
### Create and authenticate a `PurviewWorkflowClient`
|
|
24
24
|
|
|
25
|
-
Since the Workflow service uses an Azure Active Directory (AAD) bearer token for authentication and identification, an email address should be encoded into the token to allow for notification when using Workflow. It is recommended that the [Azure Identity][azure_identity] library be used
|
|
25
|
+
Since the Workflow service uses an Azure Active Directory (AAD) bearer token for authentication and identification, an email address should be encoded into the token to allow for notification when using Workflow. It is recommended that the [Azure Identity][azure_identity] library be used with a the [UsernamePasswordCredential][username_password_credential]. Before using the [Azure Identity][azure_identity] library with Workflow, [an application][app_registration] should be registered and used for the clientId passed to the [UsernamePasswordCredential][username_password_credential].
|
|
26
26
|
Set the values of the client ID, tenant ID, username and password as environment variables:
|
|
27
27
|
AZURE_CLIENT_ID, AZURE_TENANT_ID, USERNAME, PASSWORD
|
|
28
28
|
|
|
@@ -40,13 +40,8 @@ const username = process.env["USERNAME"];
|
|
|
40
40
|
const password = process.env["PASSWORD"];
|
|
41
41
|
const client = PurviewWorkflow(
|
|
42
42
|
endpoint,
|
|
43
|
-
new UsernamePasswordCredential(
|
|
44
|
-
|
|
45
|
-
clientId,
|
|
46
|
-
username,
|
|
47
|
-
password
|
|
48
|
-
)
|
|
49
|
-
);
|
|
43
|
+
new UsernamePasswordCredential(tenantId, clientId, username, password),
|
|
44
|
+
);
|
|
50
45
|
```
|
|
51
46
|
|
|
52
47
|
## Examples
|
|
@@ -60,7 +55,7 @@ The following section provides several code snippets covering some of the most c
|
|
|
60
55
|
|
|
61
56
|
```typescript
|
|
62
57
|
import createPurviewWorkflowClient, {
|
|
63
|
-
SubmitUserRequestsParameters
|
|
58
|
+
SubmitUserRequestsParameters,
|
|
64
59
|
} from "@azure-rest/purview-workflow";
|
|
65
60
|
import { UsernamePasswordCredential } from "@azure/identity";
|
|
66
61
|
import * as dotenv from "dotenv";
|
|
@@ -74,7 +69,7 @@ async function userRequestsSubmit() {
|
|
|
74
69
|
const username = process.env["USERNAME"];
|
|
75
70
|
const password = process.env["PASSWORD"];
|
|
76
71
|
|
|
77
|
-
const credential = new UsernamePasswordCredential(tenantId
|
|
72
|
+
const credential = new UsernamePasswordCredential(tenantId, clientId, username, password);
|
|
78
73
|
const client = createPurviewWorkflowClient(endpoint, credential);
|
|
79
74
|
const options: SubmitUserRequestsParameters = {
|
|
80
75
|
body: {
|
|
@@ -87,12 +82,12 @@ async function userRequestsSubmit() {
|
|
|
87
82
|
name: "term",
|
|
88
83
|
anchor: { glossaryGuid: "20031e20-b4df-4a66-a61d-1b0716f3fa48" },
|
|
89
84
|
nickName: "term",
|
|
90
|
-
status: "Approved"
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
}
|
|
85
|
+
status: "Approved",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
96
91
|
};
|
|
97
92
|
const result = await client.path("/userrequests").post(options);
|
|
98
93
|
if (isUnexpected(result)) {
|
|
@@ -109,7 +104,7 @@ userRequestsSubmit().catch(console.error);
|
|
|
109
104
|
```typescript
|
|
110
105
|
// This taskId represents an existing workflow task. The id can be obtained by calling GET /workflowtasks API.
|
|
111
106
|
import createPurviewWorkflowClient, {
|
|
112
|
-
SubmitUserRequestsParameters
|
|
107
|
+
SubmitUserRequestsParameters,
|
|
113
108
|
} from "@azure-rest/purview-workflow";
|
|
114
109
|
import { UsernamePasswordCredential } from "@azure/identity";
|
|
115
110
|
import * as dotenv from "dotenv";
|
|
@@ -125,7 +120,7 @@ async function approvalTaskApprove() {
|
|
|
125
120
|
const client = createPurviewWorkflowClient(endpoint, credential);
|
|
126
121
|
const taskId = "98d98e2c-23fa-4157-a3f8-ff8ce5cc095c";
|
|
127
122
|
const options: ApproveApprovalTaskParameters = {
|
|
128
|
-
body: { comment: "Thanks for raising this!" }
|
|
123
|
+
body: { comment: "Thanks for raising this!" },
|
|
129
124
|
};
|
|
130
125
|
const result = await client
|
|
131
126
|
.path("/workflowtasks/{taskId}/approve-approval", taskId)
|
|
@@ -154,9 +149,10 @@ setLogLevel("info");
|
|
|
154
149
|
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
|
|
155
150
|
|
|
156
151
|
<!-- LINKS -->
|
|
152
|
+
|
|
157
153
|
[product_documentation]: https://learn.microsoft.com/azure/purview/concept-workflow
|
|
158
154
|
[azure_subscription]: https://azure.microsoft.com/free/dotnet/
|
|
159
|
-
[purview_resource]: https://
|
|
155
|
+
[purview_resource]: https://learn.microsoft.com/azure/purview/create-catalog-portal
|
|
160
156
|
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#readme
|
|
161
157
|
[app_registration]: https://learn.microsoft.com/azure/active-directory/develop/quickstart-register-app
|
|
162
158
|
[username_password_credential]: https://learn.microsoft.com/javascript/api/@azure/identity/usernamepasswordcredential?view=azure-node-latest
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@azure-rest/purview-workflow",
|
|
3
3
|
"sdk-type": "client",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
|
-
"version": "1.0.0-alpha.
|
|
5
|
+
"version": "1.0.0-alpha.20250109.2",
|
|
6
6
|
"description": "A generated SDK for PurviewWorkflow.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
@@ -100,8 +100,7 @@
|
|
|
100
100
|
"productSlugs": [
|
|
101
101
|
"azure"
|
|
102
102
|
],
|
|
103
|
-
"disableDocsMs": true
|
|
104
|
-
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure-rest/purview-workflow?view=azure-node-preview"
|
|
103
|
+
"disableDocsMs": true
|
|
105
104
|
},
|
|
106
105
|
"type": "module",
|
|
107
106
|
"tshy": {
|