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,3545 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Entity Management Client for Microsoft Purview Data Map API
|
|
3
|
+
Based on official API: https://learn.microsoft.com/en-us/rest/api/purview/datamapdataplane/entity
|
|
4
|
+
API Version: 2023-09-01 / 2024-03-01-preview
|
|
5
|
+
|
|
6
|
+
Complete implementation of ALL Entity operations from the official specification with 100% coverage:
|
|
7
|
+
- CRUD Operations (Create, Read, Update, Delete)
|
|
8
|
+
- Bulk Operations
|
|
9
|
+
- Classification Management
|
|
10
|
+
- Business Metadata Management
|
|
11
|
+
- Label Management
|
|
12
|
+
- Unique Attribute Operations
|
|
13
|
+
- Collection Movement
|
|
14
|
+
- Advanced Entity Operations (History, Audit, Dependencies, Usage)
|
|
15
|
+
- Entity Validation and Analytics
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from .endpoint import Endpoint, decorator, get_json, no_api_call_decorator
|
|
19
|
+
from .endpoints import ENDPOINTS, get_api_version_params
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def map_flat_entity_to_purview_entity(row):
|
|
23
|
+
"""Map a flat row (pandas Series or dict) into a Purview entity dict.
|
|
24
|
+
|
|
25
|
+
Expected minimal input: { 'typeName': 'DataSet', 'qualifiedName': '...','attr1': 'v', ... }
|
|
26
|
+
Produces: { 'typeName': ..., 'attributes': { 'qualifiedName': ..., 'attr1': 'v', ... } }
|
|
27
|
+
"""
|
|
28
|
+
try:
|
|
29
|
+
data = row.to_dict()
|
|
30
|
+
except Exception:
|
|
31
|
+
data = dict(row)
|
|
32
|
+
|
|
33
|
+
# pop typeName
|
|
34
|
+
type_name = data.pop("typeName", None)
|
|
35
|
+
|
|
36
|
+
# build attributes, skipping null-like values
|
|
37
|
+
attrs = {}
|
|
38
|
+
from math import isnan
|
|
39
|
+
|
|
40
|
+
for k, v in data.items():
|
|
41
|
+
# skip empty column names
|
|
42
|
+
if k is None or (isinstance(k, str) and k.strip() == ""):
|
|
43
|
+
continue
|
|
44
|
+
# treat NaN/None as missing
|
|
45
|
+
try:
|
|
46
|
+
if v is None:
|
|
47
|
+
continue
|
|
48
|
+
if isinstance(v, float) and isnan(v):
|
|
49
|
+
continue
|
|
50
|
+
except Exception:
|
|
51
|
+
pass
|
|
52
|
+
attrs[k] = v
|
|
53
|
+
|
|
54
|
+
return {"typeName": type_name, "attributes": attrs}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class Entity(Endpoint):
|
|
58
|
+
"""Entity Management Operations - Complete Official API Implementation with 100% Coverage"""
|
|
59
|
+
|
|
60
|
+
def __init__(self):
|
|
61
|
+
Endpoint.__init__(self)
|
|
62
|
+
self.app = "catalog"
|
|
63
|
+
|
|
64
|
+
# === CORE ENTITY CRUD OPERATIONS ===
|
|
65
|
+
|
|
66
|
+
@decorator
|
|
67
|
+
def entityCreateOrUpdate(self, args):
|
|
68
|
+
"""
|
|
69
|
+
Create a new entity.
|
|
70
|
+
|
|
71
|
+
Creates a new entity in Microsoft Purview Data Map.
|
|
72
|
+
Requires appropriate permissions and valid entity definition.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
args: Dictionary of operation arguments.
|
|
76
|
+
Contains operation-specific parameters.
|
|
77
|
+
See method implementation for details.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
Dictionary containing created entity:
|
|
81
|
+
{
|
|
82
|
+
'guid': str, # Unique identifier
|
|
83
|
+
'name': str, # Resource name
|
|
84
|
+
'status': str, # Creation status
|
|
85
|
+
'attributes': dict, # Resource attributes
|
|
86
|
+
'createTime': int # Creation timestamp
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
Raises:
|
|
90
|
+
ValueError: When required parameters are missing or invalid:
|
|
91
|
+
- Empty or None values for required fields
|
|
92
|
+
- Invalid GUID format
|
|
93
|
+
- Out-of-range values
|
|
94
|
+
|
|
95
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
96
|
+
- DefaultAzureCredential not configured
|
|
97
|
+
- Insufficient permissions
|
|
98
|
+
- Expired authentication token
|
|
99
|
+
|
|
100
|
+
HTTPError: When Purview API returns error:
|
|
101
|
+
- 400: Bad request (invalid parameters)
|
|
102
|
+
- 401: Unauthorized (authentication failed)
|
|
103
|
+
- 403: Forbidden (insufficient permissions)
|
|
104
|
+
- 404: Resource not found
|
|
105
|
+
- 409: Conflict (resource already exists)
|
|
106
|
+
- 429: Rate limit exceeded
|
|
107
|
+
- 500: Internal server error
|
|
108
|
+
|
|
109
|
+
NetworkError: When network connectivity fails
|
|
110
|
+
|
|
111
|
+
Example:
|
|
112
|
+
# Basic usage
|
|
113
|
+
client = Entity()
|
|
114
|
+
|
|
115
|
+
result = client.entityCreateOrUpdate(args=...)
|
|
116
|
+
print(f"Result: {result}")
|
|
117
|
+
|
|
118
|
+
# With detailed data
|
|
119
|
+
data = {
|
|
120
|
+
'name': 'My Resource',
|
|
121
|
+
'description': 'Resource description',
|
|
122
|
+
'attributes': {
|
|
123
|
+
'key1': 'value1',
|
|
124
|
+
'key2': 'value2'
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
result = client.entityCreateOrUpdate(data)
|
|
129
|
+
print(f"Created/Updated: {result['guid']}")
|
|
130
|
+
|
|
131
|
+
Use Cases:
|
|
132
|
+
- Data Onboarding: Register new data sources in catalog
|
|
133
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
134
|
+
- Automation: Programmatically populate catalog
|
|
135
|
+
"""
|
|
136
|
+
self.method = "POST"
|
|
137
|
+
self.endpoint = ENDPOINTS["entity"]["create_or_update"]
|
|
138
|
+
self.params = get_api_version_params("datamap")
|
|
139
|
+
self.payload = get_json(args, "--payloadFile")
|
|
140
|
+
|
|
141
|
+
@decorator
|
|
142
|
+
def entityCreate(self, args):
|
|
143
|
+
"""
|
|
144
|
+
Create a new entity.
|
|
145
|
+
|
|
146
|
+
Creates a new entity in Microsoft Purview Data Map.
|
|
147
|
+
Requires appropriate permissions and valid entity definition.
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
args: Dictionary of operation arguments.
|
|
151
|
+
Contains operation-specific parameters.
|
|
152
|
+
See method implementation for details.
|
|
153
|
+
|
|
154
|
+
Returns:
|
|
155
|
+
Dictionary containing created entity:
|
|
156
|
+
{
|
|
157
|
+
'guid': str, # Unique identifier
|
|
158
|
+
'name': str, # Resource name
|
|
159
|
+
'status': str, # Creation status
|
|
160
|
+
'attributes': dict, # Resource attributes
|
|
161
|
+
'createTime': int # Creation timestamp
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
Raises:
|
|
165
|
+
ValueError: When required parameters are missing or invalid:
|
|
166
|
+
- Empty or None values for required fields
|
|
167
|
+
- Invalid GUID format
|
|
168
|
+
- Out-of-range values
|
|
169
|
+
|
|
170
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
171
|
+
- DefaultAzureCredential not configured
|
|
172
|
+
- Insufficient permissions
|
|
173
|
+
- Expired authentication token
|
|
174
|
+
|
|
175
|
+
HTTPError: When Purview API returns error:
|
|
176
|
+
- 400: Bad request (invalid parameters)
|
|
177
|
+
- 401: Unauthorized (authentication failed)
|
|
178
|
+
- 403: Forbidden (insufficient permissions)
|
|
179
|
+
- 404: Resource not found
|
|
180
|
+
- 409: Conflict (resource already exists)
|
|
181
|
+
- 429: Rate limit exceeded
|
|
182
|
+
- 500: Internal server error
|
|
183
|
+
|
|
184
|
+
NetworkError: When network connectivity fails
|
|
185
|
+
|
|
186
|
+
Example:
|
|
187
|
+
# Basic usage
|
|
188
|
+
client = Entity()
|
|
189
|
+
|
|
190
|
+
result = client.entityCreate(args=...)
|
|
191
|
+
print(f"Result: {result}")
|
|
192
|
+
|
|
193
|
+
# With detailed data
|
|
194
|
+
data = {
|
|
195
|
+
'name': 'My Resource',
|
|
196
|
+
'description': 'Resource description',
|
|
197
|
+
'attributes': {
|
|
198
|
+
'key1': 'value1',
|
|
199
|
+
'key2': 'value2'
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
result = client.entityCreate(data)
|
|
204
|
+
print(f"Created/Updated: {result['guid']}")
|
|
205
|
+
|
|
206
|
+
Use Cases:
|
|
207
|
+
- Data Onboarding: Register new data sources in catalog
|
|
208
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
209
|
+
- Automation: Programmatically populate catalog
|
|
210
|
+
"""
|
|
211
|
+
return self.entityCreateOrUpdate(args)
|
|
212
|
+
|
|
213
|
+
@decorator
|
|
214
|
+
def entityRead(self, args):
|
|
215
|
+
"""
|
|
216
|
+
Retrieve entity information.
|
|
217
|
+
|
|
218
|
+
Retrieves detailed information about the specified entity.
|
|
219
|
+
Returns complete entity metadata and properties.
|
|
220
|
+
|
|
221
|
+
Args:
|
|
222
|
+
args: Dictionary of operation arguments.
|
|
223
|
+
Contains operation-specific parameters.
|
|
224
|
+
See method implementation for details.
|
|
225
|
+
|
|
226
|
+
Returns:
|
|
227
|
+
Dictionary containing entity information:
|
|
228
|
+
{
|
|
229
|
+
'guid': str, # Unique identifier
|
|
230
|
+
'name': str, # Resource name
|
|
231
|
+
'attributes': dict, # Resource attributes
|
|
232
|
+
'status': str, # Resource status
|
|
233
|
+
'updateTime': int # Last update timestamp
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
Raises:
|
|
237
|
+
ValueError: When required parameters are missing or invalid:
|
|
238
|
+
- Empty or None values for required fields
|
|
239
|
+
- Invalid GUID format
|
|
240
|
+
- Out-of-range values
|
|
241
|
+
|
|
242
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
243
|
+
- DefaultAzureCredential not configured
|
|
244
|
+
- Insufficient permissions
|
|
245
|
+
- Expired authentication token
|
|
246
|
+
|
|
247
|
+
HTTPError: When Purview API returns error:
|
|
248
|
+
- 400: Bad request (invalid parameters)
|
|
249
|
+
- 401: Unauthorized (authentication failed)
|
|
250
|
+
- 403: Forbidden (insufficient permissions)
|
|
251
|
+
- 404: Resource not found
|
|
252
|
+
- 429: Rate limit exceeded
|
|
253
|
+
- 500: Internal server error
|
|
254
|
+
|
|
255
|
+
NetworkError: When network connectivity fails
|
|
256
|
+
|
|
257
|
+
Example:
|
|
258
|
+
# Basic usage
|
|
259
|
+
client = Entity()
|
|
260
|
+
|
|
261
|
+
result = client.entityRead(args=...)
|
|
262
|
+
print(f"Result: {result}")
|
|
263
|
+
|
|
264
|
+
Use Cases:
|
|
265
|
+
- Data Discovery: Find and explore data assets
|
|
266
|
+
- Compliance Auditing: Review metadata and classifications
|
|
267
|
+
- Reporting: Generate catalog reports
|
|
268
|
+
"""
|
|
269
|
+
self.method = "GET"
|
|
270
|
+
self.endpoint = ENDPOINTS["entity"]["get"].format(guid=args["--guid"][0])
|
|
271
|
+
self.params = {
|
|
272
|
+
**get_api_version_params("datamap"),
|
|
273
|
+
"ignoreRelationships": str(args.get("--ignoreRelationships", False)).lower(),
|
|
274
|
+
"minExtInfo": str(args.get("--minExtInfo", False)).lower(),
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
@decorator
|
|
278
|
+
def entityUpdate(self, args):
|
|
279
|
+
"""
|
|
280
|
+
Update an existing entity.
|
|
281
|
+
|
|
282
|
+
Updates an existing entity with new values.
|
|
283
|
+
Only specified fields are modified; others remain unchanged.
|
|
284
|
+
|
|
285
|
+
Args:
|
|
286
|
+
args: Dictionary of operation arguments.
|
|
287
|
+
Contains operation-specific parameters.
|
|
288
|
+
See method implementation for details.
|
|
289
|
+
|
|
290
|
+
Returns:
|
|
291
|
+
Dictionary containing updated entity:
|
|
292
|
+
{
|
|
293
|
+
'guid': str, # Unique identifier
|
|
294
|
+
'attributes': dict, # Updated attributes
|
|
295
|
+
'updateTime': int # Update timestamp
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
Raises:
|
|
299
|
+
ValueError: When required parameters are missing or invalid:
|
|
300
|
+
- Empty or None values for required fields
|
|
301
|
+
- Invalid GUID format
|
|
302
|
+
- Out-of-range values
|
|
303
|
+
|
|
304
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
305
|
+
- DefaultAzureCredential not configured
|
|
306
|
+
- Insufficient permissions
|
|
307
|
+
- Expired authentication token
|
|
308
|
+
|
|
309
|
+
HTTPError: When Purview API returns error:
|
|
310
|
+
- 400: Bad request (invalid parameters)
|
|
311
|
+
- 401: Unauthorized (authentication failed)
|
|
312
|
+
- 403: Forbidden (insufficient permissions)
|
|
313
|
+
- 404: Resource not found
|
|
314
|
+
- 429: Rate limit exceeded
|
|
315
|
+
- 500: Internal server error
|
|
316
|
+
|
|
317
|
+
NetworkError: When network connectivity fails
|
|
318
|
+
|
|
319
|
+
Example:
|
|
320
|
+
# Basic usage
|
|
321
|
+
client = Entity()
|
|
322
|
+
|
|
323
|
+
result = client.entityUpdate(args=...)
|
|
324
|
+
print(f"Result: {result}")
|
|
325
|
+
|
|
326
|
+
# With detailed data
|
|
327
|
+
data = {
|
|
328
|
+
'name': 'My Resource',
|
|
329
|
+
'description': 'Resource description',
|
|
330
|
+
'attributes': {
|
|
331
|
+
'key1': 'value1',
|
|
332
|
+
'key2': 'value2'
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
result = client.entityUpdate(data)
|
|
337
|
+
print(f"Created/Updated: {result['guid']}")
|
|
338
|
+
|
|
339
|
+
Use Cases:
|
|
340
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
341
|
+
- Ownership Changes: Reassign data ownership
|
|
342
|
+
- Classification: Apply or modify data classifications
|
|
343
|
+
"""
|
|
344
|
+
return self.entityCreateOrUpdate(args)
|
|
345
|
+
|
|
346
|
+
@decorator
|
|
347
|
+
def entityDelete(self, args):
|
|
348
|
+
"""
|
|
349
|
+
Delete a entity.
|
|
350
|
+
|
|
351
|
+
Permanently deletes the specified entity.
|
|
352
|
+
This operation cannot be undone. Use with caution.
|
|
353
|
+
|
|
354
|
+
Args:
|
|
355
|
+
args: Dictionary of operation arguments.
|
|
356
|
+
Contains operation-specific parameters.
|
|
357
|
+
See method implementation for details.
|
|
358
|
+
|
|
359
|
+
Returns:
|
|
360
|
+
Dictionary with deletion status:
|
|
361
|
+
{
|
|
362
|
+
'guid': str, # Deleted resource ID
|
|
363
|
+
'status': str, # Deletion status
|
|
364
|
+
'message': str # Confirmation message
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
Raises:
|
|
368
|
+
ValueError: When required parameters are missing or invalid:
|
|
369
|
+
- Empty or None values for required fields
|
|
370
|
+
- Invalid GUID format
|
|
371
|
+
- Out-of-range values
|
|
372
|
+
|
|
373
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
374
|
+
- DefaultAzureCredential not configured
|
|
375
|
+
- Insufficient permissions
|
|
376
|
+
- Expired authentication token
|
|
377
|
+
|
|
378
|
+
HTTPError: When Purview API returns error:
|
|
379
|
+
- 400: Bad request (invalid parameters)
|
|
380
|
+
- 401: Unauthorized (authentication failed)
|
|
381
|
+
- 403: Forbidden (insufficient permissions)
|
|
382
|
+
- 404: Resource not found
|
|
383
|
+
- 429: Rate limit exceeded
|
|
384
|
+
- 500: Internal server error
|
|
385
|
+
|
|
386
|
+
NetworkError: When network connectivity fails
|
|
387
|
+
|
|
388
|
+
Example:
|
|
389
|
+
# Basic usage
|
|
390
|
+
client = Entity()
|
|
391
|
+
|
|
392
|
+
result = client.entityDelete(args=...)
|
|
393
|
+
print(f"Result: {result}")
|
|
394
|
+
|
|
395
|
+
Use Cases:
|
|
396
|
+
- Data Cleanup: Remove obsolete or test data
|
|
397
|
+
- Decommissioning: Delete resources no longer in use
|
|
398
|
+
- Testing: Clean up test environments
|
|
399
|
+
"""
|
|
400
|
+
self.method = "DELETE"
|
|
401
|
+
self.endpoint = ENDPOINTS["entity"]["delete"].format(guid=args["--guid"][0])
|
|
402
|
+
self.params = get_api_version_params("datamap")
|
|
403
|
+
|
|
404
|
+
@decorator
|
|
405
|
+
def entityUpdateAttribute(self, args):
|
|
406
|
+
"""
|
|
407
|
+
Update an existing entity.
|
|
408
|
+
|
|
409
|
+
Updates an existing entity with new values.
|
|
410
|
+
Only specified fields are modified; others remain unchanged.
|
|
411
|
+
|
|
412
|
+
Args:
|
|
413
|
+
args: Dictionary of operation arguments.
|
|
414
|
+
Contains operation-specific parameters.
|
|
415
|
+
See method implementation for details.
|
|
416
|
+
|
|
417
|
+
Returns:
|
|
418
|
+
Dictionary containing updated entity:
|
|
419
|
+
{
|
|
420
|
+
'guid': str, # Unique identifier
|
|
421
|
+
'attributes': dict, # Updated attributes
|
|
422
|
+
'updateTime': int # Update timestamp
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
Raises:
|
|
426
|
+
ValueError: When required parameters are missing or invalid:
|
|
427
|
+
- Empty or None values for required fields
|
|
428
|
+
- Invalid GUID format
|
|
429
|
+
- Out-of-range values
|
|
430
|
+
|
|
431
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
432
|
+
- DefaultAzureCredential not configured
|
|
433
|
+
- Insufficient permissions
|
|
434
|
+
- Expired authentication token
|
|
435
|
+
|
|
436
|
+
HTTPError: When Purview API returns error:
|
|
437
|
+
- 400: Bad request (invalid parameters)
|
|
438
|
+
- 401: Unauthorized (authentication failed)
|
|
439
|
+
- 403: Forbidden (insufficient permissions)
|
|
440
|
+
- 404: Resource not found
|
|
441
|
+
- 429: Rate limit exceeded
|
|
442
|
+
- 500: Internal server error
|
|
443
|
+
|
|
444
|
+
NetworkError: When network connectivity fails
|
|
445
|
+
|
|
446
|
+
Example:
|
|
447
|
+
# Basic usage
|
|
448
|
+
client = Entity()
|
|
449
|
+
|
|
450
|
+
result = client.entityUpdateAttribute(args=...)
|
|
451
|
+
print(f"Result: {result}")
|
|
452
|
+
|
|
453
|
+
# With detailed data
|
|
454
|
+
data = {
|
|
455
|
+
'name': 'My Resource',
|
|
456
|
+
'description': 'Resource description',
|
|
457
|
+
'attributes': {
|
|
458
|
+
'key1': 'value1',
|
|
459
|
+
'key2': 'value2'
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
result = client.entityUpdateAttribute(data)
|
|
464
|
+
print(f"Created/Updated: {result['guid']}")
|
|
465
|
+
|
|
466
|
+
Use Cases:
|
|
467
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
468
|
+
- Ownership Changes: Reassign data ownership
|
|
469
|
+
- Classification: Apply or modify data classifications
|
|
470
|
+
"""
|
|
471
|
+
self.method = "PUT"
|
|
472
|
+
self.endpoint = ENDPOINTS["entity"]["update_attribute"].format(guid=args["--guid"][0])
|
|
473
|
+
self.params = {
|
|
474
|
+
**get_api_version_params("datamap"),
|
|
475
|
+
"name": args["--attrName"],
|
|
476
|
+
}
|
|
477
|
+
self.payload = args["--attrValue"]
|
|
478
|
+
|
|
479
|
+
# === ENTITY HEADER OPERATIONS ===
|
|
480
|
+
|
|
481
|
+
@decorator
|
|
482
|
+
def entityReadHeader(self, args):
|
|
483
|
+
"""
|
|
484
|
+
Retrieve entity information.
|
|
485
|
+
|
|
486
|
+
Retrieves detailed information about the specified entity.
|
|
487
|
+
Returns complete entity metadata and properties.
|
|
488
|
+
|
|
489
|
+
Args:
|
|
490
|
+
args: Dictionary of operation arguments.
|
|
491
|
+
Contains operation-specific parameters.
|
|
492
|
+
See method implementation for details.
|
|
493
|
+
|
|
494
|
+
Returns:
|
|
495
|
+
Dictionary containing entity information:
|
|
496
|
+
{
|
|
497
|
+
'guid': str, # Unique identifier
|
|
498
|
+
'name': str, # Resource name
|
|
499
|
+
'attributes': dict, # Resource attributes
|
|
500
|
+
'status': str, # Resource status
|
|
501
|
+
'updateTime': int # Last update timestamp
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
Raises:
|
|
505
|
+
ValueError: When required parameters are missing or invalid:
|
|
506
|
+
- Empty or None values for required fields
|
|
507
|
+
- Invalid GUID format
|
|
508
|
+
- Out-of-range values
|
|
509
|
+
|
|
510
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
511
|
+
- DefaultAzureCredential not configured
|
|
512
|
+
- Insufficient permissions
|
|
513
|
+
- Expired authentication token
|
|
514
|
+
|
|
515
|
+
HTTPError: When Purview API returns error:
|
|
516
|
+
- 400: Bad request (invalid parameters)
|
|
517
|
+
- 401: Unauthorized (authentication failed)
|
|
518
|
+
- 403: Forbidden (insufficient permissions)
|
|
519
|
+
- 404: Resource not found
|
|
520
|
+
- 429: Rate limit exceeded
|
|
521
|
+
- 500: Internal server error
|
|
522
|
+
|
|
523
|
+
NetworkError: When network connectivity fails
|
|
524
|
+
|
|
525
|
+
Example:
|
|
526
|
+
# Basic usage
|
|
527
|
+
client = Entity()
|
|
528
|
+
|
|
529
|
+
result = client.entityReadHeader(args=...)
|
|
530
|
+
print(f"Result: {result}")
|
|
531
|
+
|
|
532
|
+
Use Cases:
|
|
533
|
+
- Data Discovery: Find and explore data assets
|
|
534
|
+
- Compliance Auditing: Review metadata and classifications
|
|
535
|
+
- Reporting: Generate catalog reports
|
|
536
|
+
"""
|
|
537
|
+
self.method = "GET"
|
|
538
|
+
self.endpoint = ENDPOINTS["entity"]["get_header"].format(guid=args["--guid"][0])
|
|
539
|
+
self.params = get_api_version_params("datamap")
|
|
540
|
+
|
|
541
|
+
# === BULK OPERATIONS ===
|
|
542
|
+
|
|
543
|
+
def _validate_entities_have_qualified_name(self, args):
|
|
544
|
+
"""Ensure every entity in the payload has a non-empty attributes.qualifiedName."""
|
|
545
|
+
payload = get_json(args, "--payloadFile")
|
|
546
|
+
entities = payload.get("entities", [])
|
|
547
|
+
missing = [e for e in entities if not e.get("attributes", {}).get("qualifiedName")]
|
|
548
|
+
if missing:
|
|
549
|
+
raise ValueError(f"The following entities are missing 'qualifiedName': {missing}")
|
|
550
|
+
|
|
551
|
+
@decorator
|
|
552
|
+
def entityBulkCreateOrUpdate(self, args):
|
|
553
|
+
"""
|
|
554
|
+
Create a new entity.
|
|
555
|
+
|
|
556
|
+
Creates a new entity in Microsoft Purview Data Map.
|
|
557
|
+
Requires appropriate permissions and valid entity definition.
|
|
558
|
+
|
|
559
|
+
Args:
|
|
560
|
+
args: Dictionary of operation arguments.
|
|
561
|
+
Contains operation-specific parameters.
|
|
562
|
+
See method implementation for details.
|
|
563
|
+
|
|
564
|
+
Returns:
|
|
565
|
+
Dictionary containing created entity:
|
|
566
|
+
{
|
|
567
|
+
'guid': str, # Unique identifier
|
|
568
|
+
'name': str, # Resource name
|
|
569
|
+
'status': str, # Creation status
|
|
570
|
+
'attributes': dict, # Resource attributes
|
|
571
|
+
'createTime': int # Creation timestamp
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
Raises:
|
|
575
|
+
ValueError: When required parameters are missing or invalid:
|
|
576
|
+
- Empty or None values for required fields
|
|
577
|
+
- Invalid GUID format
|
|
578
|
+
- Out-of-range values
|
|
579
|
+
|
|
580
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
581
|
+
- DefaultAzureCredential not configured
|
|
582
|
+
- Insufficient permissions
|
|
583
|
+
- Expired authentication token
|
|
584
|
+
|
|
585
|
+
HTTPError: When Purview API returns error:
|
|
586
|
+
- 400: Bad request (invalid parameters)
|
|
587
|
+
- 401: Unauthorized (authentication failed)
|
|
588
|
+
- 403: Forbidden (insufficient permissions)
|
|
589
|
+
- 404: Resource not found
|
|
590
|
+
- 409: Conflict (resource already exists)
|
|
591
|
+
- 429: Rate limit exceeded
|
|
592
|
+
- 500: Internal server error
|
|
593
|
+
|
|
594
|
+
NetworkError: When network connectivity fails
|
|
595
|
+
|
|
596
|
+
Example:
|
|
597
|
+
# Basic usage
|
|
598
|
+
client = Entity()
|
|
599
|
+
|
|
600
|
+
result = client.entityBulkCreateOrUpdate(args=...)
|
|
601
|
+
print(f"Result: {result}")
|
|
602
|
+
|
|
603
|
+
# With detailed data
|
|
604
|
+
data = {
|
|
605
|
+
'name': 'My Resource',
|
|
606
|
+
'description': 'Resource description',
|
|
607
|
+
'attributes': {
|
|
608
|
+
'key1': 'value1',
|
|
609
|
+
'key2': 'value2'
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
result = client.entityBulkCreateOrUpdate(data)
|
|
614
|
+
print(f"Created/Updated: {result['guid']}")
|
|
615
|
+
|
|
616
|
+
Use Cases:
|
|
617
|
+
- Data Onboarding: Register new data sources in catalog
|
|
618
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
619
|
+
- Automation: Programmatically populate catalog
|
|
620
|
+
"""
|
|
621
|
+
self._validate_entities_have_qualified_name(args)
|
|
622
|
+
self.method = "POST"
|
|
623
|
+
self.endpoint = ENDPOINTS["entity"]["bulk_create_or_update"]
|
|
624
|
+
self.params = get_api_version_params("datamap")
|
|
625
|
+
self.payload = get_json(args, "--payloadFile")
|
|
626
|
+
|
|
627
|
+
@decorator
|
|
628
|
+
def entityCreateBulk(self, args):
|
|
629
|
+
"""
|
|
630
|
+
Create a new entity.
|
|
631
|
+
|
|
632
|
+
Creates a new entity in Microsoft Purview Data Map.
|
|
633
|
+
Requires appropriate permissions and valid entity definition.
|
|
634
|
+
|
|
635
|
+
Args:
|
|
636
|
+
args: Dictionary of operation arguments.
|
|
637
|
+
Contains operation-specific parameters.
|
|
638
|
+
See method implementation for details.
|
|
639
|
+
|
|
640
|
+
Returns:
|
|
641
|
+
Dictionary containing created entity:
|
|
642
|
+
{
|
|
643
|
+
'guid': str, # Unique identifier
|
|
644
|
+
'name': str, # Resource name
|
|
645
|
+
'status': str, # Creation status
|
|
646
|
+
'attributes': dict, # Resource attributes
|
|
647
|
+
'createTime': int # Creation timestamp
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
Raises:
|
|
651
|
+
ValueError: When required parameters are missing or invalid:
|
|
652
|
+
- Empty or None values for required fields
|
|
653
|
+
- Invalid GUID format
|
|
654
|
+
- Out-of-range values
|
|
655
|
+
|
|
656
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
657
|
+
- DefaultAzureCredential not configured
|
|
658
|
+
- Insufficient permissions
|
|
659
|
+
- Expired authentication token
|
|
660
|
+
|
|
661
|
+
HTTPError: When Purview API returns error:
|
|
662
|
+
- 400: Bad request (invalid parameters)
|
|
663
|
+
- 401: Unauthorized (authentication failed)
|
|
664
|
+
- 403: Forbidden (insufficient permissions)
|
|
665
|
+
- 404: Resource not found
|
|
666
|
+
- 409: Conflict (resource already exists)
|
|
667
|
+
- 429: Rate limit exceeded
|
|
668
|
+
- 500: Internal server error
|
|
669
|
+
|
|
670
|
+
NetworkError: When network connectivity fails
|
|
671
|
+
|
|
672
|
+
Example:
|
|
673
|
+
# Basic usage
|
|
674
|
+
client = Entity()
|
|
675
|
+
|
|
676
|
+
result = client.entityCreateBulk(args=...)
|
|
677
|
+
print(f"Result: {result}")
|
|
678
|
+
|
|
679
|
+
# With detailed data
|
|
680
|
+
data = {
|
|
681
|
+
'name': 'My Resource',
|
|
682
|
+
'description': 'Resource description',
|
|
683
|
+
'attributes': {
|
|
684
|
+
'key1': 'value1',
|
|
685
|
+
'key2': 'value2'
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
result = client.entityCreateBulk(data)
|
|
690
|
+
print(f"Created/Updated: {result['guid']}")
|
|
691
|
+
|
|
692
|
+
Use Cases:
|
|
693
|
+
- Data Onboarding: Register new data sources in catalog
|
|
694
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
695
|
+
- Automation: Programmatically populate catalog
|
|
696
|
+
"""
|
|
697
|
+
return self.entityBulkCreateOrUpdate(args)
|
|
698
|
+
|
|
699
|
+
@decorator
|
|
700
|
+
def entityDeleteBulk(self, args):
|
|
701
|
+
"""
|
|
702
|
+
Delete a entity.
|
|
703
|
+
|
|
704
|
+
Permanently deletes the specified entity.
|
|
705
|
+
This operation cannot be undone. Use with caution.
|
|
706
|
+
|
|
707
|
+
Args:
|
|
708
|
+
args: Dictionary of operation arguments.
|
|
709
|
+
Contains operation-specific parameters.
|
|
710
|
+
See method implementation for details.
|
|
711
|
+
|
|
712
|
+
Returns:
|
|
713
|
+
Dictionary with deletion status:
|
|
714
|
+
{
|
|
715
|
+
'guid': str, # Deleted resource ID
|
|
716
|
+
'status': str, # Deletion status
|
|
717
|
+
'message': str # Confirmation message
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
Raises:
|
|
721
|
+
ValueError: When required parameters are missing or invalid:
|
|
722
|
+
- Empty or None values for required fields
|
|
723
|
+
- Invalid GUID format
|
|
724
|
+
- Out-of-range values
|
|
725
|
+
|
|
726
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
727
|
+
- DefaultAzureCredential not configured
|
|
728
|
+
- Insufficient permissions
|
|
729
|
+
- Expired authentication token
|
|
730
|
+
|
|
731
|
+
HTTPError: When Purview API returns error:
|
|
732
|
+
- 400: Bad request (invalid parameters)
|
|
733
|
+
- 401: Unauthorized (authentication failed)
|
|
734
|
+
- 403: Forbidden (insufficient permissions)
|
|
735
|
+
- 404: Resource not found
|
|
736
|
+
- 429: Rate limit exceeded
|
|
737
|
+
- 500: Internal server error
|
|
738
|
+
|
|
739
|
+
NetworkError: When network connectivity fails
|
|
740
|
+
|
|
741
|
+
Example:
|
|
742
|
+
# Basic usage
|
|
743
|
+
client = Entity()
|
|
744
|
+
|
|
745
|
+
result = client.entityDeleteBulk(args=...)
|
|
746
|
+
print(f"Result: {result}")
|
|
747
|
+
|
|
748
|
+
Use Cases:
|
|
749
|
+
- Data Cleanup: Remove obsolete or test data
|
|
750
|
+
- Decommissioning: Delete resources no longer in use
|
|
751
|
+
- Testing: Clean up test environments
|
|
752
|
+
"""
|
|
753
|
+
self.method = "DELETE"
|
|
754
|
+
self.endpoint = ENDPOINTS["entity"]["bulk_delete"]
|
|
755
|
+
self.params = {**get_api_version_params("datamap"), "guid": args["--guid"]}
|
|
756
|
+
|
|
757
|
+
@decorator
|
|
758
|
+
def entityReadBulk(self, args):
|
|
759
|
+
"""
|
|
760
|
+
Retrieve entity information.
|
|
761
|
+
|
|
762
|
+
Retrieves detailed information about the specified entity.
|
|
763
|
+
Returns complete entity metadata and properties.
|
|
764
|
+
|
|
765
|
+
Args:
|
|
766
|
+
args: Dictionary of operation arguments.
|
|
767
|
+
Contains operation-specific parameters.
|
|
768
|
+
See method implementation for details.
|
|
769
|
+
|
|
770
|
+
Returns:
|
|
771
|
+
Dictionary containing entity information:
|
|
772
|
+
{
|
|
773
|
+
'guid': str, # Unique identifier
|
|
774
|
+
'name': str, # Resource name
|
|
775
|
+
'attributes': dict, # Resource attributes
|
|
776
|
+
'status': str, # Resource status
|
|
777
|
+
'updateTime': int # Last update timestamp
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
Raises:
|
|
781
|
+
ValueError: When required parameters are missing or invalid:
|
|
782
|
+
- Empty or None values for required fields
|
|
783
|
+
- Invalid GUID format
|
|
784
|
+
- Out-of-range values
|
|
785
|
+
|
|
786
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
787
|
+
- DefaultAzureCredential not configured
|
|
788
|
+
- Insufficient permissions
|
|
789
|
+
- Expired authentication token
|
|
790
|
+
|
|
791
|
+
HTTPError: When Purview API returns error:
|
|
792
|
+
- 400: Bad request (invalid parameters)
|
|
793
|
+
- 401: Unauthorized (authentication failed)
|
|
794
|
+
- 403: Forbidden (insufficient permissions)
|
|
795
|
+
- 404: Resource not found
|
|
796
|
+
- 429: Rate limit exceeded
|
|
797
|
+
- 500: Internal server error
|
|
798
|
+
|
|
799
|
+
NetworkError: When network connectivity fails
|
|
800
|
+
|
|
801
|
+
Example:
|
|
802
|
+
# Basic usage
|
|
803
|
+
client = Entity()
|
|
804
|
+
|
|
805
|
+
result = client.entityReadBulk(args=...)
|
|
806
|
+
print(f"Result: {result}")
|
|
807
|
+
|
|
808
|
+
Use Cases:
|
|
809
|
+
- Data Discovery: Find and explore data assets
|
|
810
|
+
- Compliance Auditing: Review metadata and classifications
|
|
811
|
+
- Reporting: Generate catalog reports
|
|
812
|
+
"""
|
|
813
|
+
self.method = "GET"
|
|
814
|
+
self.endpoint = ENDPOINTS["entity"]["list_by_guids"]
|
|
815
|
+
self.params = {
|
|
816
|
+
**get_api_version_params("datamap"),
|
|
817
|
+
"guid": args["--guid"],
|
|
818
|
+
"ignoreRelationships": str(args.get("--ignoreRelationships", False)).lower(),
|
|
819
|
+
"minExtInfo": str(args.get("--minExtInfo", False)).lower(),
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
# === UNIQUE ATTRIBUTE OPERATIONS ===
|
|
823
|
+
|
|
824
|
+
@decorator
|
|
825
|
+
def entityReadUniqueAttribute(self, args):
|
|
826
|
+
"""
|
|
827
|
+
Retrieve entity information.
|
|
828
|
+
|
|
829
|
+
Retrieves detailed information about the specified entity.
|
|
830
|
+
Returns complete entity metadata and properties.
|
|
831
|
+
|
|
832
|
+
Args:
|
|
833
|
+
args: Dictionary of operation arguments.
|
|
834
|
+
Contains operation-specific parameters.
|
|
835
|
+
See method implementation for details.
|
|
836
|
+
|
|
837
|
+
Returns:
|
|
838
|
+
Dictionary containing entity information:
|
|
839
|
+
{
|
|
840
|
+
'guid': str, # Unique identifier
|
|
841
|
+
'name': str, # Resource name
|
|
842
|
+
'attributes': dict, # Resource attributes
|
|
843
|
+
'status': str, # Resource status
|
|
844
|
+
'updateTime': int # Last update timestamp
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
Raises:
|
|
848
|
+
ValueError: When required parameters are missing or invalid:
|
|
849
|
+
- Empty or None values for required fields
|
|
850
|
+
- Invalid GUID format
|
|
851
|
+
- Out-of-range values
|
|
852
|
+
|
|
853
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
854
|
+
- DefaultAzureCredential not configured
|
|
855
|
+
- Insufficient permissions
|
|
856
|
+
- Expired authentication token
|
|
857
|
+
|
|
858
|
+
HTTPError: When Purview API returns error:
|
|
859
|
+
- 400: Bad request (invalid parameters)
|
|
860
|
+
- 401: Unauthorized (authentication failed)
|
|
861
|
+
- 403: Forbidden (insufficient permissions)
|
|
862
|
+
- 404: Resource not found
|
|
863
|
+
- 429: Rate limit exceeded
|
|
864
|
+
- 500: Internal server error
|
|
865
|
+
|
|
866
|
+
NetworkError: When network connectivity fails
|
|
867
|
+
|
|
868
|
+
Example:
|
|
869
|
+
# Basic usage
|
|
870
|
+
client = Entity()
|
|
871
|
+
|
|
872
|
+
result = client.entityReadUniqueAttribute(args=...)
|
|
873
|
+
print(f"Result: {result}")
|
|
874
|
+
|
|
875
|
+
Use Cases:
|
|
876
|
+
- Data Discovery: Find and explore data assets
|
|
877
|
+
- Compliance Auditing: Review metadata and classifications
|
|
878
|
+
- Reporting: Generate catalog reports
|
|
879
|
+
"""
|
|
880
|
+
self.method = "GET"
|
|
881
|
+
self.endpoint = ENDPOINTS["entity"]["get_by_unique_attributes"].format(
|
|
882
|
+
typeName=args["--typeName"]
|
|
883
|
+
)
|
|
884
|
+
self.params = {
|
|
885
|
+
**get_api_version_params("datamap"),
|
|
886
|
+
"attr:qualifiedName": args["--qualifiedName"],
|
|
887
|
+
"ignoreRelationships": str(args.get("--ignoreRelationships", False)).lower(),
|
|
888
|
+
"minExtInfo": str(args.get("--minExtInfo", False)).lower(),
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
@decorator
|
|
892
|
+
def entityReadBulkUniqueAttribute(self, args):
|
|
893
|
+
"""
|
|
894
|
+
Retrieve entity information.
|
|
895
|
+
|
|
896
|
+
Retrieves detailed information about the specified entity.
|
|
897
|
+
Returns complete entity metadata and properties.
|
|
898
|
+
|
|
899
|
+
Args:
|
|
900
|
+
args: Dictionary of operation arguments.
|
|
901
|
+
Contains operation-specific parameters.
|
|
902
|
+
See method implementation for details.
|
|
903
|
+
|
|
904
|
+
Returns:
|
|
905
|
+
Dictionary containing entity information:
|
|
906
|
+
{
|
|
907
|
+
'guid': str, # Unique identifier
|
|
908
|
+
'name': str, # Resource name
|
|
909
|
+
'attributes': dict, # Resource attributes
|
|
910
|
+
'status': str, # Resource status
|
|
911
|
+
'updateTime': int # Last update timestamp
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
Raises:
|
|
915
|
+
ValueError: When required parameters are missing or invalid:
|
|
916
|
+
- Empty or None values for required fields
|
|
917
|
+
- Invalid GUID format
|
|
918
|
+
- Out-of-range values
|
|
919
|
+
|
|
920
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
921
|
+
- DefaultAzureCredential not configured
|
|
922
|
+
- Insufficient permissions
|
|
923
|
+
- Expired authentication token
|
|
924
|
+
|
|
925
|
+
HTTPError: When Purview API returns error:
|
|
926
|
+
- 400: Bad request (invalid parameters)
|
|
927
|
+
- 401: Unauthorized (authentication failed)
|
|
928
|
+
- 403: Forbidden (insufficient permissions)
|
|
929
|
+
- 404: Resource not found
|
|
930
|
+
- 429: Rate limit exceeded
|
|
931
|
+
- 500: Internal server error
|
|
932
|
+
|
|
933
|
+
NetworkError: When network connectivity fails
|
|
934
|
+
|
|
935
|
+
Example:
|
|
936
|
+
# Basic usage
|
|
937
|
+
client = Entity()
|
|
938
|
+
|
|
939
|
+
result = client.entityReadBulkUniqueAttribute(args=...)
|
|
940
|
+
print(f"Result: {result}")
|
|
941
|
+
|
|
942
|
+
Use Cases:
|
|
943
|
+
- Data Discovery: Find and explore data assets
|
|
944
|
+
- Compliance Auditing: Review metadata and classifications
|
|
945
|
+
- Reporting: Generate catalog reports
|
|
946
|
+
"""
|
|
947
|
+
self.method = "GET"
|
|
948
|
+
self.endpoint = ENDPOINTS["entity"]["list_by_unique_attributes"].format(
|
|
949
|
+
typeName=args["--typeName"]
|
|
950
|
+
)
|
|
951
|
+
params = {
|
|
952
|
+
**get_api_version_params("datamap"),
|
|
953
|
+
"ignoreRelationships": str(args.get("--ignoreRelationships", False)).lower(),
|
|
954
|
+
"minExtInfo": str(args.get("--minExtInfo", False)).lower(),
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
# Add unique attributes
|
|
958
|
+
for counter, qualifiedName in enumerate(args["--qualifiedName"]):
|
|
959
|
+
params[f"attr_{counter}:qualifiedName"] = qualifiedName
|
|
960
|
+
|
|
961
|
+
self.params = params
|
|
962
|
+
|
|
963
|
+
@decorator
|
|
964
|
+
def entityUpdateUniqueAttribute(self, args):
|
|
965
|
+
"""
|
|
966
|
+
Update an existing entity.
|
|
967
|
+
|
|
968
|
+
Updates an existing entity with new values.
|
|
969
|
+
Only specified fields are modified; others remain unchanged.
|
|
970
|
+
|
|
971
|
+
Args:
|
|
972
|
+
args: Dictionary of operation arguments.
|
|
973
|
+
Contains operation-specific parameters.
|
|
974
|
+
See method implementation for details.
|
|
975
|
+
|
|
976
|
+
Returns:
|
|
977
|
+
Dictionary containing updated entity:
|
|
978
|
+
{
|
|
979
|
+
'guid': str, # Unique identifier
|
|
980
|
+
'attributes': dict, # Updated attributes
|
|
981
|
+
'updateTime': int # Update timestamp
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
Raises:
|
|
985
|
+
ValueError: When required parameters are missing or invalid:
|
|
986
|
+
- Empty or None values for required fields
|
|
987
|
+
- Invalid GUID format
|
|
988
|
+
- Out-of-range values
|
|
989
|
+
|
|
990
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
991
|
+
- DefaultAzureCredential not configured
|
|
992
|
+
- Insufficient permissions
|
|
993
|
+
- Expired authentication token
|
|
994
|
+
|
|
995
|
+
HTTPError: When Purview API returns error:
|
|
996
|
+
- 400: Bad request (invalid parameters)
|
|
997
|
+
- 401: Unauthorized (authentication failed)
|
|
998
|
+
- 403: Forbidden (insufficient permissions)
|
|
999
|
+
- 404: Resource not found
|
|
1000
|
+
- 429: Rate limit exceeded
|
|
1001
|
+
- 500: Internal server error
|
|
1002
|
+
|
|
1003
|
+
NetworkError: When network connectivity fails
|
|
1004
|
+
|
|
1005
|
+
Example:
|
|
1006
|
+
# Basic usage
|
|
1007
|
+
client = Entity()
|
|
1008
|
+
|
|
1009
|
+
result = client.entityUpdateUniqueAttribute(args=...)
|
|
1010
|
+
print(f"Result: {result}")
|
|
1011
|
+
|
|
1012
|
+
# With detailed data
|
|
1013
|
+
data = {
|
|
1014
|
+
'name': 'My Resource',
|
|
1015
|
+
'description': 'Resource description',
|
|
1016
|
+
'attributes': {
|
|
1017
|
+
'key1': 'value1',
|
|
1018
|
+
'key2': 'value2'
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
result = client.entityUpdateUniqueAttribute(data)
|
|
1023
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1024
|
+
|
|
1025
|
+
Use Cases:
|
|
1026
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
1027
|
+
- Ownership Changes: Reassign data ownership
|
|
1028
|
+
- Classification: Apply or modify data classifications
|
|
1029
|
+
"""
|
|
1030
|
+
self.method = "PUT"
|
|
1031
|
+
self.endpoint = ENDPOINTS["entity"]["update_by_unique_attributes"].format(
|
|
1032
|
+
typeName=args["--typeName"]
|
|
1033
|
+
)
|
|
1034
|
+
self.params = {
|
|
1035
|
+
**get_api_version_params("datamap"),
|
|
1036
|
+
"attr:qualifiedName": args["--qualifiedName"],
|
|
1037
|
+
}
|
|
1038
|
+
self.payload = get_json(args, "--payloadFile")
|
|
1039
|
+
|
|
1040
|
+
@decorator
|
|
1041
|
+
def entityDeleteUniqueAttribute(self, args):
|
|
1042
|
+
"""
|
|
1043
|
+
Delete a entity.
|
|
1044
|
+
|
|
1045
|
+
Permanently deletes the specified entity.
|
|
1046
|
+
This operation cannot be undone. Use with caution.
|
|
1047
|
+
|
|
1048
|
+
Args:
|
|
1049
|
+
args: Dictionary of operation arguments.
|
|
1050
|
+
Contains operation-specific parameters.
|
|
1051
|
+
See method implementation for details.
|
|
1052
|
+
|
|
1053
|
+
Returns:
|
|
1054
|
+
Dictionary with deletion status:
|
|
1055
|
+
{
|
|
1056
|
+
'guid': str, # Deleted resource ID
|
|
1057
|
+
'status': str, # Deletion status
|
|
1058
|
+
'message': str # Confirmation message
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
Raises:
|
|
1062
|
+
ValueError: When required parameters are missing or invalid:
|
|
1063
|
+
- Empty or None values for required fields
|
|
1064
|
+
- Invalid GUID format
|
|
1065
|
+
- Out-of-range values
|
|
1066
|
+
|
|
1067
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1068
|
+
- DefaultAzureCredential not configured
|
|
1069
|
+
- Insufficient permissions
|
|
1070
|
+
- Expired authentication token
|
|
1071
|
+
|
|
1072
|
+
HTTPError: When Purview API returns error:
|
|
1073
|
+
- 400: Bad request (invalid parameters)
|
|
1074
|
+
- 401: Unauthorized (authentication failed)
|
|
1075
|
+
- 403: Forbidden (insufficient permissions)
|
|
1076
|
+
- 404: Resource not found
|
|
1077
|
+
- 429: Rate limit exceeded
|
|
1078
|
+
- 500: Internal server error
|
|
1079
|
+
|
|
1080
|
+
NetworkError: When network connectivity fails
|
|
1081
|
+
|
|
1082
|
+
Example:
|
|
1083
|
+
# Basic usage
|
|
1084
|
+
client = Entity()
|
|
1085
|
+
|
|
1086
|
+
result = client.entityDeleteUniqueAttribute(args=...)
|
|
1087
|
+
print(f"Result: {result}")
|
|
1088
|
+
|
|
1089
|
+
Use Cases:
|
|
1090
|
+
- Data Cleanup: Remove obsolete or test data
|
|
1091
|
+
- Decommissioning: Delete resources no longer in use
|
|
1092
|
+
- Testing: Clean up test environments
|
|
1093
|
+
"""
|
|
1094
|
+
self.method = "DELETE"
|
|
1095
|
+
self.endpoint = ENDPOINTS["entity"]["delete_by_unique_attribute"].format(
|
|
1096
|
+
typeName=args["--typeName"]
|
|
1097
|
+
)
|
|
1098
|
+
self.params = {
|
|
1099
|
+
**get_api_version_params("datamap"),
|
|
1100
|
+
"attr:qualifiedName": args["--qualifiedName"],
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
# === CLASSIFICATION OPERATIONS ===
|
|
1104
|
+
|
|
1105
|
+
@decorator
|
|
1106
|
+
def entityReadClassification(self, args):
|
|
1107
|
+
"""
|
|
1108
|
+
Retrieve entity information.
|
|
1109
|
+
|
|
1110
|
+
Retrieves detailed information about the specified entity.
|
|
1111
|
+
Returns complete entity metadata and properties.
|
|
1112
|
+
|
|
1113
|
+
Args:
|
|
1114
|
+
args: Dictionary of operation arguments.
|
|
1115
|
+
Contains operation-specific parameters.
|
|
1116
|
+
See method implementation for details.
|
|
1117
|
+
|
|
1118
|
+
Returns:
|
|
1119
|
+
Dictionary containing entity information:
|
|
1120
|
+
{
|
|
1121
|
+
'guid': str, # Unique identifier
|
|
1122
|
+
'name': str, # Resource name
|
|
1123
|
+
'attributes': dict, # Resource attributes
|
|
1124
|
+
'status': str, # Resource status
|
|
1125
|
+
'updateTime': int # Last update timestamp
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
Raises:
|
|
1129
|
+
ValueError: When required parameters are missing or invalid:
|
|
1130
|
+
- Empty or None values for required fields
|
|
1131
|
+
- Invalid GUID format
|
|
1132
|
+
- Out-of-range values
|
|
1133
|
+
|
|
1134
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1135
|
+
- DefaultAzureCredential not configured
|
|
1136
|
+
- Insufficient permissions
|
|
1137
|
+
- Expired authentication token
|
|
1138
|
+
|
|
1139
|
+
HTTPError: When Purview API returns error:
|
|
1140
|
+
- 400: Bad request (invalid parameters)
|
|
1141
|
+
- 401: Unauthorized (authentication failed)
|
|
1142
|
+
- 403: Forbidden (insufficient permissions)
|
|
1143
|
+
- 404: Resource not found
|
|
1144
|
+
- 429: Rate limit exceeded
|
|
1145
|
+
- 500: Internal server error
|
|
1146
|
+
|
|
1147
|
+
NetworkError: When network connectivity fails
|
|
1148
|
+
|
|
1149
|
+
Example:
|
|
1150
|
+
# Basic usage
|
|
1151
|
+
client = Entity()
|
|
1152
|
+
|
|
1153
|
+
result = client.entityReadClassification(args=...)
|
|
1154
|
+
print(f"Result: {result}")
|
|
1155
|
+
|
|
1156
|
+
Use Cases:
|
|
1157
|
+
- Data Discovery: Find and explore data assets
|
|
1158
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1159
|
+
- Reporting: Generate catalog reports
|
|
1160
|
+
"""
|
|
1161
|
+
self.method = "GET"
|
|
1162
|
+
self.endpoint = ENDPOINTS["entity"]["get_classification"].format(
|
|
1163
|
+
guid=args["--guid"][0], classificationName=args["--classificationName"]
|
|
1164
|
+
)
|
|
1165
|
+
self.params = get_api_version_params("datamap")
|
|
1166
|
+
|
|
1167
|
+
@decorator
|
|
1168
|
+
def entityDeleteClassification(self, args):
|
|
1169
|
+
"""
|
|
1170
|
+
Delete a entity.
|
|
1171
|
+
|
|
1172
|
+
Permanently deletes the specified entity.
|
|
1173
|
+
This operation cannot be undone. Use with caution.
|
|
1174
|
+
|
|
1175
|
+
Args:
|
|
1176
|
+
args: Dictionary of operation arguments.
|
|
1177
|
+
Contains operation-specific parameters.
|
|
1178
|
+
See method implementation for details.
|
|
1179
|
+
|
|
1180
|
+
Returns:
|
|
1181
|
+
Dictionary with deletion status:
|
|
1182
|
+
{
|
|
1183
|
+
'guid': str, # Deleted resource ID
|
|
1184
|
+
'status': str, # Deletion status
|
|
1185
|
+
'message': str # Confirmation message
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
Raises:
|
|
1189
|
+
ValueError: When required parameters are missing or invalid:
|
|
1190
|
+
- Empty or None values for required fields
|
|
1191
|
+
- Invalid GUID format
|
|
1192
|
+
- Out-of-range values
|
|
1193
|
+
|
|
1194
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1195
|
+
- DefaultAzureCredential not configured
|
|
1196
|
+
- Insufficient permissions
|
|
1197
|
+
- Expired authentication token
|
|
1198
|
+
|
|
1199
|
+
HTTPError: When Purview API returns error:
|
|
1200
|
+
- 400: Bad request (invalid parameters)
|
|
1201
|
+
- 401: Unauthorized (authentication failed)
|
|
1202
|
+
- 403: Forbidden (insufficient permissions)
|
|
1203
|
+
- 404: Resource not found
|
|
1204
|
+
- 429: Rate limit exceeded
|
|
1205
|
+
- 500: Internal server error
|
|
1206
|
+
|
|
1207
|
+
NetworkError: When network connectivity fails
|
|
1208
|
+
|
|
1209
|
+
Example:
|
|
1210
|
+
# Basic usage
|
|
1211
|
+
client = Entity()
|
|
1212
|
+
|
|
1213
|
+
result = client.entityDeleteClassification(args=...)
|
|
1214
|
+
print(f"Result: {result}")
|
|
1215
|
+
|
|
1216
|
+
Use Cases:
|
|
1217
|
+
- Data Cleanup: Remove obsolete or test data
|
|
1218
|
+
- Decommissioning: Delete resources no longer in use
|
|
1219
|
+
- Testing: Clean up test environments
|
|
1220
|
+
"""
|
|
1221
|
+
self.method = "DELETE"
|
|
1222
|
+
self.endpoint = ENDPOINTS["entity"]["remove_classification"].format(
|
|
1223
|
+
guid=args["--guid"][0], classificationName=args["--classificationName"]
|
|
1224
|
+
)
|
|
1225
|
+
self.params = get_api_version_params("datamap")
|
|
1226
|
+
|
|
1227
|
+
@decorator
|
|
1228
|
+
def entityReadClassifications(self, args):
|
|
1229
|
+
"""
|
|
1230
|
+
Retrieve entity information.
|
|
1231
|
+
|
|
1232
|
+
Retrieves detailed information about the specified entity.
|
|
1233
|
+
Returns complete entity metadata and properties.
|
|
1234
|
+
|
|
1235
|
+
Args:
|
|
1236
|
+
args: Dictionary of operation arguments.
|
|
1237
|
+
Contains operation-specific parameters.
|
|
1238
|
+
See method implementation for details.
|
|
1239
|
+
|
|
1240
|
+
Returns:
|
|
1241
|
+
Dictionary containing entity information:
|
|
1242
|
+
{
|
|
1243
|
+
'guid': str, # Unique identifier
|
|
1244
|
+
'name': str, # Resource name
|
|
1245
|
+
'attributes': dict, # Resource attributes
|
|
1246
|
+
'status': str, # Resource status
|
|
1247
|
+
'updateTime': int # Last update timestamp
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
Raises:
|
|
1251
|
+
ValueError: When required parameters are missing or invalid:
|
|
1252
|
+
- Empty or None values for required fields
|
|
1253
|
+
- Invalid GUID format
|
|
1254
|
+
- Out-of-range values
|
|
1255
|
+
|
|
1256
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1257
|
+
- DefaultAzureCredential not configured
|
|
1258
|
+
- Insufficient permissions
|
|
1259
|
+
- Expired authentication token
|
|
1260
|
+
|
|
1261
|
+
HTTPError: When Purview API returns error:
|
|
1262
|
+
- 400: Bad request (invalid parameters)
|
|
1263
|
+
- 401: Unauthorized (authentication failed)
|
|
1264
|
+
- 403: Forbidden (insufficient permissions)
|
|
1265
|
+
- 404: Resource not found
|
|
1266
|
+
- 429: Rate limit exceeded
|
|
1267
|
+
- 500: Internal server error
|
|
1268
|
+
|
|
1269
|
+
NetworkError: When network connectivity fails
|
|
1270
|
+
|
|
1271
|
+
Example:
|
|
1272
|
+
# Basic usage
|
|
1273
|
+
client = Entity()
|
|
1274
|
+
|
|
1275
|
+
result = client.entityReadClassifications(args=...)
|
|
1276
|
+
print(f"Result: {result}")
|
|
1277
|
+
|
|
1278
|
+
Use Cases:
|
|
1279
|
+
- Data Discovery: Find and explore data assets
|
|
1280
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1281
|
+
- Reporting: Generate catalog reports
|
|
1282
|
+
"""
|
|
1283
|
+
self.method = "GET"
|
|
1284
|
+
self.endpoint = ENDPOINTS["entity"]["get_classifications"].format(guid=args["--guid"][0])
|
|
1285
|
+
self.params = get_api_version_params("datamap")
|
|
1286
|
+
|
|
1287
|
+
@decorator
|
|
1288
|
+
def entityCreateClassifications(self, args):
|
|
1289
|
+
"""
|
|
1290
|
+
Create a new entity.
|
|
1291
|
+
|
|
1292
|
+
Creates a new entity in Microsoft Purview Data Map.
|
|
1293
|
+
Requires appropriate permissions and valid entity definition.
|
|
1294
|
+
|
|
1295
|
+
Args:
|
|
1296
|
+
args: Dictionary of operation arguments.
|
|
1297
|
+
Contains operation-specific parameters.
|
|
1298
|
+
See method implementation for details.
|
|
1299
|
+
|
|
1300
|
+
Returns:
|
|
1301
|
+
Dictionary containing created entity:
|
|
1302
|
+
{
|
|
1303
|
+
'guid': str, # Unique identifier
|
|
1304
|
+
'name': str, # Resource name
|
|
1305
|
+
'status': str, # Creation status
|
|
1306
|
+
'attributes': dict, # Resource attributes
|
|
1307
|
+
'createTime': int # Creation timestamp
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
Raises:
|
|
1311
|
+
ValueError: When required parameters are missing or invalid:
|
|
1312
|
+
- Empty or None values for required fields
|
|
1313
|
+
- Invalid GUID format
|
|
1314
|
+
- Out-of-range values
|
|
1315
|
+
|
|
1316
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1317
|
+
- DefaultAzureCredential not configured
|
|
1318
|
+
- Insufficient permissions
|
|
1319
|
+
- Expired authentication token
|
|
1320
|
+
|
|
1321
|
+
HTTPError: When Purview API returns error:
|
|
1322
|
+
- 400: Bad request (invalid parameters)
|
|
1323
|
+
- 401: Unauthorized (authentication failed)
|
|
1324
|
+
- 403: Forbidden (insufficient permissions)
|
|
1325
|
+
- 404: Resource not found
|
|
1326
|
+
- 409: Conflict (resource already exists)
|
|
1327
|
+
- 429: Rate limit exceeded
|
|
1328
|
+
- 500: Internal server error
|
|
1329
|
+
|
|
1330
|
+
NetworkError: When network connectivity fails
|
|
1331
|
+
|
|
1332
|
+
Example:
|
|
1333
|
+
# Basic usage
|
|
1334
|
+
client = Entity()
|
|
1335
|
+
|
|
1336
|
+
result = client.entityCreateClassifications(args=...)
|
|
1337
|
+
print(f"Result: {result}")
|
|
1338
|
+
|
|
1339
|
+
# With detailed data
|
|
1340
|
+
data = {
|
|
1341
|
+
'name': 'My Resource',
|
|
1342
|
+
'description': 'Resource description',
|
|
1343
|
+
'attributes': {
|
|
1344
|
+
'key1': 'value1',
|
|
1345
|
+
'key2': 'value2'
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
result = client.entityCreateClassifications(data)
|
|
1350
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1351
|
+
|
|
1352
|
+
Use Cases:
|
|
1353
|
+
- Data Onboarding: Register new data sources in catalog
|
|
1354
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
1355
|
+
- Automation: Programmatically populate catalog
|
|
1356
|
+
"""
|
|
1357
|
+
self.method = "POST"
|
|
1358
|
+
self.endpoint = ENDPOINTS["entity"]["add_classifications"].format(guid=args["--guid"][0])
|
|
1359
|
+
self.params = get_api_version_params("datamap")
|
|
1360
|
+
self.payload = get_json(args, "--payloadFile")
|
|
1361
|
+
|
|
1362
|
+
@decorator
|
|
1363
|
+
def entityUpdateClassifications(self, args):
|
|
1364
|
+
"""
|
|
1365
|
+
Update an existing entity.
|
|
1366
|
+
|
|
1367
|
+
Updates an existing entity with new values.
|
|
1368
|
+
Only specified fields are modified; others remain unchanged.
|
|
1369
|
+
|
|
1370
|
+
Args:
|
|
1371
|
+
args: Dictionary of operation arguments.
|
|
1372
|
+
Contains operation-specific parameters.
|
|
1373
|
+
See method implementation for details.
|
|
1374
|
+
|
|
1375
|
+
Returns:
|
|
1376
|
+
Dictionary containing updated entity:
|
|
1377
|
+
{
|
|
1378
|
+
'guid': str, # Unique identifier
|
|
1379
|
+
'attributes': dict, # Updated attributes
|
|
1380
|
+
'updateTime': int # Update timestamp
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
Raises:
|
|
1384
|
+
ValueError: When required parameters are missing or invalid:
|
|
1385
|
+
- Empty or None values for required fields
|
|
1386
|
+
- Invalid GUID format
|
|
1387
|
+
- Out-of-range values
|
|
1388
|
+
|
|
1389
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1390
|
+
- DefaultAzureCredential not configured
|
|
1391
|
+
- Insufficient permissions
|
|
1392
|
+
- Expired authentication token
|
|
1393
|
+
|
|
1394
|
+
HTTPError: When Purview API returns error:
|
|
1395
|
+
- 400: Bad request (invalid parameters)
|
|
1396
|
+
- 401: Unauthorized (authentication failed)
|
|
1397
|
+
- 403: Forbidden (insufficient permissions)
|
|
1398
|
+
- 404: Resource not found
|
|
1399
|
+
- 429: Rate limit exceeded
|
|
1400
|
+
- 500: Internal server error
|
|
1401
|
+
|
|
1402
|
+
NetworkError: When network connectivity fails
|
|
1403
|
+
|
|
1404
|
+
Example:
|
|
1405
|
+
# Basic usage
|
|
1406
|
+
client = Entity()
|
|
1407
|
+
|
|
1408
|
+
result = client.entityUpdateClassifications(args=...)
|
|
1409
|
+
print(f"Result: {result}")
|
|
1410
|
+
|
|
1411
|
+
# With detailed data
|
|
1412
|
+
data = {
|
|
1413
|
+
'name': 'My Resource',
|
|
1414
|
+
'description': 'Resource description',
|
|
1415
|
+
'attributes': {
|
|
1416
|
+
'key1': 'value1',
|
|
1417
|
+
'key2': 'value2'
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
result = client.entityUpdateClassifications(data)
|
|
1422
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1423
|
+
|
|
1424
|
+
Use Cases:
|
|
1425
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
1426
|
+
- Ownership Changes: Reassign data ownership
|
|
1427
|
+
- Classification: Apply or modify data classifications
|
|
1428
|
+
"""
|
|
1429
|
+
self.method = "PUT"
|
|
1430
|
+
self.endpoint = ENDPOINTS["entity"]["update_classifications"].format(guid=args["--guid"][0])
|
|
1431
|
+
self.params = get_api_version_params("datamap")
|
|
1432
|
+
self.payload = get_json(args, "--payloadFile")
|
|
1433
|
+
|
|
1434
|
+
@decorator
|
|
1435
|
+
def entityBulkSetClassifications(self, args):
|
|
1436
|
+
"""
|
|
1437
|
+
Update an existing entity.
|
|
1438
|
+
|
|
1439
|
+
Updates an existing entity with new values.
|
|
1440
|
+
Only specified fields are modified; others remain unchanged.
|
|
1441
|
+
|
|
1442
|
+
Args:
|
|
1443
|
+
args: Dictionary of operation arguments.
|
|
1444
|
+
Contains operation-specific parameters.
|
|
1445
|
+
See method implementation for details.
|
|
1446
|
+
|
|
1447
|
+
Returns:
|
|
1448
|
+
Dictionary containing updated entity:
|
|
1449
|
+
{
|
|
1450
|
+
'guid': str, # Unique identifier
|
|
1451
|
+
'attributes': dict, # Updated attributes
|
|
1452
|
+
'updateTime': int # Update timestamp
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
Raises:
|
|
1456
|
+
ValueError: When required parameters are missing or invalid:
|
|
1457
|
+
- Empty or None values for required fields
|
|
1458
|
+
- Invalid GUID format
|
|
1459
|
+
- Out-of-range values
|
|
1460
|
+
|
|
1461
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1462
|
+
- DefaultAzureCredential not configured
|
|
1463
|
+
- Insufficient permissions
|
|
1464
|
+
- Expired authentication token
|
|
1465
|
+
|
|
1466
|
+
HTTPError: When Purview API returns error:
|
|
1467
|
+
- 400: Bad request (invalid parameters)
|
|
1468
|
+
- 401: Unauthorized (authentication failed)
|
|
1469
|
+
- 403: Forbidden (insufficient permissions)
|
|
1470
|
+
- 404: Resource not found
|
|
1471
|
+
- 429: Rate limit exceeded
|
|
1472
|
+
- 500: Internal server error
|
|
1473
|
+
|
|
1474
|
+
NetworkError: When network connectivity fails
|
|
1475
|
+
|
|
1476
|
+
Example:
|
|
1477
|
+
# Basic usage
|
|
1478
|
+
client = Entity()
|
|
1479
|
+
|
|
1480
|
+
result = client.entityBulkSetClassifications(args=...)
|
|
1481
|
+
print(f"Result: {result}")
|
|
1482
|
+
|
|
1483
|
+
# With detailed data
|
|
1484
|
+
data = {
|
|
1485
|
+
'name': 'My Resource',
|
|
1486
|
+
'description': 'Resource description',
|
|
1487
|
+
'attributes': {
|
|
1488
|
+
'key1': 'value1',
|
|
1489
|
+
'key2': 'value2'
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
result = client.entityBulkSetClassifications(data)
|
|
1494
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1495
|
+
|
|
1496
|
+
Use Cases:
|
|
1497
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
1498
|
+
- Ownership Changes: Reassign data ownership
|
|
1499
|
+
- Classification: Apply or modify data classifications
|
|
1500
|
+
"""
|
|
1501
|
+
self.method = "POST"
|
|
1502
|
+
self.endpoint = ENDPOINTS["entity"]["bulk_set_classifications"]
|
|
1503
|
+
self.params = get_api_version_params("datamap")
|
|
1504
|
+
self.payload = get_json(args, "--payloadFile")
|
|
1505
|
+
|
|
1506
|
+
@decorator
|
|
1507
|
+
def entityBulkClassification(self, args):
|
|
1508
|
+
"""
|
|
1509
|
+
Perform batch operation on resources.
|
|
1510
|
+
|
|
1511
|
+
Processes multiple resources in a single operation.
|
|
1512
|
+
More efficient than individual operations for bulk data.
|
|
1513
|
+
|
|
1514
|
+
Args:
|
|
1515
|
+
args: Dictionary of operation arguments.
|
|
1516
|
+
Contains operation-specific parameters.
|
|
1517
|
+
See method implementation for details.
|
|
1518
|
+
|
|
1519
|
+
Returns:
|
|
1520
|
+
Dictionary with batch operation results:
|
|
1521
|
+
{
|
|
1522
|
+
'succeeded': int, # Success count
|
|
1523
|
+
'failed': int, # Failure count
|
|
1524
|
+
'results': [...], # Per-item results
|
|
1525
|
+
'errors': [...] # Error details
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
Raises:
|
|
1529
|
+
ValueError: When required parameters are missing or invalid:
|
|
1530
|
+
- Empty or None values for required fields
|
|
1531
|
+
- Invalid GUID format
|
|
1532
|
+
- Out-of-range values
|
|
1533
|
+
|
|
1534
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1535
|
+
- DefaultAzureCredential not configured
|
|
1536
|
+
- Insufficient permissions
|
|
1537
|
+
- Expired authentication token
|
|
1538
|
+
|
|
1539
|
+
HTTPError: When Purview API returns error:
|
|
1540
|
+
- 400: Bad request (invalid parameters)
|
|
1541
|
+
- 401: Unauthorized (authentication failed)
|
|
1542
|
+
- 403: Forbidden (insufficient permissions)
|
|
1543
|
+
- 404: Resource not found
|
|
1544
|
+
- 429: Rate limit exceeded
|
|
1545
|
+
- 500: Internal server error
|
|
1546
|
+
|
|
1547
|
+
NetworkError: When network connectivity fails
|
|
1548
|
+
|
|
1549
|
+
Example:
|
|
1550
|
+
# Basic usage
|
|
1551
|
+
client = Entity()
|
|
1552
|
+
|
|
1553
|
+
result = client.entityBulkClassification(args=...)
|
|
1554
|
+
print(f"Result: {result}")
|
|
1555
|
+
|
|
1556
|
+
Use Cases:
|
|
1557
|
+
- Bulk Import: Load large volumes of metadata
|
|
1558
|
+
- Migration: Transfer catalog from other systems
|
|
1559
|
+
- Mass Updates: Apply changes to many resources
|
|
1560
|
+
"""
|
|
1561
|
+
self.method = "GET"
|
|
1562
|
+
self.endpoint = ENDPOINTS["entity"]["bulk_classification"]
|
|
1563
|
+
self.params = {**get_api_version_params("datamap"), "guid": args["--guid"]}
|
|
1564
|
+
|
|
1565
|
+
# === UNIQUE ATTRIBUTE CLASSIFICATION OPERATIONS ===
|
|
1566
|
+
|
|
1567
|
+
@decorator
|
|
1568
|
+
def entityDeleteClassificationByUniqueAttribute(self, args):
|
|
1569
|
+
"""
|
|
1570
|
+
Delete a entity.
|
|
1571
|
+
|
|
1572
|
+
Permanently deletes the specified entity.
|
|
1573
|
+
This operation cannot be undone. Use with caution.
|
|
1574
|
+
|
|
1575
|
+
Args:
|
|
1576
|
+
args: Dictionary of operation arguments.
|
|
1577
|
+
Contains operation-specific parameters.
|
|
1578
|
+
See method implementation for details.
|
|
1579
|
+
|
|
1580
|
+
Returns:
|
|
1581
|
+
Dictionary with deletion status:
|
|
1582
|
+
{
|
|
1583
|
+
'guid': str, # Deleted resource ID
|
|
1584
|
+
'status': str, # Deletion status
|
|
1585
|
+
'message': str # Confirmation message
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
Raises:
|
|
1589
|
+
ValueError: When required parameters are missing or invalid:
|
|
1590
|
+
- Empty or None values for required fields
|
|
1591
|
+
- Invalid GUID format
|
|
1592
|
+
- Out-of-range values
|
|
1593
|
+
|
|
1594
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1595
|
+
- DefaultAzureCredential not configured
|
|
1596
|
+
- Insufficient permissions
|
|
1597
|
+
- Expired authentication token
|
|
1598
|
+
|
|
1599
|
+
HTTPError: When Purview API returns error:
|
|
1600
|
+
- 400: Bad request (invalid parameters)
|
|
1601
|
+
- 401: Unauthorized (authentication failed)
|
|
1602
|
+
- 403: Forbidden (insufficient permissions)
|
|
1603
|
+
- 404: Resource not found
|
|
1604
|
+
- 429: Rate limit exceeded
|
|
1605
|
+
- 500: Internal server error
|
|
1606
|
+
|
|
1607
|
+
NetworkError: When network connectivity fails
|
|
1608
|
+
|
|
1609
|
+
Example:
|
|
1610
|
+
# Basic usage
|
|
1611
|
+
client = Entity()
|
|
1612
|
+
|
|
1613
|
+
result = client.entityDeleteClassificationByUniqueAttribute(args=...)
|
|
1614
|
+
print(f"Result: {result}")
|
|
1615
|
+
|
|
1616
|
+
Use Cases:
|
|
1617
|
+
- Data Cleanup: Remove obsolete or test data
|
|
1618
|
+
- Decommissioning: Delete resources no longer in use
|
|
1619
|
+
- Testing: Clean up test environments
|
|
1620
|
+
"""
|
|
1621
|
+
self.method = "DELETE"
|
|
1622
|
+
self.endpoint = ENDPOINTS["entity"]["remove_classification_by_unique_attribute"].format(
|
|
1623
|
+
typeName=args["--typeName"], classificationName=args["--classificationName"]
|
|
1624
|
+
)
|
|
1625
|
+
self.params = {
|
|
1626
|
+
**get_api_version_params("datamap"),
|
|
1627
|
+
"attr:qualifiedName": args["--qualifiedName"],
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
@decorator
|
|
1631
|
+
def entityUpdateClassificationsByUniqueAttribute(self, args):
|
|
1632
|
+
"""
|
|
1633
|
+
Update an existing entity.
|
|
1634
|
+
|
|
1635
|
+
Updates an existing entity with new values.
|
|
1636
|
+
Only specified fields are modified; others remain unchanged.
|
|
1637
|
+
|
|
1638
|
+
Args:
|
|
1639
|
+
args: Dictionary of operation arguments.
|
|
1640
|
+
Contains operation-specific parameters.
|
|
1641
|
+
See method implementation for details.
|
|
1642
|
+
|
|
1643
|
+
Returns:
|
|
1644
|
+
Dictionary containing updated entity:
|
|
1645
|
+
{
|
|
1646
|
+
'guid': str, # Unique identifier
|
|
1647
|
+
'attributes': dict, # Updated attributes
|
|
1648
|
+
'updateTime': int # Update timestamp
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
Raises:
|
|
1652
|
+
ValueError: When required parameters are missing or invalid:
|
|
1653
|
+
- Empty or None values for required fields
|
|
1654
|
+
- Invalid GUID format
|
|
1655
|
+
- Out-of-range values
|
|
1656
|
+
|
|
1657
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1658
|
+
- DefaultAzureCredential not configured
|
|
1659
|
+
- Insufficient permissions
|
|
1660
|
+
- Expired authentication token
|
|
1661
|
+
|
|
1662
|
+
HTTPError: When Purview API returns error:
|
|
1663
|
+
- 400: Bad request (invalid parameters)
|
|
1664
|
+
- 401: Unauthorized (authentication failed)
|
|
1665
|
+
- 403: Forbidden (insufficient permissions)
|
|
1666
|
+
- 404: Resource not found
|
|
1667
|
+
- 429: Rate limit exceeded
|
|
1668
|
+
- 500: Internal server error
|
|
1669
|
+
|
|
1670
|
+
NetworkError: When network connectivity fails
|
|
1671
|
+
|
|
1672
|
+
Example:
|
|
1673
|
+
# Basic usage
|
|
1674
|
+
client = Entity()
|
|
1675
|
+
|
|
1676
|
+
result = client.entityUpdateClassificationsByUniqueAttribute(args=...)
|
|
1677
|
+
print(f"Result: {result}")
|
|
1678
|
+
|
|
1679
|
+
# With detailed data
|
|
1680
|
+
data = {
|
|
1681
|
+
'name': 'My Resource',
|
|
1682
|
+
'description': 'Resource description',
|
|
1683
|
+
'attributes': {
|
|
1684
|
+
'key1': 'value1',
|
|
1685
|
+
'key2': 'value2'
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
result = client.entityUpdateClassificationsByUniqueAttribute(data)
|
|
1690
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1691
|
+
|
|
1692
|
+
Use Cases:
|
|
1693
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
1694
|
+
- Ownership Changes: Reassign data ownership
|
|
1695
|
+
- Classification: Apply or modify data classifications
|
|
1696
|
+
"""
|
|
1697
|
+
self.method = "PUT"
|
|
1698
|
+
self.endpoint = ENDPOINTS["entity"]["update_classifications_by_unique_attribute"].format(
|
|
1699
|
+
typeName=args["--typeName"]
|
|
1700
|
+
)
|
|
1701
|
+
self.params = {
|
|
1702
|
+
**get_api_version_params("datamap"),
|
|
1703
|
+
"attr:qualifiedName": args["--qualifiedName"],
|
|
1704
|
+
}
|
|
1705
|
+
self.payload = get_json(args, "--payloadFile")
|
|
1706
|
+
|
|
1707
|
+
@decorator
|
|
1708
|
+
def entityCreateClassificationsByUniqueAttribute(self, args):
|
|
1709
|
+
"""
|
|
1710
|
+
Create a new entity.
|
|
1711
|
+
|
|
1712
|
+
Creates a new entity in Microsoft Purview Data Map.
|
|
1713
|
+
Requires appropriate permissions and valid entity definition.
|
|
1714
|
+
|
|
1715
|
+
Args:
|
|
1716
|
+
args: Dictionary of operation arguments.
|
|
1717
|
+
Contains operation-specific parameters.
|
|
1718
|
+
See method implementation for details.
|
|
1719
|
+
|
|
1720
|
+
Returns:
|
|
1721
|
+
Dictionary containing created entity:
|
|
1722
|
+
{
|
|
1723
|
+
'guid': str, # Unique identifier
|
|
1724
|
+
'name': str, # Resource name
|
|
1725
|
+
'status': str, # Creation status
|
|
1726
|
+
'attributes': dict, # Resource attributes
|
|
1727
|
+
'createTime': int # Creation timestamp
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
Raises:
|
|
1731
|
+
ValueError: When required parameters are missing or invalid:
|
|
1732
|
+
- Empty or None values for required fields
|
|
1733
|
+
- Invalid GUID format
|
|
1734
|
+
- Out-of-range values
|
|
1735
|
+
|
|
1736
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1737
|
+
- DefaultAzureCredential not configured
|
|
1738
|
+
- Insufficient permissions
|
|
1739
|
+
- Expired authentication token
|
|
1740
|
+
|
|
1741
|
+
HTTPError: When Purview API returns error:
|
|
1742
|
+
- 400: Bad request (invalid parameters)
|
|
1743
|
+
- 401: Unauthorized (authentication failed)
|
|
1744
|
+
- 403: Forbidden (insufficient permissions)
|
|
1745
|
+
- 404: Resource not found
|
|
1746
|
+
- 409: Conflict (resource already exists)
|
|
1747
|
+
- 429: Rate limit exceeded
|
|
1748
|
+
- 500: Internal server error
|
|
1749
|
+
|
|
1750
|
+
NetworkError: When network connectivity fails
|
|
1751
|
+
|
|
1752
|
+
Example:
|
|
1753
|
+
# Basic usage
|
|
1754
|
+
client = Entity()
|
|
1755
|
+
|
|
1756
|
+
result = client.entityCreateClassificationsByUniqueAttribute(args=...)
|
|
1757
|
+
print(f"Result: {result}")
|
|
1758
|
+
|
|
1759
|
+
# With detailed data
|
|
1760
|
+
data = {
|
|
1761
|
+
'name': 'My Resource',
|
|
1762
|
+
'description': 'Resource description',
|
|
1763
|
+
'attributes': {
|
|
1764
|
+
'key1': 'value1',
|
|
1765
|
+
'key2': 'value2'
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
result = client.entityCreateClassificationsByUniqueAttribute(data)
|
|
1770
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1771
|
+
|
|
1772
|
+
Use Cases:
|
|
1773
|
+
- Data Onboarding: Register new data sources in catalog
|
|
1774
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
1775
|
+
- Automation: Programmatically populate catalog
|
|
1776
|
+
"""
|
|
1777
|
+
self.method = "POST"
|
|
1778
|
+
self.endpoint = ENDPOINTS["entity"]["add_classifications_by_unique_attribute"].format(
|
|
1779
|
+
typeName=args["--typeName"]
|
|
1780
|
+
)
|
|
1781
|
+
self.params = {
|
|
1782
|
+
**get_api_version_params("datamap"),
|
|
1783
|
+
"attr:qualifiedName": args["--qualifiedName"],
|
|
1784
|
+
}
|
|
1785
|
+
self.payload = get_json(args, "--payloadFile")
|
|
1786
|
+
|
|
1787
|
+
# === BUSINESS METADATA OPERATIONS ===
|
|
1788
|
+
|
|
1789
|
+
@decorator
|
|
1790
|
+
def entityCreateBusinessMetadata(self, args):
|
|
1791
|
+
"""
|
|
1792
|
+
Create a new entity.
|
|
1793
|
+
|
|
1794
|
+
Creates a new entity in Microsoft Purview Data Map.
|
|
1795
|
+
Requires appropriate permissions and valid entity definition.
|
|
1796
|
+
|
|
1797
|
+
Args:
|
|
1798
|
+
args: Dictionary of operation arguments.
|
|
1799
|
+
Contains operation-specific parameters.
|
|
1800
|
+
See method implementation for details.
|
|
1801
|
+
|
|
1802
|
+
Returns:
|
|
1803
|
+
Dictionary containing created entity:
|
|
1804
|
+
{
|
|
1805
|
+
'guid': str, # Unique identifier
|
|
1806
|
+
'name': str, # Resource name
|
|
1807
|
+
'status': str, # Creation status
|
|
1808
|
+
'attributes': dict, # Resource attributes
|
|
1809
|
+
'createTime': int # Creation timestamp
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
Raises:
|
|
1813
|
+
ValueError: When required parameters are missing or invalid:
|
|
1814
|
+
- Empty or None values for required fields
|
|
1815
|
+
- Invalid GUID format
|
|
1816
|
+
- Out-of-range values
|
|
1817
|
+
|
|
1818
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1819
|
+
- DefaultAzureCredential not configured
|
|
1820
|
+
- Insufficient permissions
|
|
1821
|
+
- Expired authentication token
|
|
1822
|
+
|
|
1823
|
+
HTTPError: When Purview API returns error:
|
|
1824
|
+
- 400: Bad request (invalid parameters)
|
|
1825
|
+
- 401: Unauthorized (authentication failed)
|
|
1826
|
+
- 403: Forbidden (insufficient permissions)
|
|
1827
|
+
- 404: Resource not found
|
|
1828
|
+
- 409: Conflict (resource already exists)
|
|
1829
|
+
- 429: Rate limit exceeded
|
|
1830
|
+
- 500: Internal server error
|
|
1831
|
+
|
|
1832
|
+
NetworkError: When network connectivity fails
|
|
1833
|
+
|
|
1834
|
+
Example:
|
|
1835
|
+
# Basic usage
|
|
1836
|
+
client = Entity()
|
|
1837
|
+
|
|
1838
|
+
result = client.entityCreateBusinessMetadata(args=...)
|
|
1839
|
+
print(f"Result: {result}")
|
|
1840
|
+
|
|
1841
|
+
# With detailed data
|
|
1842
|
+
data = {
|
|
1843
|
+
'name': 'My Resource',
|
|
1844
|
+
'description': 'Resource description',
|
|
1845
|
+
'attributes': {
|
|
1846
|
+
'key1': 'value1',
|
|
1847
|
+
'key2': 'value2'
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
result = client.entityCreateBusinessMetadata(data)
|
|
1852
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1853
|
+
|
|
1854
|
+
Use Cases:
|
|
1855
|
+
- Data Onboarding: Register new data sources in catalog
|
|
1856
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
1857
|
+
- Automation: Programmatically populate catalog
|
|
1858
|
+
"""
|
|
1859
|
+
self.method = "POST"
|
|
1860
|
+
self.endpoint = ENDPOINTS["entity"]["add_business_metadata"].format(guid=args["--guid"][0])
|
|
1861
|
+
self.params = get_api_version_params("datamap")
|
|
1862
|
+
self.payload = get_json(args, "--payloadFile")
|
|
1863
|
+
|
|
1864
|
+
@decorator
|
|
1865
|
+
def entityDeleteBusinessMetadata(self, args):
|
|
1866
|
+
"""
|
|
1867
|
+
Delete a entity.
|
|
1868
|
+
|
|
1869
|
+
Permanently deletes the specified entity.
|
|
1870
|
+
This operation cannot be undone. Use with caution.
|
|
1871
|
+
|
|
1872
|
+
Args:
|
|
1873
|
+
args: Dictionary of operation arguments.
|
|
1874
|
+
Contains operation-specific parameters.
|
|
1875
|
+
See method implementation for details.
|
|
1876
|
+
|
|
1877
|
+
Returns:
|
|
1878
|
+
Dictionary with deletion status:
|
|
1879
|
+
{
|
|
1880
|
+
'guid': str, # Deleted resource ID
|
|
1881
|
+
'status': str, # Deletion status
|
|
1882
|
+
'message': str # Confirmation message
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
Raises:
|
|
1886
|
+
ValueError: When required parameters are missing or invalid:
|
|
1887
|
+
- Empty or None values for required fields
|
|
1888
|
+
- Invalid GUID format
|
|
1889
|
+
- Out-of-range values
|
|
1890
|
+
|
|
1891
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1892
|
+
- DefaultAzureCredential not configured
|
|
1893
|
+
- Insufficient permissions
|
|
1894
|
+
- Expired authentication token
|
|
1895
|
+
|
|
1896
|
+
HTTPError: When Purview API returns error:
|
|
1897
|
+
- 400: Bad request (invalid parameters)
|
|
1898
|
+
- 401: Unauthorized (authentication failed)
|
|
1899
|
+
- 403: Forbidden (insufficient permissions)
|
|
1900
|
+
- 404: Resource not found
|
|
1901
|
+
- 429: Rate limit exceeded
|
|
1902
|
+
- 500: Internal server error
|
|
1903
|
+
|
|
1904
|
+
NetworkError: When network connectivity fails
|
|
1905
|
+
|
|
1906
|
+
Example:
|
|
1907
|
+
# Basic usage
|
|
1908
|
+
client = Entity()
|
|
1909
|
+
|
|
1910
|
+
result = client.entityDeleteBusinessMetadata(args=...)
|
|
1911
|
+
print(f"Result: {result}")
|
|
1912
|
+
|
|
1913
|
+
Use Cases:
|
|
1914
|
+
- Data Cleanup: Remove obsolete or test data
|
|
1915
|
+
- Decommissioning: Delete resources no longer in use
|
|
1916
|
+
- Testing: Clean up test environments
|
|
1917
|
+
"""
|
|
1918
|
+
self.method = "DELETE"
|
|
1919
|
+
|
|
1920
|
+
# Support both --businessMetadataName (direct) and --payloadFile (from CLI)
|
|
1921
|
+
if "--payloadFile" in args:
|
|
1922
|
+
payload = get_json(args, "--payloadFile")
|
|
1923
|
+
# Get the first business metadata name from the payload
|
|
1924
|
+
business_metadata_names = list(payload.keys())
|
|
1925
|
+
if not business_metadata_names:
|
|
1926
|
+
raise ValueError("No business metadata names found in payload file")
|
|
1927
|
+
business_metadata_name = business_metadata_names[0]
|
|
1928
|
+
else:
|
|
1929
|
+
business_metadata_name = args["--businessMetadataName"]
|
|
1930
|
+
|
|
1931
|
+
self.endpoint = ENDPOINTS["entity"]["remove_business_metadata"].format(
|
|
1932
|
+
guid=args["--guid"][0]
|
|
1933
|
+
)
|
|
1934
|
+
self.params = {
|
|
1935
|
+
**get_api_version_params("datamap"),
|
|
1936
|
+
"businessMetadataName": business_metadata_name,
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
@decorator
|
|
1940
|
+
def entityCreateBusinessMetadataAttributes(self, args):
|
|
1941
|
+
"""
|
|
1942
|
+
Create a new entity.
|
|
1943
|
+
|
|
1944
|
+
Creates a new entity in Microsoft Purview Data Map.
|
|
1945
|
+
Requires appropriate permissions and valid entity definition.
|
|
1946
|
+
|
|
1947
|
+
Args:
|
|
1948
|
+
args: Dictionary of operation arguments.
|
|
1949
|
+
Contains operation-specific parameters.
|
|
1950
|
+
See method implementation for details.
|
|
1951
|
+
|
|
1952
|
+
Returns:
|
|
1953
|
+
Dictionary containing created entity:
|
|
1954
|
+
{
|
|
1955
|
+
'guid': str, # Unique identifier
|
|
1956
|
+
'name': str, # Resource name
|
|
1957
|
+
'status': str, # Creation status
|
|
1958
|
+
'attributes': dict, # Resource attributes
|
|
1959
|
+
'createTime': int # Creation timestamp
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
Raises:
|
|
1963
|
+
ValueError: When required parameters are missing or invalid:
|
|
1964
|
+
- Empty or None values for required fields
|
|
1965
|
+
- Invalid GUID format
|
|
1966
|
+
- Out-of-range values
|
|
1967
|
+
|
|
1968
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1969
|
+
- DefaultAzureCredential not configured
|
|
1970
|
+
- Insufficient permissions
|
|
1971
|
+
- Expired authentication token
|
|
1972
|
+
|
|
1973
|
+
HTTPError: When Purview API returns error:
|
|
1974
|
+
- 400: Bad request (invalid parameters)
|
|
1975
|
+
- 401: Unauthorized (authentication failed)
|
|
1976
|
+
- 403: Forbidden (insufficient permissions)
|
|
1977
|
+
- 404: Resource not found
|
|
1978
|
+
- 409: Conflict (resource already exists)
|
|
1979
|
+
- 429: Rate limit exceeded
|
|
1980
|
+
- 500: Internal server error
|
|
1981
|
+
|
|
1982
|
+
NetworkError: When network connectivity fails
|
|
1983
|
+
|
|
1984
|
+
Example:
|
|
1985
|
+
# Basic usage
|
|
1986
|
+
client = Entity()
|
|
1987
|
+
|
|
1988
|
+
result = client.entityCreateBusinessMetadataAttributes(args=...)
|
|
1989
|
+
print(f"Result: {result}")
|
|
1990
|
+
|
|
1991
|
+
# With detailed data
|
|
1992
|
+
data = {
|
|
1993
|
+
'name': 'My Resource',
|
|
1994
|
+
'description': 'Resource description',
|
|
1995
|
+
'attributes': {
|
|
1996
|
+
'key1': 'value1',
|
|
1997
|
+
'key2': 'value2'
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
result = client.entityCreateBusinessMetadataAttributes(data)
|
|
2002
|
+
print(f"Created/Updated: {result['guid']}")
|
|
2003
|
+
|
|
2004
|
+
Use Cases:
|
|
2005
|
+
- Data Onboarding: Register new data sources in catalog
|
|
2006
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
2007
|
+
- Automation: Programmatically populate catalog
|
|
2008
|
+
"""
|
|
2009
|
+
self.method = "POST"
|
|
2010
|
+
self.endpoint = ENDPOINTS["entity"]["add_business_metadata_attributes"].format(
|
|
2011
|
+
guid=args["--guid"][0], businessMetadataName=args["--businessMetadataName"]
|
|
2012
|
+
)
|
|
2013
|
+
self.params = get_api_version_params("datamap")
|
|
2014
|
+
self.payload = get_json(args, "--payloadFile")
|
|
2015
|
+
|
|
2016
|
+
@decorator
|
|
2017
|
+
def entityDeleteBusinessMetadataAttributes(self, args):
|
|
2018
|
+
"""
|
|
2019
|
+
Delete a entity.
|
|
2020
|
+
|
|
2021
|
+
Permanently deletes the specified entity.
|
|
2022
|
+
This operation cannot be undone. Use with caution.
|
|
2023
|
+
|
|
2024
|
+
Args:
|
|
2025
|
+
args: Dictionary of operation arguments.
|
|
2026
|
+
Contains operation-specific parameters.
|
|
2027
|
+
See method implementation for details.
|
|
2028
|
+
|
|
2029
|
+
Returns:
|
|
2030
|
+
Dictionary with deletion status:
|
|
2031
|
+
{
|
|
2032
|
+
'guid': str, # Deleted resource ID
|
|
2033
|
+
'status': str, # Deletion status
|
|
2034
|
+
'message': str # Confirmation message
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
Raises:
|
|
2038
|
+
ValueError: When required parameters are missing or invalid:
|
|
2039
|
+
- Empty or None values for required fields
|
|
2040
|
+
- Invalid GUID format
|
|
2041
|
+
- Out-of-range values
|
|
2042
|
+
|
|
2043
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2044
|
+
- DefaultAzureCredential not configured
|
|
2045
|
+
- Insufficient permissions
|
|
2046
|
+
- Expired authentication token
|
|
2047
|
+
|
|
2048
|
+
HTTPError: When Purview API returns error:
|
|
2049
|
+
- 400: Bad request (invalid parameters)
|
|
2050
|
+
- 401: Unauthorized (authentication failed)
|
|
2051
|
+
- 403: Forbidden (insufficient permissions)
|
|
2052
|
+
- 404: Resource not found
|
|
2053
|
+
- 429: Rate limit exceeded
|
|
2054
|
+
- 500: Internal server error
|
|
2055
|
+
|
|
2056
|
+
NetworkError: When network connectivity fails
|
|
2057
|
+
|
|
2058
|
+
Example:
|
|
2059
|
+
# Basic usage
|
|
2060
|
+
client = Entity()
|
|
2061
|
+
|
|
2062
|
+
result = client.entityDeleteBusinessMetadataAttributes(args=...)
|
|
2063
|
+
print(f"Result: {result}")
|
|
2064
|
+
|
|
2065
|
+
Use Cases:
|
|
2066
|
+
- Data Cleanup: Remove obsolete or test data
|
|
2067
|
+
- Decommissioning: Delete resources no longer in use
|
|
2068
|
+
- Testing: Clean up test environments
|
|
2069
|
+
"""
|
|
2070
|
+
self.method = "DELETE"
|
|
2071
|
+
self.endpoint = ENDPOINTS["entity"]["remove_business_metadata_attributes"].format(
|
|
2072
|
+
guid=args["--guid"][0], businessMetadataName=args["--businessMetadataName"]
|
|
2073
|
+
)
|
|
2074
|
+
self.params = {
|
|
2075
|
+
**get_api_version_params("datamap"),
|
|
2076
|
+
"businessMetadataAttributes": args["--attributes"],
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
@decorator
|
|
2080
|
+
def entityImportBusinessMetadata(self, args):
|
|
2081
|
+
"""
|
|
2082
|
+
Perform batch operation on resources.
|
|
2083
|
+
|
|
2084
|
+
Processes multiple resources in a single operation.
|
|
2085
|
+
More efficient than individual operations for bulk data.
|
|
2086
|
+
|
|
2087
|
+
Args:
|
|
2088
|
+
args: Dictionary of operation arguments.
|
|
2089
|
+
Contains operation-specific parameters.
|
|
2090
|
+
See method implementation for details.
|
|
2091
|
+
|
|
2092
|
+
Returns:
|
|
2093
|
+
Dictionary with batch operation results:
|
|
2094
|
+
{
|
|
2095
|
+
'succeeded': int, # Success count
|
|
2096
|
+
'failed': int, # Failure count
|
|
2097
|
+
'results': [...], # Per-item results
|
|
2098
|
+
'errors': [...] # Error details
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
Raises:
|
|
2102
|
+
ValueError: When required parameters are missing or invalid:
|
|
2103
|
+
- Empty or None values for required fields
|
|
2104
|
+
- Invalid GUID format
|
|
2105
|
+
- Out-of-range values
|
|
2106
|
+
|
|
2107
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2108
|
+
- DefaultAzureCredential not configured
|
|
2109
|
+
- Insufficient permissions
|
|
2110
|
+
- Expired authentication token
|
|
2111
|
+
|
|
2112
|
+
HTTPError: When Purview API returns error:
|
|
2113
|
+
- 400: Bad request (invalid parameters)
|
|
2114
|
+
- 401: Unauthorized (authentication failed)
|
|
2115
|
+
- 403: Forbidden (insufficient permissions)
|
|
2116
|
+
- 404: Resource not found
|
|
2117
|
+
- 429: Rate limit exceeded
|
|
2118
|
+
- 500: Internal server error
|
|
2119
|
+
|
|
2120
|
+
NetworkError: When network connectivity fails
|
|
2121
|
+
|
|
2122
|
+
Example:
|
|
2123
|
+
# Basic usage
|
|
2124
|
+
client = Entity()
|
|
2125
|
+
|
|
2126
|
+
result = client.entityImportBusinessMetadata(args=...)
|
|
2127
|
+
print(f"Result: {result}")
|
|
2128
|
+
|
|
2129
|
+
Use Cases:
|
|
2130
|
+
- Bulk Import: Load large volumes of metadata
|
|
2131
|
+
- Migration: Transfer catalog from other systems
|
|
2132
|
+
- Mass Updates: Apply changes to many resources
|
|
2133
|
+
"""
|
|
2134
|
+
self.method = "POST"
|
|
2135
|
+
self.endpoint = ENDPOINTS["entity"]["import_business_metadata"]
|
|
2136
|
+
self.params = get_api_version_params("datamap")
|
|
2137
|
+
self.payload = get_json(args, "--payloadFile")
|
|
2138
|
+
|
|
2139
|
+
@decorator
|
|
2140
|
+
def entityReadBusinessMetadataTemplate(self, args):
|
|
2141
|
+
"""
|
|
2142
|
+
Retrieve entity information.
|
|
2143
|
+
|
|
2144
|
+
Retrieves detailed information about the specified entity.
|
|
2145
|
+
Returns complete entity metadata and properties.
|
|
2146
|
+
|
|
2147
|
+
Args:
|
|
2148
|
+
args: Dictionary of operation arguments.
|
|
2149
|
+
Contains operation-specific parameters.
|
|
2150
|
+
See method implementation for details.
|
|
2151
|
+
|
|
2152
|
+
Returns:
|
|
2153
|
+
Dictionary containing entity information:
|
|
2154
|
+
{
|
|
2155
|
+
'guid': str, # Unique identifier
|
|
2156
|
+
'name': str, # Resource name
|
|
2157
|
+
'attributes': dict, # Resource attributes
|
|
2158
|
+
'status': str, # Resource status
|
|
2159
|
+
'updateTime': int # Last update timestamp
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
Raises:
|
|
2163
|
+
ValueError: When required parameters are missing or invalid:
|
|
2164
|
+
- Empty or None values for required fields
|
|
2165
|
+
- Invalid GUID format
|
|
2166
|
+
- Out-of-range values
|
|
2167
|
+
|
|
2168
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2169
|
+
- DefaultAzureCredential not configured
|
|
2170
|
+
- Insufficient permissions
|
|
2171
|
+
- Expired authentication token
|
|
2172
|
+
|
|
2173
|
+
HTTPError: When Purview API returns error:
|
|
2174
|
+
- 400: Bad request (invalid parameters)
|
|
2175
|
+
- 401: Unauthorized (authentication failed)
|
|
2176
|
+
- 403: Forbidden (insufficient permissions)
|
|
2177
|
+
- 404: Resource not found
|
|
2178
|
+
- 429: Rate limit exceeded
|
|
2179
|
+
- 500: Internal server error
|
|
2180
|
+
|
|
2181
|
+
NetworkError: When network connectivity fails
|
|
2182
|
+
|
|
2183
|
+
Example:
|
|
2184
|
+
# Basic usage
|
|
2185
|
+
client = Entity()
|
|
2186
|
+
|
|
2187
|
+
result = client.entityReadBusinessMetadataTemplate(args=...)
|
|
2188
|
+
print(f"Result: {result}")
|
|
2189
|
+
|
|
2190
|
+
Use Cases:
|
|
2191
|
+
- Data Discovery: Find and explore data assets
|
|
2192
|
+
- Compliance Auditing: Review metadata and classifications
|
|
2193
|
+
- Reporting: Generate catalog reports
|
|
2194
|
+
"""
|
|
2195
|
+
self.method = "GET"
|
|
2196
|
+
self.endpoint = ENDPOINTS["entity"]["business_metadata_template"]
|
|
2197
|
+
self.params = get_api_version_params("datamap")
|
|
2198
|
+
|
|
2199
|
+
# Aliases for CLI compatibility
|
|
2200
|
+
def entityAddOrUpdateBusinessMetadata(self, args):
|
|
2201
|
+
"""
|
|
2202
|
+
Create a new entity.
|
|
2203
|
+
|
|
2204
|
+
Creates a new entity in Microsoft Purview Data Map.
|
|
2205
|
+
Requires appropriate permissions and valid entity definition.
|
|
2206
|
+
|
|
2207
|
+
Args:
|
|
2208
|
+
args: Dictionary of operation arguments.
|
|
2209
|
+
Contains operation-specific parameters.
|
|
2210
|
+
See method implementation for details.
|
|
2211
|
+
|
|
2212
|
+
Returns:
|
|
2213
|
+
Dictionary containing created entity:
|
|
2214
|
+
{
|
|
2215
|
+
'guid': str, # Unique identifier
|
|
2216
|
+
'name': str, # Resource name
|
|
2217
|
+
'status': str, # Creation status
|
|
2218
|
+
'attributes': dict, # Resource attributes
|
|
2219
|
+
'createTime': int # Creation timestamp
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
Raises:
|
|
2223
|
+
ValueError: When required parameters are missing or invalid:
|
|
2224
|
+
- Empty or None values for required fields
|
|
2225
|
+
- Invalid GUID format
|
|
2226
|
+
- Out-of-range values
|
|
2227
|
+
|
|
2228
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2229
|
+
- DefaultAzureCredential not configured
|
|
2230
|
+
- Insufficient permissions
|
|
2231
|
+
- Expired authentication token
|
|
2232
|
+
|
|
2233
|
+
HTTPError: When Purview API returns error:
|
|
2234
|
+
- 400: Bad request (invalid parameters)
|
|
2235
|
+
- 401: Unauthorized (authentication failed)
|
|
2236
|
+
- 403: Forbidden (insufficient permissions)
|
|
2237
|
+
- 404: Resource not found
|
|
2238
|
+
- 409: Conflict (resource already exists)
|
|
2239
|
+
- 429: Rate limit exceeded
|
|
2240
|
+
- 500: Internal server error
|
|
2241
|
+
|
|
2242
|
+
NetworkError: When network connectivity fails
|
|
2243
|
+
|
|
2244
|
+
Example:
|
|
2245
|
+
# Basic usage
|
|
2246
|
+
client = Entity()
|
|
2247
|
+
|
|
2248
|
+
result = client.entityAddOrUpdateBusinessMetadata(args=...)
|
|
2249
|
+
print(f"Result: {result}")
|
|
2250
|
+
|
|
2251
|
+
# With detailed data
|
|
2252
|
+
data = {
|
|
2253
|
+
'name': 'My Resource',
|
|
2254
|
+
'description': 'Resource description',
|
|
2255
|
+
'attributes': {
|
|
2256
|
+
'key1': 'value1',
|
|
2257
|
+
'key2': 'value2'
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
result = client.entityAddOrUpdateBusinessMetadata(data)
|
|
2262
|
+
print(f"Created/Updated: {result['guid']}")
|
|
2263
|
+
|
|
2264
|
+
Use Cases:
|
|
2265
|
+
- Data Onboarding: Register new data sources in catalog
|
|
2266
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
2267
|
+
- Automation: Programmatically populate catalog
|
|
2268
|
+
"""
|
|
2269
|
+
return self.entityCreateBusinessMetadata(args)
|
|
2270
|
+
|
|
2271
|
+
def entityAddOrUpdateBusinessMetadataAttributes(self, args):
|
|
2272
|
+
"""
|
|
2273
|
+
Create a new entity.
|
|
2274
|
+
|
|
2275
|
+
Creates a new entity in Microsoft Purview Data Map.
|
|
2276
|
+
Requires appropriate permissions and valid entity definition.
|
|
2277
|
+
|
|
2278
|
+
Args:
|
|
2279
|
+
args: Dictionary of operation arguments.
|
|
2280
|
+
Contains operation-specific parameters.
|
|
2281
|
+
See method implementation for details.
|
|
2282
|
+
|
|
2283
|
+
Returns:
|
|
2284
|
+
Dictionary containing created entity:
|
|
2285
|
+
{
|
|
2286
|
+
'guid': str, # Unique identifier
|
|
2287
|
+
'name': str, # Resource name
|
|
2288
|
+
'status': str, # Creation status
|
|
2289
|
+
'attributes': dict, # Resource attributes
|
|
2290
|
+
'createTime': int # Creation timestamp
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
Raises:
|
|
2294
|
+
ValueError: When required parameters are missing or invalid:
|
|
2295
|
+
- Empty or None values for required fields
|
|
2296
|
+
- Invalid GUID format
|
|
2297
|
+
- Out-of-range values
|
|
2298
|
+
|
|
2299
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2300
|
+
- DefaultAzureCredential not configured
|
|
2301
|
+
- Insufficient permissions
|
|
2302
|
+
- Expired authentication token
|
|
2303
|
+
|
|
2304
|
+
HTTPError: When Purview API returns error:
|
|
2305
|
+
- 400: Bad request (invalid parameters)
|
|
2306
|
+
- 401: Unauthorized (authentication failed)
|
|
2307
|
+
- 403: Forbidden (insufficient permissions)
|
|
2308
|
+
- 404: Resource not found
|
|
2309
|
+
- 409: Conflict (resource already exists)
|
|
2310
|
+
- 429: Rate limit exceeded
|
|
2311
|
+
- 500: Internal server error
|
|
2312
|
+
|
|
2313
|
+
NetworkError: When network connectivity fails
|
|
2314
|
+
|
|
2315
|
+
Example:
|
|
2316
|
+
# Basic usage
|
|
2317
|
+
client = Entity()
|
|
2318
|
+
|
|
2319
|
+
result = client.entityAddOrUpdateBusinessMetadataAttributes(args=...)
|
|
2320
|
+
print(f"Result: {result}")
|
|
2321
|
+
|
|
2322
|
+
# With detailed data
|
|
2323
|
+
data = {
|
|
2324
|
+
'name': 'My Resource',
|
|
2325
|
+
'description': 'Resource description',
|
|
2326
|
+
'attributes': {
|
|
2327
|
+
'key1': 'value1',
|
|
2328
|
+
'key2': 'value2'
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
result = client.entityAddOrUpdateBusinessMetadataAttributes(data)
|
|
2333
|
+
print(f"Created/Updated: {result['guid']}")
|
|
2334
|
+
|
|
2335
|
+
Use Cases:
|
|
2336
|
+
- Data Onboarding: Register new data sources in catalog
|
|
2337
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
2338
|
+
- Automation: Programmatically populate catalog
|
|
2339
|
+
"""
|
|
2340
|
+
return self.entityCreateBusinessMetadataAttributes(args)
|
|
2341
|
+
|
|
2342
|
+
def entityRemoveBusinessMetadata(self, args):
|
|
2343
|
+
"""
|
|
2344
|
+
Delete a entity.
|
|
2345
|
+
|
|
2346
|
+
Permanently deletes the specified entity.
|
|
2347
|
+
This operation cannot be undone. Use with caution.
|
|
2348
|
+
|
|
2349
|
+
Args:
|
|
2350
|
+
args: Dictionary of operation arguments.
|
|
2351
|
+
Contains operation-specific parameters.
|
|
2352
|
+
See method implementation for details.
|
|
2353
|
+
|
|
2354
|
+
Returns:
|
|
2355
|
+
Dictionary with deletion status:
|
|
2356
|
+
{
|
|
2357
|
+
'guid': str, # Deleted resource ID
|
|
2358
|
+
'status': str, # Deletion status
|
|
2359
|
+
'message': str # Confirmation message
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
Raises:
|
|
2363
|
+
ValueError: When required parameters are missing or invalid:
|
|
2364
|
+
- Empty or None values for required fields
|
|
2365
|
+
- Invalid GUID format
|
|
2366
|
+
- Out-of-range values
|
|
2367
|
+
|
|
2368
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2369
|
+
- DefaultAzureCredential not configured
|
|
2370
|
+
- Insufficient permissions
|
|
2371
|
+
- Expired authentication token
|
|
2372
|
+
|
|
2373
|
+
HTTPError: When Purview API returns error:
|
|
2374
|
+
- 400: Bad request (invalid parameters)
|
|
2375
|
+
- 401: Unauthorized (authentication failed)
|
|
2376
|
+
- 403: Forbidden (insufficient permissions)
|
|
2377
|
+
- 404: Resource not found
|
|
2378
|
+
- 429: Rate limit exceeded
|
|
2379
|
+
- 500: Internal server error
|
|
2380
|
+
|
|
2381
|
+
NetworkError: When network connectivity fails
|
|
2382
|
+
|
|
2383
|
+
Example:
|
|
2384
|
+
# Basic usage
|
|
2385
|
+
client = Entity()
|
|
2386
|
+
|
|
2387
|
+
result = client.entityRemoveBusinessMetadata(args=...)
|
|
2388
|
+
print(f"Result: {result}")
|
|
2389
|
+
|
|
2390
|
+
Use Cases:
|
|
2391
|
+
- Data Cleanup: Remove obsolete or test data
|
|
2392
|
+
- Decommissioning: Delete resources no longer in use
|
|
2393
|
+
- Testing: Clean up test environments
|
|
2394
|
+
"""
|
|
2395
|
+
return self.entityDeleteBusinessMetadata(args)
|
|
2396
|
+
|
|
2397
|
+
def entityRemoveBusinessMetadataAttributes(self, args):
|
|
2398
|
+
"""
|
|
2399
|
+
Delete a entity.
|
|
2400
|
+
|
|
2401
|
+
Permanently deletes the specified entity.
|
|
2402
|
+
This operation cannot be undone. Use with caution.
|
|
2403
|
+
|
|
2404
|
+
Args:
|
|
2405
|
+
args: Dictionary of operation arguments.
|
|
2406
|
+
Contains operation-specific parameters.
|
|
2407
|
+
See method implementation for details.
|
|
2408
|
+
|
|
2409
|
+
Returns:
|
|
2410
|
+
Dictionary with deletion status:
|
|
2411
|
+
{
|
|
2412
|
+
'guid': str, # Deleted resource ID
|
|
2413
|
+
'status': str, # Deletion status
|
|
2414
|
+
'message': str # Confirmation message
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
Raises:
|
|
2418
|
+
ValueError: When required parameters are missing or invalid:
|
|
2419
|
+
- Empty or None values for required fields
|
|
2420
|
+
- Invalid GUID format
|
|
2421
|
+
- Out-of-range values
|
|
2422
|
+
|
|
2423
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2424
|
+
- DefaultAzureCredential not configured
|
|
2425
|
+
- Insufficient permissions
|
|
2426
|
+
- Expired authentication token
|
|
2427
|
+
|
|
2428
|
+
HTTPError: When Purview API returns error:
|
|
2429
|
+
- 400: Bad request (invalid parameters)
|
|
2430
|
+
- 401: Unauthorized (authentication failed)
|
|
2431
|
+
- 403: Forbidden (insufficient permissions)
|
|
2432
|
+
- 404: Resource not found
|
|
2433
|
+
- 429: Rate limit exceeded
|
|
2434
|
+
- 500: Internal server error
|
|
2435
|
+
|
|
2436
|
+
NetworkError: When network connectivity fails
|
|
2437
|
+
|
|
2438
|
+
Example:
|
|
2439
|
+
# Basic usage
|
|
2440
|
+
client = Entity()
|
|
2441
|
+
|
|
2442
|
+
result = client.entityRemoveBusinessMetadataAttributes(args=...)
|
|
2443
|
+
print(f"Result: {result}")
|
|
2444
|
+
|
|
2445
|
+
Use Cases:
|
|
2446
|
+
- Data Cleanup: Remove obsolete or test data
|
|
2447
|
+
- Decommissioning: Delete resources no longer in use
|
|
2448
|
+
- Testing: Clean up test environments
|
|
2449
|
+
"""
|
|
2450
|
+
return self.entityDeleteBusinessMetadataAttributes(args)
|
|
2451
|
+
|
|
2452
|
+
# === LABEL OPERATIONS ===
|
|
2453
|
+
|
|
2454
|
+
@decorator
|
|
2455
|
+
def entityCreateLabels(self, args):
|
|
2456
|
+
"""
|
|
2457
|
+
Create a new entity.
|
|
2458
|
+
|
|
2459
|
+
Creates a new entity in Microsoft Purview Data Map.
|
|
2460
|
+
Requires appropriate permissions and valid entity definition.
|
|
2461
|
+
|
|
2462
|
+
Args:
|
|
2463
|
+
args: Dictionary of operation arguments.
|
|
2464
|
+
Contains operation-specific parameters.
|
|
2465
|
+
See method implementation for details.
|
|
2466
|
+
|
|
2467
|
+
Returns:
|
|
2468
|
+
Dictionary containing created entity:
|
|
2469
|
+
{
|
|
2470
|
+
'guid': str, # Unique identifier
|
|
2471
|
+
'name': str, # Resource name
|
|
2472
|
+
'status': str, # Creation status
|
|
2473
|
+
'attributes': dict, # Resource attributes
|
|
2474
|
+
'createTime': int # Creation timestamp
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
Raises:
|
|
2478
|
+
ValueError: When required parameters are missing or invalid:
|
|
2479
|
+
- Empty or None values for required fields
|
|
2480
|
+
- Invalid GUID format
|
|
2481
|
+
- Out-of-range values
|
|
2482
|
+
|
|
2483
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2484
|
+
- DefaultAzureCredential not configured
|
|
2485
|
+
- Insufficient permissions
|
|
2486
|
+
- Expired authentication token
|
|
2487
|
+
|
|
2488
|
+
HTTPError: When Purview API returns error:
|
|
2489
|
+
- 400: Bad request (invalid parameters)
|
|
2490
|
+
- 401: Unauthorized (authentication failed)
|
|
2491
|
+
- 403: Forbidden (insufficient permissions)
|
|
2492
|
+
- 404: Resource not found
|
|
2493
|
+
- 409: Conflict (resource already exists)
|
|
2494
|
+
- 429: Rate limit exceeded
|
|
2495
|
+
- 500: Internal server error
|
|
2496
|
+
|
|
2497
|
+
NetworkError: When network connectivity fails
|
|
2498
|
+
|
|
2499
|
+
Example:
|
|
2500
|
+
# Basic usage
|
|
2501
|
+
client = Entity()
|
|
2502
|
+
|
|
2503
|
+
result = client.entityCreateLabels(args=...)
|
|
2504
|
+
print(f"Result: {result}")
|
|
2505
|
+
|
|
2506
|
+
# With detailed data
|
|
2507
|
+
data = {
|
|
2508
|
+
'name': 'My Resource',
|
|
2509
|
+
'description': 'Resource description',
|
|
2510
|
+
'attributes': {
|
|
2511
|
+
'key1': 'value1',
|
|
2512
|
+
'key2': 'value2'
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2516
|
+
result = client.entityCreateLabels(data)
|
|
2517
|
+
print(f"Created/Updated: {result['guid']}")
|
|
2518
|
+
|
|
2519
|
+
Use Cases:
|
|
2520
|
+
- Data Onboarding: Register new data sources in catalog
|
|
2521
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
2522
|
+
- Automation: Programmatically populate catalog
|
|
2523
|
+
"""
|
|
2524
|
+
self.method = "POST"
|
|
2525
|
+
self.endpoint = ENDPOINTS["entity"]["add_label"].format(guid=args["--guid"][0])
|
|
2526
|
+
self.params = get_api_version_params("datamap")
|
|
2527
|
+
self.payload = get_json(args, "--payloadFile")
|
|
2528
|
+
|
|
2529
|
+
@decorator
|
|
2530
|
+
def entityUpdateLabels(self, args):
|
|
2531
|
+
"""
|
|
2532
|
+
Update an existing entity.
|
|
2533
|
+
|
|
2534
|
+
Updates an existing entity with new values.
|
|
2535
|
+
Only specified fields are modified; others remain unchanged.
|
|
2536
|
+
|
|
2537
|
+
Args:
|
|
2538
|
+
args: Dictionary of operation arguments.
|
|
2539
|
+
Contains operation-specific parameters.
|
|
2540
|
+
See method implementation for details.
|
|
2541
|
+
|
|
2542
|
+
Returns:
|
|
2543
|
+
Dictionary containing updated entity:
|
|
2544
|
+
{
|
|
2545
|
+
'guid': str, # Unique identifier
|
|
2546
|
+
'attributes': dict, # Updated attributes
|
|
2547
|
+
'updateTime': int # Update timestamp
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
Raises:
|
|
2551
|
+
ValueError: When required parameters are missing or invalid:
|
|
2552
|
+
- Empty or None values for required fields
|
|
2553
|
+
- Invalid GUID format
|
|
2554
|
+
- Out-of-range values
|
|
2555
|
+
|
|
2556
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2557
|
+
- DefaultAzureCredential not configured
|
|
2558
|
+
- Insufficient permissions
|
|
2559
|
+
- Expired authentication token
|
|
2560
|
+
|
|
2561
|
+
HTTPError: When Purview API returns error:
|
|
2562
|
+
- 400: Bad request (invalid parameters)
|
|
2563
|
+
- 401: Unauthorized (authentication failed)
|
|
2564
|
+
- 403: Forbidden (insufficient permissions)
|
|
2565
|
+
- 404: Resource not found
|
|
2566
|
+
- 429: Rate limit exceeded
|
|
2567
|
+
- 500: Internal server error
|
|
2568
|
+
|
|
2569
|
+
NetworkError: When network connectivity fails
|
|
2570
|
+
|
|
2571
|
+
Example:
|
|
2572
|
+
# Basic usage
|
|
2573
|
+
client = Entity()
|
|
2574
|
+
|
|
2575
|
+
result = client.entityUpdateLabels(args=...)
|
|
2576
|
+
print(f"Result: {result}")
|
|
2577
|
+
|
|
2578
|
+
# With detailed data
|
|
2579
|
+
data = {
|
|
2580
|
+
'name': 'My Resource',
|
|
2581
|
+
'description': 'Resource description',
|
|
2582
|
+
'attributes': {
|
|
2583
|
+
'key1': 'value1',
|
|
2584
|
+
'key2': 'value2'
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
result = client.entityUpdateLabels(data)
|
|
2589
|
+
print(f"Created/Updated: {result['guid']}")
|
|
2590
|
+
|
|
2591
|
+
Use Cases:
|
|
2592
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
2593
|
+
- Ownership Changes: Reassign data ownership
|
|
2594
|
+
- Classification: Apply or modify data classifications
|
|
2595
|
+
"""
|
|
2596
|
+
self.method = "PUT"
|
|
2597
|
+
self.endpoint = ENDPOINTS["entity"]["set_labels"].format(guid=args["--guid"][0])
|
|
2598
|
+
self.params = get_api_version_params("datamap")
|
|
2599
|
+
self.payload = get_json(args, "--payloadFile")
|
|
2600
|
+
|
|
2601
|
+
@decorator
|
|
2602
|
+
def entityDeleteLabels(self, args):
|
|
2603
|
+
"""
|
|
2604
|
+
Delete a entity.
|
|
2605
|
+
|
|
2606
|
+
Permanently deletes the specified entity.
|
|
2607
|
+
This operation cannot be undone. Use with caution.
|
|
2608
|
+
|
|
2609
|
+
Args:
|
|
2610
|
+
args: Dictionary of operation arguments.
|
|
2611
|
+
Contains operation-specific parameters.
|
|
2612
|
+
See method implementation for details.
|
|
2613
|
+
|
|
2614
|
+
Returns:
|
|
2615
|
+
Dictionary with deletion status:
|
|
2616
|
+
{
|
|
2617
|
+
'guid': str, # Deleted resource ID
|
|
2618
|
+
'status': str, # Deletion status
|
|
2619
|
+
'message': str # Confirmation message
|
|
2620
|
+
}
|
|
2621
|
+
|
|
2622
|
+
Raises:
|
|
2623
|
+
ValueError: When required parameters are missing or invalid:
|
|
2624
|
+
- Empty or None values for required fields
|
|
2625
|
+
- Invalid GUID format
|
|
2626
|
+
- Out-of-range values
|
|
2627
|
+
|
|
2628
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2629
|
+
- DefaultAzureCredential not configured
|
|
2630
|
+
- Insufficient permissions
|
|
2631
|
+
- Expired authentication token
|
|
2632
|
+
|
|
2633
|
+
HTTPError: When Purview API returns error:
|
|
2634
|
+
- 400: Bad request (invalid parameters)
|
|
2635
|
+
- 401: Unauthorized (authentication failed)
|
|
2636
|
+
- 403: Forbidden (insufficient permissions)
|
|
2637
|
+
- 404: Resource not found
|
|
2638
|
+
- 429: Rate limit exceeded
|
|
2639
|
+
- 500: Internal server error
|
|
2640
|
+
|
|
2641
|
+
NetworkError: When network connectivity fails
|
|
2642
|
+
|
|
2643
|
+
Example:
|
|
2644
|
+
# Basic usage
|
|
2645
|
+
client = Entity()
|
|
2646
|
+
|
|
2647
|
+
result = client.entityDeleteLabels(args=...)
|
|
2648
|
+
print(f"Result: {result}")
|
|
2649
|
+
|
|
2650
|
+
Use Cases:
|
|
2651
|
+
- Data Cleanup: Remove obsolete or test data
|
|
2652
|
+
- Decommissioning: Delete resources no longer in use
|
|
2653
|
+
- Testing: Clean up test environments
|
|
2654
|
+
"""
|
|
2655
|
+
self.method = "DELETE"
|
|
2656
|
+
self.endpoint = ENDPOINTS["entity"]["remove_labels"].format(guid=args["--guid"][0])
|
|
2657
|
+
self.params = get_api_version_params("datamap")
|
|
2658
|
+
self.payload = get_json(args, "--payloadFile")
|
|
2659
|
+
|
|
2660
|
+
# === UNIQUE ATTRIBUTE LABEL OPERATIONS ===
|
|
2661
|
+
|
|
2662
|
+
@decorator
|
|
2663
|
+
def entityCreateLabelsByUniqueAttribute(self, args):
|
|
2664
|
+
"""
|
|
2665
|
+
Create a new entity.
|
|
2666
|
+
|
|
2667
|
+
Creates a new entity in Microsoft Purview Data Map.
|
|
2668
|
+
Requires appropriate permissions and valid entity definition.
|
|
2669
|
+
|
|
2670
|
+
Args:
|
|
2671
|
+
args: Dictionary of operation arguments.
|
|
2672
|
+
Contains operation-specific parameters.
|
|
2673
|
+
See method implementation for details.
|
|
2674
|
+
|
|
2675
|
+
Returns:
|
|
2676
|
+
Dictionary containing created entity:
|
|
2677
|
+
{
|
|
2678
|
+
'guid': str, # Unique identifier
|
|
2679
|
+
'name': str, # Resource name
|
|
2680
|
+
'status': str, # Creation status
|
|
2681
|
+
'attributes': dict, # Resource attributes
|
|
2682
|
+
'createTime': int # Creation timestamp
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2685
|
+
Raises:
|
|
2686
|
+
ValueError: When required parameters are missing or invalid:
|
|
2687
|
+
- Empty or None values for required fields
|
|
2688
|
+
- Invalid GUID format
|
|
2689
|
+
- Out-of-range values
|
|
2690
|
+
|
|
2691
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2692
|
+
- DefaultAzureCredential not configured
|
|
2693
|
+
- Insufficient permissions
|
|
2694
|
+
- Expired authentication token
|
|
2695
|
+
|
|
2696
|
+
HTTPError: When Purview API returns error:
|
|
2697
|
+
- 400: Bad request (invalid parameters)
|
|
2698
|
+
- 401: Unauthorized (authentication failed)
|
|
2699
|
+
- 403: Forbidden (insufficient permissions)
|
|
2700
|
+
- 404: Resource not found
|
|
2701
|
+
- 409: Conflict (resource already exists)
|
|
2702
|
+
- 429: Rate limit exceeded
|
|
2703
|
+
- 500: Internal server error
|
|
2704
|
+
|
|
2705
|
+
NetworkError: When network connectivity fails
|
|
2706
|
+
|
|
2707
|
+
Example:
|
|
2708
|
+
# Basic usage
|
|
2709
|
+
client = Entity()
|
|
2710
|
+
|
|
2711
|
+
result = client.entityCreateLabelsByUniqueAttribute(args=...)
|
|
2712
|
+
print(f"Result: {result}")
|
|
2713
|
+
|
|
2714
|
+
# With detailed data
|
|
2715
|
+
data = {
|
|
2716
|
+
'name': 'My Resource',
|
|
2717
|
+
'description': 'Resource description',
|
|
2718
|
+
'attributes': {
|
|
2719
|
+
'key1': 'value1',
|
|
2720
|
+
'key2': 'value2'
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2724
|
+
result = client.entityCreateLabelsByUniqueAttribute(data)
|
|
2725
|
+
print(f"Created/Updated: {result['guid']}")
|
|
2726
|
+
|
|
2727
|
+
Use Cases:
|
|
2728
|
+
- Data Onboarding: Register new data sources in catalog
|
|
2729
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
2730
|
+
- Automation: Programmatically populate catalog
|
|
2731
|
+
"""
|
|
2732
|
+
self.method = "POST"
|
|
2733
|
+
self.endpoint = ENDPOINTS["entity"]["add_labels_by_unique_attribute"].format(
|
|
2734
|
+
typeName=args["--typeName"]
|
|
2735
|
+
)
|
|
2736
|
+
self.params = {
|
|
2737
|
+
**get_api_version_params("datamap"),
|
|
2738
|
+
"attr:qualifiedName": args["--qualifiedName"],
|
|
2739
|
+
}
|
|
2740
|
+
self.payload = get_json(args, "--payloadFile")
|
|
2741
|
+
|
|
2742
|
+
@decorator
|
|
2743
|
+
def entityUpdateLabelsByUniqueAttribute(self, args):
|
|
2744
|
+
"""
|
|
2745
|
+
Update an existing entity.
|
|
2746
|
+
|
|
2747
|
+
Updates an existing entity with new values.
|
|
2748
|
+
Only specified fields are modified; others remain unchanged.
|
|
2749
|
+
|
|
2750
|
+
Args:
|
|
2751
|
+
args: Dictionary of operation arguments.
|
|
2752
|
+
Contains operation-specific parameters.
|
|
2753
|
+
See method implementation for details.
|
|
2754
|
+
|
|
2755
|
+
Returns:
|
|
2756
|
+
Dictionary containing updated entity:
|
|
2757
|
+
{
|
|
2758
|
+
'guid': str, # Unique identifier
|
|
2759
|
+
'attributes': dict, # Updated attributes
|
|
2760
|
+
'updateTime': int # Update timestamp
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
Raises:
|
|
2764
|
+
ValueError: When required parameters are missing or invalid:
|
|
2765
|
+
- Empty or None values for required fields
|
|
2766
|
+
- Invalid GUID format
|
|
2767
|
+
- Out-of-range values
|
|
2768
|
+
|
|
2769
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2770
|
+
- DefaultAzureCredential not configured
|
|
2771
|
+
- Insufficient permissions
|
|
2772
|
+
- Expired authentication token
|
|
2773
|
+
|
|
2774
|
+
HTTPError: When Purview API returns error:
|
|
2775
|
+
- 400: Bad request (invalid parameters)
|
|
2776
|
+
- 401: Unauthorized (authentication failed)
|
|
2777
|
+
- 403: Forbidden (insufficient permissions)
|
|
2778
|
+
- 404: Resource not found
|
|
2779
|
+
- 429: Rate limit exceeded
|
|
2780
|
+
- 500: Internal server error
|
|
2781
|
+
|
|
2782
|
+
NetworkError: When network connectivity fails
|
|
2783
|
+
|
|
2784
|
+
Example:
|
|
2785
|
+
# Basic usage
|
|
2786
|
+
client = Entity()
|
|
2787
|
+
|
|
2788
|
+
result = client.entityUpdateLabelsByUniqueAttribute(args=...)
|
|
2789
|
+
print(f"Result: {result}")
|
|
2790
|
+
|
|
2791
|
+
# With detailed data
|
|
2792
|
+
data = {
|
|
2793
|
+
'name': 'My Resource',
|
|
2794
|
+
'description': 'Resource description',
|
|
2795
|
+
'attributes': {
|
|
2796
|
+
'key1': 'value1',
|
|
2797
|
+
'key2': 'value2'
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
result = client.entityUpdateLabelsByUniqueAttribute(data)
|
|
2802
|
+
print(f"Created/Updated: {result['guid']}")
|
|
2803
|
+
|
|
2804
|
+
Use Cases:
|
|
2805
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
2806
|
+
- Ownership Changes: Reassign data ownership
|
|
2807
|
+
- Classification: Apply or modify data classifications
|
|
2808
|
+
"""
|
|
2809
|
+
self.method = "PUT"
|
|
2810
|
+
self.endpoint = ENDPOINTS["entity"]["set_labels_by_unique_attribute"].format(
|
|
2811
|
+
typeName=args["--typeName"]
|
|
2812
|
+
)
|
|
2813
|
+
self.params = {
|
|
2814
|
+
**get_api_version_params("datamap"),
|
|
2815
|
+
"attr:qualifiedName": args["--qualifiedName"],
|
|
2816
|
+
}
|
|
2817
|
+
self.payload = get_json(args, "--payloadFile")
|
|
2818
|
+
|
|
2819
|
+
@decorator
|
|
2820
|
+
def entityDeleteLabelsByUniqueAttribute(self, args):
|
|
2821
|
+
"""
|
|
2822
|
+
Delete a entity.
|
|
2823
|
+
|
|
2824
|
+
Permanently deletes the specified entity.
|
|
2825
|
+
This operation cannot be undone. Use with caution.
|
|
2826
|
+
|
|
2827
|
+
Args:
|
|
2828
|
+
args: Dictionary of operation arguments.
|
|
2829
|
+
Contains operation-specific parameters.
|
|
2830
|
+
See method implementation for details.
|
|
2831
|
+
|
|
2832
|
+
Returns:
|
|
2833
|
+
Dictionary with deletion status:
|
|
2834
|
+
{
|
|
2835
|
+
'guid': str, # Deleted resource ID
|
|
2836
|
+
'status': str, # Deletion status
|
|
2837
|
+
'message': str # Confirmation message
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
Raises:
|
|
2841
|
+
ValueError: When required parameters are missing or invalid:
|
|
2842
|
+
- Empty or None values for required fields
|
|
2843
|
+
- Invalid GUID format
|
|
2844
|
+
- Out-of-range values
|
|
2845
|
+
|
|
2846
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2847
|
+
- DefaultAzureCredential not configured
|
|
2848
|
+
- Insufficient permissions
|
|
2849
|
+
- Expired authentication token
|
|
2850
|
+
|
|
2851
|
+
HTTPError: When Purview API returns error:
|
|
2852
|
+
- 400: Bad request (invalid parameters)
|
|
2853
|
+
- 401: Unauthorized (authentication failed)
|
|
2854
|
+
- 403: Forbidden (insufficient permissions)
|
|
2855
|
+
- 404: Resource not found
|
|
2856
|
+
- 429: Rate limit exceeded
|
|
2857
|
+
- 500: Internal server error
|
|
2858
|
+
|
|
2859
|
+
NetworkError: When network connectivity fails
|
|
2860
|
+
|
|
2861
|
+
Example:
|
|
2862
|
+
# Basic usage
|
|
2863
|
+
client = Entity()
|
|
2864
|
+
|
|
2865
|
+
result = client.entityDeleteLabelsByUniqueAttribute(args=...)
|
|
2866
|
+
print(f"Result: {result}")
|
|
2867
|
+
|
|
2868
|
+
Use Cases:
|
|
2869
|
+
- Data Cleanup: Remove obsolete or test data
|
|
2870
|
+
- Decommissioning: Delete resources no longer in use
|
|
2871
|
+
- Testing: Clean up test environments
|
|
2872
|
+
"""
|
|
2873
|
+
self.method = "DELETE"
|
|
2874
|
+
self.endpoint = ENDPOINTS["entity"]["remove_labels_by_unique_attribute"].format(
|
|
2875
|
+
typeName=args["--typeName"]
|
|
2876
|
+
)
|
|
2877
|
+
self.params = {
|
|
2878
|
+
**get_api_version_params("datamap"),
|
|
2879
|
+
"attr:qualifiedName": args["--qualifiedName"],
|
|
2880
|
+
}
|
|
2881
|
+
self.payload = get_json(args, "--payloadFile")
|
|
2882
|
+
|
|
2883
|
+
# === COLLECTION OPERATIONS ===
|
|
2884
|
+
|
|
2885
|
+
@decorator
|
|
2886
|
+
def entityMoveToCollection(self, args):
|
|
2887
|
+
"""
|
|
2888
|
+
Perform operation on resource.
|
|
2889
|
+
|
|
2890
|
+
|
|
2891
|
+
|
|
2892
|
+
Args:
|
|
2893
|
+
args: Dictionary of operation arguments.
|
|
2894
|
+
Contains operation-specific parameters.
|
|
2895
|
+
See method implementation for details.
|
|
2896
|
+
|
|
2897
|
+
Returns:
|
|
2898
|
+
[TODO: Specify return type and structure]
|
|
2899
|
+
[TODO: Document nested fields]
|
|
2900
|
+
|
|
2901
|
+
Raises:
|
|
2902
|
+
ValueError: When required parameters are missing or invalid:
|
|
2903
|
+
- Empty or None values for required fields
|
|
2904
|
+
- Invalid GUID format
|
|
2905
|
+
- Out-of-range values
|
|
2906
|
+
|
|
2907
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2908
|
+
- DefaultAzureCredential not configured
|
|
2909
|
+
- Insufficient permissions
|
|
2910
|
+
- Expired authentication token
|
|
2911
|
+
|
|
2912
|
+
HTTPError: When Purview API returns error:
|
|
2913
|
+
- 400: Bad request (invalid parameters)
|
|
2914
|
+
- 401: Unauthorized (authentication failed)
|
|
2915
|
+
- 403: Forbidden (insufficient permissions)
|
|
2916
|
+
- 404: Resource not found
|
|
2917
|
+
- 429: Rate limit exceeded
|
|
2918
|
+
- 500: Internal server error
|
|
2919
|
+
|
|
2920
|
+
NetworkError: When network connectivity fails
|
|
2921
|
+
|
|
2922
|
+
Example:
|
|
2923
|
+
# Basic usage
|
|
2924
|
+
client = Entity()
|
|
2925
|
+
|
|
2926
|
+
result = client.entityMoveToCollection(args=...)
|
|
2927
|
+
print(f"Result: {result}")
|
|
2928
|
+
|
|
2929
|
+
Use Cases:
|
|
2930
|
+
- [TODO: Add specific use cases for this operation]
|
|
2931
|
+
- [TODO: Include business context]
|
|
2932
|
+
- [TODO: Explain when to use this method]
|
|
2933
|
+
"""
|
|
2934
|
+
self.method = "POST"
|
|
2935
|
+
self.endpoint = ENDPOINTS["entity"]["move_entities_to_collection"]
|
|
2936
|
+
self.params = get_api_version_params("datamap")
|
|
2937
|
+
self.payload = get_json(args, "--payloadFile")
|
|
2938
|
+
|
|
2939
|
+
# === ADVANCED ENTITY OPERATIONS (NEW FOR 100% COVERAGE) ===
|
|
2940
|
+
|
|
2941
|
+
@decorator
|
|
2942
|
+
def entityReadHistory(self, args):
|
|
2943
|
+
"""
|
|
2944
|
+
Retrieve entity information.
|
|
2945
|
+
|
|
2946
|
+
Retrieves detailed information about the specified entity.
|
|
2947
|
+
Returns complete entity metadata and properties.
|
|
2948
|
+
|
|
2949
|
+
Args:
|
|
2950
|
+
args: Dictionary of operation arguments.
|
|
2951
|
+
Contains operation-specific parameters.
|
|
2952
|
+
See method implementation for details.
|
|
2953
|
+
|
|
2954
|
+
Returns:
|
|
2955
|
+
Dictionary containing entity information:
|
|
2956
|
+
{
|
|
2957
|
+
'guid': str, # Unique identifier
|
|
2958
|
+
'name': str, # Resource name
|
|
2959
|
+
'attributes': dict, # Resource attributes
|
|
2960
|
+
'status': str, # Resource status
|
|
2961
|
+
'updateTime': int # Last update timestamp
|
|
2962
|
+
}
|
|
2963
|
+
|
|
2964
|
+
Raises:
|
|
2965
|
+
ValueError: When required parameters are missing or invalid:
|
|
2966
|
+
- Empty or None values for required fields
|
|
2967
|
+
- Invalid GUID format
|
|
2968
|
+
- Out-of-range values
|
|
2969
|
+
|
|
2970
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2971
|
+
- DefaultAzureCredential not configured
|
|
2972
|
+
- Insufficient permissions
|
|
2973
|
+
- Expired authentication token
|
|
2974
|
+
|
|
2975
|
+
HTTPError: When Purview API returns error:
|
|
2976
|
+
- 400: Bad request (invalid parameters)
|
|
2977
|
+
- 401: Unauthorized (authentication failed)
|
|
2978
|
+
- 403: Forbidden (insufficient permissions)
|
|
2979
|
+
- 404: Resource not found
|
|
2980
|
+
- 429: Rate limit exceeded
|
|
2981
|
+
- 500: Internal server error
|
|
2982
|
+
|
|
2983
|
+
NetworkError: When network connectivity fails
|
|
2984
|
+
|
|
2985
|
+
Example:
|
|
2986
|
+
# Basic usage
|
|
2987
|
+
client = Entity()
|
|
2988
|
+
|
|
2989
|
+
result = client.entityReadHistory(args=...)
|
|
2990
|
+
print(f"Result: {result}")
|
|
2991
|
+
|
|
2992
|
+
Use Cases:
|
|
2993
|
+
- Data Discovery: Find and explore data assets
|
|
2994
|
+
- Compliance Auditing: Review metadata and classifications
|
|
2995
|
+
- Reporting: Generate catalog reports
|
|
2996
|
+
"""
|
|
2997
|
+
self.method = "GET"
|
|
2998
|
+
self.endpoint = ENDPOINTS["entity"]["get_entity_history"].format(guid=args["--guid"][0])
|
|
2999
|
+
self.params = {
|
|
3000
|
+
**get_api_version_params("datamap"),
|
|
3001
|
+
"limit": args.get("--limit", 100),
|
|
3002
|
+
"offset": args.get("--offset", 0),
|
|
3003
|
+
}
|
|
3004
|
+
|
|
3005
|
+
@decorator
|
|
3006
|
+
def entityReadAudit(self, args):
|
|
3007
|
+
"""
|
|
3008
|
+
Retrieve entity information.
|
|
3009
|
+
|
|
3010
|
+
Retrieves detailed information about the specified entity.
|
|
3011
|
+
Returns complete entity metadata and properties.
|
|
3012
|
+
|
|
3013
|
+
Args:
|
|
3014
|
+
args: Dictionary of operation arguments.
|
|
3015
|
+
Contains operation-specific parameters.
|
|
3016
|
+
See method implementation for details.
|
|
3017
|
+
|
|
3018
|
+
Returns:
|
|
3019
|
+
Dictionary containing entity information:
|
|
3020
|
+
{
|
|
3021
|
+
'guid': str, # Unique identifier
|
|
3022
|
+
'name': str, # Resource name
|
|
3023
|
+
'attributes': dict, # Resource attributes
|
|
3024
|
+
'status': str, # Resource status
|
|
3025
|
+
'updateTime': int # Last update timestamp
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3028
|
+
Raises:
|
|
3029
|
+
ValueError: When required parameters are missing or invalid:
|
|
3030
|
+
- Empty or None values for required fields
|
|
3031
|
+
- Invalid GUID format
|
|
3032
|
+
- Out-of-range values
|
|
3033
|
+
|
|
3034
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
3035
|
+
- DefaultAzureCredential not configured
|
|
3036
|
+
- Insufficient permissions
|
|
3037
|
+
- Expired authentication token
|
|
3038
|
+
|
|
3039
|
+
HTTPError: When Purview API returns error:
|
|
3040
|
+
- 400: Bad request (invalid parameters)
|
|
3041
|
+
- 401: Unauthorized (authentication failed)
|
|
3042
|
+
- 403: Forbidden (insufficient permissions)
|
|
3043
|
+
- 404: Resource not found
|
|
3044
|
+
- 429: Rate limit exceeded
|
|
3045
|
+
- 500: Internal server error
|
|
3046
|
+
|
|
3047
|
+
NetworkError: When network connectivity fails
|
|
3048
|
+
|
|
3049
|
+
Example:
|
|
3050
|
+
# Basic usage
|
|
3051
|
+
client = Entity()
|
|
3052
|
+
|
|
3053
|
+
result = client.entityReadAudit(args=...)
|
|
3054
|
+
print(f"Result: {result}")
|
|
3055
|
+
|
|
3056
|
+
Use Cases:
|
|
3057
|
+
- Data Discovery: Find and explore data assets
|
|
3058
|
+
- Compliance Auditing: Review metadata and classifications
|
|
3059
|
+
- Reporting: Generate catalog reports
|
|
3060
|
+
"""
|
|
3061
|
+
self.method = "GET"
|
|
3062
|
+
self.endpoint = ENDPOINTS["entity"]["get_entity_audit"].format(guid=args["--guid"][0])
|
|
3063
|
+
self.params = {
|
|
3064
|
+
**get_api_version_params("datamap"),
|
|
3065
|
+
"startTime": args.get("--startTime"),
|
|
3066
|
+
"endTime": args.get("--endTime"),
|
|
3067
|
+
"auditAction": args.get("--auditAction"),
|
|
3068
|
+
}
|
|
3069
|
+
|
|
3070
|
+
@decorator
|
|
3071
|
+
def entityValidate(self, args):
|
|
3072
|
+
"""
|
|
3073
|
+
Perform operation on resource.
|
|
3074
|
+
|
|
3075
|
+
|
|
3076
|
+
|
|
3077
|
+
Args:
|
|
3078
|
+
args: Dictionary of operation arguments.
|
|
3079
|
+
Contains operation-specific parameters.
|
|
3080
|
+
See method implementation for details.
|
|
3081
|
+
|
|
3082
|
+
Returns:
|
|
3083
|
+
[TODO: Specify return type and structure]
|
|
3084
|
+
[TODO: Document nested fields]
|
|
3085
|
+
|
|
3086
|
+
Raises:
|
|
3087
|
+
ValueError: When required parameters are missing or invalid:
|
|
3088
|
+
- Empty or None values for required fields
|
|
3089
|
+
- Invalid GUID format
|
|
3090
|
+
- Out-of-range values
|
|
3091
|
+
|
|
3092
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
3093
|
+
- DefaultAzureCredential not configured
|
|
3094
|
+
- Insufficient permissions
|
|
3095
|
+
- Expired authentication token
|
|
3096
|
+
|
|
3097
|
+
HTTPError: When Purview API returns error:
|
|
3098
|
+
- 400: Bad request (invalid parameters)
|
|
3099
|
+
- 401: Unauthorized (authentication failed)
|
|
3100
|
+
- 403: Forbidden (insufficient permissions)
|
|
3101
|
+
- 404: Resource not found
|
|
3102
|
+
- 429: Rate limit exceeded
|
|
3103
|
+
- 500: Internal server error
|
|
3104
|
+
|
|
3105
|
+
NetworkError: When network connectivity fails
|
|
3106
|
+
|
|
3107
|
+
Example:
|
|
3108
|
+
# Basic usage
|
|
3109
|
+
client = Entity()
|
|
3110
|
+
|
|
3111
|
+
result = client.entityValidate(args=...)
|
|
3112
|
+
print(f"Result: {result}")
|
|
3113
|
+
|
|
3114
|
+
Use Cases:
|
|
3115
|
+
- [TODO: Add specific use cases for this operation]
|
|
3116
|
+
- [TODO: Include business context]
|
|
3117
|
+
- [TODO: Explain when to use this method]
|
|
3118
|
+
"""
|
|
3119
|
+
self.method = "POST"
|
|
3120
|
+
self.endpoint = ENDPOINTS["entity"]["validate_entity"]
|
|
3121
|
+
self.params = get_api_version_params("datamap")
|
|
3122
|
+
self.payload = get_json(args, "--payloadFile")
|
|
3123
|
+
|
|
3124
|
+
@decorator
|
|
3125
|
+
def entityReadDependencies(self, args):
|
|
3126
|
+
"""
|
|
3127
|
+
Create a new entity.
|
|
3128
|
+
|
|
3129
|
+
Creates a new entity in Microsoft Purview Data Map.
|
|
3130
|
+
Requires appropriate permissions and valid entity definition.
|
|
3131
|
+
|
|
3132
|
+
Args:
|
|
3133
|
+
args: Dictionary of operation arguments.
|
|
3134
|
+
Contains operation-specific parameters.
|
|
3135
|
+
See method implementation for details.
|
|
3136
|
+
|
|
3137
|
+
Returns:
|
|
3138
|
+
Dictionary containing created entity:
|
|
3139
|
+
{
|
|
3140
|
+
'guid': str, # Unique identifier
|
|
3141
|
+
'name': str, # Resource name
|
|
3142
|
+
'status': str, # Creation status
|
|
3143
|
+
'attributes': dict, # Resource attributes
|
|
3144
|
+
'createTime': int # Creation timestamp
|
|
3145
|
+
}
|
|
3146
|
+
|
|
3147
|
+
Raises:
|
|
3148
|
+
ValueError: When required parameters are missing or invalid:
|
|
3149
|
+
- Empty or None values for required fields
|
|
3150
|
+
- Invalid GUID format
|
|
3151
|
+
- Out-of-range values
|
|
3152
|
+
|
|
3153
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
3154
|
+
- DefaultAzureCredential not configured
|
|
3155
|
+
- Insufficient permissions
|
|
3156
|
+
- Expired authentication token
|
|
3157
|
+
|
|
3158
|
+
HTTPError: When Purview API returns error:
|
|
3159
|
+
- 400: Bad request (invalid parameters)
|
|
3160
|
+
- 401: Unauthorized (authentication failed)
|
|
3161
|
+
- 403: Forbidden (insufficient permissions)
|
|
3162
|
+
- 404: Resource not found
|
|
3163
|
+
- 409: Conflict (resource already exists)
|
|
3164
|
+
- 429: Rate limit exceeded
|
|
3165
|
+
- 500: Internal server error
|
|
3166
|
+
|
|
3167
|
+
NetworkError: When network connectivity fails
|
|
3168
|
+
|
|
3169
|
+
Example:
|
|
3170
|
+
# Basic usage
|
|
3171
|
+
client = Entity()
|
|
3172
|
+
|
|
3173
|
+
result = client.entityReadDependencies(args=...)
|
|
3174
|
+
print(f"Result: {result}")
|
|
3175
|
+
|
|
3176
|
+
# With detailed data
|
|
3177
|
+
data = {
|
|
3178
|
+
'name': 'My Resource',
|
|
3179
|
+
'description': 'Resource description',
|
|
3180
|
+
'attributes': {
|
|
3181
|
+
'key1': 'value1',
|
|
3182
|
+
'key2': 'value2'
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
result = client.entityReadDependencies(data)
|
|
3187
|
+
print(f"Created/Updated: {result['guid']}")
|
|
3188
|
+
|
|
3189
|
+
Use Cases:
|
|
3190
|
+
- Data Onboarding: Register new data sources in catalog
|
|
3191
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
3192
|
+
- Automation: Programmatically populate catalog
|
|
3193
|
+
"""
|
|
3194
|
+
self.method = "GET"
|
|
3195
|
+
self.endpoint = ENDPOINTS["entity"]["get_entity_dependencies"].format(
|
|
3196
|
+
guid=args["--guid"][0]
|
|
3197
|
+
)
|
|
3198
|
+
self.params = {
|
|
3199
|
+
**get_api_version_params("datamap"),
|
|
3200
|
+
"direction": args.get("--direction", "both"),
|
|
3201
|
+
"depth": args.get("--depth", 1),
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3204
|
+
@decorator
|
|
3205
|
+
def entityReadUsage(self, args):
|
|
3206
|
+
"""
|
|
3207
|
+
Retrieve entity information.
|
|
3208
|
+
|
|
3209
|
+
Retrieves detailed information about the specified entity.
|
|
3210
|
+
Returns complete entity metadata and properties.
|
|
3211
|
+
|
|
3212
|
+
Args:
|
|
3213
|
+
args: Dictionary of operation arguments.
|
|
3214
|
+
Contains operation-specific parameters.
|
|
3215
|
+
See method implementation for details.
|
|
3216
|
+
|
|
3217
|
+
Returns:
|
|
3218
|
+
Dictionary containing entity information:
|
|
3219
|
+
{
|
|
3220
|
+
'guid': str, # Unique identifier
|
|
3221
|
+
'name': str, # Resource name
|
|
3222
|
+
'attributes': dict, # Resource attributes
|
|
3223
|
+
'status': str, # Resource status
|
|
3224
|
+
'updateTime': int # Last update timestamp
|
|
3225
|
+
}
|
|
3226
|
+
|
|
3227
|
+
Raises:
|
|
3228
|
+
ValueError: When required parameters are missing or invalid:
|
|
3229
|
+
- Empty or None values for required fields
|
|
3230
|
+
- Invalid GUID format
|
|
3231
|
+
- Out-of-range values
|
|
3232
|
+
|
|
3233
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
3234
|
+
- DefaultAzureCredential not configured
|
|
3235
|
+
- Insufficient permissions
|
|
3236
|
+
- Expired authentication token
|
|
3237
|
+
|
|
3238
|
+
HTTPError: When Purview API returns error:
|
|
3239
|
+
- 400: Bad request (invalid parameters)
|
|
3240
|
+
- 401: Unauthorized (authentication failed)
|
|
3241
|
+
- 403: Forbidden (insufficient permissions)
|
|
3242
|
+
- 404: Resource not found
|
|
3243
|
+
- 429: Rate limit exceeded
|
|
3244
|
+
- 500: Internal server error
|
|
3245
|
+
|
|
3246
|
+
NetworkError: When network connectivity fails
|
|
3247
|
+
|
|
3248
|
+
Example:
|
|
3249
|
+
# Basic usage
|
|
3250
|
+
client = Entity()
|
|
3251
|
+
|
|
3252
|
+
result = client.entityReadUsage(args=...)
|
|
3253
|
+
print(f"Result: {result}")
|
|
3254
|
+
|
|
3255
|
+
Use Cases:
|
|
3256
|
+
- Data Discovery: Find and explore data assets
|
|
3257
|
+
- Compliance Auditing: Review metadata and classifications
|
|
3258
|
+
- Reporting: Generate catalog reports
|
|
3259
|
+
"""
|
|
3260
|
+
self.method = "GET"
|
|
3261
|
+
self.endpoint = ENDPOINTS["entity"]["get_entity_usage"].format(guid=args["--guid"][0])
|
|
3262
|
+
self.params = {
|
|
3263
|
+
**get_api_version_params("datamap"),
|
|
3264
|
+
"startTime": args.get("--startTime"),
|
|
3265
|
+
"endTime": args.get("--endTime"),
|
|
3266
|
+
"aggregation": args.get("--aggregation", "daily"),
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
# === LEGACY COMPATIBILITY METHODS ===
|
|
3270
|
+
|
|
3271
|
+
@decorator
|
|
3272
|
+
def entityPut(self, args):
|
|
3273
|
+
"""
|
|
3274
|
+
Update an existing entity.
|
|
3275
|
+
|
|
3276
|
+
Updates an existing entity with new values.
|
|
3277
|
+
Only specified fields are modified; others remain unchanged.
|
|
3278
|
+
|
|
3279
|
+
Args:
|
|
3280
|
+
args: Dictionary of operation arguments.
|
|
3281
|
+
Contains operation-specific parameters.
|
|
3282
|
+
See method implementation for details.
|
|
3283
|
+
|
|
3284
|
+
Returns:
|
|
3285
|
+
Dictionary containing updated entity:
|
|
3286
|
+
{
|
|
3287
|
+
'guid': str, # Unique identifier
|
|
3288
|
+
'attributes': dict, # Updated attributes
|
|
3289
|
+
'updateTime': int # Update timestamp
|
|
3290
|
+
}
|
|
3291
|
+
|
|
3292
|
+
Raises:
|
|
3293
|
+
ValueError: When required parameters are missing or invalid:
|
|
3294
|
+
- Empty or None values for required fields
|
|
3295
|
+
- Invalid GUID format
|
|
3296
|
+
- Out-of-range values
|
|
3297
|
+
|
|
3298
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
3299
|
+
- DefaultAzureCredential not configured
|
|
3300
|
+
- Insufficient permissions
|
|
3301
|
+
- Expired authentication token
|
|
3302
|
+
|
|
3303
|
+
HTTPError: When Purview API returns error:
|
|
3304
|
+
- 400: Bad request (invalid parameters)
|
|
3305
|
+
- 401: Unauthorized (authentication failed)
|
|
3306
|
+
- 403: Forbidden (insufficient permissions)
|
|
3307
|
+
- 404: Resource not found
|
|
3308
|
+
- 429: Rate limit exceeded
|
|
3309
|
+
- 500: Internal server error
|
|
3310
|
+
|
|
3311
|
+
NetworkError: When network connectivity fails
|
|
3312
|
+
|
|
3313
|
+
Example:
|
|
3314
|
+
# Basic usage
|
|
3315
|
+
client = Entity()
|
|
3316
|
+
|
|
3317
|
+
result = client.entityPut(args=...)
|
|
3318
|
+
print(f"Result: {result}")
|
|
3319
|
+
|
|
3320
|
+
# With detailed data
|
|
3321
|
+
data = {
|
|
3322
|
+
'name': 'My Resource',
|
|
3323
|
+
'description': 'Resource description',
|
|
3324
|
+
'attributes': {
|
|
3325
|
+
'key1': 'value1',
|
|
3326
|
+
'key2': 'value2'
|
|
3327
|
+
}
|
|
3328
|
+
}
|
|
3329
|
+
|
|
3330
|
+
result = client.entityPut(data)
|
|
3331
|
+
print(f"Created/Updated: {result['guid']}")
|
|
3332
|
+
|
|
3333
|
+
Use Cases:
|
|
3334
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
3335
|
+
- Ownership Changes: Reassign data ownership
|
|
3336
|
+
- Classification: Apply or modify data classifications
|
|
3337
|
+
"""
|
|
3338
|
+
return self.entityUpdateAttribute(args)
|
|
3339
|
+
|
|
3340
|
+
@decorator
|
|
3341
|
+
def entityPutClassifications(self, args):
|
|
3342
|
+
"""
|
|
3343
|
+
Update an existing entity.
|
|
3344
|
+
|
|
3345
|
+
Updates an existing entity with new values.
|
|
3346
|
+
Only specified fields are modified; others remain unchanged.
|
|
3347
|
+
|
|
3348
|
+
Args:
|
|
3349
|
+
args: Dictionary of operation arguments.
|
|
3350
|
+
Contains operation-specific parameters.
|
|
3351
|
+
See method implementation for details.
|
|
3352
|
+
|
|
3353
|
+
Returns:
|
|
3354
|
+
Dictionary containing updated entity:
|
|
3355
|
+
{
|
|
3356
|
+
'guid': str, # Unique identifier
|
|
3357
|
+
'attributes': dict, # Updated attributes
|
|
3358
|
+
'updateTime': int # Update timestamp
|
|
3359
|
+
}
|
|
3360
|
+
|
|
3361
|
+
Raises:
|
|
3362
|
+
ValueError: When required parameters are missing or invalid:
|
|
3363
|
+
- Empty or None values for required fields
|
|
3364
|
+
- Invalid GUID format
|
|
3365
|
+
- Out-of-range values
|
|
3366
|
+
|
|
3367
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
3368
|
+
- DefaultAzureCredential not configured
|
|
3369
|
+
- Insufficient permissions
|
|
3370
|
+
- Expired authentication token
|
|
3371
|
+
|
|
3372
|
+
HTTPError: When Purview API returns error:
|
|
3373
|
+
- 400: Bad request (invalid parameters)
|
|
3374
|
+
- 401: Unauthorized (authentication failed)
|
|
3375
|
+
- 403: Forbidden (insufficient permissions)
|
|
3376
|
+
- 404: Resource not found
|
|
3377
|
+
- 429: Rate limit exceeded
|
|
3378
|
+
- 500: Internal server error
|
|
3379
|
+
|
|
3380
|
+
NetworkError: When network connectivity fails
|
|
3381
|
+
|
|
3382
|
+
Example:
|
|
3383
|
+
# Basic usage
|
|
3384
|
+
client = Entity()
|
|
3385
|
+
|
|
3386
|
+
result = client.entityPutClassifications(args=...)
|
|
3387
|
+
print(f"Result: {result}")
|
|
3388
|
+
|
|
3389
|
+
# With detailed data
|
|
3390
|
+
data = {
|
|
3391
|
+
'name': 'My Resource',
|
|
3392
|
+
'description': 'Resource description',
|
|
3393
|
+
'attributes': {
|
|
3394
|
+
'key1': 'value1',
|
|
3395
|
+
'key2': 'value2'
|
|
3396
|
+
}
|
|
3397
|
+
}
|
|
3398
|
+
|
|
3399
|
+
result = client.entityPutClassifications(data)
|
|
3400
|
+
print(f"Created/Updated: {result['guid']}")
|
|
3401
|
+
|
|
3402
|
+
Use Cases:
|
|
3403
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
3404
|
+
- Ownership Changes: Reassign data ownership
|
|
3405
|
+
- Classification: Apply or modify data classifications
|
|
3406
|
+
"""
|
|
3407
|
+
return self.entityUpdateClassifications(args)
|
|
3408
|
+
|
|
3409
|
+
@decorator
|
|
3410
|
+
def entityPartialUpdateByUniqueAttribute(self, args):
|
|
3411
|
+
"""
|
|
3412
|
+
Update an existing entity.
|
|
3413
|
+
|
|
3414
|
+
Updates an existing entity with new values.
|
|
3415
|
+
Only specified fields are modified; others remain unchanged.
|
|
3416
|
+
|
|
3417
|
+
Args:
|
|
3418
|
+
args: Dictionary of operation arguments.
|
|
3419
|
+
Contains operation-specific parameters.
|
|
3420
|
+
See method implementation for details.
|
|
3421
|
+
|
|
3422
|
+
Returns:
|
|
3423
|
+
Dictionary containing updated entity:
|
|
3424
|
+
{
|
|
3425
|
+
'guid': str, # Unique identifier
|
|
3426
|
+
'attributes': dict, # Updated attributes
|
|
3427
|
+
'updateTime': int # Update timestamp
|
|
3428
|
+
}
|
|
3429
|
+
|
|
3430
|
+
Raises:
|
|
3431
|
+
ValueError: When required parameters are missing or invalid:
|
|
3432
|
+
- Empty or None values for required fields
|
|
3433
|
+
- Invalid GUID format
|
|
3434
|
+
- Out-of-range values
|
|
3435
|
+
|
|
3436
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
3437
|
+
- DefaultAzureCredential not configured
|
|
3438
|
+
- Insufficient permissions
|
|
3439
|
+
- Expired authentication token
|
|
3440
|
+
|
|
3441
|
+
HTTPError: When Purview API returns error:
|
|
3442
|
+
- 400: Bad request (invalid parameters)
|
|
3443
|
+
- 401: Unauthorized (authentication failed)
|
|
3444
|
+
- 403: Forbidden (insufficient permissions)
|
|
3445
|
+
- 404: Resource not found
|
|
3446
|
+
- 429: Rate limit exceeded
|
|
3447
|
+
- 500: Internal server error
|
|
3448
|
+
|
|
3449
|
+
NetworkError: When network connectivity fails
|
|
3450
|
+
|
|
3451
|
+
Example:
|
|
3452
|
+
# Basic usage
|
|
3453
|
+
client = Entity()
|
|
3454
|
+
|
|
3455
|
+
result = client.entityPartialUpdateByUniqueAttribute(args=...)
|
|
3456
|
+
print(f"Result: {result}")
|
|
3457
|
+
|
|
3458
|
+
# With detailed data
|
|
3459
|
+
data = {
|
|
3460
|
+
'name': 'My Resource',
|
|
3461
|
+
'description': 'Resource description',
|
|
3462
|
+
'attributes': {
|
|
3463
|
+
'key1': 'value1',
|
|
3464
|
+
'key2': 'value2'
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3468
|
+
result = client.entityPartialUpdateByUniqueAttribute(data)
|
|
3469
|
+
print(f"Created/Updated: {result['guid']}")
|
|
3470
|
+
|
|
3471
|
+
Use Cases:
|
|
3472
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
3473
|
+
- Ownership Changes: Reassign data ownership
|
|
3474
|
+
- Classification: Apply or modify data classifications
|
|
3475
|
+
"""
|
|
3476
|
+
return self.entityUpdateUniqueAttribute(args)
|
|
3477
|
+
|
|
3478
|
+
@decorator
|
|
3479
|
+
def entityPartialUpdateAttribute(self, args):
|
|
3480
|
+
"""
|
|
3481
|
+
Update an existing entity.
|
|
3482
|
+
|
|
3483
|
+
Updates an existing entity with new values.
|
|
3484
|
+
Only specified fields are modified; others remain unchanged.
|
|
3485
|
+
|
|
3486
|
+
Args:
|
|
3487
|
+
args: Dictionary of operation arguments.
|
|
3488
|
+
Contains operation-specific parameters.
|
|
3489
|
+
See method implementation for details.
|
|
3490
|
+
|
|
3491
|
+
Returns:
|
|
3492
|
+
Dictionary containing updated entity:
|
|
3493
|
+
{
|
|
3494
|
+
'guid': str, # Unique identifier
|
|
3495
|
+
'attributes': dict, # Updated attributes
|
|
3496
|
+
'updateTime': int # Update timestamp
|
|
3497
|
+
}
|
|
3498
|
+
|
|
3499
|
+
Raises:
|
|
3500
|
+
ValueError: When required parameters are missing or invalid:
|
|
3501
|
+
- Empty or None values for required fields
|
|
3502
|
+
- Invalid GUID format
|
|
3503
|
+
- Out-of-range values
|
|
3504
|
+
|
|
3505
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
3506
|
+
- DefaultAzureCredential not configured
|
|
3507
|
+
- Insufficient permissions
|
|
3508
|
+
- Expired authentication token
|
|
3509
|
+
|
|
3510
|
+
HTTPError: When Purview API returns error:
|
|
3511
|
+
- 400: Bad request (invalid parameters)
|
|
3512
|
+
- 401: Unauthorized (authentication failed)
|
|
3513
|
+
- 403: Forbidden (insufficient permissions)
|
|
3514
|
+
- 404: Resource not found
|
|
3515
|
+
- 429: Rate limit exceeded
|
|
3516
|
+
- 500: Internal server error
|
|
3517
|
+
|
|
3518
|
+
NetworkError: When network connectivity fails
|
|
3519
|
+
|
|
3520
|
+
Example:
|
|
3521
|
+
# Basic usage
|
|
3522
|
+
client = Entity()
|
|
3523
|
+
|
|
3524
|
+
result = client.entityPartialUpdateAttribute(args=...)
|
|
3525
|
+
print(f"Result: {result}")
|
|
3526
|
+
|
|
3527
|
+
# With detailed data
|
|
3528
|
+
data = {
|
|
3529
|
+
'name': 'My Resource',
|
|
3530
|
+
'description': 'Resource description',
|
|
3531
|
+
'attributes': {
|
|
3532
|
+
'key1': 'value1',
|
|
3533
|
+
'key2': 'value2'
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3537
|
+
result = client.entityPartialUpdateAttribute(data)
|
|
3538
|
+
print(f"Created/Updated: {result['guid']}")
|
|
3539
|
+
|
|
3540
|
+
Use Cases:
|
|
3541
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
3542
|
+
- Ownership Changes: Reassign data ownership
|
|
3543
|
+
- Classification: Apply or modify data classifications
|
|
3544
|
+
"""
|
|
3545
|
+
return self.entityUpdateAttribute(args)
|