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,501 @@
1
+ """
2
+ Health API Client for Microsoft Purview Unified Catalog
3
+ Provides governance health monitoring and recommendations
4
+ """
5
+
6
+ from .endpoint import Endpoint, decorator, no_api_call_decorator
7
+
8
+
9
+ class Health(Endpoint):
10
+ """Health API operations for governance monitoring.
11
+
12
+ API Version: 2024-02-01-preview
13
+ Base Path: /datagovernance/health
14
+ """
15
+
16
+ def __init__(self):
17
+ Endpoint.__init__(self)
18
+ self.app = "datagovernance"
19
+
20
+ # ========================================
21
+ # HEALTH ACTIONS
22
+ # ========================================
23
+
24
+ @decorator
25
+ def query_health_actions(self, args):
26
+ """
27
+ Search for health metrics.
28
+
29
+ Searches for resources matching the specified criteria.
30
+ Supports filtering, pagination, and sorting.
31
+
32
+ Args:
33
+ args: Dictionary of operation arguments.
34
+ Contains operation-specific parameters.
35
+ See method implementation for details.
36
+
37
+ Returns:
38
+ Dictionary containing search results:
39
+ {
40
+ 'value': [...] # List of matching resources
41
+ 'count': int, # Total results count
42
+ 'nextLink': str # Pagination link (if applicable)
43
+ }
44
+
45
+ Raises:
46
+ ValueError: When required parameters are missing or invalid:
47
+ - Empty or None values for required fields
48
+ - Invalid GUID format
49
+ - Out-of-range values
50
+
51
+ AuthenticationError: When Azure credentials are invalid:
52
+ - DefaultAzureCredential not configured
53
+ - Insufficient permissions
54
+ - Expired authentication token
55
+
56
+ HTTPError: When Purview API returns error:
57
+ - 400: Bad request (invalid parameters)
58
+ - 401: Unauthorized (authentication failed)
59
+ - 403: Forbidden (insufficient permissions)
60
+ - 404: Resource not found
61
+ - 429: Rate limit exceeded
62
+ - 500: Internal server error
63
+
64
+ NetworkError: When network connectivity fails
65
+
66
+ Example:
67
+ # Basic usage
68
+ client = Health()
69
+
70
+ result = client.query_health_actions(args=...)
71
+ print(f"Result: {result}")
72
+
73
+ Use Cases:
74
+ - Data Discovery: Locate datasets by name or properties
75
+ - Impact Analysis: Find all assets related to a term
76
+ - Compliance: Identify sensitive data across catalog
77
+ """
78
+ self.method = "POST"
79
+ self.endpoint = "/datagovernance/health/actions/query"
80
+ self.params = {"api-version": "2024-02-01-preview"}
81
+
82
+ # Build filter payload
83
+ payload = {}
84
+
85
+ domain_id = args.get("--domain-id", [""])[0]
86
+ if domain_id:
87
+ payload["domainId"] = domain_id
88
+
89
+ severity = args.get("--severity", [""])[0]
90
+ if severity:
91
+ payload["severity"] = severity
92
+
93
+ status = args.get("--status", [""])[0]
94
+ if status:
95
+ payload["status"] = status
96
+
97
+ finding_type = args.get("--finding-type", [""])[0]
98
+ if finding_type:
99
+ payload["findingType"] = finding_type
100
+
101
+ target_type = args.get("--target-entity-type", [""])[0]
102
+ if target_type:
103
+ payload["targetEntityType"] = target_type
104
+
105
+ self.payload = payload
106
+
107
+ @decorator
108
+ def get_health_action(self, args):
109
+ """
110
+ Retrieve health metric information.
111
+
112
+ Retrieves detailed information about the specified health metric.
113
+ Returns complete health metric metadata and properties.
114
+
115
+ Args:
116
+ args: Dictionary of operation arguments.
117
+ Contains operation-specific parameters.
118
+ See method implementation for details.
119
+
120
+ Returns:
121
+ Dictionary containing health metric information:
122
+ {
123
+ 'guid': str, # Unique identifier
124
+ 'name': str, # Resource name
125
+ 'attributes': dict, # Resource attributes
126
+ 'status': str, # Resource status
127
+ 'updateTime': int # Last update timestamp
128
+ }
129
+
130
+ Raises:
131
+ ValueError: When required parameters are missing or invalid:
132
+ - Empty or None values for required fields
133
+ - Invalid GUID format
134
+ - Out-of-range values
135
+
136
+ AuthenticationError: When Azure credentials are invalid:
137
+ - DefaultAzureCredential not configured
138
+ - Insufficient permissions
139
+ - Expired authentication token
140
+
141
+ HTTPError: When Purview API returns error:
142
+ - 400: Bad request (invalid parameters)
143
+ - 401: Unauthorized (authentication failed)
144
+ - 403: Forbidden (insufficient permissions)
145
+ - 404: Resource not found
146
+ - 429: Rate limit exceeded
147
+ - 500: Internal server error
148
+
149
+ NetworkError: When network connectivity fails
150
+
151
+ Example:
152
+ # Basic usage
153
+ client = Health()
154
+
155
+ result = client.get_health_action(args=...)
156
+ print(f"Result: {result}")
157
+
158
+ Use Cases:
159
+ - Data Discovery: Find and explore data assets
160
+ - Compliance Auditing: Review metadata and classifications
161
+ - Reporting: Generate catalog reports
162
+ """
163
+ action_id = args.get("--action-id", [""])[0]
164
+
165
+ self.method = "GET"
166
+ self.endpoint = f"/datagovernance/health/actions/{action_id}"
167
+ self.params = {"api-version": "2024-02-01-preview"}
168
+
169
+ @decorator
170
+ def update_health_action(self, args):
171
+ """
172
+ Update an existing health metric.
173
+
174
+ Updates an existing health metric with new values.
175
+ Only specified fields are modified; others remain unchanged.
176
+
177
+ Args:
178
+ args: Dictionary of operation arguments.
179
+ Contains operation-specific parameters.
180
+ See method implementation for details.
181
+
182
+ Returns:
183
+ Dictionary containing updated health metric:
184
+ {
185
+ 'guid': str, # Unique identifier
186
+ 'attributes': dict, # Updated attributes
187
+ 'updateTime': int # Update timestamp
188
+ }
189
+
190
+ Raises:
191
+ ValueError: When required parameters are missing or invalid:
192
+ - Empty or None values for required fields
193
+ - Invalid GUID format
194
+ - Out-of-range values
195
+
196
+ AuthenticationError: When Azure credentials are invalid:
197
+ - DefaultAzureCredential not configured
198
+ - Insufficient permissions
199
+ - Expired authentication token
200
+
201
+ HTTPError: When Purview API returns error:
202
+ - 400: Bad request (invalid parameters)
203
+ - 401: Unauthorized (authentication failed)
204
+ - 403: Forbidden (insufficient permissions)
205
+ - 404: Resource not found
206
+ - 429: Rate limit exceeded
207
+ - 500: Internal server error
208
+
209
+ NetworkError: When network connectivity fails
210
+
211
+ Example:
212
+ # Basic usage
213
+ client = Health()
214
+
215
+ result = client.update_health_action(args=...)
216
+ print(f"Result: {result}")
217
+
218
+ # With detailed data
219
+ data = {
220
+ 'name': 'My Resource',
221
+ 'description': 'Resource description',
222
+ 'attributes': {
223
+ 'key1': 'value1',
224
+ 'key2': 'value2'
225
+ }
226
+ }
227
+
228
+ result = client.update_health_action(data)
229
+ print(f"Created/Updated: {result['guid']}")
230
+
231
+ Use Cases:
232
+ - Metadata Enrichment: Update descriptions and tags
233
+ - Ownership Changes: Reassign data ownership
234
+ - Classification: Apply or modify data classifications
235
+ """
236
+ action_id = args.get("--action-id", [""])[0]
237
+
238
+ self.method = "PUT"
239
+ self.endpoint = f"/datagovernance/health/actions/{action_id}"
240
+ self.params = {"api-version": "2024-02-01-preview"}
241
+
242
+ payload = {}
243
+
244
+ status = args.get("--status", [""])[0]
245
+ if status:
246
+ payload["status"] = status
247
+
248
+ assigned_to = args.get("--assigned-to", [""])[0]
249
+ if assigned_to:
250
+ payload["assignedTo"] = [assigned_to] if assigned_to else []
251
+
252
+ reason = args.get("--reason", [""])[0]
253
+ if reason:
254
+ payload["reason"] = reason
255
+
256
+ self.payload = payload
257
+
258
+ @decorator
259
+ def delete_health_action(self, args):
260
+ """
261
+ Delete a health metric.
262
+
263
+ Permanently deletes the specified health metric.
264
+ This operation cannot be undone. Use with caution.
265
+
266
+ Args:
267
+ args: Dictionary of operation arguments.
268
+ Contains operation-specific parameters.
269
+ See method implementation for details.
270
+
271
+ Returns:
272
+ Dictionary with deletion status:
273
+ {
274
+ 'guid': str, # Deleted resource ID
275
+ 'status': str, # Deletion status
276
+ 'message': str # Confirmation message
277
+ }
278
+
279
+ Raises:
280
+ ValueError: When required parameters are missing or invalid:
281
+ - Empty or None values for required fields
282
+ - Invalid GUID format
283
+ - Out-of-range values
284
+
285
+ AuthenticationError: When Azure credentials are invalid:
286
+ - DefaultAzureCredential not configured
287
+ - Insufficient permissions
288
+ - Expired authentication token
289
+
290
+ HTTPError: When Purview API returns error:
291
+ - 400: Bad request (invalid parameters)
292
+ - 401: Unauthorized (authentication failed)
293
+ - 403: Forbidden (insufficient permissions)
294
+ - 404: Resource not found
295
+ - 429: Rate limit exceeded
296
+ - 500: Internal server error
297
+
298
+ NetworkError: When network connectivity fails
299
+
300
+ Example:
301
+ # Basic usage
302
+ client = Health()
303
+
304
+ result = client.delete_health_action(args=...)
305
+ print(f"Result: {result}")
306
+
307
+ Use Cases:
308
+ - Data Cleanup: Remove obsolete or test data
309
+ - Decommissioning: Delete resources no longer in use
310
+ - Testing: Clean up test environments
311
+ """
312
+ action_id = args.get("--action-id", [""])[0]
313
+
314
+ self.method = "DELETE"
315
+ self.endpoint = f"/datagovernance/health/actions/{action_id}"
316
+ self.params = {"api-version": "2024-02-01-preview"}
317
+
318
+ # ========================================
319
+ # STATISTICS & SUMMARIES
320
+ # ========================================
321
+
322
+ @decorator
323
+ def get_health_summary(self, args):
324
+ """
325
+ Retrieve health metric information.
326
+
327
+ Retrieves detailed information about the specified health metric.
328
+ Returns complete health metric metadata and properties.
329
+
330
+ Args:
331
+ args: Dictionary of operation arguments.
332
+ Contains operation-specific parameters.
333
+ See method implementation for details.
334
+
335
+ Returns:
336
+ Dictionary containing health metric information:
337
+ {
338
+ 'guid': str, # Unique identifier
339
+ 'name': str, # Resource name
340
+ 'attributes': dict, # Resource attributes
341
+ 'status': str, # Resource status
342
+ 'updateTime': int # Last update timestamp
343
+ }
344
+
345
+ Raises:
346
+ ValueError: When required parameters are missing or invalid:
347
+ - Empty or None values for required fields
348
+ - Invalid GUID format
349
+ - Out-of-range values
350
+
351
+ AuthenticationError: When Azure credentials are invalid:
352
+ - DefaultAzureCredential not configured
353
+ - Insufficient permissions
354
+ - Expired authentication token
355
+
356
+ HTTPError: When Purview API returns error:
357
+ - 400: Bad request (invalid parameters)
358
+ - 401: Unauthorized (authentication failed)
359
+ - 403: Forbidden (insufficient permissions)
360
+ - 404: Resource not found
361
+ - 429: Rate limit exceeded
362
+ - 500: Internal server error
363
+
364
+ NetworkError: When network connectivity fails
365
+
366
+ Example:
367
+ # Basic usage
368
+ client = Health()
369
+
370
+ result = client.get_health_summary(args=...)
371
+ print(f"Result: {result}")
372
+
373
+ Use Cases:
374
+ - Data Discovery: Find and explore data assets
375
+ - Compliance Auditing: Review metadata and classifications
376
+ - Reporting: Generate catalog reports
377
+ """
378
+ domain_id = args.get("--domain-id", [""])[0]
379
+
380
+ self.method = "GET"
381
+ self.endpoint = "/datagovernance/health/summary"
382
+ self.params = {
383
+ "api-version": "2024-02-01-preview",
384
+ "domainId": domain_id
385
+ }
386
+
387
+ # ========================================
388
+ # UTILITY METHODS
389
+ # ========================================
390
+
391
+ @no_api_call_decorator
392
+ def help(self, args):
393
+ """
394
+ Perform operation on resource.
395
+
396
+
397
+
398
+ Args:
399
+ args: Dictionary of operation arguments.
400
+ Contains operation-specific parameters.
401
+ See method implementation for details.
402
+
403
+ Returns:
404
+ [TODO: Specify return type and structure]
405
+ [TODO: Document nested fields]
406
+
407
+ Raises:
408
+ ValueError: When required parameters are missing or invalid:
409
+ - Empty or None values for required fields
410
+ - Invalid GUID format
411
+ - Out-of-range values
412
+
413
+ AuthenticationError: When Azure credentials are invalid:
414
+ - DefaultAzureCredential not configured
415
+ - Insufficient permissions
416
+ - Expired authentication token
417
+
418
+ HTTPError: When Purview API returns error:
419
+ - 400: Bad request (invalid parameters)
420
+ - 401: Unauthorized (authentication failed)
421
+ - 403: Forbidden (insufficient permissions)
422
+ - 404: Resource not found
423
+ - 429: Rate limit exceeded
424
+ - 500: Internal server error
425
+
426
+ NetworkError: When network connectivity fails
427
+
428
+ Example:
429
+ # Basic usage
430
+ client = Health()
431
+
432
+ result = client.help(args=...)
433
+ print(f"Result: {result}")
434
+
435
+ Use Cases:
436
+ - [TODO: Add specific use cases for this operation]
437
+ - [TODO: Include business context]
438
+ - [TODO: Explain when to use this method]
439
+ """
440
+ help_text = """
441
+ Microsoft Purview Health API Client
442
+
443
+ OVERVIEW:
444
+ The Health API provides automated governance monitoring and recommendations.
445
+ It identifies gaps in metadata, governance policies, and data quality.
446
+
447
+ OPERATIONS:
448
+ - query_health_actions: List all health findings with filters
449
+ - get_health_action: Get details of a specific finding
450
+ - update_health_action: Update status or assignment
451
+ - delete_health_action: Delete a finding
452
+ - get_health_summary: Get health statistics for a domain
453
+
454
+ HEALTH FINDING TYPES:
455
+ - Estate Curation: Critical data identification, classification
456
+ - Access and Use: Terms of use, compliant data use
457
+ - Discoverability: Data cataloging, term assignment
458
+ - Trusted Data: Data quality enablement
459
+ - Value Creation: Business OKRs alignment
460
+ - Metadata Quality Management: Description quality, completeness
461
+
462
+ SEVERITY LEVELS:
463
+ - High: Critical governance gaps
464
+ - Medium: Important improvements needed
465
+ - Low: Nice-to-have enhancements
466
+
467
+ STATUS VALUES:
468
+ - NotStarted: No action taken
469
+ - InProgress: Being addressed
470
+ - Resolved: Completed
471
+ - Dismissed: Acknowledged but not acting
472
+
473
+ FILTERS:
474
+ --domain-id: Filter by governance domain
475
+ --severity: High, Medium, Low
476
+ --status: NotStarted, InProgress, Resolved, Dismissed
477
+ --finding-type: Estate Curation, Access and Use, etc.
478
+ --target-entity-type: BusinessDomain, DataProduct, Term, etc.
479
+
480
+ EXAMPLES:
481
+ # List all health actions
482
+ pvcli health query
483
+
484
+ # List high severity issues
485
+ pvcli health query --severity High
486
+
487
+ # List actions for a specific domain
488
+ pvcli health query --domain-id xxx
489
+
490
+ # Get details of a specific action
491
+ pvcli health show --action-id xxx
492
+
493
+ # Mark action as in progress
494
+ pvcli health update --action-id xxx --status InProgress
495
+
496
+ # Assign action to a user
497
+ pvcli health update --action-id xxx --assigned-to user@domain.com
498
+
499
+ API VERSION: 2024-02-01-preview
500
+ """
501
+ return {"message": help_text}