pvw-cli 1.2.8__py3-none-any.whl

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.

Potentially problematic release.


This version of pvw-cli might be problematic. Click here for more details.

Files changed (60) hide show
  1. purviewcli/__init__.py +27 -0
  2. purviewcli/__main__.py +15 -0
  3. purviewcli/cli/__init__.py +5 -0
  4. purviewcli/cli/account.py +199 -0
  5. purviewcli/cli/cli.py +170 -0
  6. purviewcli/cli/collections.py +502 -0
  7. purviewcli/cli/domain.py +361 -0
  8. purviewcli/cli/entity.py +2436 -0
  9. purviewcli/cli/glossary.py +533 -0
  10. purviewcli/cli/health.py +250 -0
  11. purviewcli/cli/insight.py +113 -0
  12. purviewcli/cli/lineage.py +1103 -0
  13. purviewcli/cli/management.py +141 -0
  14. purviewcli/cli/policystore.py +103 -0
  15. purviewcli/cli/relationship.py +75 -0
  16. purviewcli/cli/scan.py +357 -0
  17. purviewcli/cli/search.py +527 -0
  18. purviewcli/cli/share.py +478 -0
  19. purviewcli/cli/types.py +831 -0
  20. purviewcli/cli/unified_catalog.py +3540 -0
  21. purviewcli/cli/workflow.py +402 -0
  22. purviewcli/client/__init__.py +21 -0
  23. purviewcli/client/_account.py +1877 -0
  24. purviewcli/client/_collections.py +1761 -0
  25. purviewcli/client/_domain.py +414 -0
  26. purviewcli/client/_entity.py +3545 -0
  27. purviewcli/client/_glossary.py +3233 -0
  28. purviewcli/client/_health.py +501 -0
  29. purviewcli/client/_insight.py +2873 -0
  30. purviewcli/client/_lineage.py +2138 -0
  31. purviewcli/client/_management.py +2202 -0
  32. purviewcli/client/_policystore.py +2915 -0
  33. purviewcli/client/_relationship.py +1351 -0
  34. purviewcli/client/_scan.py +2607 -0
  35. purviewcli/client/_search.py +1472 -0
  36. purviewcli/client/_share.py +272 -0
  37. purviewcli/client/_types.py +2708 -0
  38. purviewcli/client/_unified_catalog.py +5112 -0
  39. purviewcli/client/_workflow.py +2734 -0
  40. purviewcli/client/api_client.py +1295 -0
  41. purviewcli/client/business_rules.py +675 -0
  42. purviewcli/client/config.py +231 -0
  43. purviewcli/client/data_quality.py +433 -0
  44. purviewcli/client/endpoint.py +123 -0
  45. purviewcli/client/endpoints.py +554 -0
  46. purviewcli/client/exceptions.py +38 -0
  47. purviewcli/client/lineage_visualization.py +797 -0
  48. purviewcli/client/monitoring_dashboard.py +712 -0
  49. purviewcli/client/rate_limiter.py +30 -0
  50. purviewcli/client/retry_handler.py +125 -0
  51. purviewcli/client/scanning_operations.py +523 -0
  52. purviewcli/client/settings.py +1 -0
  53. purviewcli/client/sync_client.py +250 -0
  54. purviewcli/plugins/__init__.py +1 -0
  55. purviewcli/plugins/plugin_system.py +709 -0
  56. pvw_cli-1.2.8.dist-info/METADATA +1618 -0
  57. pvw_cli-1.2.8.dist-info/RECORD +60 -0
  58. pvw_cli-1.2.8.dist-info/WHEEL +5 -0
  59. pvw_cli-1.2.8.dist-info/entry_points.txt +3 -0
  60. pvw_cli-1.2.8.dist-info/top_level.txt +1 -0
