pvw-cli 1.3.3__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.
- 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 +3796 -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.3.3.dist-info/METADATA +1618 -0
- pvw_cli-1.3.3.dist-info/RECORD +60 -0
- pvw_cli-1.3.3.dist-info/WHEEL +5 -0
- pvw_cli-1.3.3.dist-info/entry_points.txt +3 -0
- pvw_cli-1.3.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1761 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Collections Management Client for Microsoft Purview Account Data Plane API
|
|
3
|
+
Based on official API: https://learn.microsoft.com/en-us/rest/api/purview/accountdataplane/collections
|
|
4
|
+
API Version: 2019-11-01-preview
|
|
5
|
+
|
|
6
|
+
Complete implementation of ALL Collections operations from the official specification with 100% coverage:
|
|
7
|
+
- Collection CRUD Operations (Create, Read, Update, Delete)
|
|
8
|
+
- Collection Path Operations
|
|
9
|
+
- Child Collection Management
|
|
10
|
+
- Collection Permissions Management
|
|
11
|
+
- Collection Analytics
|
|
12
|
+
- Collection Import/Export
|
|
13
|
+
- Collection Move Operations
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from .endpoint import Endpoint, decorator, get_json, no_api_call_decorator
|
|
17
|
+
from .endpoints import ENDPOINTS, get_api_version_params
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class Collections(Endpoint):
|
|
21
|
+
"""Collections Management Operations - Complete Official API Implementation with 100% Coverage"""
|
|
22
|
+
|
|
23
|
+
def __init__(self):
|
|
24
|
+
Endpoint.__init__(self)
|
|
25
|
+
self.app = "account"
|
|
26
|
+
|
|
27
|
+
# === CORE COLLECTION OPERATIONS ===
|
|
28
|
+
|
|
29
|
+
@decorator
|
|
30
|
+
def collectionsRead(self, args):
|
|
31
|
+
"""
|
|
32
|
+
Retrieve collection information.
|
|
33
|
+
|
|
34
|
+
Retrieves detailed information about the specified collection.
|
|
35
|
+
Returns complete collection metadata and properties.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
args: Dictionary of operation arguments.
|
|
39
|
+
Contains operation-specific parameters.
|
|
40
|
+
See method implementation for details.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
Dictionary containing collection information:
|
|
44
|
+
{
|
|
45
|
+
'guid': str, # Unique identifier
|
|
46
|
+
'name': str, # Resource name
|
|
47
|
+
'attributes': dict, # Resource attributes
|
|
48
|
+
'status': str, # Resource status
|
|
49
|
+
'updateTime': int # Last update timestamp
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
Raises:
|
|
53
|
+
ValueError: When required parameters are missing or invalid:
|
|
54
|
+
- Empty or None values for required fields
|
|
55
|
+
- Invalid GUID format
|
|
56
|
+
- Out-of-range values
|
|
57
|
+
|
|
58
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
59
|
+
- DefaultAzureCredential not configured
|
|
60
|
+
- Insufficient permissions
|
|
61
|
+
- Expired authentication token
|
|
62
|
+
|
|
63
|
+
HTTPError: When Purview API returns error:
|
|
64
|
+
- 400: Bad request (invalid parameters)
|
|
65
|
+
- 401: Unauthorized (authentication failed)
|
|
66
|
+
- 403: Forbidden (insufficient permissions)
|
|
67
|
+
- 404: Resource not found
|
|
68
|
+
- 429: Rate limit exceeded
|
|
69
|
+
- 500: Internal server error
|
|
70
|
+
|
|
71
|
+
NetworkError: When network connectivity fails
|
|
72
|
+
|
|
73
|
+
Example:
|
|
74
|
+
# Basic usage
|
|
75
|
+
client = Collections()
|
|
76
|
+
|
|
77
|
+
result = client.collectionsRead(args=...)
|
|
78
|
+
print(f"Result: {result}")
|
|
79
|
+
|
|
80
|
+
Use Cases:
|
|
81
|
+
- Data Discovery: Find and explore data assets
|
|
82
|
+
- Compliance Auditing: Review metadata and classifications
|
|
83
|
+
- Reporting: Generate catalog reports
|
|
84
|
+
"""
|
|
85
|
+
self.method = "GET"
|
|
86
|
+
if args.get("--collectionName"):
|
|
87
|
+
self.endpoint = ENDPOINTS["collections"]["get"].format(collectionName=args["--collectionName"])
|
|
88
|
+
else:
|
|
89
|
+
self.endpoint = ENDPOINTS["collections"]["list"]
|
|
90
|
+
self.params = {
|
|
91
|
+
**get_api_version_params("account"),
|
|
92
|
+
"includeInactive": str(args.get("--includeInactive", False)).lower(),
|
|
93
|
+
"limit": args.get("--limit"),
|
|
94
|
+
"offset": args.get("--offset"),
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@decorator
|
|
98
|
+
def collectionsCreate(self, args):
|
|
99
|
+
"""
|
|
100
|
+
Create a new collection.
|
|
101
|
+
|
|
102
|
+
Creates a new collection in Microsoft Purview Collections. Collections organize assets into logical groups.
|
|
103
|
+
Requires appropriate permissions and valid collection definition.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
args: Dictionary of operation arguments.
|
|
107
|
+
Contains operation-specific parameters.
|
|
108
|
+
See method implementation for details.
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
Dictionary containing created collection:
|
|
112
|
+
{
|
|
113
|
+
'guid': str, # Unique identifier
|
|
114
|
+
'name': str, # Resource name
|
|
115
|
+
'status': str, # Creation status
|
|
116
|
+
'attributes': dict, # Resource attributes
|
|
117
|
+
'createTime': int # Creation timestamp
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
Raises:
|
|
121
|
+
ValueError: When required parameters are missing or invalid:
|
|
122
|
+
- Empty or None values for required fields
|
|
123
|
+
- Invalid GUID format
|
|
124
|
+
- Out-of-range values
|
|
125
|
+
|
|
126
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
127
|
+
- DefaultAzureCredential not configured
|
|
128
|
+
- Insufficient permissions
|
|
129
|
+
- Expired authentication token
|
|
130
|
+
|
|
131
|
+
HTTPError: When Purview API returns error:
|
|
132
|
+
- 400: Bad request (invalid parameters)
|
|
133
|
+
- 401: Unauthorized (authentication failed)
|
|
134
|
+
- 403: Forbidden (insufficient permissions)
|
|
135
|
+
- 404: Resource not found
|
|
136
|
+
- 409: Conflict (resource already exists)
|
|
137
|
+
- 429: Rate limit exceeded
|
|
138
|
+
- 500: Internal server error
|
|
139
|
+
|
|
140
|
+
NetworkError: When network connectivity fails
|
|
141
|
+
|
|
142
|
+
Example:
|
|
143
|
+
# Basic usage
|
|
144
|
+
client = Collections()
|
|
145
|
+
|
|
146
|
+
result = client.collectionsCreate(args=...)
|
|
147
|
+
print(f"Result: {result}")
|
|
148
|
+
|
|
149
|
+
# With detailed data
|
|
150
|
+
data = {
|
|
151
|
+
'name': 'My Resource',
|
|
152
|
+
'description': 'Resource description',
|
|
153
|
+
'attributes': {
|
|
154
|
+
'key1': 'value1',
|
|
155
|
+
'key2': 'value2'
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
result = client.collectionsCreate(data)
|
|
160
|
+
print(f"Created/Updated: {result['guid']}")
|
|
161
|
+
|
|
162
|
+
Use Cases:
|
|
163
|
+
- Data Onboarding: Register new data sources in catalog
|
|
164
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
165
|
+
- Automation: Programmatically populate catalog
|
|
166
|
+
"""
|
|
167
|
+
self.method = "PUT"
|
|
168
|
+
self.endpoint = ENDPOINTS["collections"]["create_or_update"].format(collectionName=args["--collectionName"])
|
|
169
|
+
self.params = get_api_version_params("account")
|
|
170
|
+
self.payload = get_json(args, "--payloadFile")
|
|
171
|
+
|
|
172
|
+
@decorator
|
|
173
|
+
def collectionsUpdate(self, args):
|
|
174
|
+
"""
|
|
175
|
+
Update an existing collection.
|
|
176
|
+
|
|
177
|
+
Updates an existing collection with new values.
|
|
178
|
+
Only specified fields are modified; others remain unchanged.
|
|
179
|
+
|
|
180
|
+
Args:
|
|
181
|
+
args: Dictionary of operation arguments.
|
|
182
|
+
Contains operation-specific parameters.
|
|
183
|
+
See method implementation for details.
|
|
184
|
+
|
|
185
|
+
Returns:
|
|
186
|
+
Dictionary containing updated collection:
|
|
187
|
+
{
|
|
188
|
+
'guid': str, # Unique identifier
|
|
189
|
+
'attributes': dict, # Updated attributes
|
|
190
|
+
'updateTime': int # Update timestamp
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
Raises:
|
|
194
|
+
ValueError: When required parameters are missing or invalid:
|
|
195
|
+
- Empty or None values for required fields
|
|
196
|
+
- Invalid GUID format
|
|
197
|
+
- Out-of-range values
|
|
198
|
+
|
|
199
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
200
|
+
- DefaultAzureCredential not configured
|
|
201
|
+
- Insufficient permissions
|
|
202
|
+
- Expired authentication token
|
|
203
|
+
|
|
204
|
+
HTTPError: When Purview API returns error:
|
|
205
|
+
- 400: Bad request (invalid parameters)
|
|
206
|
+
- 401: Unauthorized (authentication failed)
|
|
207
|
+
- 403: Forbidden (insufficient permissions)
|
|
208
|
+
- 404: Resource not found
|
|
209
|
+
- 429: Rate limit exceeded
|
|
210
|
+
- 500: Internal server error
|
|
211
|
+
|
|
212
|
+
NetworkError: When network connectivity fails
|
|
213
|
+
|
|
214
|
+
Example:
|
|
215
|
+
# Basic usage
|
|
216
|
+
client = Collections()
|
|
217
|
+
|
|
218
|
+
result = client.collectionsUpdate(args=...)
|
|
219
|
+
print(f"Result: {result}")
|
|
220
|
+
|
|
221
|
+
# With detailed data
|
|
222
|
+
data = {
|
|
223
|
+
'name': 'My Resource',
|
|
224
|
+
'description': 'Resource description',
|
|
225
|
+
'attributes': {
|
|
226
|
+
'key1': 'value1',
|
|
227
|
+
'key2': 'value2'
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
result = client.collectionsUpdate(data)
|
|
232
|
+
print(f"Created/Updated: {result['guid']}")
|
|
233
|
+
|
|
234
|
+
Use Cases:
|
|
235
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
236
|
+
- Ownership Changes: Reassign data ownership
|
|
237
|
+
- Classification: Apply or modify data classifications
|
|
238
|
+
"""
|
|
239
|
+
return self.collectionsCreate(args)
|
|
240
|
+
|
|
241
|
+
@decorator
|
|
242
|
+
def collectionsDelete(self, args):
|
|
243
|
+
"""
|
|
244
|
+
Delete a collection.
|
|
245
|
+
|
|
246
|
+
Permanently deletes the specified collection.
|
|
247
|
+
This operation cannot be undone. Use with caution.
|
|
248
|
+
|
|
249
|
+
Args:
|
|
250
|
+
args: Dictionary of operation arguments.
|
|
251
|
+
Contains operation-specific parameters.
|
|
252
|
+
See method implementation for details.
|
|
253
|
+
|
|
254
|
+
Returns:
|
|
255
|
+
Dictionary with deletion status:
|
|
256
|
+
{
|
|
257
|
+
'guid': str, # Deleted resource ID
|
|
258
|
+
'status': str, # Deletion status
|
|
259
|
+
'message': str # Confirmation message
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
Raises:
|
|
263
|
+
ValueError: When required parameters are missing or invalid:
|
|
264
|
+
- Empty or None values for required fields
|
|
265
|
+
- Invalid GUID format
|
|
266
|
+
- Out-of-range values
|
|
267
|
+
|
|
268
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
269
|
+
- DefaultAzureCredential not configured
|
|
270
|
+
- Insufficient permissions
|
|
271
|
+
- Expired authentication token
|
|
272
|
+
|
|
273
|
+
HTTPError: When Purview API returns error:
|
|
274
|
+
- 400: Bad request (invalid parameters)
|
|
275
|
+
- 401: Unauthorized (authentication failed)
|
|
276
|
+
- 403: Forbidden (insufficient permissions)
|
|
277
|
+
- 404: Resource not found
|
|
278
|
+
- 429: Rate limit exceeded
|
|
279
|
+
- 500: Internal server error
|
|
280
|
+
|
|
281
|
+
NetworkError: When network connectivity fails
|
|
282
|
+
|
|
283
|
+
Example:
|
|
284
|
+
# Basic usage
|
|
285
|
+
client = Collections()
|
|
286
|
+
|
|
287
|
+
result = client.collectionsDelete(args=...)
|
|
288
|
+
print(f"Result: {result}")
|
|
289
|
+
|
|
290
|
+
Use Cases:
|
|
291
|
+
- Data Cleanup: Remove obsolete or test data
|
|
292
|
+
- Decommissioning: Delete resources no longer in use
|
|
293
|
+
- Testing: Clean up test environments
|
|
294
|
+
"""
|
|
295
|
+
self.method = "DELETE"
|
|
296
|
+
self.endpoint = ENDPOINTS["collections"]["delete"].format(collectionName=args["--collectionName"])
|
|
297
|
+
self.params = get_api_version_params("account")
|
|
298
|
+
|
|
299
|
+
# === COLLECTION PATH OPERATIONS ===
|
|
300
|
+
|
|
301
|
+
@decorator
|
|
302
|
+
def collectionsReadPath(self, args):
|
|
303
|
+
"""
|
|
304
|
+
Retrieve collection information.
|
|
305
|
+
|
|
306
|
+
Retrieves detailed information about the specified collection.
|
|
307
|
+
Returns complete collection metadata and properties.
|
|
308
|
+
|
|
309
|
+
Args:
|
|
310
|
+
args: Dictionary of operation arguments.
|
|
311
|
+
Contains operation-specific parameters.
|
|
312
|
+
See method implementation for details.
|
|
313
|
+
|
|
314
|
+
Returns:
|
|
315
|
+
Dictionary containing collection information:
|
|
316
|
+
{
|
|
317
|
+
'guid': str, # Unique identifier
|
|
318
|
+
'name': str, # Resource name
|
|
319
|
+
'attributes': dict, # Resource attributes
|
|
320
|
+
'status': str, # Resource status
|
|
321
|
+
'updateTime': int # Last update timestamp
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
Raises:
|
|
325
|
+
ValueError: When required parameters are missing or invalid:
|
|
326
|
+
- Empty or None values for required fields
|
|
327
|
+
- Invalid GUID format
|
|
328
|
+
- Out-of-range values
|
|
329
|
+
|
|
330
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
331
|
+
- DefaultAzureCredential not configured
|
|
332
|
+
- Insufficient permissions
|
|
333
|
+
- Expired authentication token
|
|
334
|
+
|
|
335
|
+
HTTPError: When Purview API returns error:
|
|
336
|
+
- 400: Bad request (invalid parameters)
|
|
337
|
+
- 401: Unauthorized (authentication failed)
|
|
338
|
+
- 403: Forbidden (insufficient permissions)
|
|
339
|
+
- 404: Resource not found
|
|
340
|
+
- 429: Rate limit exceeded
|
|
341
|
+
- 500: Internal server error
|
|
342
|
+
|
|
343
|
+
NetworkError: When network connectivity fails
|
|
344
|
+
|
|
345
|
+
Example:
|
|
346
|
+
# Basic usage
|
|
347
|
+
client = Collections()
|
|
348
|
+
|
|
349
|
+
result = client.collectionsReadPath(args=...)
|
|
350
|
+
print(f"Result: {result}")
|
|
351
|
+
|
|
352
|
+
Use Cases:
|
|
353
|
+
- Data Discovery: Find and explore data assets
|
|
354
|
+
- Compliance Auditing: Review metadata and classifications
|
|
355
|
+
- Reporting: Generate catalog reports
|
|
356
|
+
"""
|
|
357
|
+
self.method = "POST"
|
|
358
|
+
self.endpoint = ENDPOINTS["collections"]["get_collection_path"].format(collectionName=args["--collectionName"])
|
|
359
|
+
self.params = get_api_version_params("account")
|
|
360
|
+
|
|
361
|
+
@decorator
|
|
362
|
+
def collectionsReadChildNames(self, args):
|
|
363
|
+
"""
|
|
364
|
+
Retrieve collection information.
|
|
365
|
+
|
|
366
|
+
Retrieves detailed information about the specified collection.
|
|
367
|
+
Returns complete collection metadata and properties.
|
|
368
|
+
|
|
369
|
+
Args:
|
|
370
|
+
args: Dictionary of operation arguments.
|
|
371
|
+
Contains operation-specific parameters.
|
|
372
|
+
See method implementation for details.
|
|
373
|
+
|
|
374
|
+
Returns:
|
|
375
|
+
Dictionary containing collection information:
|
|
376
|
+
{
|
|
377
|
+
'guid': str, # Unique identifier
|
|
378
|
+
'name': str, # Resource name
|
|
379
|
+
'attributes': dict, # Resource attributes
|
|
380
|
+
'status': str, # Resource status
|
|
381
|
+
'updateTime': int # Last update timestamp
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
Raises:
|
|
385
|
+
ValueError: When required parameters are missing or invalid:
|
|
386
|
+
- Empty or None values for required fields
|
|
387
|
+
- Invalid GUID format
|
|
388
|
+
- Out-of-range values
|
|
389
|
+
|
|
390
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
391
|
+
- DefaultAzureCredential not configured
|
|
392
|
+
- Insufficient permissions
|
|
393
|
+
- Expired authentication token
|
|
394
|
+
|
|
395
|
+
HTTPError: When Purview API returns error:
|
|
396
|
+
- 400: Bad request (invalid parameters)
|
|
397
|
+
- 401: Unauthorized (authentication failed)
|
|
398
|
+
- 403: Forbidden (insufficient permissions)
|
|
399
|
+
- 404: Resource not found
|
|
400
|
+
- 429: Rate limit exceeded
|
|
401
|
+
- 500: Internal server error
|
|
402
|
+
|
|
403
|
+
NetworkError: When network connectivity fails
|
|
404
|
+
|
|
405
|
+
Example:
|
|
406
|
+
# Basic usage
|
|
407
|
+
client = Collections()
|
|
408
|
+
|
|
409
|
+
result = client.collectionsReadChildNames(args=...)
|
|
410
|
+
print(f"Result: {result}")
|
|
411
|
+
|
|
412
|
+
Use Cases:
|
|
413
|
+
- Data Discovery: Find and explore data assets
|
|
414
|
+
- Compliance Auditing: Review metadata and classifications
|
|
415
|
+
- Reporting: Generate catalog reports
|
|
416
|
+
"""
|
|
417
|
+
self.method = "POST"
|
|
418
|
+
self.endpoint = ENDPOINTS["collections"]["get_child_collection_names"].format(collectionName=args["--collectionName"])
|
|
419
|
+
self.params = get_api_version_params("account")
|
|
420
|
+
|
|
421
|
+
# === ADVANCED COLLECTION OPERATIONS (NEW FOR 100% COVERAGE) ===
|
|
422
|
+
|
|
423
|
+
@decorator
|
|
424
|
+
def collectionsMove(self, args):
|
|
425
|
+
"""
|
|
426
|
+
Perform operation on resource.
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
Args:
|
|
431
|
+
args: Dictionary of operation arguments.
|
|
432
|
+
Contains operation-specific parameters.
|
|
433
|
+
See method implementation for details.
|
|
434
|
+
|
|
435
|
+
Returns:
|
|
436
|
+
[TODO: Specify return type and structure]
|
|
437
|
+
[TODO: Document nested fields]
|
|
438
|
+
|
|
439
|
+
Raises:
|
|
440
|
+
ValueError: When required parameters are missing or invalid:
|
|
441
|
+
- Empty or None values for required fields
|
|
442
|
+
- Invalid GUID format
|
|
443
|
+
- Out-of-range values
|
|
444
|
+
|
|
445
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
446
|
+
- DefaultAzureCredential not configured
|
|
447
|
+
- Insufficient permissions
|
|
448
|
+
- Expired authentication token
|
|
449
|
+
|
|
450
|
+
HTTPError: When Purview API returns error:
|
|
451
|
+
- 400: Bad request (invalid parameters)
|
|
452
|
+
- 401: Unauthorized (authentication failed)
|
|
453
|
+
- 403: Forbidden (insufficient permissions)
|
|
454
|
+
- 404: Resource not found
|
|
455
|
+
- 429: Rate limit exceeded
|
|
456
|
+
- 500: Internal server error
|
|
457
|
+
|
|
458
|
+
NetworkError: When network connectivity fails
|
|
459
|
+
|
|
460
|
+
Example:
|
|
461
|
+
# Basic usage
|
|
462
|
+
client = Collections()
|
|
463
|
+
|
|
464
|
+
result = client.collectionsMove(args=...)
|
|
465
|
+
print(f"Result: {result}")
|
|
466
|
+
|
|
467
|
+
Use Cases:
|
|
468
|
+
- [TODO: Add specific use cases for this operation]
|
|
469
|
+
- [TODO: Include business context]
|
|
470
|
+
- [TODO: Explain when to use this method]
|
|
471
|
+
"""
|
|
472
|
+
self.method = "POST"
|
|
473
|
+
self.endpoint = ENDPOINTS["collections"]["move_collection"].format(collectionName=args["--collectionName"])
|
|
474
|
+
self.params = get_api_version_params("account")
|
|
475
|
+
move_request = {
|
|
476
|
+
"parentCollectionName": args["--parentCollectionName"],
|
|
477
|
+
"newName": args.get("--newName"),
|
|
478
|
+
"preservePermissions": str(args.get("--preservePermissions", True)).lower()
|
|
479
|
+
}
|
|
480
|
+
self.payload = move_request
|
|
481
|
+
|
|
482
|
+
@decorator
|
|
483
|
+
def collectionsReadPermissions(self, args):
|
|
484
|
+
"""
|
|
485
|
+
Retrieve collection information.
|
|
486
|
+
|
|
487
|
+
Retrieves detailed information about the specified collection.
|
|
488
|
+
Returns complete collection metadata and properties.
|
|
489
|
+
|
|
490
|
+
Args:
|
|
491
|
+
args: Dictionary of operation arguments.
|
|
492
|
+
Contains operation-specific parameters.
|
|
493
|
+
See method implementation for details.
|
|
494
|
+
|
|
495
|
+
Returns:
|
|
496
|
+
Dictionary containing collection information:
|
|
497
|
+
{
|
|
498
|
+
'guid': str, # Unique identifier
|
|
499
|
+
'name': str, # Resource name
|
|
500
|
+
'attributes': dict, # Resource attributes
|
|
501
|
+
'status': str, # Resource status
|
|
502
|
+
'updateTime': int # Last update timestamp
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
Raises:
|
|
506
|
+
ValueError: When required parameters are missing or invalid:
|
|
507
|
+
- Empty or None values for required fields
|
|
508
|
+
- Invalid GUID format
|
|
509
|
+
- Out-of-range values
|
|
510
|
+
|
|
511
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
512
|
+
- DefaultAzureCredential not configured
|
|
513
|
+
- Insufficient permissions
|
|
514
|
+
- Expired authentication token
|
|
515
|
+
|
|
516
|
+
HTTPError: When Purview API returns error:
|
|
517
|
+
- 400: Bad request (invalid parameters)
|
|
518
|
+
- 401: Unauthorized (authentication failed)
|
|
519
|
+
- 403: Forbidden (insufficient permissions)
|
|
520
|
+
- 404: Resource not found
|
|
521
|
+
- 429: Rate limit exceeded
|
|
522
|
+
- 500: Internal server error
|
|
523
|
+
|
|
524
|
+
NetworkError: When network connectivity fails
|
|
525
|
+
|
|
526
|
+
Example:
|
|
527
|
+
# Basic usage
|
|
528
|
+
client = Collections()
|
|
529
|
+
|
|
530
|
+
result = client.collectionsReadPermissions(args=...)
|
|
531
|
+
print(f"Result: {result}")
|
|
532
|
+
|
|
533
|
+
Use Cases:
|
|
534
|
+
- Data Discovery: Find and explore data assets
|
|
535
|
+
- Compliance Auditing: Review metadata and classifications
|
|
536
|
+
- Reporting: Generate catalog reports
|
|
537
|
+
"""
|
|
538
|
+
self.method = "GET"
|
|
539
|
+
self.endpoint = ENDPOINTS["collections"]["get_collection_permissions"].format(collectionName=args["--collectionName"])
|
|
540
|
+
self.params = {
|
|
541
|
+
**get_api_version_params("account"),
|
|
542
|
+
"includeInherited": str(args.get("--includeInherited", True)).lower(),
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
@decorator
|
|
546
|
+
def collectionsUpdatePermissions(self, args):
|
|
547
|
+
"""
|
|
548
|
+
Update an existing collection.
|
|
549
|
+
|
|
550
|
+
Updates an existing collection with new values.
|
|
551
|
+
Only specified fields are modified; others remain unchanged.
|
|
552
|
+
|
|
553
|
+
Args:
|
|
554
|
+
args: Dictionary of operation arguments.
|
|
555
|
+
Contains operation-specific parameters.
|
|
556
|
+
See method implementation for details.
|
|
557
|
+
|
|
558
|
+
Returns:
|
|
559
|
+
Dictionary containing updated collection:
|
|
560
|
+
{
|
|
561
|
+
'guid': str, # Unique identifier
|
|
562
|
+
'attributes': dict, # Updated attributes
|
|
563
|
+
'updateTime': int # Update timestamp
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
Raises:
|
|
567
|
+
ValueError: When required parameters are missing or invalid:
|
|
568
|
+
- Empty or None values for required fields
|
|
569
|
+
- Invalid GUID format
|
|
570
|
+
- Out-of-range values
|
|
571
|
+
|
|
572
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
573
|
+
- DefaultAzureCredential not configured
|
|
574
|
+
- Insufficient permissions
|
|
575
|
+
- Expired authentication token
|
|
576
|
+
|
|
577
|
+
HTTPError: When Purview API returns error:
|
|
578
|
+
- 400: Bad request (invalid parameters)
|
|
579
|
+
- 401: Unauthorized (authentication failed)
|
|
580
|
+
- 403: Forbidden (insufficient permissions)
|
|
581
|
+
- 404: Resource not found
|
|
582
|
+
- 429: Rate limit exceeded
|
|
583
|
+
- 500: Internal server error
|
|
584
|
+
|
|
585
|
+
NetworkError: When network connectivity fails
|
|
586
|
+
|
|
587
|
+
Example:
|
|
588
|
+
# Basic usage
|
|
589
|
+
client = Collections()
|
|
590
|
+
|
|
591
|
+
result = client.collectionsUpdatePermissions(args=...)
|
|
592
|
+
print(f"Result: {result}")
|
|
593
|
+
|
|
594
|
+
# With detailed data
|
|
595
|
+
data = {
|
|
596
|
+
'name': 'My Resource',
|
|
597
|
+
'description': 'Resource description',
|
|
598
|
+
'attributes': {
|
|
599
|
+
'key1': 'value1',
|
|
600
|
+
'key2': 'value2'
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
result = client.collectionsUpdatePermissions(data)
|
|
605
|
+
print(f"Created/Updated: {result['guid']}")
|
|
606
|
+
|
|
607
|
+
Use Cases:
|
|
608
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
609
|
+
- Ownership Changes: Reassign data ownership
|
|
610
|
+
- Classification: Apply or modify data classifications
|
|
611
|
+
"""
|
|
612
|
+
self.method = "PUT"
|
|
613
|
+
self.endpoint = ENDPOINTS["collections"]["update_collection_permissions"].format(collectionName=args["--collectionName"])
|
|
614
|
+
self.params = get_api_version_params("account")
|
|
615
|
+
self.payload = get_json(args, "--payloadFile")
|
|
616
|
+
|
|
617
|
+
@decorator
|
|
618
|
+
def collectionsReadAnalytics(self, args):
|
|
619
|
+
"""
|
|
620
|
+
Retrieve collection information.
|
|
621
|
+
|
|
622
|
+
Retrieves detailed information about the specified collection.
|
|
623
|
+
Returns complete collection metadata and properties.
|
|
624
|
+
|
|
625
|
+
Args:
|
|
626
|
+
args: Dictionary of operation arguments.
|
|
627
|
+
Contains operation-specific parameters.
|
|
628
|
+
See method implementation for details.
|
|
629
|
+
|
|
630
|
+
Returns:
|
|
631
|
+
Dictionary containing collection information:
|
|
632
|
+
{
|
|
633
|
+
'guid': str, # Unique identifier
|
|
634
|
+
'name': str, # Resource name
|
|
635
|
+
'attributes': dict, # Resource attributes
|
|
636
|
+
'status': str, # Resource status
|
|
637
|
+
'updateTime': int # Last update timestamp
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
Raises:
|
|
641
|
+
ValueError: When required parameters are missing or invalid:
|
|
642
|
+
- Empty or None values for required fields
|
|
643
|
+
- Invalid GUID format
|
|
644
|
+
- Out-of-range values
|
|
645
|
+
|
|
646
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
647
|
+
- DefaultAzureCredential not configured
|
|
648
|
+
- Insufficient permissions
|
|
649
|
+
- Expired authentication token
|
|
650
|
+
|
|
651
|
+
HTTPError: When Purview API returns error:
|
|
652
|
+
- 400: Bad request (invalid parameters)
|
|
653
|
+
- 401: Unauthorized (authentication failed)
|
|
654
|
+
- 403: Forbidden (insufficient permissions)
|
|
655
|
+
- 404: Resource not found
|
|
656
|
+
- 429: Rate limit exceeded
|
|
657
|
+
- 500: Internal server error
|
|
658
|
+
|
|
659
|
+
NetworkError: When network connectivity fails
|
|
660
|
+
|
|
661
|
+
Example:
|
|
662
|
+
# Basic usage
|
|
663
|
+
client = Collections()
|
|
664
|
+
|
|
665
|
+
result = client.collectionsReadAnalytics(args=...)
|
|
666
|
+
print(f"Result: {result}")
|
|
667
|
+
|
|
668
|
+
Use Cases:
|
|
669
|
+
- Data Discovery: Find and explore data assets
|
|
670
|
+
- Compliance Auditing: Review metadata and classifications
|
|
671
|
+
- Reporting: Generate catalog reports
|
|
672
|
+
"""
|
|
673
|
+
self.method = "GET"
|
|
674
|
+
self.endpoint = ENDPOINTS["collections"]["get_collection_analytics"].format(collectionName=args["--collectionName"])
|
|
675
|
+
self.params = {
|
|
676
|
+
**get_api_version_params("account"),
|
|
677
|
+
"startTime": args.get("--startTime"),
|
|
678
|
+
"endTime": args.get("--endTime"),
|
|
679
|
+
"metrics": args.get("--metrics", "all"),
|
|
680
|
+
"aggregation": args.get("--aggregation", "daily")
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
@decorator
|
|
684
|
+
def collectionsExport(self, args):
|
|
685
|
+
"""
|
|
686
|
+
Perform batch operation on resources.
|
|
687
|
+
|
|
688
|
+
Processes multiple resources in a single operation.
|
|
689
|
+
More efficient than individual operations for bulk data.
|
|
690
|
+
|
|
691
|
+
Args:
|
|
692
|
+
args: Dictionary of operation arguments.
|
|
693
|
+
Contains operation-specific parameters.
|
|
694
|
+
See method implementation for details.
|
|
695
|
+
|
|
696
|
+
Returns:
|
|
697
|
+
Dictionary with batch operation results:
|
|
698
|
+
{
|
|
699
|
+
'succeeded': int, # Success count
|
|
700
|
+
'failed': int, # Failure count
|
|
701
|
+
'results': [...], # Per-item results
|
|
702
|
+
'errors': [...] # Error details
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
Raises:
|
|
706
|
+
ValueError: When required parameters are missing or invalid:
|
|
707
|
+
- Empty or None values for required fields
|
|
708
|
+
- Invalid GUID format
|
|
709
|
+
- Out-of-range values
|
|
710
|
+
|
|
711
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
712
|
+
- DefaultAzureCredential not configured
|
|
713
|
+
- Insufficient permissions
|
|
714
|
+
- Expired authentication token
|
|
715
|
+
|
|
716
|
+
HTTPError: When Purview API returns error:
|
|
717
|
+
- 400: Bad request (invalid parameters)
|
|
718
|
+
- 401: Unauthorized (authentication failed)
|
|
719
|
+
- 403: Forbidden (insufficient permissions)
|
|
720
|
+
- 404: Resource not found
|
|
721
|
+
- 429: Rate limit exceeded
|
|
722
|
+
- 500: Internal server error
|
|
723
|
+
|
|
724
|
+
NetworkError: When network connectivity fails
|
|
725
|
+
|
|
726
|
+
Example:
|
|
727
|
+
# Basic usage
|
|
728
|
+
client = Collections()
|
|
729
|
+
|
|
730
|
+
result = client.collectionsExport(args=...)
|
|
731
|
+
print(f"Result: {result}")
|
|
732
|
+
|
|
733
|
+
Use Cases:
|
|
734
|
+
- Bulk Import: Load large volumes of metadata
|
|
735
|
+
- Migration: Transfer catalog from other systems
|
|
736
|
+
- Mass Updates: Apply changes to many resources
|
|
737
|
+
"""
|
|
738
|
+
self.method = "POST"
|
|
739
|
+
self.endpoint = ENDPOINTS["collections"]["export_collection"].format(collectionName=args["--collectionName"])
|
|
740
|
+
self.params = {
|
|
741
|
+
**get_api_version_params("account"),
|
|
742
|
+
"format": args.get("--format", "json"),
|
|
743
|
+
"includeChildren": str(args.get("--includeChildren", False)).lower(),
|
|
744
|
+
"includePermissions": str(args.get("--includePermissions", True)).lower(),
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
# === COLLECTION HIERARCHY OPERATIONS ===
|
|
748
|
+
|
|
749
|
+
@decorator
|
|
750
|
+
def collectionsReadHierarchy(self, args):
|
|
751
|
+
"""
|
|
752
|
+
Retrieve collection information.
|
|
753
|
+
|
|
754
|
+
Retrieves detailed information about the specified collection.
|
|
755
|
+
Returns complete collection metadata and properties.
|
|
756
|
+
|
|
757
|
+
Args:
|
|
758
|
+
args: Dictionary of operation arguments.
|
|
759
|
+
Contains operation-specific parameters.
|
|
760
|
+
See method implementation for details.
|
|
761
|
+
|
|
762
|
+
Returns:
|
|
763
|
+
Dictionary containing collection information:
|
|
764
|
+
{
|
|
765
|
+
'guid': str, # Unique identifier
|
|
766
|
+
'name': str, # Resource name
|
|
767
|
+
'attributes': dict, # Resource attributes
|
|
768
|
+
'status': str, # Resource status
|
|
769
|
+
'updateTime': int # Last update timestamp
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
Raises:
|
|
773
|
+
ValueError: When required parameters are missing or invalid:
|
|
774
|
+
- Empty or None values for required fields
|
|
775
|
+
- Invalid GUID format
|
|
776
|
+
- Out-of-range values
|
|
777
|
+
|
|
778
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
779
|
+
- DefaultAzureCredential not configured
|
|
780
|
+
- Insufficient permissions
|
|
781
|
+
- Expired authentication token
|
|
782
|
+
|
|
783
|
+
HTTPError: When Purview API returns error:
|
|
784
|
+
- 400: Bad request (invalid parameters)
|
|
785
|
+
- 401: Unauthorized (authentication failed)
|
|
786
|
+
- 403: Forbidden (insufficient permissions)
|
|
787
|
+
- 404: Resource not found
|
|
788
|
+
- 429: Rate limit exceeded
|
|
789
|
+
- 500: Internal server error
|
|
790
|
+
|
|
791
|
+
NetworkError: When network connectivity fails
|
|
792
|
+
|
|
793
|
+
Example:
|
|
794
|
+
# Basic usage
|
|
795
|
+
client = Collections()
|
|
796
|
+
|
|
797
|
+
result = client.collectionsReadHierarchy(args=...)
|
|
798
|
+
print(f"Result: {result}")
|
|
799
|
+
|
|
800
|
+
Use Cases:
|
|
801
|
+
- Data Discovery: Find and explore data assets
|
|
802
|
+
- Compliance Auditing: Review metadata and classifications
|
|
803
|
+
- Reporting: Generate catalog reports
|
|
804
|
+
"""
|
|
805
|
+
self.method = "GET"
|
|
806
|
+
self.endpoint = f"{ENDPOINTS['collections']['list']}/hierarchy"
|
|
807
|
+
self.params = {
|
|
808
|
+
**get_api_version_params("account"),
|
|
809
|
+
"rootCollection": args.get("--rootCollection"),
|
|
810
|
+
"depth": args.get("--depth", 5),
|
|
811
|
+
"includeMetadata": str(args.get("--includeMetadata", True)).lower(),
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
@decorator
|
|
815
|
+
def collectionsReadTree(self, args):
|
|
816
|
+
"""
|
|
817
|
+
Retrieve collection information.
|
|
818
|
+
|
|
819
|
+
Retrieves detailed information about the specified collection.
|
|
820
|
+
Returns complete collection metadata and properties.
|
|
821
|
+
|
|
822
|
+
Args:
|
|
823
|
+
args: Dictionary of operation arguments.
|
|
824
|
+
Contains operation-specific parameters.
|
|
825
|
+
See method implementation for details.
|
|
826
|
+
|
|
827
|
+
Returns:
|
|
828
|
+
Dictionary containing collection information:
|
|
829
|
+
{
|
|
830
|
+
'guid': str, # Unique identifier
|
|
831
|
+
'name': str, # Resource name
|
|
832
|
+
'attributes': dict, # Resource attributes
|
|
833
|
+
'status': str, # Resource status
|
|
834
|
+
'updateTime': int # Last update timestamp
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
Raises:
|
|
838
|
+
ValueError: When required parameters are missing or invalid:
|
|
839
|
+
- Empty or None values for required fields
|
|
840
|
+
- Invalid GUID format
|
|
841
|
+
- Out-of-range values
|
|
842
|
+
|
|
843
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
844
|
+
- DefaultAzureCredential not configured
|
|
845
|
+
- Insufficient permissions
|
|
846
|
+
- Expired authentication token
|
|
847
|
+
|
|
848
|
+
HTTPError: When Purview API returns error:
|
|
849
|
+
- 400: Bad request (invalid parameters)
|
|
850
|
+
- 401: Unauthorized (authentication failed)
|
|
851
|
+
- 403: Forbidden (insufficient permissions)
|
|
852
|
+
- 404: Resource not found
|
|
853
|
+
- 429: Rate limit exceeded
|
|
854
|
+
- 500: Internal server error
|
|
855
|
+
|
|
856
|
+
NetworkError: When network connectivity fails
|
|
857
|
+
|
|
858
|
+
Example:
|
|
859
|
+
# Basic usage
|
|
860
|
+
client = Collections()
|
|
861
|
+
|
|
862
|
+
result = client.collectionsReadTree(args=...)
|
|
863
|
+
print(f"Result: {result}")
|
|
864
|
+
|
|
865
|
+
Use Cases:
|
|
866
|
+
- Data Discovery: Find and explore data assets
|
|
867
|
+
- Compliance Auditing: Review metadata and classifications
|
|
868
|
+
- Reporting: Generate catalog reports
|
|
869
|
+
"""
|
|
870
|
+
self.method = "GET"
|
|
871
|
+
self.endpoint = f"{ENDPOINTS['collections']['get'].format(collectionName=args['--collectionName'])}/tree"
|
|
872
|
+
self.params = {
|
|
873
|
+
**get_api_version_params("account"),
|
|
874
|
+
"includeChildren": str(args.get("--includeChildren", True)).lower(),
|
|
875
|
+
"includeParents": str(args.get("--includeParents", True)).lower(),
|
|
876
|
+
"maxDepth": args.get("--maxDepth", 10),
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
# === COLLECTION SEARCH AND DISCOVERY ===
|
|
880
|
+
|
|
881
|
+
@decorator
|
|
882
|
+
def collectionsSearch(self, args):
|
|
883
|
+
"""
|
|
884
|
+
Search for collections.
|
|
885
|
+
|
|
886
|
+
Searches for resources matching the specified criteria.
|
|
887
|
+
Supports filtering, pagination, and sorting.
|
|
888
|
+
|
|
889
|
+
Args:
|
|
890
|
+
args: Dictionary of operation arguments.
|
|
891
|
+
Contains operation-specific parameters.
|
|
892
|
+
See method implementation for details.
|
|
893
|
+
|
|
894
|
+
Returns:
|
|
895
|
+
Dictionary containing search results:
|
|
896
|
+
{
|
|
897
|
+
'value': [...] # List of matching resources
|
|
898
|
+
'count': int, # Total results count
|
|
899
|
+
'nextLink': str # Pagination link (if applicable)
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
Raises:
|
|
903
|
+
ValueError: When required parameters are missing or invalid:
|
|
904
|
+
- Empty or None values for required fields
|
|
905
|
+
- Invalid GUID format
|
|
906
|
+
- Out-of-range values
|
|
907
|
+
|
|
908
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
909
|
+
- DefaultAzureCredential not configured
|
|
910
|
+
- Insufficient permissions
|
|
911
|
+
- Expired authentication token
|
|
912
|
+
|
|
913
|
+
HTTPError: When Purview API returns error:
|
|
914
|
+
- 400: Bad request (invalid parameters)
|
|
915
|
+
- 401: Unauthorized (authentication failed)
|
|
916
|
+
- 403: Forbidden (insufficient permissions)
|
|
917
|
+
- 404: Resource not found
|
|
918
|
+
- 429: Rate limit exceeded
|
|
919
|
+
- 500: Internal server error
|
|
920
|
+
|
|
921
|
+
NetworkError: When network connectivity fails
|
|
922
|
+
|
|
923
|
+
Example:
|
|
924
|
+
# Basic usage
|
|
925
|
+
client = Collections()
|
|
926
|
+
|
|
927
|
+
result = client.collectionsSearch(args=...)
|
|
928
|
+
print(f"Result: {result}")
|
|
929
|
+
|
|
930
|
+
Use Cases:
|
|
931
|
+
- Data Discovery: Locate datasets by name or properties
|
|
932
|
+
- Impact Analysis: Find all assets related to a term
|
|
933
|
+
- Compliance: Identify sensitive data across catalog
|
|
934
|
+
"""
|
|
935
|
+
self.method = "GET"
|
|
936
|
+
self.endpoint = f"{ENDPOINTS['collections']['list']}/search"
|
|
937
|
+
self.params = {
|
|
938
|
+
**get_api_version_params("account"),
|
|
939
|
+
"query": args.get("--query"),
|
|
940
|
+
"filter": args.get("--filter"),
|
|
941
|
+
"includeInactive": str(args.get("--includeInactive", False)).lower(),
|
|
942
|
+
"limit": args.get("--limit", 50),
|
|
943
|
+
"offset": args.get("--offset", 0),
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
@decorator
|
|
947
|
+
def collectionsReadByEntity(self, args):
|
|
948
|
+
"""
|
|
949
|
+
Retrieve collection information.
|
|
950
|
+
|
|
951
|
+
Retrieves detailed information about the specified collection.
|
|
952
|
+
Returns complete collection metadata and properties.
|
|
953
|
+
|
|
954
|
+
Args:
|
|
955
|
+
args: Dictionary of operation arguments.
|
|
956
|
+
Contains operation-specific parameters.
|
|
957
|
+
See method implementation for details.
|
|
958
|
+
|
|
959
|
+
Returns:
|
|
960
|
+
Dictionary containing collection information:
|
|
961
|
+
{
|
|
962
|
+
'guid': str, # Unique identifier
|
|
963
|
+
'name': str, # Resource name
|
|
964
|
+
'attributes': dict, # Resource attributes
|
|
965
|
+
'status': str, # Resource status
|
|
966
|
+
'updateTime': int # Last update timestamp
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
Raises:
|
|
970
|
+
ValueError: When required parameters are missing or invalid:
|
|
971
|
+
- Empty or None values for required fields
|
|
972
|
+
- Invalid GUID format
|
|
973
|
+
- Out-of-range values
|
|
974
|
+
|
|
975
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
976
|
+
- DefaultAzureCredential not configured
|
|
977
|
+
- Insufficient permissions
|
|
978
|
+
- Expired authentication token
|
|
979
|
+
|
|
980
|
+
HTTPError: When Purview API returns error:
|
|
981
|
+
- 400: Bad request (invalid parameters)
|
|
982
|
+
- 401: Unauthorized (authentication failed)
|
|
983
|
+
- 403: Forbidden (insufficient permissions)
|
|
984
|
+
- 404: Resource not found
|
|
985
|
+
- 429: Rate limit exceeded
|
|
986
|
+
- 500: Internal server error
|
|
987
|
+
|
|
988
|
+
NetworkError: When network connectivity fails
|
|
989
|
+
|
|
990
|
+
Example:
|
|
991
|
+
# Basic usage
|
|
992
|
+
client = EntityCollections()
|
|
993
|
+
|
|
994
|
+
result = client.collectionsReadByEntity(args=...)
|
|
995
|
+
print(f"Result: {result}")
|
|
996
|
+
|
|
997
|
+
Use Cases:
|
|
998
|
+
- Data Discovery: Find and explore data assets
|
|
999
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1000
|
+
- Reporting: Generate catalog reports
|
|
1001
|
+
"""
|
|
1002
|
+
self.method = "GET"
|
|
1003
|
+
self.endpoint = f"{ENDPOINTS['collections']['list']}/entity/{args['--entityGuid']}"
|
|
1004
|
+
self.params = {
|
|
1005
|
+
**get_api_version_params("account"),
|
|
1006
|
+
"includeParents": str(args.get("--includeParents", True)).lower(),
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
# === COLLECTION BULK OPERATIONS ===
|
|
1010
|
+
|
|
1011
|
+
@decorator
|
|
1012
|
+
def collectionsBulkMove(self, args):
|
|
1013
|
+
"""
|
|
1014
|
+
Perform batch operation on resources.
|
|
1015
|
+
|
|
1016
|
+
Processes multiple resources in a single operation.
|
|
1017
|
+
More efficient than individual operations for bulk data.
|
|
1018
|
+
|
|
1019
|
+
Args:
|
|
1020
|
+
args: Dictionary of operation arguments.
|
|
1021
|
+
Contains operation-specific parameters.
|
|
1022
|
+
See method implementation for details.
|
|
1023
|
+
|
|
1024
|
+
Returns:
|
|
1025
|
+
Dictionary with batch operation results:
|
|
1026
|
+
{
|
|
1027
|
+
'succeeded': int, # Success count
|
|
1028
|
+
'failed': int, # Failure count
|
|
1029
|
+
'results': [...], # Per-item results
|
|
1030
|
+
'errors': [...] # Error details
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
Raises:
|
|
1034
|
+
ValueError: When required parameters are missing or invalid:
|
|
1035
|
+
- Empty or None values for required fields
|
|
1036
|
+
- Invalid GUID format
|
|
1037
|
+
- Out-of-range values
|
|
1038
|
+
|
|
1039
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1040
|
+
- DefaultAzureCredential not configured
|
|
1041
|
+
- Insufficient permissions
|
|
1042
|
+
- Expired authentication token
|
|
1043
|
+
|
|
1044
|
+
HTTPError: When Purview API returns error:
|
|
1045
|
+
- 400: Bad request (invalid parameters)
|
|
1046
|
+
- 401: Unauthorized (authentication failed)
|
|
1047
|
+
- 403: Forbidden (insufficient permissions)
|
|
1048
|
+
- 404: Resource not found
|
|
1049
|
+
- 429: Rate limit exceeded
|
|
1050
|
+
- 500: Internal server error
|
|
1051
|
+
|
|
1052
|
+
NetworkError: When network connectivity fails
|
|
1053
|
+
|
|
1054
|
+
Example:
|
|
1055
|
+
# Basic usage
|
|
1056
|
+
client = Collections()
|
|
1057
|
+
|
|
1058
|
+
result = client.collectionsBulkMove(args=...)
|
|
1059
|
+
print(f"Result: {result}")
|
|
1060
|
+
|
|
1061
|
+
Use Cases:
|
|
1062
|
+
- Bulk Import: Load large volumes of metadata
|
|
1063
|
+
- Migration: Transfer catalog from other systems
|
|
1064
|
+
- Mass Updates: Apply changes to many resources
|
|
1065
|
+
"""
|
|
1066
|
+
self.method = "POST"
|
|
1067
|
+
self.endpoint = f"{ENDPOINTS['collections']['list']}/bulk/move"
|
|
1068
|
+
self.params = get_api_version_params("account")
|
|
1069
|
+
self.payload = get_json(args, "--payloadFile")
|
|
1070
|
+
|
|
1071
|
+
@decorator
|
|
1072
|
+
def collectionsBulkUpdate(self, args):
|
|
1073
|
+
"""
|
|
1074
|
+
Update an existing collection.
|
|
1075
|
+
|
|
1076
|
+
Updates an existing collection with new values.
|
|
1077
|
+
Only specified fields are modified; others remain unchanged.
|
|
1078
|
+
|
|
1079
|
+
Args:
|
|
1080
|
+
args: Dictionary of operation arguments.
|
|
1081
|
+
Contains operation-specific parameters.
|
|
1082
|
+
See method implementation for details.
|
|
1083
|
+
|
|
1084
|
+
Returns:
|
|
1085
|
+
Dictionary containing updated collection:
|
|
1086
|
+
{
|
|
1087
|
+
'guid': str, # Unique identifier
|
|
1088
|
+
'attributes': dict, # Updated attributes
|
|
1089
|
+
'updateTime': int # Update timestamp
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
Raises:
|
|
1093
|
+
ValueError: When required parameters are missing or invalid:
|
|
1094
|
+
- Empty or None values for required fields
|
|
1095
|
+
- Invalid GUID format
|
|
1096
|
+
- Out-of-range values
|
|
1097
|
+
|
|
1098
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1099
|
+
- DefaultAzureCredential not configured
|
|
1100
|
+
- Insufficient permissions
|
|
1101
|
+
- Expired authentication token
|
|
1102
|
+
|
|
1103
|
+
HTTPError: When Purview API returns error:
|
|
1104
|
+
- 400: Bad request (invalid parameters)
|
|
1105
|
+
- 401: Unauthorized (authentication failed)
|
|
1106
|
+
- 403: Forbidden (insufficient permissions)
|
|
1107
|
+
- 404: Resource not found
|
|
1108
|
+
- 429: Rate limit exceeded
|
|
1109
|
+
- 500: Internal server error
|
|
1110
|
+
|
|
1111
|
+
NetworkError: When network connectivity fails
|
|
1112
|
+
|
|
1113
|
+
Example:
|
|
1114
|
+
# Basic usage
|
|
1115
|
+
client = Collections()
|
|
1116
|
+
|
|
1117
|
+
result = client.collectionsBulkUpdate(args=...)
|
|
1118
|
+
print(f"Result: {result}")
|
|
1119
|
+
|
|
1120
|
+
# With detailed data
|
|
1121
|
+
data = {
|
|
1122
|
+
'name': 'My Resource',
|
|
1123
|
+
'description': 'Resource description',
|
|
1124
|
+
'attributes': {
|
|
1125
|
+
'key1': 'value1',
|
|
1126
|
+
'key2': 'value2'
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
result = client.collectionsBulkUpdate(data)
|
|
1131
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1132
|
+
|
|
1133
|
+
Use Cases:
|
|
1134
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
1135
|
+
- Ownership Changes: Reassign data ownership
|
|
1136
|
+
- Classification: Apply or modify data classifications
|
|
1137
|
+
"""
|
|
1138
|
+
self.method = "PUT"
|
|
1139
|
+
self.endpoint = f"{ENDPOINTS['collections']['list']}/bulk"
|
|
1140
|
+
self.params = get_api_version_params("account")
|
|
1141
|
+
self.payload = get_json(args, "--payloadFile")
|
|
1142
|
+
|
|
1143
|
+
@decorator
|
|
1144
|
+
def collectionsBulkDelete(self, args):
|
|
1145
|
+
"""
|
|
1146
|
+
Delete a collection.
|
|
1147
|
+
|
|
1148
|
+
Permanently deletes the specified collection.
|
|
1149
|
+
This operation cannot be undone. Use with caution.
|
|
1150
|
+
|
|
1151
|
+
Args:
|
|
1152
|
+
args: Dictionary of operation arguments.
|
|
1153
|
+
Contains operation-specific parameters.
|
|
1154
|
+
See method implementation for details.
|
|
1155
|
+
|
|
1156
|
+
Returns:
|
|
1157
|
+
Dictionary with deletion status:
|
|
1158
|
+
{
|
|
1159
|
+
'guid': str, # Deleted resource ID
|
|
1160
|
+
'status': str, # Deletion status
|
|
1161
|
+
'message': str # Confirmation message
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
Raises:
|
|
1165
|
+
ValueError: When required parameters are missing or invalid:
|
|
1166
|
+
- Empty or None values for required fields
|
|
1167
|
+
- Invalid GUID format
|
|
1168
|
+
- Out-of-range values
|
|
1169
|
+
|
|
1170
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1171
|
+
- DefaultAzureCredential not configured
|
|
1172
|
+
- Insufficient permissions
|
|
1173
|
+
- Expired authentication token
|
|
1174
|
+
|
|
1175
|
+
HTTPError: When Purview API returns error:
|
|
1176
|
+
- 400: Bad request (invalid parameters)
|
|
1177
|
+
- 401: Unauthorized (authentication failed)
|
|
1178
|
+
- 403: Forbidden (insufficient permissions)
|
|
1179
|
+
- 404: Resource not found
|
|
1180
|
+
- 429: Rate limit exceeded
|
|
1181
|
+
- 500: Internal server error
|
|
1182
|
+
|
|
1183
|
+
NetworkError: When network connectivity fails
|
|
1184
|
+
|
|
1185
|
+
Example:
|
|
1186
|
+
# Basic usage
|
|
1187
|
+
client = Collections()
|
|
1188
|
+
|
|
1189
|
+
result = client.collectionsBulkDelete(args=...)
|
|
1190
|
+
print(f"Result: {result}")
|
|
1191
|
+
|
|
1192
|
+
Use Cases:
|
|
1193
|
+
- Data Cleanup: Remove obsolete or test data
|
|
1194
|
+
- Decommissioning: Delete resources no longer in use
|
|
1195
|
+
- Testing: Clean up test environments
|
|
1196
|
+
"""
|
|
1197
|
+
self.method = "DELETE"
|
|
1198
|
+
self.endpoint = f"{ENDPOINTS['collections']['list']}/bulk"
|
|
1199
|
+
self.params = get_api_version_params("account")
|
|
1200
|
+
self.payload = get_json(args, "--payloadFile")
|
|
1201
|
+
|
|
1202
|
+
# === COLLECTION IMPORT OPERATIONS ===
|
|
1203
|
+
|
|
1204
|
+
@decorator
|
|
1205
|
+
def collectionsImport(self, args):
|
|
1206
|
+
"""
|
|
1207
|
+
Perform batch operation on resources.
|
|
1208
|
+
|
|
1209
|
+
Processes multiple resources in a single operation.
|
|
1210
|
+
More efficient than individual operations for bulk data.
|
|
1211
|
+
|
|
1212
|
+
Args:
|
|
1213
|
+
args: Dictionary of operation arguments.
|
|
1214
|
+
Contains operation-specific parameters.
|
|
1215
|
+
See method implementation for details.
|
|
1216
|
+
|
|
1217
|
+
Returns:
|
|
1218
|
+
Dictionary with batch operation results:
|
|
1219
|
+
{
|
|
1220
|
+
'succeeded': int, # Success count
|
|
1221
|
+
'failed': int, # Failure count
|
|
1222
|
+
'results': [...], # Per-item results
|
|
1223
|
+
'errors': [...] # Error details
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
Raises:
|
|
1227
|
+
ValueError: When required parameters are missing or invalid:
|
|
1228
|
+
- Empty or None values for required fields
|
|
1229
|
+
- Invalid GUID format
|
|
1230
|
+
- Out-of-range values
|
|
1231
|
+
|
|
1232
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1233
|
+
- DefaultAzureCredential not configured
|
|
1234
|
+
- Insufficient permissions
|
|
1235
|
+
- Expired authentication token
|
|
1236
|
+
|
|
1237
|
+
HTTPError: When Purview API returns error:
|
|
1238
|
+
- 400: Bad request (invalid parameters)
|
|
1239
|
+
- 401: Unauthorized (authentication failed)
|
|
1240
|
+
- 403: Forbidden (insufficient permissions)
|
|
1241
|
+
- 404: Resource not found
|
|
1242
|
+
- 429: Rate limit exceeded
|
|
1243
|
+
- 500: Internal server error
|
|
1244
|
+
|
|
1245
|
+
NetworkError: When network connectivity fails
|
|
1246
|
+
|
|
1247
|
+
Example:
|
|
1248
|
+
# Basic usage
|
|
1249
|
+
client = Collections()
|
|
1250
|
+
|
|
1251
|
+
result = client.collectionsImport(args=...)
|
|
1252
|
+
print(f"Result: {result}")
|
|
1253
|
+
|
|
1254
|
+
Use Cases:
|
|
1255
|
+
- Bulk Import: Load large volumes of metadata
|
|
1256
|
+
- Migration: Transfer catalog from other systems
|
|
1257
|
+
- Mass Updates: Apply changes to many resources
|
|
1258
|
+
"""
|
|
1259
|
+
self.method = "POST"
|
|
1260
|
+
self.endpoint = f"{ENDPOINTS['collections']['list']}/import"
|
|
1261
|
+
self.params = {
|
|
1262
|
+
**get_api_version_params("account"),
|
|
1263
|
+
"validateOnly": str(args.get("--validateOnly", False)).lower(),
|
|
1264
|
+
"overwriteExisting": str(args.get("--overwriteExisting", False)).lower(),
|
|
1265
|
+
}
|
|
1266
|
+
self.payload = get_json(args, "--payloadFile")
|
|
1267
|
+
|
|
1268
|
+
@decorator
|
|
1269
|
+
def collectionsValidate(self, args):
|
|
1270
|
+
"""
|
|
1271
|
+
Perform operation on resource.
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
Args:
|
|
1276
|
+
args: Dictionary of operation arguments.
|
|
1277
|
+
Contains operation-specific parameters.
|
|
1278
|
+
See method implementation for details.
|
|
1279
|
+
|
|
1280
|
+
Returns:
|
|
1281
|
+
[TODO: Specify return type and structure]
|
|
1282
|
+
[TODO: Document nested fields]
|
|
1283
|
+
|
|
1284
|
+
Raises:
|
|
1285
|
+
ValueError: When required parameters are missing or invalid:
|
|
1286
|
+
- Empty or None values for required fields
|
|
1287
|
+
- Invalid GUID format
|
|
1288
|
+
- Out-of-range values
|
|
1289
|
+
|
|
1290
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1291
|
+
- DefaultAzureCredential not configured
|
|
1292
|
+
- Insufficient permissions
|
|
1293
|
+
- Expired authentication token
|
|
1294
|
+
|
|
1295
|
+
HTTPError: When Purview API returns error:
|
|
1296
|
+
- 400: Bad request (invalid parameters)
|
|
1297
|
+
- 401: Unauthorized (authentication failed)
|
|
1298
|
+
- 403: Forbidden (insufficient permissions)
|
|
1299
|
+
- 404: Resource not found
|
|
1300
|
+
- 429: Rate limit exceeded
|
|
1301
|
+
- 500: Internal server error
|
|
1302
|
+
|
|
1303
|
+
NetworkError: When network connectivity fails
|
|
1304
|
+
|
|
1305
|
+
Example:
|
|
1306
|
+
# Basic usage
|
|
1307
|
+
client = Collections()
|
|
1308
|
+
|
|
1309
|
+
result = client.collectionsValidate(args=...)
|
|
1310
|
+
print(f"Result: {result}")
|
|
1311
|
+
|
|
1312
|
+
Use Cases:
|
|
1313
|
+
- [TODO: Add specific use cases for this operation]
|
|
1314
|
+
- [TODO: Include business context]
|
|
1315
|
+
- [TODO: Explain when to use this method]
|
|
1316
|
+
"""
|
|
1317
|
+
self.method = "POST"
|
|
1318
|
+
self.endpoint = f"{ENDPOINTS['collections']['list']}/validate"
|
|
1319
|
+
self.params = get_api_version_params("account")
|
|
1320
|
+
self.payload = get_json(args, "--payloadFile")
|
|
1321
|
+
|
|
1322
|
+
# === COLLECTION STATISTICS AND REPORTING ===
|
|
1323
|
+
|
|
1324
|
+
@decorator
|
|
1325
|
+
def collectionsReadStatistics(self, args):
|
|
1326
|
+
"""
|
|
1327
|
+
Retrieve collection information.
|
|
1328
|
+
|
|
1329
|
+
Retrieves detailed information about the specified collection.
|
|
1330
|
+
Returns complete collection metadata and properties.
|
|
1331
|
+
|
|
1332
|
+
Args:
|
|
1333
|
+
args: Dictionary of operation arguments.
|
|
1334
|
+
Contains operation-specific parameters.
|
|
1335
|
+
See method implementation for details.
|
|
1336
|
+
|
|
1337
|
+
Returns:
|
|
1338
|
+
Dictionary containing collection information:
|
|
1339
|
+
{
|
|
1340
|
+
'guid': str, # Unique identifier
|
|
1341
|
+
'name': str, # Resource name
|
|
1342
|
+
'attributes': dict, # Resource attributes
|
|
1343
|
+
'status': str, # Resource status
|
|
1344
|
+
'updateTime': int # Last update timestamp
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
Raises:
|
|
1348
|
+
ValueError: When required parameters are missing or invalid:
|
|
1349
|
+
- Empty or None values for required fields
|
|
1350
|
+
- Invalid GUID format
|
|
1351
|
+
- Out-of-range values
|
|
1352
|
+
|
|
1353
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1354
|
+
- DefaultAzureCredential not configured
|
|
1355
|
+
- Insufficient permissions
|
|
1356
|
+
- Expired authentication token
|
|
1357
|
+
|
|
1358
|
+
HTTPError: When Purview API returns error:
|
|
1359
|
+
- 400: Bad request (invalid parameters)
|
|
1360
|
+
- 401: Unauthorized (authentication failed)
|
|
1361
|
+
- 403: Forbidden (insufficient permissions)
|
|
1362
|
+
- 404: Resource not found
|
|
1363
|
+
- 429: Rate limit exceeded
|
|
1364
|
+
- 500: Internal server error
|
|
1365
|
+
|
|
1366
|
+
NetworkError: When network connectivity fails
|
|
1367
|
+
|
|
1368
|
+
Example:
|
|
1369
|
+
# Basic usage
|
|
1370
|
+
client = Collections()
|
|
1371
|
+
|
|
1372
|
+
result = client.collectionsReadStatistics(args=...)
|
|
1373
|
+
print(f"Result: {result}")
|
|
1374
|
+
|
|
1375
|
+
Use Cases:
|
|
1376
|
+
- Data Discovery: Find and explore data assets
|
|
1377
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1378
|
+
- Reporting: Generate catalog reports
|
|
1379
|
+
"""
|
|
1380
|
+
self.method = "GET"
|
|
1381
|
+
self.endpoint = f"{ENDPOINTS['collections']['get'].format(collectionName=args['--collectionName'])}/statistics"
|
|
1382
|
+
self.params = {
|
|
1383
|
+
**get_api_version_params("account"),
|
|
1384
|
+
"includeChildren": str(args.get("--includeChildren", False)).lower(),
|
|
1385
|
+
"metrics": args.get("--metrics", "all"),
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
@decorator
|
|
1389
|
+
def collectionsGenerateReport(self, args):
|
|
1390
|
+
"""
|
|
1391
|
+
Perform operation on resource.
|
|
1392
|
+
|
|
1393
|
+
|
|
1394
|
+
|
|
1395
|
+
Args:
|
|
1396
|
+
args: Dictionary of operation arguments.
|
|
1397
|
+
Contains operation-specific parameters.
|
|
1398
|
+
See method implementation for details.
|
|
1399
|
+
|
|
1400
|
+
Returns:
|
|
1401
|
+
[TODO: Specify return type and structure]
|
|
1402
|
+
[TODO: Document nested fields]
|
|
1403
|
+
|
|
1404
|
+
Raises:
|
|
1405
|
+
ValueError: When required parameters are missing or invalid:
|
|
1406
|
+
- Empty or None values for required fields
|
|
1407
|
+
- Invalid GUID format
|
|
1408
|
+
- Out-of-range values
|
|
1409
|
+
|
|
1410
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1411
|
+
- DefaultAzureCredential not configured
|
|
1412
|
+
- Insufficient permissions
|
|
1413
|
+
- Expired authentication token
|
|
1414
|
+
|
|
1415
|
+
HTTPError: When Purview API returns error:
|
|
1416
|
+
- 400: Bad request (invalid parameters)
|
|
1417
|
+
- 401: Unauthorized (authentication failed)
|
|
1418
|
+
- 403: Forbidden (insufficient permissions)
|
|
1419
|
+
- 404: Resource not found
|
|
1420
|
+
- 429: Rate limit exceeded
|
|
1421
|
+
- 500: Internal server error
|
|
1422
|
+
|
|
1423
|
+
NetworkError: When network connectivity fails
|
|
1424
|
+
|
|
1425
|
+
Example:
|
|
1426
|
+
# Basic usage
|
|
1427
|
+
client = Collections()
|
|
1428
|
+
|
|
1429
|
+
result = client.collectionsGenerateReport(args=...)
|
|
1430
|
+
print(f"Result: {result}")
|
|
1431
|
+
|
|
1432
|
+
Use Cases:
|
|
1433
|
+
- [TODO: Add specific use cases for this operation]
|
|
1434
|
+
- [TODO: Include business context]
|
|
1435
|
+
- [TODO: Explain when to use this method]
|
|
1436
|
+
"""
|
|
1437
|
+
self.method = "POST"
|
|
1438
|
+
self.endpoint = f"{ENDPOINTS['collections']['get'].format(collectionName=args['--collectionName'])}/report"
|
|
1439
|
+
self.params = {
|
|
1440
|
+
**get_api_version_params("account"),
|
|
1441
|
+
"reportType": args.get("--reportType", "summary"),
|
|
1442
|
+
"format": args.get("--format", "json"),
|
|
1443
|
+
}
|
|
1444
|
+
self.payload = get_json(args, "--payloadFile") if args.get("--payloadFile") else {}
|
|
1445
|
+
|
|
1446
|
+
# === LEGACY COMPATIBILITY METHODS ===
|
|
1447
|
+
|
|
1448
|
+
@decorator
|
|
1449
|
+
def collectionsCreateOrUpdate(self, args):
|
|
1450
|
+
"""
|
|
1451
|
+
Create a new collection.
|
|
1452
|
+
|
|
1453
|
+
Creates a new collection in Microsoft Purview Collections. Collections organize assets into logical groups.
|
|
1454
|
+
Requires appropriate permissions and valid collection definition.
|
|
1455
|
+
|
|
1456
|
+
Args:
|
|
1457
|
+
args: Dictionary of operation arguments.
|
|
1458
|
+
Contains operation-specific parameters.
|
|
1459
|
+
See method implementation for details.
|
|
1460
|
+
|
|
1461
|
+
Returns:
|
|
1462
|
+
Dictionary containing created collection:
|
|
1463
|
+
{
|
|
1464
|
+
'guid': str, # Unique identifier
|
|
1465
|
+
'name': str, # Resource name
|
|
1466
|
+
'status': str, # Creation status
|
|
1467
|
+
'attributes': dict, # Resource attributes
|
|
1468
|
+
'createTime': int # Creation timestamp
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
Raises:
|
|
1472
|
+
ValueError: When required parameters are missing or invalid:
|
|
1473
|
+
- Empty or None values for required fields
|
|
1474
|
+
- Invalid GUID format
|
|
1475
|
+
- Out-of-range values
|
|
1476
|
+
|
|
1477
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1478
|
+
- DefaultAzureCredential not configured
|
|
1479
|
+
- Insufficient permissions
|
|
1480
|
+
- Expired authentication token
|
|
1481
|
+
|
|
1482
|
+
HTTPError: When Purview API returns error:
|
|
1483
|
+
- 400: Bad request (invalid parameters)
|
|
1484
|
+
- 401: Unauthorized (authentication failed)
|
|
1485
|
+
- 403: Forbidden (insufficient permissions)
|
|
1486
|
+
- 404: Resource not found
|
|
1487
|
+
- 409: Conflict (resource already exists)
|
|
1488
|
+
- 429: Rate limit exceeded
|
|
1489
|
+
- 500: Internal server error
|
|
1490
|
+
|
|
1491
|
+
NetworkError: When network connectivity fails
|
|
1492
|
+
|
|
1493
|
+
Example:
|
|
1494
|
+
# Basic usage
|
|
1495
|
+
client = Collections()
|
|
1496
|
+
|
|
1497
|
+
result = client.collectionsCreateOrUpdate(args=...)
|
|
1498
|
+
print(f"Result: {result}")
|
|
1499
|
+
|
|
1500
|
+
# With detailed data
|
|
1501
|
+
data = {
|
|
1502
|
+
'name': 'My Resource',
|
|
1503
|
+
'description': 'Resource description',
|
|
1504
|
+
'attributes': {
|
|
1505
|
+
'key1': 'value1',
|
|
1506
|
+
'key2': 'value2'
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
result = client.collectionsCreateOrUpdate(data)
|
|
1511
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1512
|
+
|
|
1513
|
+
Use Cases:
|
|
1514
|
+
- Data Onboarding: Register new data sources in catalog
|
|
1515
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
1516
|
+
- Automation: Programmatically populate catalog
|
|
1517
|
+
"""
|
|
1518
|
+
return self.collectionsCreate(args)
|
|
1519
|
+
|
|
1520
|
+
@decorator
|
|
1521
|
+
def collectionsPut(self, args):
|
|
1522
|
+
"""
|
|
1523
|
+
Update an existing collection.
|
|
1524
|
+
|
|
1525
|
+
Updates an existing collection with new values.
|
|
1526
|
+
Only specified fields are modified; others remain unchanged.
|
|
1527
|
+
|
|
1528
|
+
Args:
|
|
1529
|
+
args: Dictionary of operation arguments.
|
|
1530
|
+
Contains operation-specific parameters.
|
|
1531
|
+
See method implementation for details.
|
|
1532
|
+
|
|
1533
|
+
Returns:
|
|
1534
|
+
Dictionary containing updated collection:
|
|
1535
|
+
{
|
|
1536
|
+
'guid': str, # Unique identifier
|
|
1537
|
+
'attributes': dict, # Updated attributes
|
|
1538
|
+
'updateTime': int # Update timestamp
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
Raises:
|
|
1542
|
+
ValueError: When required parameters are missing or invalid:
|
|
1543
|
+
- Empty or None values for required fields
|
|
1544
|
+
- Invalid GUID format
|
|
1545
|
+
- Out-of-range values
|
|
1546
|
+
|
|
1547
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1548
|
+
- DefaultAzureCredential not configured
|
|
1549
|
+
- Insufficient permissions
|
|
1550
|
+
- Expired authentication token
|
|
1551
|
+
|
|
1552
|
+
HTTPError: When Purview API returns error:
|
|
1553
|
+
- 400: Bad request (invalid parameters)
|
|
1554
|
+
- 401: Unauthorized (authentication failed)
|
|
1555
|
+
- 403: Forbidden (insufficient permissions)
|
|
1556
|
+
- 404: Resource not found
|
|
1557
|
+
- 429: Rate limit exceeded
|
|
1558
|
+
- 500: Internal server error
|
|
1559
|
+
|
|
1560
|
+
NetworkError: When network connectivity fails
|
|
1561
|
+
|
|
1562
|
+
Example:
|
|
1563
|
+
# Basic usage
|
|
1564
|
+
client = Collections()
|
|
1565
|
+
|
|
1566
|
+
result = client.collectionsPut(args=...)
|
|
1567
|
+
print(f"Result: {result}")
|
|
1568
|
+
|
|
1569
|
+
# With detailed data
|
|
1570
|
+
data = {
|
|
1571
|
+
'name': 'My Resource',
|
|
1572
|
+
'description': 'Resource description',
|
|
1573
|
+
'attributes': {
|
|
1574
|
+
'key1': 'value1',
|
|
1575
|
+
'key2': 'value2'
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
result = client.collectionsPut(data)
|
|
1580
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1581
|
+
|
|
1582
|
+
Use Cases:
|
|
1583
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
1584
|
+
- Ownership Changes: Reassign data ownership
|
|
1585
|
+
- Classification: Apply or modify data classifications
|
|
1586
|
+
"""
|
|
1587
|
+
return self.collectionsCreate(args)
|
|
1588
|
+
|
|
1589
|
+
@decorator
|
|
1590
|
+
def collectionsGet(self, args):
|
|
1591
|
+
"""
|
|
1592
|
+
Retrieve collection information.
|
|
1593
|
+
|
|
1594
|
+
Retrieves detailed information about the specified collection.
|
|
1595
|
+
Returns complete collection metadata and properties.
|
|
1596
|
+
|
|
1597
|
+
Args:
|
|
1598
|
+
args: Dictionary of operation arguments.
|
|
1599
|
+
Contains operation-specific parameters.
|
|
1600
|
+
See method implementation for details.
|
|
1601
|
+
|
|
1602
|
+
Returns:
|
|
1603
|
+
Dictionary containing collection information:
|
|
1604
|
+
{
|
|
1605
|
+
'guid': str, # Unique identifier
|
|
1606
|
+
'name': str, # Resource name
|
|
1607
|
+
'attributes': dict, # Resource attributes
|
|
1608
|
+
'status': str, # Resource status
|
|
1609
|
+
'updateTime': int # Last update timestamp
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
Raises:
|
|
1613
|
+
ValueError: When required parameters are missing or invalid:
|
|
1614
|
+
- Empty or None values for required fields
|
|
1615
|
+
- Invalid GUID format
|
|
1616
|
+
- Out-of-range values
|
|
1617
|
+
|
|
1618
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1619
|
+
- DefaultAzureCredential not configured
|
|
1620
|
+
- Insufficient permissions
|
|
1621
|
+
- Expired authentication token
|
|
1622
|
+
|
|
1623
|
+
HTTPError: When Purview API returns error:
|
|
1624
|
+
- 400: Bad request (invalid parameters)
|
|
1625
|
+
- 401: Unauthorized (authentication failed)
|
|
1626
|
+
- 403: Forbidden (insufficient permissions)
|
|
1627
|
+
- 404: Resource not found
|
|
1628
|
+
- 429: Rate limit exceeded
|
|
1629
|
+
- 500: Internal server error
|
|
1630
|
+
|
|
1631
|
+
NetworkError: When network connectivity fails
|
|
1632
|
+
|
|
1633
|
+
Example:
|
|
1634
|
+
# Basic usage
|
|
1635
|
+
client = Collections()
|
|
1636
|
+
|
|
1637
|
+
result = client.collectionsGet(args=...)
|
|
1638
|
+
print(f"Result: {result}")
|
|
1639
|
+
|
|
1640
|
+
Use Cases:
|
|
1641
|
+
- Data Discovery: Find and explore data assets
|
|
1642
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1643
|
+
- Reporting: Generate catalog reports
|
|
1644
|
+
"""
|
|
1645
|
+
return self.collectionsRead(args)
|
|
1646
|
+
|
|
1647
|
+
@decorator
|
|
1648
|
+
def collectionsGetPath(self, args):
|
|
1649
|
+
"""
|
|
1650
|
+
Retrieve collection information.
|
|
1651
|
+
|
|
1652
|
+
Retrieves detailed information about the specified collection.
|
|
1653
|
+
Returns complete collection metadata and properties.
|
|
1654
|
+
|
|
1655
|
+
Args:
|
|
1656
|
+
args: Dictionary of operation arguments.
|
|
1657
|
+
Contains operation-specific parameters.
|
|
1658
|
+
See method implementation for details.
|
|
1659
|
+
|
|
1660
|
+
Returns:
|
|
1661
|
+
Dictionary containing collection information:
|
|
1662
|
+
{
|
|
1663
|
+
'guid': str, # Unique identifier
|
|
1664
|
+
'name': str, # Resource name
|
|
1665
|
+
'attributes': dict, # Resource attributes
|
|
1666
|
+
'status': str, # Resource status
|
|
1667
|
+
'updateTime': int # Last update timestamp
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
Raises:
|
|
1671
|
+
ValueError: When required parameters are missing or invalid:
|
|
1672
|
+
- Empty or None values for required fields
|
|
1673
|
+
- Invalid GUID format
|
|
1674
|
+
- Out-of-range values
|
|
1675
|
+
|
|
1676
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1677
|
+
- DefaultAzureCredential not configured
|
|
1678
|
+
- Insufficient permissions
|
|
1679
|
+
- Expired authentication token
|
|
1680
|
+
|
|
1681
|
+
HTTPError: When Purview API returns error:
|
|
1682
|
+
- 400: Bad request (invalid parameters)
|
|
1683
|
+
- 401: Unauthorized (authentication failed)
|
|
1684
|
+
- 403: Forbidden (insufficient permissions)
|
|
1685
|
+
- 404: Resource not found
|
|
1686
|
+
- 429: Rate limit exceeded
|
|
1687
|
+
- 500: Internal server error
|
|
1688
|
+
|
|
1689
|
+
NetworkError: When network connectivity fails
|
|
1690
|
+
|
|
1691
|
+
Example:
|
|
1692
|
+
# Basic usage
|
|
1693
|
+
client = Collections()
|
|
1694
|
+
|
|
1695
|
+
result = client.collectionsGetPath(args=...)
|
|
1696
|
+
print(f"Result: {result}")
|
|
1697
|
+
|
|
1698
|
+
Use Cases:
|
|
1699
|
+
- Data Discovery: Find and explore data assets
|
|
1700
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1701
|
+
- Reporting: Generate catalog reports
|
|
1702
|
+
"""
|
|
1703
|
+
return self.collectionsReadPath(args)
|
|
1704
|
+
|
|
1705
|
+
@decorator
|
|
1706
|
+
def collectionsGetChildNames(self, args):
|
|
1707
|
+
"""
|
|
1708
|
+
Retrieve collection information.
|
|
1709
|
+
|
|
1710
|
+
Retrieves detailed information about the specified collection.
|
|
1711
|
+
Returns complete collection metadata and properties.
|
|
1712
|
+
|
|
1713
|
+
Args:
|
|
1714
|
+
args: Dictionary of operation arguments.
|
|
1715
|
+
Contains operation-specific parameters.
|
|
1716
|
+
See method implementation for details.
|
|
1717
|
+
|
|
1718
|
+
Returns:
|
|
1719
|
+
Dictionary containing collection information:
|
|
1720
|
+
{
|
|
1721
|
+
'guid': str, # Unique identifier
|
|
1722
|
+
'name': str, # Resource name
|
|
1723
|
+
'attributes': dict, # Resource attributes
|
|
1724
|
+
'status': str, # Resource status
|
|
1725
|
+
'updateTime': int # Last update timestamp
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
Raises:
|
|
1729
|
+
ValueError: When required parameters are missing or invalid:
|
|
1730
|
+
- Empty or None values for required fields
|
|
1731
|
+
- Invalid GUID format
|
|
1732
|
+
- Out-of-range values
|
|
1733
|
+
|
|
1734
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1735
|
+
- DefaultAzureCredential not configured
|
|
1736
|
+
- Insufficient permissions
|
|
1737
|
+
- Expired authentication token
|
|
1738
|
+
|
|
1739
|
+
HTTPError: When Purview API returns error:
|
|
1740
|
+
- 400: Bad request (invalid parameters)
|
|
1741
|
+
- 401: Unauthorized (authentication failed)
|
|
1742
|
+
- 403: Forbidden (insufficient permissions)
|
|
1743
|
+
- 404: Resource not found
|
|
1744
|
+
- 429: Rate limit exceeded
|
|
1745
|
+
- 500: Internal server error
|
|
1746
|
+
|
|
1747
|
+
NetworkError: When network connectivity fails
|
|
1748
|
+
|
|
1749
|
+
Example:
|
|
1750
|
+
# Basic usage
|
|
1751
|
+
client = Collections()
|
|
1752
|
+
|
|
1753
|
+
result = client.collectionsGetChildNames(args=...)
|
|
1754
|
+
print(f"Result: {result}")
|
|
1755
|
+
|
|
1756
|
+
Use Cases:
|
|
1757
|
+
- Data Discovery: Find and explore data assets
|
|
1758
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1759
|
+
- Reporting: Generate catalog reports
|
|
1760
|
+
"""
|
|
1761
|
+
return self.collectionsReadChildNames(args)
|