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.
- purviewcli/__init__.py +27 -0
- purviewcli/__main__.py +15 -0
- purviewcli/cli/__init__.py +5 -0
- purviewcli/cli/account.py +199 -0
- purviewcli/cli/cli.py +170 -0
- purviewcli/cli/collections.py +502 -0
- purviewcli/cli/domain.py +361 -0
- purviewcli/cli/entity.py +2436 -0
- purviewcli/cli/glossary.py +533 -0
- purviewcli/cli/health.py +250 -0
- purviewcli/cli/insight.py +113 -0
- purviewcli/cli/lineage.py +1103 -0
- purviewcli/cli/management.py +141 -0
- purviewcli/cli/policystore.py +103 -0
- purviewcli/cli/relationship.py +75 -0
- purviewcli/cli/scan.py +357 -0
- purviewcli/cli/search.py +527 -0
- purviewcli/cli/share.py +478 -0
- purviewcli/cli/types.py +831 -0
- purviewcli/cli/unified_catalog.py +3540 -0
- purviewcli/cli/workflow.py +402 -0
- purviewcli/client/__init__.py +21 -0
- purviewcli/client/_account.py +1877 -0
- purviewcli/client/_collections.py +1761 -0
- purviewcli/client/_domain.py +414 -0
- purviewcli/client/_entity.py +3545 -0
- purviewcli/client/_glossary.py +3233 -0
- purviewcli/client/_health.py +501 -0
- purviewcli/client/_insight.py +2873 -0
- purviewcli/client/_lineage.py +2138 -0
- purviewcli/client/_management.py +2202 -0
- purviewcli/client/_policystore.py +2915 -0
- purviewcli/client/_relationship.py +1351 -0
- purviewcli/client/_scan.py +2607 -0
- purviewcli/client/_search.py +1472 -0
- purviewcli/client/_share.py +272 -0
- purviewcli/client/_types.py +2708 -0
- purviewcli/client/_unified_catalog.py +5112 -0
- purviewcli/client/_workflow.py +2734 -0
- purviewcli/client/api_client.py +1295 -0
- purviewcli/client/business_rules.py +675 -0
- purviewcli/client/config.py +231 -0
- purviewcli/client/data_quality.py +433 -0
- purviewcli/client/endpoint.py +123 -0
- purviewcli/client/endpoints.py +554 -0
- purviewcli/client/exceptions.py +38 -0
- purviewcli/client/lineage_visualization.py +797 -0
- purviewcli/client/monitoring_dashboard.py +712 -0
- purviewcli/client/rate_limiter.py +30 -0
- purviewcli/client/retry_handler.py +125 -0
- purviewcli/client/scanning_operations.py +523 -0
- purviewcli/client/settings.py +1 -0
- purviewcli/client/sync_client.py +250 -0
- purviewcli/plugins/__init__.py +1 -0
- purviewcli/plugins/plugin_system.py +709 -0
- pvw_cli-1.2.8.dist-info/METADATA +1618 -0
- pvw_cli-1.2.8.dist-info/RECORD +60 -0
- pvw_cli-1.2.8.dist-info/WHEEL +5 -0
- pvw_cli-1.2.8.dist-info/entry_points.txt +3 -0
- pvw_cli-1.2.8.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Governance Domain Management Client for Microsoft Purview
|
|
3
|
+
|
|
4
|
+
NOTE: Governance Domains are currently not available in the public Microsoft Purview REST API.
|
|
5
|
+
This feature may be in preview, portal-only, or planned for future release.
|
|
6
|
+
|
|
7
|
+
This client provides a foundation for when the API becomes available and includes
|
|
8
|
+
alternative approaches for domain-like organization.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from .endpoint import Endpoint
|
|
12
|
+
from .endpoints import ENDPOINTS, DATAMAP_API_VERSION
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Domain(Endpoint):
|
|
16
|
+
"""Client for managing governance domains in Microsoft Purview."""
|
|
17
|
+
|
|
18
|
+
def __init__(self):
|
|
19
|
+
Endpoint.__init__(self)
|
|
20
|
+
self.app = "catalog" # Use catalog app as fallback
|
|
21
|
+
|
|
22
|
+
def domainsList(self, args):
|
|
23
|
+
"""
|
|
24
|
+
Retrieve domain information.
|
|
25
|
+
|
|
26
|
+
Retrieves detailed information about the specified domain.
|
|
27
|
+
Returns complete domain metadata and properties.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
args: Dictionary of operation arguments.
|
|
31
|
+
Contains operation-specific parameters.
|
|
32
|
+
See method implementation for details.
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
List of resource dictionaries, each containing:
|
|
36
|
+
- guid (str): Unique identifier
|
|
37
|
+
- name (str): Resource name
|
|
38
|
+
- attributes (dict): Resource attributes
|
|
39
|
+
- status (str): Resource status
|
|
40
|
+
|
|
41
|
+
Returns empty list if no resources found.
|
|
42
|
+
|
|
43
|
+
Raises:
|
|
44
|
+
ValueError: When required parameters are missing or invalid:
|
|
45
|
+
- Empty or None values for required fields
|
|
46
|
+
- Invalid GUID format
|
|
47
|
+
- Out-of-range values
|
|
48
|
+
|
|
49
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
50
|
+
- DefaultAzureCredential not configured
|
|
51
|
+
- Insufficient permissions
|
|
52
|
+
- Expired authentication token
|
|
53
|
+
|
|
54
|
+
HTTPError: When Purview API returns error:
|
|
55
|
+
- 400: Bad request (invalid parameters)
|
|
56
|
+
- 401: Unauthorized (authentication failed)
|
|
57
|
+
- 403: Forbidden (insufficient permissions)
|
|
58
|
+
- 404: Resource not found
|
|
59
|
+
- 429: Rate limit exceeded
|
|
60
|
+
- 500: Internal server error
|
|
61
|
+
|
|
62
|
+
NetworkError: When network connectivity fails
|
|
63
|
+
|
|
64
|
+
Example:
|
|
65
|
+
# Basic usage
|
|
66
|
+
client = Domain()
|
|
67
|
+
|
|
68
|
+
result = client.domainsList(args=...)
|
|
69
|
+
print(f"Result: {result}")
|
|
70
|
+
|
|
71
|
+
Use Cases:
|
|
72
|
+
- Data Discovery: Find and explore data assets
|
|
73
|
+
- Compliance Auditing: Review metadata and classifications
|
|
74
|
+
- Reporting: Generate catalog reports
|
|
75
|
+
"""
|
|
76
|
+
result = {
|
|
77
|
+
"status": "not_available",
|
|
78
|
+
"message": "Governance Domains are not currently available in the public Microsoft Purview REST API. Please use the Azure portal to manage governance domains, or use collections as an alternative organizational structure.",
|
|
79
|
+
"alternatives": [
|
|
80
|
+
"Use collections to organize assets hierarchically",
|
|
81
|
+
"Use custom entity attributes to tag assets with domain information",
|
|
82
|
+
"Use glossary terms to create domain vocabularies",
|
|
83
|
+
],
|
|
84
|
+
}
|
|
85
|
+
return result
|
|
86
|
+
|
|
87
|
+
def domainsCreate(self, args):
|
|
88
|
+
"""
|
|
89
|
+
Create a new domain.
|
|
90
|
+
|
|
91
|
+
Creates a new domain in Microsoft Purview.
|
|
92
|
+
Requires appropriate permissions and valid domain definition.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
args: Dictionary of operation arguments.
|
|
96
|
+
Contains operation-specific parameters.
|
|
97
|
+
See method implementation for details.
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
Dictionary containing created domain:
|
|
101
|
+
{
|
|
102
|
+
'guid': str, # Unique identifier
|
|
103
|
+
'name': str, # Resource name
|
|
104
|
+
'status': str, # Creation status
|
|
105
|
+
'attributes': dict, # Resource attributes
|
|
106
|
+
'createTime': int # Creation timestamp
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
Raises:
|
|
110
|
+
ValueError: When required parameters are missing or invalid:
|
|
111
|
+
- Empty or None values for required fields
|
|
112
|
+
- Invalid GUID format
|
|
113
|
+
- Out-of-range values
|
|
114
|
+
|
|
115
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
116
|
+
- DefaultAzureCredential not configured
|
|
117
|
+
- Insufficient permissions
|
|
118
|
+
- Expired authentication token
|
|
119
|
+
|
|
120
|
+
HTTPError: When Purview API returns error:
|
|
121
|
+
- 400: Bad request (invalid parameters)
|
|
122
|
+
- 401: Unauthorized (authentication failed)
|
|
123
|
+
- 403: Forbidden (insufficient permissions)
|
|
124
|
+
- 404: Resource not found
|
|
125
|
+
- 409: Conflict (resource already exists)
|
|
126
|
+
- 429: Rate limit exceeded
|
|
127
|
+
- 500: Internal server error
|
|
128
|
+
|
|
129
|
+
NetworkError: When network connectivity fails
|
|
130
|
+
|
|
131
|
+
Example:
|
|
132
|
+
# Basic usage
|
|
133
|
+
client = Domain()
|
|
134
|
+
|
|
135
|
+
result = client.domainsCreate(args=...)
|
|
136
|
+
print(f"Result: {result}")
|
|
137
|
+
|
|
138
|
+
# With detailed data
|
|
139
|
+
data = {
|
|
140
|
+
'name': 'My Resource',
|
|
141
|
+
'description': 'Resource description',
|
|
142
|
+
'attributes': {
|
|
143
|
+
'key1': 'value1',
|
|
144
|
+
'key2': 'value2'
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
result = client.domainsCreate(data)
|
|
149
|
+
print(f"Created/Updated: {result['guid']}")
|
|
150
|
+
|
|
151
|
+
Use Cases:
|
|
152
|
+
- Data Onboarding: Register new data sources in catalog
|
|
153
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
154
|
+
- Automation: Programmatically populate catalog
|
|
155
|
+
"""
|
|
156
|
+
result = {
|
|
157
|
+
"status": "not_available",
|
|
158
|
+
"message": "Governance Domain creation is not currently available in the public Microsoft Purview REST API. Please use the Azure portal or consider using collections as an alternative.",
|
|
159
|
+
"suggested_action": f"Consider creating a collection named '{args.get('--name', 'unknown')}' instead using: pvw collections create --collection-name {args.get('--name', 'domain-name')}",
|
|
160
|
+
}
|
|
161
|
+
return result
|
|
162
|
+
|
|
163
|
+
def domainsGet(self, args):
|
|
164
|
+
"""
|
|
165
|
+
Retrieve domain information.
|
|
166
|
+
|
|
167
|
+
Retrieves detailed information about the specified domain.
|
|
168
|
+
Returns complete domain metadata and properties.
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
args: Dictionary of operation arguments.
|
|
172
|
+
Contains operation-specific parameters.
|
|
173
|
+
See method implementation for details.
|
|
174
|
+
|
|
175
|
+
Returns:
|
|
176
|
+
Dictionary containing domain information:
|
|
177
|
+
{
|
|
178
|
+
'guid': str, # Unique identifier
|
|
179
|
+
'name': str, # Resource name
|
|
180
|
+
'attributes': dict, # Resource attributes
|
|
181
|
+
'status': str, # Resource status
|
|
182
|
+
'updateTime': int # Last update timestamp
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
Raises:
|
|
186
|
+
ValueError: When required parameters are missing or invalid:
|
|
187
|
+
- Empty or None values for required fields
|
|
188
|
+
- Invalid GUID format
|
|
189
|
+
- Out-of-range values
|
|
190
|
+
|
|
191
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
192
|
+
- DefaultAzureCredential not configured
|
|
193
|
+
- Insufficient permissions
|
|
194
|
+
- Expired authentication token
|
|
195
|
+
|
|
196
|
+
HTTPError: When Purview API returns error:
|
|
197
|
+
- 400: Bad request (invalid parameters)
|
|
198
|
+
- 401: Unauthorized (authentication failed)
|
|
199
|
+
- 403: Forbidden (insufficient permissions)
|
|
200
|
+
- 404: Resource not found
|
|
201
|
+
- 429: Rate limit exceeded
|
|
202
|
+
- 500: Internal server error
|
|
203
|
+
|
|
204
|
+
NetworkError: When network connectivity fails
|
|
205
|
+
|
|
206
|
+
Example:
|
|
207
|
+
# Basic usage
|
|
208
|
+
client = Domain()
|
|
209
|
+
|
|
210
|
+
result = client.domainsGet(args=...)
|
|
211
|
+
print(f"Result: {result}")
|
|
212
|
+
|
|
213
|
+
Use Cases:
|
|
214
|
+
- Data Discovery: Find and explore data assets
|
|
215
|
+
- Compliance Auditing: Review metadata and classifications
|
|
216
|
+
- Reporting: Generate catalog reports
|
|
217
|
+
"""
|
|
218
|
+
domain_name = args.get("--domainName", "unknown")
|
|
219
|
+
result = {
|
|
220
|
+
"status": "not_available",
|
|
221
|
+
"message": f"Cannot retrieve governance domain '{domain_name}' - feature not available in public API",
|
|
222
|
+
"suggested_action": f"Try: pvw collections get --collection-name {domain_name}",
|
|
223
|
+
}
|
|
224
|
+
return result
|
|
225
|
+
|
|
226
|
+
def domainsUpdate(self, args):
|
|
227
|
+
"""
|
|
228
|
+
Update an existing domain.
|
|
229
|
+
|
|
230
|
+
Updates an existing domain with new values.
|
|
231
|
+
Only specified fields are modified; others remain unchanged.
|
|
232
|
+
|
|
233
|
+
Args:
|
|
234
|
+
args: Dictionary of operation arguments.
|
|
235
|
+
Contains operation-specific parameters.
|
|
236
|
+
See method implementation for details.
|
|
237
|
+
|
|
238
|
+
Returns:
|
|
239
|
+
Dictionary containing updated domain:
|
|
240
|
+
{
|
|
241
|
+
'guid': str, # Unique identifier
|
|
242
|
+
'attributes': dict, # Updated attributes
|
|
243
|
+
'updateTime': int # Update timestamp
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
Raises:
|
|
247
|
+
ValueError: When required parameters are missing or invalid:
|
|
248
|
+
- Empty or None values for required fields
|
|
249
|
+
- Invalid GUID format
|
|
250
|
+
- Out-of-range values
|
|
251
|
+
|
|
252
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
253
|
+
- DefaultAzureCredential not configured
|
|
254
|
+
- Insufficient permissions
|
|
255
|
+
- Expired authentication token
|
|
256
|
+
|
|
257
|
+
HTTPError: When Purview API returns error:
|
|
258
|
+
- 400: Bad request (invalid parameters)
|
|
259
|
+
- 401: Unauthorized (authentication failed)
|
|
260
|
+
- 403: Forbidden (insufficient permissions)
|
|
261
|
+
- 404: Resource not found
|
|
262
|
+
- 429: Rate limit exceeded
|
|
263
|
+
- 500: Internal server error
|
|
264
|
+
|
|
265
|
+
NetworkError: When network connectivity fails
|
|
266
|
+
|
|
267
|
+
Example:
|
|
268
|
+
# Basic usage
|
|
269
|
+
client = Domain()
|
|
270
|
+
|
|
271
|
+
result = client.domainsUpdate(args=...)
|
|
272
|
+
print(f"Result: {result}")
|
|
273
|
+
|
|
274
|
+
# With detailed data
|
|
275
|
+
data = {
|
|
276
|
+
'name': 'My Resource',
|
|
277
|
+
'description': 'Resource description',
|
|
278
|
+
'attributes': {
|
|
279
|
+
'key1': 'value1',
|
|
280
|
+
'key2': 'value2'
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
result = client.domainsUpdate(data)
|
|
285
|
+
print(f"Created/Updated: {result['guid']}")
|
|
286
|
+
|
|
287
|
+
Use Cases:
|
|
288
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
289
|
+
- Ownership Changes: Reassign data ownership
|
|
290
|
+
- Classification: Apply or modify data classifications
|
|
291
|
+
"""
|
|
292
|
+
domain_name = args.get("--domainName", "unknown")
|
|
293
|
+
result = {
|
|
294
|
+
"status": "not_available",
|
|
295
|
+
"message": f"Cannot update governance domain '{domain_name}' - feature not available in public API",
|
|
296
|
+
}
|
|
297
|
+
return result
|
|
298
|
+
|
|
299
|
+
def domainsDelete(self, args):
|
|
300
|
+
"""
|
|
301
|
+
Delete a domain.
|
|
302
|
+
|
|
303
|
+
Permanently deletes the specified domain.
|
|
304
|
+
This operation cannot be undone. Use with caution.
|
|
305
|
+
|
|
306
|
+
Args:
|
|
307
|
+
args: Dictionary of operation arguments.
|
|
308
|
+
Contains operation-specific parameters.
|
|
309
|
+
See method implementation for details.
|
|
310
|
+
|
|
311
|
+
Returns:
|
|
312
|
+
Dictionary with deletion status:
|
|
313
|
+
{
|
|
314
|
+
'guid': str, # Deleted resource ID
|
|
315
|
+
'status': str, # Deletion status
|
|
316
|
+
'message': str # Confirmation message
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
Raises:
|
|
320
|
+
ValueError: When required parameters are missing or invalid:
|
|
321
|
+
- Empty or None values for required fields
|
|
322
|
+
- Invalid GUID format
|
|
323
|
+
- Out-of-range values
|
|
324
|
+
|
|
325
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
326
|
+
- DefaultAzureCredential not configured
|
|
327
|
+
- Insufficient permissions
|
|
328
|
+
- Expired authentication token
|
|
329
|
+
|
|
330
|
+
HTTPError: When Purview API returns error:
|
|
331
|
+
- 400: Bad request (invalid parameters)
|
|
332
|
+
- 401: Unauthorized (authentication failed)
|
|
333
|
+
- 403: Forbidden (insufficient permissions)
|
|
334
|
+
- 404: Resource not found
|
|
335
|
+
- 429: Rate limit exceeded
|
|
336
|
+
- 500: Internal server error
|
|
337
|
+
|
|
338
|
+
NetworkError: When network connectivity fails
|
|
339
|
+
|
|
340
|
+
Example:
|
|
341
|
+
# Basic usage
|
|
342
|
+
client = Domain()
|
|
343
|
+
|
|
344
|
+
result = client.domainsDelete(args=...)
|
|
345
|
+
print(f"Result: {result}")
|
|
346
|
+
|
|
347
|
+
Use Cases:
|
|
348
|
+
- Data Cleanup: Remove obsolete or test data
|
|
349
|
+
- Decommissioning: Delete resources no longer in use
|
|
350
|
+
- Testing: Clean up test environments
|
|
351
|
+
"""
|
|
352
|
+
domain_name = args.get("--domainName", "unknown")
|
|
353
|
+
result = {
|
|
354
|
+
"status": "not_available",
|
|
355
|
+
"message": f"Cannot delete governance domain '{domain_name}' - feature not available in public API",
|
|
356
|
+
}
|
|
357
|
+
return result
|
|
358
|
+
|
|
359
|
+
def get_api_version(self):
|
|
360
|
+
"""
|
|
361
|
+
Get the API version string for governance domain (datamap) operations.
|
|
362
|
+
|
|
363
|
+
Returns:
|
|
364
|
+
str: The API version string (e.g., "2023-09-01") used for all domain-related endpoints.
|
|
365
|
+
|
|
366
|
+
Raises:
|
|
367
|
+
None: This method does not raise exceptions.
|
|
368
|
+
|
|
369
|
+
Example:
|
|
370
|
+
```python
|
|
371
|
+
domain = Domain()
|
|
372
|
+
version = domain.get_api_version()
|
|
373
|
+
print(f"Using API version: {version}")
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
Use Cases:
|
|
377
|
+
- Retrieve the current API version for documentation purposes
|
|
378
|
+
- Construct custom API requests with correct version parameter
|
|
379
|
+
- Validate API compatibility when integrating with other systems
|
|
380
|
+
- Log API version information for troubleshooting
|
|
381
|
+
"""
|
|
382
|
+
return DATAMAP_API_VERSION
|
|
383
|
+
|
|
384
|
+
def get_api_version_params(self):
|
|
385
|
+
"""
|
|
386
|
+
Get the API version parameter dictionary for governance domain operations.
|
|
387
|
+
|
|
388
|
+
Returns:
|
|
389
|
+
dict: Dictionary containing the API version parameter in the format
|
|
390
|
+
{"api-version": "2023-09-01"} ready for use in HTTP requests.
|
|
391
|
+
|
|
392
|
+
Raises:
|
|
393
|
+
None: This method does not raise exceptions.
|
|
394
|
+
|
|
395
|
+
Example:
|
|
396
|
+
```python
|
|
397
|
+
domain = Domain()
|
|
398
|
+
params = domain.get_api_version_params()
|
|
399
|
+
# Use in requests: requests.get(url, params=params)
|
|
400
|
+
print(params) # {"api-version": "2023-09-01"}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
Use Cases:
|
|
404
|
+
- Automatically add correct API version to HTTP request parameters
|
|
405
|
+
- Ensure consistent API version across all domain operations
|
|
406
|
+
- Simplify request parameter construction when calling domain endpoints
|
|
407
|
+
- Maintain version compatibility when API versions change
|
|
408
|
+
"""
|
|
409
|
+
return {"api-version": DATAMAP_API_VERSION}
|
|
410
|
+
|
|
411
|
+
# Example usage in a real API call (when available):
|
|
412
|
+
# version = self.get_api_version()
|
|
413
|
+
# params = self.get_api_version_params()
|
|
414
|
+
# ... use version/params in requests ...
|