@@ -0,0 +1,402 @@
1
+ """
2
+ Microsoft Purview Workflow CLI Commands
3
+ Provides command-line interface for workflow management operations
4
+ """
5
+
6
+ import click
7
+ import json
8
+ from rich.console import Console
9
+
10
+ console = Console()
11
+
12
+
13
+ @click.group()
14
+ def workflow():
15
+ """Manage workflows and approval processes in Microsoft Purview."""
16
+ pass
17
+
18
+
19
+ # ========== Basic Workflow Management Commands ==========
20
+
21
+
22
+ @workflow.command()
23
+ @click.option("--json", "output_json", is_flag=True, help="Output results in JSON format")
24
+ @click.pass_context
25
+ def list(ctx, output_json):
26
+ """List all workflows."""
27
+ try:
28
+ if ctx.obj and ctx.obj.get("mock"):
29
+ console.print("[yellow]🎭 Mock: workflow list command[/yellow]")
30
+ console.print("[green][OK] Mock workflow list completed successfully[/green]")
31
+ return
32
+
33
+ from purviewcli.client._workflow import Workflow
34
+ from rich.table import Table
35
+
36
+ args = {}
37
+ workflow_client = Workflow()
38
+ result = workflow_client.workflowListWorkflows(args)
39
+
40
+ # Handle response structure
41
+ if isinstance(result, dict):
42
+ workflows = result.get("results", []) or result.get("value", [])
43
+ elif isinstance(result, (list, tuple)):
44
+ workflows = result
45
+ else:
46
+ workflows = []
47
+
48
+ if not workflows:
49
+ console.print("[yellow][!] No workflows found[/yellow]")
50
+ return
51
+
52
+ # Output in JSON format if requested
53
+ if output_json:
54
+ console.print(json.dumps(workflows, indent=2))
55
+ return
56
+
57
+ table = Table(title="Workflows", show_lines=True)
58
+ table.add_column("ID", style="cyan", no_wrap=True, width=38)
59
+ table.add_column("Name", style="green", width=30)
60
+ table.add_column("Type", style="blue")
61
+ table.add_column("Status", style="yellow")
62
+ table.add_column("Description", style="white")
63
+
64
+ for wf in workflows:
65
+ if not isinstance(wf, dict):
66
+ continue
67
+
68
+ workflow_id = wf.get("id", "N/A")
69
+ name = wf.get("name", "N/A")
70
+ wf_type = wf.get("type", "N/A")
71
+ status = wf.get("status", "N/A")
72
+ description = wf.get("description", "")
73
+
74
+ # Truncate description if too long
75
+ if len(description) > 60:
76
+ description = description[:60] + "..."
77
+
78
+ table.add_row(workflow_id, name, wf_type, status, description)
79
+
80
+ console.print(table)
81
+ console.print(f"\n[dim]Total: {len(workflows)} workflow(s)[/dim]")
82
+
83
+ except Exception as e:
84
+ console.print(f"[red][X] Error executing workflow list: {str(e)}[/red]")
85
+
86
+
87
+ @workflow.command()
88
+ @click.option("--workflow-id", required=True, help="Workflow ID")
89
+ @click.option(
90
+ "--payload-file",
91
+ required=True,
92
+ type=click.Path(exists=True),
93
+ help="JSON file with workflow definition",
94
+ )
95
+ @click.pass_context
96
+ def create(ctx, workflow_id, payload_file):
97
+ """Create a new workflow."""
98
+ try:
99
+ if ctx.obj and ctx.obj.get("mock"):
100
+ console.print("[yellow]🎭 Mock: workflow create command[/yellow]")
101
+ console.print(f"[dim]Workflow ID: {workflow_id}[/dim]")
102
+ console.print(f"[dim]Payload File: {payload_file}[/dim]")
103
+ console.print("[green][OK] Mock workflow create completed successfully[/green]")
104
+ return
105
+
106
+ from purviewcli.client._workflow import Workflow
107
+
108
+ args = {"--workflowId": workflow_id, "--payloadFile": payload_file}
109
+ workflow_client = Workflow()
110
+ result = workflow_client.workflowCreateWorkflow(args)
111
+
112
+ if result:
113
+ console.print("[green][OK] Workflow create completed successfully[/green]")
114
+ console.print(json.dumps(result, indent=2))
115
+ else:
116
+ console.print("[yellow][!] Workflow create completed with no result[/yellow]")
117
+ except Exception as e:
118
+ console.print(f"[red][X] Error executing workflow create: {str(e)}[/red]")
119
+
120
+
121
+ @workflow.command()
122
+ @click.option("--workflow-id", required=True, help="Workflow ID")
123
+ @click.pass_context
124
+ def get(ctx, workflow_id):
125
+ """Get a specific workflow."""
126
+ try:
127
+ if ctx.obj and ctx.obj.get("mock"):
128
+ console.print("[yellow]🎭 Mock: workflow get command[/yellow]")
129
+ console.print(f"[dim]Workflow ID: {workflow_id}[/dim]")
130
+ console.print("[green][OK] Mock workflow get completed successfully[/green]")
131
+ return
132
+
133
+ from purviewcli.client._workflow import Workflow
134
+
135
+ args = {"--workflowId": workflow_id}
136
+ workflow_client = Workflow()
137
+ result = workflow_client.workflowGetWorkflow(args)
138
+
139
+ if result:
140
+ console.print("[green][OK] Workflow get completed successfully[/green]")
141
+ console.print(json.dumps(result, indent=2))
142
+ else:
143
+ console.print("[yellow][!] Workflow not found[/yellow]")
144
+ except Exception as e:
145
+ console.print(f"[red][X] Error executing workflow get: {str(e)}[/red]")
146
+
147
+
148
+ @workflow.command()
149
+ @click.option("--workflow-id", required=True, help="Workflow ID")
150
+ @click.option(
151
+ "--payload-file", type=click.Path(exists=True), help="JSON file with execution parameters"
152
+ )
153
+ @click.pass_context
154
+ def execute(ctx, workflow_id, payload_file):
155
+ """Execute a workflow."""
156
+ try:
157
+ if ctx.obj and ctx.obj.get("mock"):
158
+ console.print("[yellow]🎭 Mock: workflow execute command[/yellow]")
159
+ console.print(f"[dim]Workflow ID: {workflow_id}[/dim]")
160
+ if payload_file:
161
+ console.print(f"[dim]Payload File: {payload_file}[/dim]")
162
+ console.print("[green][OK] Mock workflow execute completed successfully[/green]")
163
+ return
164
+
165
+ from purviewcli.client._workflow import Workflow
166
+
167
+ args = {"--workflowId": workflow_id}
168
+ if payload_file:
169
+ args["--payloadFile"] = payload_file
170
+ workflow_client = Workflow()
171
+ result = workflow_client.workflowExecuteWorkflow(args)
172
+
173
+ if result:
174
+ console.print("[green][OK] Workflow execute completed successfully[/green]")
175
+ console.print(json.dumps(result, indent=2))
176
+ else:
177
+ console.print("[yellow][!] Workflow execute completed with no result[/yellow]")
178
+ except Exception as e:
179
+ console.print(f"[red][X] Error executing workflow: {str(e)}[/red]")
180
+
181
+
182
+ @workflow.command()
183
+ @click.option("--workflow-id", required=True, help="Workflow ID")
184
+ @click.pass_context
185
+ def executions(ctx, workflow_id):
186
+ """List workflow executions."""
187
+ try:
188
+ if ctx.obj and ctx.obj.get("mock"):
189
+ console.print("[yellow]🎭 Mock: workflow executions command[/yellow]")
190
+ console.print(f"[dim]Workflow ID: {workflow_id}[/dim]")
191
+ console.print("[green][OK] Mock workflow executions completed successfully[/green]")
192
+ return
193
+
194
+ from purviewcli.client._workflow import Workflow
195
+
196
+ args = {"--workflowId": workflow_id}
197
+ workflow_client = Workflow()
198
+ result = workflow_client.workflowListWorkflowExecutions(args)
199
+
200
+ if result:
201
+ console.print("[green][OK] Workflow executions list completed successfully[/green]")
202
+ console.print(json.dumps(result, indent=2))
203
+ else:
204
+ console.print("[yellow][!] No workflow executions found[/yellow]")
205
+ except Exception as e:
206
+ console.print(f"[red][X] Error listing workflow executions: {str(e)}[/red]")
207
+
208
+
209
+ # ========== Approval Commands ==========
210
+
211
+
212
+ @workflow.command()
213
+ @click.option("--status", help="Filter by approval status")
214
+ @click.option("--assigned-to", help="Filter by assignee")
215
+ @click.pass_context
216
+ def approvals(ctx, status, assigned_to):
217
+ """List approval requests."""
218
+ try:
219
+ if ctx.obj and ctx.obj.get("mock"):
220
+ console.print("[yellow]🎭 Mock: workflow approvals command[/yellow]")
221
+ if status:
222
+ console.print(f"[dim]Status Filter: {status}[/dim]")
223
+ if assigned_to:
224
+ console.print(f"[dim]Assigned To: {assigned_to}[/dim]")
225
+ console.print("[green][OK] Mock workflow approvals completed successfully[/green]")
226
+ return
227
+
228
+ from purviewcli.client._workflow import Workflow
229
+
230
+ args = {}
231
+ if status:
232
+ args["--status"] = status
233
+ if assigned_to:
234
+ args["--assignedTo"] = assigned_to
235
+ workflow_client = Workflow()
236
+ result = workflow_client.workflowGetApprovalRequests(args)
237
+
238
+ if result:
239
+ console.print("[green][OK] Approval requests list completed successfully[/green]")
240
+ console.print(json.dumps(result, indent=2))
241
+ else:
242
+ console.print("[yellow][!] No approval requests found[/yellow]")
243
+ except Exception as e:
244
+ console.print(f"[red][X] Error listing approval requests: {str(e)}[/red]")
245
+
246
+
247
+ @workflow.command()
248
+ @click.option("--request-id", required=True, help="Approval request ID")
249
+ @click.option("--comments", help="Approval comments")
250
+ @click.pass_context
251
+ def approve(ctx, request_id, comments):
252
+ """Approve a request."""
253
+ try:
254
+ if ctx.obj and ctx.obj.get("mock"):
255
+ console.print("[yellow]🎭 Mock: workflow approve command[/yellow]")
256
+ console.print(f"[dim]Request ID: {request_id}[/dim]")
257
+ if comments:
258
+ console.print(f"[dim]Comments: {comments}[/dim]")
259
+ console.print("[green][OK] Mock workflow approve completed successfully[/green]")
260
+ return
261
+
262
+ from purviewcli.client._workflow import Workflow
263
+
264
+ args = {"--requestId": request_id}
265
+ if comments:
266
+ args["--comments"] = comments
267
+ workflow_client = Workflow()
268
+ result = workflow_client.workflowApproveRequest(args)
269
+
270
+ if result:
271
+ console.print("[green][OK] Request approved successfully[/green]")
272
+ console.print(json.dumps(result, indent=2))
273
+ else:
274
+ console.print("[yellow][!] Request approval completed with no result[/yellow]")
275
+ except Exception as e:
276
+ console.print(f"[red][X] Error approving request: {str(e)}[/red]")
277
+
278
+
279
+ @workflow.command()
280
+ @click.option("--request-id", required=True, help="Approval request ID")
281
+ @click.option("--comments", help="Rejection comments")
282
+ @click.pass_context
283
+ def reject(ctx, request_id, comments):
284
+ """Reject a request."""
285
+ try:
286
+ if ctx.obj and ctx.obj.get("mock"):
287
+ console.print("[yellow]🎭 Mock: workflow reject command[/yellow]")
288
+ console.print(f"[dim]Request ID: {request_id}[/dim]")
289
+ if comments:
290
+ console.print(f"[dim]Comments: {comments}[/dim]")
291
+ console.print("[green][OK] Mock workflow reject completed successfully[/green]")
292
+ return
293
+
294
+ from purviewcli.client._workflow import Workflow
295
+
296
+ args = {"--requestId": request_id}
297
+ if comments:
298
+ args["--comments"] = comments
299
+ workflow_client = Workflow()
300
+ result = workflow_client.workflowRejectRequest(args)
301
+
302
+ if result:
303
+ console.print("[green][OK] Request rejected successfully[/green]")
304
+ console.print(json.dumps(result, indent=2))
305
+ else:
306
+ console.print("[yellow][!] Request rejection completed with no result[/yellow]")
307
+ except Exception as e:
308
+ console.print(f"[red][X] Error rejecting request: {str(e)}[/red]")
309
+
310
+
311
+ # ========== Template Commands ==========
312
+
313
+
314
+ @workflow.command()
315
+ @click.pass_context
316
+ def templates(ctx):
317
+ """List available workflow templates."""
318
+ try:
319
+ if ctx.obj and ctx.obj.get("mock"):
320
+ console.print("[yellow]🎭 Mock: workflow templates command[/yellow]")
321
+ console.print("[green][OK] Mock workflow templates completed successfully[/green]")
322
+ return
323
+
324
+ from purviewcli.client._workflow import Workflow
325
+
326
+ args = {}
327
+ workflow_client = Workflow()
328
+ result = workflow_client.workflowListWorkflowTemplates(args)
329
+
330
+ if result:
331
+ console.print("[green][OK] Workflow templates list completed successfully[/green]")
332
+ console.print(json.dumps(result, indent=2))
333
+ else:
334
+ console.print("[yellow][!] No workflow templates found[/yellow]")
335
+ except Exception as e:
336
+ console.print(f"[red][X] Error listing workflow templates: {str(e)}[/red]")
337
+
338
+
339
+ @workflow.command()
340
+ @click.option("--template-id", required=True, help="Template ID")
341
+ @click.pass_context
342
+ def template(ctx, template_id):
343
+ """Get a specific workflow template."""
344
+ try:
345
+ if ctx.obj and ctx.obj.get("mock"):
346
+ console.print("[yellow]🎭 Mock: workflow template command[/yellow]")
347
+ console.print(f"[dim]Template ID: {template_id}[/dim]")
348
+ console.print("[green][OK] Mock workflow template completed successfully[/green]")
349
+ return
350
+
351
+ from purviewcli.client._workflow import Workflow
352
+
353
+ args = {"--templateId": template_id}
354
+ workflow_client = Workflow()
355
+ result = workflow_client.workflowGetWorkflowTemplate(args)
356
+
357
+ if result:
358
+ console.print("[green][OK] Workflow template get completed successfully[/green]")
359
+ console.print(json.dumps(result, indent=2))
360
+ else:
361
+ console.print("[yellow][!] Workflow template not found[/yellow]")
362
+ except Exception as e:
363
+ console.print(f"[red][X] Error getting workflow template: {str(e)}[/red]")
364
+
365
+
366
+ # ========== Validation Commands ==========
367
+
368
+
369
+ @workflow.command()
370
+ @click.option(
371
+ "--payload-file",
372
+ required=True,
373
+ type=click.Path(exists=True),
374
+ help="JSON file with workflow definition to validate",
375
+ )
376
+ @click.pass_context
377
+ def validate(ctx, payload_file):
378
+ """Validate a workflow definition."""
379
+ try:
380
+ if ctx.obj and ctx.obj.get("mock"):
381
+ console.print("[yellow]🎭 Mock: workflow validate command[/yellow]")
382
+ console.print(f"[dim]Payload File: {payload_file}[/dim]")
383
+ console.print("[green][OK] Mock workflow validate completed successfully[/green]")
384
+ return
385
+
386
+ from purviewcli.client._workflow import Workflow
387
+
388
+ args = {"--payloadFile": payload_file}
389
+ workflow_client = Workflow()
390
+ result = workflow_client.workflowValidateWorkflow(args)
391
+
392
+ if result:
393
+ console.print("[green][OK] Workflow validation completed successfully[/green]")
394
+ console.print(json.dumps(result, indent=2))
395
+ else:
396
+ console.print("[yellow][!] Workflow validation completed with no result[/yellow]")
397
+ except Exception as e:
398
+ console.print(f"[red][X] Error validating workflow: {str(e)}[/red]")
399
+
400
+
401
+ if __name__ == "__main__":
402
+ workflow()
@@ -0,0 +1,21 @@
1
+ from .api_client import PurviewClient
2
+ from ._entity import Entity
3
+ from ._glossary import Glossary
4
+ from ._unified_catalog import UnifiedCatalogClient
5
+ from ._collections import Collections
6
+ from ._lineage import Lineage
7
+ from ._search import Search
8
+ from ._types import Types
9
+ from ._relationship import Relationship
10
+
11
+ __all__ = [
12
+ "PurviewClient",
13
+ "Entity",
14
+ "Glossary",
15
+ "UnifiedCatalogClient",
16
+ "Collections",
17
+ "Lineage",
18
+ "Search",
19
+ "Types",
20
+ "Relationship",
21
+ ]