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,2915 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Microsoft Purview Policy Store Client - Complete API Coverage
|
|
3
|
+
Handles Metadata Policies, Data Policies, DevOps Policies, Self-Service Policies, and more
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from .endpoint import Endpoint, decorator, get_json
|
|
7
|
+
from .endpoints import ENDPOINTS, format_endpoint, get_api_version_params
|
|
8
|
+
|
|
9
|
+
class Policystore(Endpoint):
|
|
10
|
+
def __init__(self):
|
|
11
|
+
Endpoint.__init__(self)
|
|
12
|
+
self.app = 'policystore'
|
|
13
|
+
|
|
14
|
+
# ========== Metadata Policies ==========
|
|
15
|
+
|
|
16
|
+
@decorator
|
|
17
|
+
def policystoreReadMetadataRoles(self, args):
|
|
18
|
+
"""
|
|
19
|
+
Retrieve policy information.
|
|
20
|
+
|
|
21
|
+
Retrieves detailed information about the specified policy.
|
|
22
|
+
Returns complete policy metadata and properties.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
args: Dictionary of operation arguments.
|
|
26
|
+
Contains operation-specific parameters.
|
|
27
|
+
See method implementation for details.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
Dictionary containing policy information:
|
|
31
|
+
{
|
|
32
|
+
'guid': str, # Unique identifier
|
|
33
|
+
'name': str, # Resource name
|
|
34
|
+
'attributes': dict, # Resource attributes
|
|
35
|
+
'status': str, # Resource status
|
|
36
|
+
'updateTime': int # Last update timestamp
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
Raises:
|
|
40
|
+
ValueError: When required parameters are missing or invalid:
|
|
41
|
+
- Empty or None values for required fields
|
|
42
|
+
- Invalid GUID format
|
|
43
|
+
- Out-of-range values
|
|
44
|
+
|
|
45
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
46
|
+
- DefaultAzureCredential not configured
|
|
47
|
+
- Insufficient permissions
|
|
48
|
+
- Expired authentication token
|
|
49
|
+
|
|
50
|
+
HTTPError: When Purview API returns error:
|
|
51
|
+
- 400: Bad request (invalid parameters)
|
|
52
|
+
- 401: Unauthorized (authentication failed)
|
|
53
|
+
- 403: Forbidden (insufficient permissions)
|
|
54
|
+
- 404: Resource not found
|
|
55
|
+
- 429: Rate limit exceeded
|
|
56
|
+
- 500: Internal server error
|
|
57
|
+
|
|
58
|
+
NetworkError: When network connectivity fails
|
|
59
|
+
|
|
60
|
+
Example:
|
|
61
|
+
# Basic usage
|
|
62
|
+
client = PolicyStore()
|
|
63
|
+
|
|
64
|
+
result = client.policystoreReadMetadataRoles(args=...)
|
|
65
|
+
print(f"Result: {result}")
|
|
66
|
+
|
|
67
|
+
Use Cases:
|
|
68
|
+
- Data Discovery: Find and explore data assets
|
|
69
|
+
- Compliance Auditing: Review metadata and classifications
|
|
70
|
+
- Reporting: Generate catalog reports
|
|
71
|
+
"""
|
|
72
|
+
self.method = 'GET'
|
|
73
|
+
self.endpoint = ENDPOINTS['policystore']['metadata_roles']
|
|
74
|
+
self.params = get_api_version_params('metadata_policies')
|
|
75
|
+
|
|
76
|
+
@decorator
|
|
77
|
+
def policystoreReadMetadataPolicy(self, args):
|
|
78
|
+
"""
|
|
79
|
+
Retrieve policy information.
|
|
80
|
+
|
|
81
|
+
Retrieves detailed information about the specified policy.
|
|
82
|
+
Returns complete policy metadata and properties.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
args: Dictionary of operation arguments.
|
|
86
|
+
Contains operation-specific parameters.
|
|
87
|
+
See method implementation for details.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
Dictionary containing policy information:
|
|
91
|
+
{
|
|
92
|
+
'guid': str, # Unique identifier
|
|
93
|
+
'name': str, # Resource name
|
|
94
|
+
'attributes': dict, # Resource attributes
|
|
95
|
+
'status': str, # Resource status
|
|
96
|
+
'updateTime': int # Last update timestamp
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
Raises:
|
|
100
|
+
ValueError: When required parameters are missing or invalid:
|
|
101
|
+
- Empty or None values for required fields
|
|
102
|
+
- Invalid GUID format
|
|
103
|
+
- Out-of-range values
|
|
104
|
+
|
|
105
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
106
|
+
- DefaultAzureCredential not configured
|
|
107
|
+
- Insufficient permissions
|
|
108
|
+
- Expired authentication token
|
|
109
|
+
|
|
110
|
+
HTTPError: When Purview API returns error:
|
|
111
|
+
- 400: Bad request (invalid parameters)
|
|
112
|
+
- 401: Unauthorized (authentication failed)
|
|
113
|
+
- 403: Forbidden (insufficient permissions)
|
|
114
|
+
- 404: Resource not found
|
|
115
|
+
- 429: Rate limit exceeded
|
|
116
|
+
- 500: Internal server error
|
|
117
|
+
|
|
118
|
+
NetworkError: When network connectivity fails
|
|
119
|
+
|
|
120
|
+
Example:
|
|
121
|
+
# Basic usage
|
|
122
|
+
client = PolicyStore()
|
|
123
|
+
|
|
124
|
+
result = client.policystoreReadMetadataPolicy(args=...)
|
|
125
|
+
print(f"Result: {result}")
|
|
126
|
+
|
|
127
|
+
Use Cases:
|
|
128
|
+
- Data Discovery: Find and explore data assets
|
|
129
|
+
- Compliance Auditing: Review metadata and classifications
|
|
130
|
+
- Reporting: Generate catalog reports
|
|
131
|
+
"""
|
|
132
|
+
self.method = 'GET'
|
|
133
|
+
if args.get("--policyId"):
|
|
134
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['metadata_policy_by_id'],
|
|
135
|
+
policyId=args["--policyId"])
|
|
136
|
+
elif args.get("--collectionName"):
|
|
137
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['collection_metadata_policy'],
|
|
138
|
+
collectionName=args["--collectionName"])
|
|
139
|
+
else:
|
|
140
|
+
raise ValueError("Either --policyId or --collectionName must be provided")
|
|
141
|
+
self.params = get_api_version_params('metadata_policies')
|
|
142
|
+
|
|
143
|
+
@decorator
|
|
144
|
+
def policystoreReadMetadataPolicies(self, args):
|
|
145
|
+
"""
|
|
146
|
+
Retrieve policy information.
|
|
147
|
+
|
|
148
|
+
Retrieves detailed information about the specified policy.
|
|
149
|
+
Returns complete policy metadata and properties.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
args: Dictionary of operation arguments.
|
|
153
|
+
Contains operation-specific parameters.
|
|
154
|
+
See method implementation for details.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
Dictionary containing policy information:
|
|
158
|
+
{
|
|
159
|
+
'guid': str, # Unique identifier
|
|
160
|
+
'name': str, # Resource name
|
|
161
|
+
'attributes': dict, # Resource attributes
|
|
162
|
+
'status': str, # Resource status
|
|
163
|
+
'updateTime': int # Last update timestamp
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
Raises:
|
|
167
|
+
ValueError: When required parameters are missing or invalid:
|
|
168
|
+
- Empty or None values for required fields
|
|
169
|
+
- Invalid GUID format
|
|
170
|
+
- Out-of-range values
|
|
171
|
+
|
|
172
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
173
|
+
- DefaultAzureCredential not configured
|
|
174
|
+
- Insufficient permissions
|
|
175
|
+
- Expired authentication token
|
|
176
|
+
|
|
177
|
+
HTTPError: When Purview API returns error:
|
|
178
|
+
- 400: Bad request (invalid parameters)
|
|
179
|
+
- 401: Unauthorized (authentication failed)
|
|
180
|
+
- 403: Forbidden (insufficient permissions)
|
|
181
|
+
- 404: Resource not found
|
|
182
|
+
- 429: Rate limit exceeded
|
|
183
|
+
- 500: Internal server error
|
|
184
|
+
|
|
185
|
+
NetworkError: When network connectivity fails
|
|
186
|
+
|
|
187
|
+
Example:
|
|
188
|
+
# Basic usage
|
|
189
|
+
client = PolicyStore()
|
|
190
|
+
|
|
191
|
+
result = client.policystoreReadMetadataPolicies(args=...)
|
|
192
|
+
print(f"Result: {result}")
|
|
193
|
+
|
|
194
|
+
Use Cases:
|
|
195
|
+
- Data Discovery: Find and explore data assets
|
|
196
|
+
- Compliance Auditing: Review metadata and classifications
|
|
197
|
+
- Reporting: Generate catalog reports
|
|
198
|
+
"""
|
|
199
|
+
self.method = 'GET'
|
|
200
|
+
self.endpoint = ENDPOINTS['policystore']['metadata_policies']
|
|
201
|
+
self.params = get_api_version_params('metadata_policies')
|
|
202
|
+
if args.get('--collectionName'):
|
|
203
|
+
self.params['collectionName'] = args['--collectionName']
|
|
204
|
+
|
|
205
|
+
@decorator
|
|
206
|
+
def policystorePutMetadataPolicy(self, args):
|
|
207
|
+
"""
|
|
208
|
+
Update an existing policy.
|
|
209
|
+
|
|
210
|
+
Updates an existing policy with new values.
|
|
211
|
+
Only specified fields are modified; others remain unchanged.
|
|
212
|
+
|
|
213
|
+
Args:
|
|
214
|
+
args: Dictionary of operation arguments.
|
|
215
|
+
Contains operation-specific parameters.
|
|
216
|
+
See method implementation for details.
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
Dictionary containing updated policy:
|
|
220
|
+
{
|
|
221
|
+
'guid': str, # Unique identifier
|
|
222
|
+
'attributes': dict, # Updated attributes
|
|
223
|
+
'updateTime': int # Update timestamp
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
Raises:
|
|
227
|
+
ValueError: When required parameters are missing or invalid:
|
|
228
|
+
- Empty or None values for required fields
|
|
229
|
+
- Invalid GUID format
|
|
230
|
+
- Out-of-range values
|
|
231
|
+
|
|
232
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
233
|
+
- DefaultAzureCredential not configured
|
|
234
|
+
- Insufficient permissions
|
|
235
|
+
- Expired authentication token
|
|
236
|
+
|
|
237
|
+
HTTPError: When Purview API returns error:
|
|
238
|
+
- 400: Bad request (invalid parameters)
|
|
239
|
+
- 401: Unauthorized (authentication failed)
|
|
240
|
+
- 403: Forbidden (insufficient permissions)
|
|
241
|
+
- 404: Resource not found
|
|
242
|
+
- 429: Rate limit exceeded
|
|
243
|
+
- 500: Internal server error
|
|
244
|
+
|
|
245
|
+
NetworkError: When network connectivity fails
|
|
246
|
+
|
|
247
|
+
Example:
|
|
248
|
+
# Basic usage
|
|
249
|
+
client = PolicyStore()
|
|
250
|
+
|
|
251
|
+
result = client.policystorePutMetadataPolicy(args=...)
|
|
252
|
+
print(f"Result: {result}")
|
|
253
|
+
|
|
254
|
+
# With detailed data
|
|
255
|
+
data = {
|
|
256
|
+
'name': 'My Resource',
|
|
257
|
+
'description': 'Resource description',
|
|
258
|
+
'attributes': {
|
|
259
|
+
'key1': 'value1',
|
|
260
|
+
'key2': 'value2'
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
result = client.policystorePutMetadataPolicy(data)
|
|
265
|
+
print(f"Created/Updated: {result['guid']}")
|
|
266
|
+
|
|
267
|
+
Use Cases:
|
|
268
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
269
|
+
- Ownership Changes: Reassign data ownership
|
|
270
|
+
- Classification: Apply or modify data classifications
|
|
271
|
+
"""
|
|
272
|
+
self.method = 'PUT'
|
|
273
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['metadata_policy_by_id'],
|
|
274
|
+
policyId=args["--policyId"])
|
|
275
|
+
self.params = get_api_version_params('metadata_policies')
|
|
276
|
+
self.payload = get_json(args, '--payloadFile')
|
|
277
|
+
|
|
278
|
+
@decorator
|
|
279
|
+
def policystoreDeleteMetadataPolicy(self, args):
|
|
280
|
+
"""
|
|
281
|
+
Delete a policy.
|
|
282
|
+
|
|
283
|
+
Permanently deletes the specified policy.
|
|
284
|
+
This operation cannot be undone. Use with caution.
|
|
285
|
+
|
|
286
|
+
Args:
|
|
287
|
+
args: Dictionary of operation arguments.
|
|
288
|
+
Contains operation-specific parameters.
|
|
289
|
+
See method implementation for details.
|
|
290
|
+
|
|
291
|
+
Returns:
|
|
292
|
+
Dictionary with deletion status:
|
|
293
|
+
{
|
|
294
|
+
'guid': str, # Deleted resource ID
|
|
295
|
+
'status': str, # Deletion status
|
|
296
|
+
'message': str # Confirmation message
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
Raises:
|
|
300
|
+
ValueError: When required parameters are missing or invalid:
|
|
301
|
+
- Empty or None values for required fields
|
|
302
|
+
- Invalid GUID format
|
|
303
|
+
- Out-of-range values
|
|
304
|
+
|
|
305
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
306
|
+
- DefaultAzureCredential not configured
|
|
307
|
+
- Insufficient permissions
|
|
308
|
+
- Expired authentication token
|
|
309
|
+
|
|
310
|
+
HTTPError: When Purview API returns error:
|
|
311
|
+
- 400: Bad request (invalid parameters)
|
|
312
|
+
- 401: Unauthorized (authentication failed)
|
|
313
|
+
- 403: Forbidden (insufficient permissions)
|
|
314
|
+
- 404: Resource not found
|
|
315
|
+
- 429: Rate limit exceeded
|
|
316
|
+
- 500: Internal server error
|
|
317
|
+
|
|
318
|
+
NetworkError: When network connectivity fails
|
|
319
|
+
|
|
320
|
+
Example:
|
|
321
|
+
# Basic usage
|
|
322
|
+
client = PolicyStore()
|
|
323
|
+
|
|
324
|
+
result = client.policystoreDeleteMetadataPolicy(args=...)
|
|
325
|
+
print(f"Result: {result}")
|
|
326
|
+
|
|
327
|
+
Use Cases:
|
|
328
|
+
- Data Cleanup: Remove obsolete or test data
|
|
329
|
+
- Decommissioning: Delete resources no longer in use
|
|
330
|
+
- Testing: Clean up test environments
|
|
331
|
+
"""
|
|
332
|
+
self.method = 'DELETE'
|
|
333
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['metadata_policy_by_id'],
|
|
334
|
+
policyId=args["--policyId"])
|
|
335
|
+
self.params = get_api_version_params('metadata_policies')
|
|
336
|
+
|
|
337
|
+
# ========== Data Policies ==========
|
|
338
|
+
|
|
339
|
+
@decorator
|
|
340
|
+
def policystoreReadDataPolicies(self, args):
|
|
341
|
+
"""
|
|
342
|
+
Create a new policy.
|
|
343
|
+
|
|
344
|
+
Creates a new policy in Microsoft Purview Policy Store. Manage access and data policies.
|
|
345
|
+
Requires appropriate permissions and valid policy definition.
|
|
346
|
+
|
|
347
|
+
Args:
|
|
348
|
+
args: Dictionary of operation arguments.
|
|
349
|
+
Contains operation-specific parameters.
|
|
350
|
+
See method implementation for details.
|
|
351
|
+
|
|
352
|
+
Returns:
|
|
353
|
+
Dictionary containing created policy:
|
|
354
|
+
{
|
|
355
|
+
'guid': str, # Unique identifier
|
|
356
|
+
'name': str, # Resource name
|
|
357
|
+
'status': str, # Creation status
|
|
358
|
+
'attributes': dict, # Resource attributes
|
|
359
|
+
'createTime': int # Creation timestamp
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
Raises:
|
|
363
|
+
ValueError: When required parameters are missing or invalid:
|
|
364
|
+
- Empty or None values for required fields
|
|
365
|
+
- Invalid GUID format
|
|
366
|
+
- Out-of-range values
|
|
367
|
+
|
|
368
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
369
|
+
- DefaultAzureCredential not configured
|
|
370
|
+
- Insufficient permissions
|
|
371
|
+
- Expired authentication token
|
|
372
|
+
|
|
373
|
+
HTTPError: When Purview API returns error:
|
|
374
|
+
- 400: Bad request (invalid parameters)
|
|
375
|
+
- 401: Unauthorized (authentication failed)
|
|
376
|
+
- 403: Forbidden (insufficient permissions)
|
|
377
|
+
- 404: Resource not found
|
|
378
|
+
- 409: Conflict (resource already exists)
|
|
379
|
+
- 429: Rate limit exceeded
|
|
380
|
+
- 500: Internal server error
|
|
381
|
+
|
|
382
|
+
NetworkError: When network connectivity fails
|
|
383
|
+
|
|
384
|
+
Example:
|
|
385
|
+
# Basic usage
|
|
386
|
+
client = PolicyStore()
|
|
387
|
+
|
|
388
|
+
result = client.policystoreReadDataPolicies(args=...)
|
|
389
|
+
print(f"Result: {result}")
|
|
390
|
+
|
|
391
|
+
# With detailed data
|
|
392
|
+
data = {
|
|
393
|
+
'name': 'My Resource',
|
|
394
|
+
'description': 'Resource description',
|
|
395
|
+
'attributes': {
|
|
396
|
+
'key1': 'value1',
|
|
397
|
+
'key2': 'value2'
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
result = client.policystoreReadDataPolicies(data)
|
|
402
|
+
print(f"Created/Updated: {result['guid']}")
|
|
403
|
+
|
|
404
|
+
Use Cases:
|
|
405
|
+
- Data Onboarding: Register new data sources in catalog
|
|
406
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
407
|
+
- Automation: Programmatically populate catalog
|
|
408
|
+
"""
|
|
409
|
+
self.method = 'GET'
|
|
410
|
+
if args.get('--policyName'):
|
|
411
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['data_policy_by_name'],
|
|
412
|
+
policyName=args['--policyName'])
|
|
413
|
+
else:
|
|
414
|
+
self.endpoint = ENDPOINTS['policystore']['data_policies']
|
|
415
|
+
self.params = get_api_version_params('metadata_policies')
|
|
416
|
+
|
|
417
|
+
@decorator
|
|
418
|
+
def policystoreCreateDataPolicy(self, args):
|
|
419
|
+
"""
|
|
420
|
+
Create a new policy.
|
|
421
|
+
|
|
422
|
+
Creates a new policy in Microsoft Purview Policy Store. Manage access and data policies.
|
|
423
|
+
Requires appropriate permissions and valid policy definition.
|
|
424
|
+
|
|
425
|
+
Args:
|
|
426
|
+
args: Dictionary of operation arguments.
|
|
427
|
+
Contains operation-specific parameters.
|
|
428
|
+
See method implementation for details.
|
|
429
|
+
|
|
430
|
+
Returns:
|
|
431
|
+
Dictionary containing created policy:
|
|
432
|
+
{
|
|
433
|
+
'guid': str, # Unique identifier
|
|
434
|
+
'name': str, # Resource name
|
|
435
|
+
'status': str, # Creation status
|
|
436
|
+
'attributes': dict, # Resource attributes
|
|
437
|
+
'createTime': int # Creation timestamp
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
Raises:
|
|
441
|
+
ValueError: When required parameters are missing or invalid:
|
|
442
|
+
- Empty or None values for required fields
|
|
443
|
+
- Invalid GUID format
|
|
444
|
+
- Out-of-range values
|
|
445
|
+
|
|
446
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
447
|
+
- DefaultAzureCredential not configured
|
|
448
|
+
- Insufficient permissions
|
|
449
|
+
- Expired authentication token
|
|
450
|
+
|
|
451
|
+
HTTPError: When Purview API returns error:
|
|
452
|
+
- 400: Bad request (invalid parameters)
|
|
453
|
+
- 401: Unauthorized (authentication failed)
|
|
454
|
+
- 403: Forbidden (insufficient permissions)
|
|
455
|
+
- 404: Resource not found
|
|
456
|
+
- 409: Conflict (resource already exists)
|
|
457
|
+
- 429: Rate limit exceeded
|
|
458
|
+
- 500: Internal server error
|
|
459
|
+
|
|
460
|
+
NetworkError: When network connectivity fails
|
|
461
|
+
|
|
462
|
+
Example:
|
|
463
|
+
# Basic usage
|
|
464
|
+
client = PolicyStore()
|
|
465
|
+
|
|
466
|
+
result = client.policystoreCreateDataPolicy(args=...)
|
|
467
|
+
print(f"Result: {result}")
|
|
468
|
+
|
|
469
|
+
# With detailed data
|
|
470
|
+
data = {
|
|
471
|
+
'name': 'My Resource',
|
|
472
|
+
'description': 'Resource description',
|
|
473
|
+
'attributes': {
|
|
474
|
+
'key1': 'value1',
|
|
475
|
+
'key2': 'value2'
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
result = client.policystoreCreateDataPolicy(data)
|
|
480
|
+
print(f"Created/Updated: {result['guid']}")
|
|
481
|
+
|
|
482
|
+
Use Cases:
|
|
483
|
+
- Data Onboarding: Register new data sources in catalog
|
|
484
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
485
|
+
- Automation: Programmatically populate catalog
|
|
486
|
+
"""
|
|
487
|
+
self.method = 'PUT'
|
|
488
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['data_policy_by_name'],
|
|
489
|
+
policyName=args['--policyName'])
|
|
490
|
+
self.params = get_api_version_params('metadata_policies')
|
|
491
|
+
self.payload = get_json(args, '--payloadFile')
|
|
492
|
+
|
|
493
|
+
@decorator
|
|
494
|
+
def policystoreUpdateDataPolicy(self, args):
|
|
495
|
+
"""
|
|
496
|
+
Update an existing policy.
|
|
497
|
+
|
|
498
|
+
Updates an existing policy with new values.
|
|
499
|
+
Only specified fields are modified; others remain unchanged.
|
|
500
|
+
|
|
501
|
+
Args:
|
|
502
|
+
args: Dictionary of operation arguments.
|
|
503
|
+
Contains operation-specific parameters.
|
|
504
|
+
See method implementation for details.
|
|
505
|
+
|
|
506
|
+
Returns:
|
|
507
|
+
Dictionary containing updated policy:
|
|
508
|
+
{
|
|
509
|
+
'guid': str, # Unique identifier
|
|
510
|
+
'attributes': dict, # Updated attributes
|
|
511
|
+
'updateTime': int # Update timestamp
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
Raises:
|
|
515
|
+
ValueError: When required parameters are missing or invalid:
|
|
516
|
+
- Empty or None values for required fields
|
|
517
|
+
- Invalid GUID format
|
|
518
|
+
- Out-of-range values
|
|
519
|
+
|
|
520
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
521
|
+
- DefaultAzureCredential not configured
|
|
522
|
+
- Insufficient permissions
|
|
523
|
+
- Expired authentication token
|
|
524
|
+
|
|
525
|
+
HTTPError: When Purview API returns error:
|
|
526
|
+
- 400: Bad request (invalid parameters)
|
|
527
|
+
- 401: Unauthorized (authentication failed)
|
|
528
|
+
- 403: Forbidden (insufficient permissions)
|
|
529
|
+
- 404: Resource not found
|
|
530
|
+
- 429: Rate limit exceeded
|
|
531
|
+
- 500: Internal server error
|
|
532
|
+
|
|
533
|
+
NetworkError: When network connectivity fails
|
|
534
|
+
|
|
535
|
+
Example:
|
|
536
|
+
# Basic usage
|
|
537
|
+
client = PolicyStore()
|
|
538
|
+
|
|
539
|
+
result = client.policystoreUpdateDataPolicy(args=...)
|
|
540
|
+
print(f"Result: {result}")
|
|
541
|
+
|
|
542
|
+
# With detailed data
|
|
543
|
+
data = {
|
|
544
|
+
'name': 'My Resource',
|
|
545
|
+
'description': 'Resource description',
|
|
546
|
+
'attributes': {
|
|
547
|
+
'key1': 'value1',
|
|
548
|
+
'key2': 'value2'
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
result = client.policystoreUpdateDataPolicy(data)
|
|
553
|
+
print(f"Created/Updated: {result['guid']}")
|
|
554
|
+
|
|
555
|
+
Use Cases:
|
|
556
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
557
|
+
- Ownership Changes: Reassign data ownership
|
|
558
|
+
- Classification: Apply or modify data classifications
|
|
559
|
+
"""
|
|
560
|
+
self.method = 'PUT'
|
|
561
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['data_policy_by_name'],
|
|
562
|
+
policyName=args['--policyName'])
|
|
563
|
+
self.params = get_api_version_params('metadata_policies')
|
|
564
|
+
self.payload = get_json(args, '--payloadFile')
|
|
565
|
+
|
|
566
|
+
@decorator
|
|
567
|
+
def policystoreDeleteDataPolicy(self, args):
|
|
568
|
+
"""
|
|
569
|
+
Delete a policy.
|
|
570
|
+
|
|
571
|
+
Permanently deletes the specified policy.
|
|
572
|
+
This operation cannot be undone. Use with caution.
|
|
573
|
+
|
|
574
|
+
Args:
|
|
575
|
+
args: Dictionary of operation arguments.
|
|
576
|
+
Contains operation-specific parameters.
|
|
577
|
+
See method implementation for details.
|
|
578
|
+
|
|
579
|
+
Returns:
|
|
580
|
+
Dictionary with deletion status:
|
|
581
|
+
{
|
|
582
|
+
'guid': str, # Deleted resource ID
|
|
583
|
+
'status': str, # Deletion status
|
|
584
|
+
'message': str # Confirmation message
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
Raises:
|
|
588
|
+
ValueError: When required parameters are missing or invalid:
|
|
589
|
+
- Empty or None values for required fields
|
|
590
|
+
- Invalid GUID format
|
|
591
|
+
- Out-of-range values
|
|
592
|
+
|
|
593
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
594
|
+
- DefaultAzureCredential not configured
|
|
595
|
+
- Insufficient permissions
|
|
596
|
+
- Expired authentication token
|
|
597
|
+
|
|
598
|
+
HTTPError: When Purview API returns error:
|
|
599
|
+
- 400: Bad request (invalid parameters)
|
|
600
|
+
- 401: Unauthorized (authentication failed)
|
|
601
|
+
- 403: Forbidden (insufficient permissions)
|
|
602
|
+
- 404: Resource not found
|
|
603
|
+
- 429: Rate limit exceeded
|
|
604
|
+
- 500: Internal server error
|
|
605
|
+
|
|
606
|
+
NetworkError: When network connectivity fails
|
|
607
|
+
|
|
608
|
+
Example:
|
|
609
|
+
# Basic usage
|
|
610
|
+
client = PolicyStore()
|
|
611
|
+
|
|
612
|
+
result = client.policystoreDeleteDataPolicy(args=...)
|
|
613
|
+
print(f"Result: {result}")
|
|
614
|
+
|
|
615
|
+
Use Cases:
|
|
616
|
+
- Data Cleanup: Remove obsolete or test data
|
|
617
|
+
- Decommissioning: Delete resources no longer in use
|
|
618
|
+
- Testing: Clean up test environments
|
|
619
|
+
"""
|
|
620
|
+
self.method = 'DELETE'
|
|
621
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['data_policy_by_name'],
|
|
622
|
+
policyName=args['--policyName'])
|
|
623
|
+
self.params = get_api_version_params('metadata_policies')
|
|
624
|
+
|
|
625
|
+
# ========== DevOps Policies ==========
|
|
626
|
+
|
|
627
|
+
@decorator
|
|
628
|
+
def policystoreListDevOpsPolicies(self, args):
|
|
629
|
+
"""
|
|
630
|
+
Retrieve policy information.
|
|
631
|
+
|
|
632
|
+
Retrieves detailed information about the specified policy.
|
|
633
|
+
Returns complete policy metadata and properties.
|
|
634
|
+
|
|
635
|
+
Args:
|
|
636
|
+
args: Dictionary of operation arguments.
|
|
637
|
+
Contains operation-specific parameters.
|
|
638
|
+
See method implementation for details.
|
|
639
|
+
|
|
640
|
+
Returns:
|
|
641
|
+
List of resource dictionaries, each containing:
|
|
642
|
+
- guid (str): Unique identifier
|
|
643
|
+
- name (str): Resource name
|
|
644
|
+
- attributes (dict): Resource attributes
|
|
645
|
+
- status (str): Resource status
|
|
646
|
+
|
|
647
|
+
Returns empty list if no resources found.
|
|
648
|
+
|
|
649
|
+
Raises:
|
|
650
|
+
ValueError: When required parameters are missing or invalid:
|
|
651
|
+
- Empty or None values for required fields
|
|
652
|
+
- Invalid GUID format
|
|
653
|
+
- Out-of-range values
|
|
654
|
+
|
|
655
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
656
|
+
- DefaultAzureCredential not configured
|
|
657
|
+
- Insufficient permissions
|
|
658
|
+
- Expired authentication token
|
|
659
|
+
|
|
660
|
+
HTTPError: When Purview API returns error:
|
|
661
|
+
- 400: Bad request (invalid parameters)
|
|
662
|
+
- 401: Unauthorized (authentication failed)
|
|
663
|
+
- 403: Forbidden (insufficient permissions)
|
|
664
|
+
- 404: Resource not found
|
|
665
|
+
- 429: Rate limit exceeded
|
|
666
|
+
- 500: Internal server error
|
|
667
|
+
|
|
668
|
+
NetworkError: When network connectivity fails
|
|
669
|
+
|
|
670
|
+
Example:
|
|
671
|
+
# Basic usage
|
|
672
|
+
client = PolicyStore()
|
|
673
|
+
|
|
674
|
+
result = client.policystoreListDevOpsPolicies(args=...)
|
|
675
|
+
print(f"Result: {result}")
|
|
676
|
+
|
|
677
|
+
Use Cases:
|
|
678
|
+
- Data Discovery: Find and explore data assets
|
|
679
|
+
- Compliance Auditing: Review metadata and classifications
|
|
680
|
+
- Reporting: Generate catalog reports
|
|
681
|
+
"""
|
|
682
|
+
self.method = 'GET'
|
|
683
|
+
self.endpoint = ENDPOINTS['policystore']['devops_policies']
|
|
684
|
+
self.params = get_api_version_params('devops_policies')
|
|
685
|
+
|
|
686
|
+
@decorator
|
|
687
|
+
def policystoreGetDevOpsPolicy(self, args):
|
|
688
|
+
"""
|
|
689
|
+
Retrieve policy information.
|
|
690
|
+
|
|
691
|
+
Retrieves detailed information about the specified policy.
|
|
692
|
+
Returns complete policy metadata and properties.
|
|
693
|
+
|
|
694
|
+
Args:
|
|
695
|
+
args: Dictionary of operation arguments.
|
|
696
|
+
Contains operation-specific parameters.
|
|
697
|
+
See method implementation for details.
|
|
698
|
+
|
|
699
|
+
Returns:
|
|
700
|
+
Dictionary containing policy information:
|
|
701
|
+
{
|
|
702
|
+
'guid': str, # Unique identifier
|
|
703
|
+
'name': str, # Resource name
|
|
704
|
+
'attributes': dict, # Resource attributes
|
|
705
|
+
'status': str, # Resource status
|
|
706
|
+
'updateTime': int # Last update timestamp
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
Raises:
|
|
710
|
+
ValueError: When required parameters are missing or invalid:
|
|
711
|
+
- Empty or None values for required fields
|
|
712
|
+
- Invalid GUID format
|
|
713
|
+
- Out-of-range values
|
|
714
|
+
|
|
715
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
716
|
+
- DefaultAzureCredential not configured
|
|
717
|
+
- Insufficient permissions
|
|
718
|
+
- Expired authentication token
|
|
719
|
+
|
|
720
|
+
HTTPError: When Purview API returns error:
|
|
721
|
+
- 400: Bad request (invalid parameters)
|
|
722
|
+
- 401: Unauthorized (authentication failed)
|
|
723
|
+
- 403: Forbidden (insufficient permissions)
|
|
724
|
+
- 404: Resource not found
|
|
725
|
+
- 429: Rate limit exceeded
|
|
726
|
+
- 500: Internal server error
|
|
727
|
+
|
|
728
|
+
NetworkError: When network connectivity fails
|
|
729
|
+
|
|
730
|
+
Example:
|
|
731
|
+
# Basic usage
|
|
732
|
+
client = PolicyStore()
|
|
733
|
+
|
|
734
|
+
result = client.policystoreGetDevOpsPolicy(args=...)
|
|
735
|
+
print(f"Result: {result}")
|
|
736
|
+
|
|
737
|
+
Use Cases:
|
|
738
|
+
- Data Discovery: Find and explore data assets
|
|
739
|
+
- Compliance Auditing: Review metadata and classifications
|
|
740
|
+
- Reporting: Generate catalog reports
|
|
741
|
+
"""
|
|
742
|
+
self.method = 'GET'
|
|
743
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['devops_policy'],
|
|
744
|
+
policyName=args['--policyName'])
|
|
745
|
+
self.params = get_api_version_params('devops_policies')
|
|
746
|
+
|
|
747
|
+
@decorator
|
|
748
|
+
def policystoreCreateDevOpsPolicy(self, args):
|
|
749
|
+
"""
|
|
750
|
+
Create a new policy.
|
|
751
|
+
|
|
752
|
+
Creates a new policy in Microsoft Purview Policy Store. Manage access and data policies.
|
|
753
|
+
Requires appropriate permissions and valid policy definition.
|
|
754
|
+
|
|
755
|
+
Args:
|
|
756
|
+
args: Dictionary of operation arguments.
|
|
757
|
+
Contains operation-specific parameters.
|
|
758
|
+
See method implementation for details.
|
|
759
|
+
|
|
760
|
+
Returns:
|
|
761
|
+
Dictionary containing created policy:
|
|
762
|
+
{
|
|
763
|
+
'guid': str, # Unique identifier
|
|
764
|
+
'name': str, # Resource name
|
|
765
|
+
'status': str, # Creation status
|
|
766
|
+
'attributes': dict, # Resource attributes
|
|
767
|
+
'createTime': int # Creation timestamp
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
Raises:
|
|
771
|
+
ValueError: When required parameters are missing or invalid:
|
|
772
|
+
- Empty or None values for required fields
|
|
773
|
+
- Invalid GUID format
|
|
774
|
+
- Out-of-range values
|
|
775
|
+
|
|
776
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
777
|
+
- DefaultAzureCredential not configured
|
|
778
|
+
- Insufficient permissions
|
|
779
|
+
- Expired authentication token
|
|
780
|
+
|
|
781
|
+
HTTPError: When Purview API returns error:
|
|
782
|
+
- 400: Bad request (invalid parameters)
|
|
783
|
+
- 401: Unauthorized (authentication failed)
|
|
784
|
+
- 403: Forbidden (insufficient permissions)
|
|
785
|
+
- 404: Resource not found
|
|
786
|
+
- 409: Conflict (resource already exists)
|
|
787
|
+
- 429: Rate limit exceeded
|
|
788
|
+
- 500: Internal server error
|
|
789
|
+
|
|
790
|
+
NetworkError: When network connectivity fails
|
|
791
|
+
|
|
792
|
+
Example:
|
|
793
|
+
# Basic usage
|
|
794
|
+
client = PolicyStore()
|
|
795
|
+
|
|
796
|
+
result = client.policystoreCreateDevOpsPolicy(args=...)
|
|
797
|
+
print(f"Result: {result}")
|
|
798
|
+
|
|
799
|
+
# With detailed data
|
|
800
|
+
data = {
|
|
801
|
+
'name': 'My Resource',
|
|
802
|
+
'description': 'Resource description',
|
|
803
|
+
'attributes': {
|
|
804
|
+
'key1': 'value1',
|
|
805
|
+
'key2': 'value2'
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
result = client.policystoreCreateDevOpsPolicy(data)
|
|
810
|
+
print(f"Created/Updated: {result['guid']}")
|
|
811
|
+
|
|
812
|
+
Use Cases:
|
|
813
|
+
- Data Onboarding: Register new data sources in catalog
|
|
814
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
815
|
+
- Automation: Programmatically populate catalog
|
|
816
|
+
"""
|
|
817
|
+
self.method = 'PUT'
|
|
818
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['devops_policy'],
|
|
819
|
+
policyName=args['--policyName'])
|
|
820
|
+
self.params = get_api_version_params('devops_policies')
|
|
821
|
+
self.payload = get_json(args, '--payloadFile')
|
|
822
|
+
|
|
823
|
+
@decorator
|
|
824
|
+
def policystoreUpdateDevOpsPolicy(self, args):
|
|
825
|
+
"""
|
|
826
|
+
Update an existing policy.
|
|
827
|
+
|
|
828
|
+
Updates an existing policy with new values.
|
|
829
|
+
Only specified fields are modified; others remain unchanged.
|
|
830
|
+
|
|
831
|
+
Args:
|
|
832
|
+
args: Dictionary of operation arguments.
|
|
833
|
+
Contains operation-specific parameters.
|
|
834
|
+
See method implementation for details.
|
|
835
|
+
|
|
836
|
+
Returns:
|
|
837
|
+
Dictionary containing updated policy:
|
|
838
|
+
{
|
|
839
|
+
'guid': str, # Unique identifier
|
|
840
|
+
'attributes': dict, # Updated attributes
|
|
841
|
+
'updateTime': int # Update timestamp
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
Raises:
|
|
845
|
+
ValueError: When required parameters are missing or invalid:
|
|
846
|
+
- Empty or None values for required fields
|
|
847
|
+
- Invalid GUID format
|
|
848
|
+
- Out-of-range values
|
|
849
|
+
|
|
850
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
851
|
+
- DefaultAzureCredential not configured
|
|
852
|
+
- Insufficient permissions
|
|
853
|
+
- Expired authentication token
|
|
854
|
+
|
|
855
|
+
HTTPError: When Purview API returns error:
|
|
856
|
+
- 400: Bad request (invalid parameters)
|
|
857
|
+
- 401: Unauthorized (authentication failed)
|
|
858
|
+
- 403: Forbidden (insufficient permissions)
|
|
859
|
+
- 404: Resource not found
|
|
860
|
+
- 429: Rate limit exceeded
|
|
861
|
+
- 500: Internal server error
|
|
862
|
+
|
|
863
|
+
NetworkError: When network connectivity fails
|
|
864
|
+
|
|
865
|
+
Example:
|
|
866
|
+
# Basic usage
|
|
867
|
+
client = PolicyStore()
|
|
868
|
+
|
|
869
|
+
result = client.policystoreUpdateDevOpsPolicy(args=...)
|
|
870
|
+
print(f"Result: {result}")
|
|
871
|
+
|
|
872
|
+
# With detailed data
|
|
873
|
+
data = {
|
|
874
|
+
'name': 'My Resource',
|
|
875
|
+
'description': 'Resource description',
|
|
876
|
+
'attributes': {
|
|
877
|
+
'key1': 'value1',
|
|
878
|
+
'key2': 'value2'
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
result = client.policystoreUpdateDevOpsPolicy(data)
|
|
883
|
+
print(f"Created/Updated: {result['guid']}")
|
|
884
|
+
|
|
885
|
+
Use Cases:
|
|
886
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
887
|
+
- Ownership Changes: Reassign data ownership
|
|
888
|
+
- Classification: Apply or modify data classifications
|
|
889
|
+
"""
|
|
890
|
+
self.method = 'PUT'
|
|
891
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['devops_policy'],
|
|
892
|
+
policyName=args['--policyName'])
|
|
893
|
+
self.params = get_api_version_params('devops_policies')
|
|
894
|
+
self.payload = get_json(args, '--payloadFile')
|
|
895
|
+
|
|
896
|
+
@decorator
|
|
897
|
+
def policystoreDeleteDevOpsPolicy(self, args):
|
|
898
|
+
"""
|
|
899
|
+
Delete a policy.
|
|
900
|
+
|
|
901
|
+
Permanently deletes the specified policy.
|
|
902
|
+
This operation cannot be undone. Use with caution.
|
|
903
|
+
|
|
904
|
+
Args:
|
|
905
|
+
args: Dictionary of operation arguments.
|
|
906
|
+
Contains operation-specific parameters.
|
|
907
|
+
See method implementation for details.
|
|
908
|
+
|
|
909
|
+
Returns:
|
|
910
|
+
Dictionary with deletion status:
|
|
911
|
+
{
|
|
912
|
+
'guid': str, # Deleted resource ID
|
|
913
|
+
'status': str, # Deletion status
|
|
914
|
+
'message': str # Confirmation message
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
Raises:
|
|
918
|
+
ValueError: When required parameters are missing or invalid:
|
|
919
|
+
- Empty or None values for required fields
|
|
920
|
+
- Invalid GUID format
|
|
921
|
+
- Out-of-range values
|
|
922
|
+
|
|
923
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
924
|
+
- DefaultAzureCredential not configured
|
|
925
|
+
- Insufficient permissions
|
|
926
|
+
- Expired authentication token
|
|
927
|
+
|
|
928
|
+
HTTPError: When Purview API returns error:
|
|
929
|
+
- 400: Bad request (invalid parameters)
|
|
930
|
+
- 401: Unauthorized (authentication failed)
|
|
931
|
+
- 403: Forbidden (insufficient permissions)
|
|
932
|
+
- 404: Resource not found
|
|
933
|
+
- 429: Rate limit exceeded
|
|
934
|
+
- 500: Internal server error
|
|
935
|
+
|
|
936
|
+
NetworkError: When network connectivity fails
|
|
937
|
+
|
|
938
|
+
Example:
|
|
939
|
+
# Basic usage
|
|
940
|
+
client = PolicyStore()
|
|
941
|
+
|
|
942
|
+
result = client.policystoreDeleteDevOpsPolicy(args=...)
|
|
943
|
+
print(f"Result: {result}")
|
|
944
|
+
|
|
945
|
+
Use Cases:
|
|
946
|
+
- Data Cleanup: Remove obsolete or test data
|
|
947
|
+
- Decommissioning: Delete resources no longer in use
|
|
948
|
+
- Testing: Clean up test environments
|
|
949
|
+
"""
|
|
950
|
+
self.method = 'DELETE'
|
|
951
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['devops_policy'],
|
|
952
|
+
policyName=args['--policyName'])
|
|
953
|
+
self.params = get_api_version_params('devops_policies')
|
|
954
|
+
|
|
955
|
+
# ========== Self-Service Policies ==========
|
|
956
|
+
|
|
957
|
+
@decorator
|
|
958
|
+
def policystoreListSelfServicePolicies(self, args):
|
|
959
|
+
"""
|
|
960
|
+
Retrieve policy information.
|
|
961
|
+
|
|
962
|
+
Retrieves detailed information about the specified policy.
|
|
963
|
+
Returns complete policy metadata and properties.
|
|
964
|
+
|
|
965
|
+
Args:
|
|
966
|
+
args: Dictionary of operation arguments.
|
|
967
|
+
Contains operation-specific parameters.
|
|
968
|
+
See method implementation for details.
|
|
969
|
+
|
|
970
|
+
Returns:
|
|
971
|
+
List of resource dictionaries, each containing:
|
|
972
|
+
- guid (str): Unique identifier
|
|
973
|
+
- name (str): Resource name
|
|
974
|
+
- attributes (dict): Resource attributes
|
|
975
|
+
- status (str): Resource status
|
|
976
|
+
|
|
977
|
+
Returns empty list if no resources found.
|
|
978
|
+
|
|
979
|
+
Raises:
|
|
980
|
+
ValueError: When required parameters are missing or invalid:
|
|
981
|
+
- Empty or None values for required fields
|
|
982
|
+
- Invalid GUID format
|
|
983
|
+
- Out-of-range values
|
|
984
|
+
|
|
985
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
986
|
+
- DefaultAzureCredential not configured
|
|
987
|
+
- Insufficient permissions
|
|
988
|
+
- Expired authentication token
|
|
989
|
+
|
|
990
|
+
HTTPError: When Purview API returns error:
|
|
991
|
+
- 400: Bad request (invalid parameters)
|
|
992
|
+
- 401: Unauthorized (authentication failed)
|
|
993
|
+
- 403: Forbidden (insufficient permissions)
|
|
994
|
+
- 404: Resource not found
|
|
995
|
+
- 429: Rate limit exceeded
|
|
996
|
+
- 500: Internal server error
|
|
997
|
+
|
|
998
|
+
NetworkError: When network connectivity fails
|
|
999
|
+
|
|
1000
|
+
Example:
|
|
1001
|
+
# Basic usage
|
|
1002
|
+
client = PolicyStore()
|
|
1003
|
+
|
|
1004
|
+
result = client.policystoreListSelfServicePolicies(args=...)
|
|
1005
|
+
print(f"Result: {result}")
|
|
1006
|
+
|
|
1007
|
+
Use Cases:
|
|
1008
|
+
- Data Discovery: Find and explore data assets
|
|
1009
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1010
|
+
- Reporting: Generate catalog reports
|
|
1011
|
+
"""
|
|
1012
|
+
self.method = 'GET'
|
|
1013
|
+
self.endpoint = ENDPOINTS['policystore']['self_service_policies']
|
|
1014
|
+
self.params = get_api_version_params('self_service_policies')
|
|
1015
|
+
|
|
1016
|
+
@decorator
|
|
1017
|
+
def policystoreGetSelfServicePolicy(self, args):
|
|
1018
|
+
"""
|
|
1019
|
+
Retrieve policy information.
|
|
1020
|
+
|
|
1021
|
+
Retrieves detailed information about the specified policy.
|
|
1022
|
+
Returns complete policy metadata and properties.
|
|
1023
|
+
|
|
1024
|
+
Args:
|
|
1025
|
+
args: Dictionary of operation arguments.
|
|
1026
|
+
Contains operation-specific parameters.
|
|
1027
|
+
See method implementation for details.
|
|
1028
|
+
|
|
1029
|
+
Returns:
|
|
1030
|
+
Dictionary containing policy information:
|
|
1031
|
+
{
|
|
1032
|
+
'guid': str, # Unique identifier
|
|
1033
|
+
'name': str, # Resource name
|
|
1034
|
+
'attributes': dict, # Resource attributes
|
|
1035
|
+
'status': str, # Resource status
|
|
1036
|
+
'updateTime': int # Last update timestamp
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
Raises:
|
|
1040
|
+
ValueError: When required parameters are missing or invalid:
|
|
1041
|
+
- Empty or None values for required fields
|
|
1042
|
+
- Invalid GUID format
|
|
1043
|
+
- Out-of-range values
|
|
1044
|
+
|
|
1045
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1046
|
+
- DefaultAzureCredential not configured
|
|
1047
|
+
- Insufficient permissions
|
|
1048
|
+
- Expired authentication token
|
|
1049
|
+
|
|
1050
|
+
HTTPError: When Purview API returns error:
|
|
1051
|
+
- 400: Bad request (invalid parameters)
|
|
1052
|
+
- 401: Unauthorized (authentication failed)
|
|
1053
|
+
- 403: Forbidden (insufficient permissions)
|
|
1054
|
+
- 404: Resource not found
|
|
1055
|
+
- 429: Rate limit exceeded
|
|
1056
|
+
- 500: Internal server error
|
|
1057
|
+
|
|
1058
|
+
NetworkError: When network connectivity fails
|
|
1059
|
+
|
|
1060
|
+
Example:
|
|
1061
|
+
# Basic usage
|
|
1062
|
+
client = PolicyStore()
|
|
1063
|
+
|
|
1064
|
+
result = client.policystoreGetSelfServicePolicy(args=...)
|
|
1065
|
+
print(f"Result: {result}")
|
|
1066
|
+
|
|
1067
|
+
Use Cases:
|
|
1068
|
+
- Data Discovery: Find and explore data assets
|
|
1069
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1070
|
+
- Reporting: Generate catalog reports
|
|
1071
|
+
"""
|
|
1072
|
+
self.method = 'GET'
|
|
1073
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['self_service_policy'],
|
|
1074
|
+
policyId=args['--policyId'])
|
|
1075
|
+
self.params = get_api_version_params('self_service_policies')
|
|
1076
|
+
|
|
1077
|
+
@decorator
|
|
1078
|
+
def policystoreCreateSelfServicePolicy(self, args):
|
|
1079
|
+
"""
|
|
1080
|
+
Create a new policy.
|
|
1081
|
+
|
|
1082
|
+
Creates a new policy in Microsoft Purview Policy Store. Manage access and data policies.
|
|
1083
|
+
Requires appropriate permissions and valid policy definition.
|
|
1084
|
+
|
|
1085
|
+
Args:
|
|
1086
|
+
args: Dictionary of operation arguments.
|
|
1087
|
+
Contains operation-specific parameters.
|
|
1088
|
+
See method implementation for details.
|
|
1089
|
+
|
|
1090
|
+
Returns:
|
|
1091
|
+
Dictionary containing created policy:
|
|
1092
|
+
{
|
|
1093
|
+
'guid': str, # Unique identifier
|
|
1094
|
+
'name': str, # Resource name
|
|
1095
|
+
'status': str, # Creation status
|
|
1096
|
+
'attributes': dict, # Resource attributes
|
|
1097
|
+
'createTime': int # Creation timestamp
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
Raises:
|
|
1101
|
+
ValueError: When required parameters are missing or invalid:
|
|
1102
|
+
- Empty or None values for required fields
|
|
1103
|
+
- Invalid GUID format
|
|
1104
|
+
- Out-of-range values
|
|
1105
|
+
|
|
1106
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1107
|
+
- DefaultAzureCredential not configured
|
|
1108
|
+
- Insufficient permissions
|
|
1109
|
+
- Expired authentication token
|
|
1110
|
+
|
|
1111
|
+
HTTPError: When Purview API returns error:
|
|
1112
|
+
- 400: Bad request (invalid parameters)
|
|
1113
|
+
- 401: Unauthorized (authentication failed)
|
|
1114
|
+
- 403: Forbidden (insufficient permissions)
|
|
1115
|
+
- 404: Resource not found
|
|
1116
|
+
- 409: Conflict (resource already exists)
|
|
1117
|
+
- 429: Rate limit exceeded
|
|
1118
|
+
- 500: Internal server error
|
|
1119
|
+
|
|
1120
|
+
NetworkError: When network connectivity fails
|
|
1121
|
+
|
|
1122
|
+
Example:
|
|
1123
|
+
# Basic usage
|
|
1124
|
+
client = PolicyStore()
|
|
1125
|
+
|
|
1126
|
+
result = client.policystoreCreateSelfServicePolicy(args=...)
|
|
1127
|
+
print(f"Result: {result}")
|
|
1128
|
+
|
|
1129
|
+
# With detailed data
|
|
1130
|
+
data = {
|
|
1131
|
+
'name': 'My Resource',
|
|
1132
|
+
'description': 'Resource description',
|
|
1133
|
+
'attributes': {
|
|
1134
|
+
'key1': 'value1',
|
|
1135
|
+
'key2': 'value2'
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
result = client.policystoreCreateSelfServicePolicy(data)
|
|
1140
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1141
|
+
|
|
1142
|
+
Use Cases:
|
|
1143
|
+
- Data Onboarding: Register new data sources in catalog
|
|
1144
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
1145
|
+
- Automation: Programmatically populate catalog
|
|
1146
|
+
"""
|
|
1147
|
+
self.method = 'PUT'
|
|
1148
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['self_service_policy'],
|
|
1149
|
+
policyId=args['--policyId'])
|
|
1150
|
+
self.params = get_api_version_params('self_service_policies')
|
|
1151
|
+
self.payload = get_json(args, '--payloadFile')
|
|
1152
|
+
|
|
1153
|
+
@decorator
|
|
1154
|
+
def policystoreUpdateSelfServicePolicy(self, args):
|
|
1155
|
+
"""
|
|
1156
|
+
Update an existing policy.
|
|
1157
|
+
|
|
1158
|
+
Updates an existing policy with new values.
|
|
1159
|
+
Only specified fields are modified; others remain unchanged.
|
|
1160
|
+
|
|
1161
|
+
Args:
|
|
1162
|
+
args: Dictionary of operation arguments.
|
|
1163
|
+
Contains operation-specific parameters.
|
|
1164
|
+
See method implementation for details.
|
|
1165
|
+
|
|
1166
|
+
Returns:
|
|
1167
|
+
Dictionary containing updated policy:
|
|
1168
|
+
{
|
|
1169
|
+
'guid': str, # Unique identifier
|
|
1170
|
+
'attributes': dict, # Updated attributes
|
|
1171
|
+
'updateTime': int # Update timestamp
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
Raises:
|
|
1175
|
+
ValueError: When required parameters are missing or invalid:
|
|
1176
|
+
- Empty or None values for required fields
|
|
1177
|
+
- Invalid GUID format
|
|
1178
|
+
- Out-of-range values
|
|
1179
|
+
|
|
1180
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1181
|
+
- DefaultAzureCredential not configured
|
|
1182
|
+
- Insufficient permissions
|
|
1183
|
+
- Expired authentication token
|
|
1184
|
+
|
|
1185
|
+
HTTPError: When Purview API returns error:
|
|
1186
|
+
- 400: Bad request (invalid parameters)
|
|
1187
|
+
- 401: Unauthorized (authentication failed)
|
|
1188
|
+
- 403: Forbidden (insufficient permissions)
|
|
1189
|
+
- 404: Resource not found
|
|
1190
|
+
- 429: Rate limit exceeded
|
|
1191
|
+
- 500: Internal server error
|
|
1192
|
+
|
|
1193
|
+
NetworkError: When network connectivity fails
|
|
1194
|
+
|
|
1195
|
+
Example:
|
|
1196
|
+
# Basic usage
|
|
1197
|
+
client = PolicyStore()
|
|
1198
|
+
|
|
1199
|
+
result = client.policystoreUpdateSelfServicePolicy(args=...)
|
|
1200
|
+
print(f"Result: {result}")
|
|
1201
|
+
|
|
1202
|
+
# With detailed data
|
|
1203
|
+
data = {
|
|
1204
|
+
'name': 'My Resource',
|
|
1205
|
+
'description': 'Resource description',
|
|
1206
|
+
'attributes': {
|
|
1207
|
+
'key1': 'value1',
|
|
1208
|
+
'key2': 'value2'
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
result = client.policystoreUpdateSelfServicePolicy(data)
|
|
1213
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1214
|
+
|
|
1215
|
+
Use Cases:
|
|
1216
|
+
- Metadata Enrichment: Update descriptions and tags
|
|
1217
|
+
- Ownership Changes: Reassign data ownership
|
|
1218
|
+
- Classification: Apply or modify data classifications
|
|
1219
|
+
"""
|
|
1220
|
+
self.method = 'PUT'
|
|
1221
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['self_service_policy'],
|
|
1222
|
+
policyId=args['--policyId'])
|
|
1223
|
+
self.params = get_api_version_params('self_service_policies')
|
|
1224
|
+
self.payload = get_json(args, '--payloadFile')
|
|
1225
|
+
|
|
1226
|
+
@decorator
|
|
1227
|
+
def policystoreDeleteSelfServicePolicy(self, args):
|
|
1228
|
+
"""
|
|
1229
|
+
Delete a policy.
|
|
1230
|
+
|
|
1231
|
+
Permanently deletes the specified policy.
|
|
1232
|
+
This operation cannot be undone. Use with caution.
|
|
1233
|
+
|
|
1234
|
+
Args:
|
|
1235
|
+
args: Dictionary of operation arguments.
|
|
1236
|
+
Contains operation-specific parameters.
|
|
1237
|
+
See method implementation for details.
|
|
1238
|
+
|
|
1239
|
+
Returns:
|
|
1240
|
+
Dictionary with deletion status:
|
|
1241
|
+
{
|
|
1242
|
+
'guid': str, # Deleted resource ID
|
|
1243
|
+
'status': str, # Deletion status
|
|
1244
|
+
'message': str # Confirmation message
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
Raises:
|
|
1248
|
+
ValueError: When required parameters are missing or invalid:
|
|
1249
|
+
- Empty or None values for required fields
|
|
1250
|
+
- Invalid GUID format
|
|
1251
|
+
- Out-of-range values
|
|
1252
|
+
|
|
1253
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1254
|
+
- DefaultAzureCredential not configured
|
|
1255
|
+
- Insufficient permissions
|
|
1256
|
+
- Expired authentication token
|
|
1257
|
+
|
|
1258
|
+
HTTPError: When Purview API returns error:
|
|
1259
|
+
- 400: Bad request (invalid parameters)
|
|
1260
|
+
- 401: Unauthorized (authentication failed)
|
|
1261
|
+
- 403: Forbidden (insufficient permissions)
|
|
1262
|
+
- 404: Resource not found
|
|
1263
|
+
- 429: Rate limit exceeded
|
|
1264
|
+
- 500: Internal server error
|
|
1265
|
+
|
|
1266
|
+
NetworkError: When network connectivity fails
|
|
1267
|
+
|
|
1268
|
+
Example:
|
|
1269
|
+
# Basic usage
|
|
1270
|
+
client = PolicyStore()
|
|
1271
|
+
|
|
1272
|
+
result = client.policystoreDeleteSelfServicePolicy(args=...)
|
|
1273
|
+
print(f"Result: {result}")
|
|
1274
|
+
|
|
1275
|
+
Use Cases:
|
|
1276
|
+
- Data Cleanup: Remove obsolete or test data
|
|
1277
|
+
- Decommissioning: Delete resources no longer in use
|
|
1278
|
+
- Testing: Clean up test environments
|
|
1279
|
+
"""
|
|
1280
|
+
self.method = 'DELETE'
|
|
1281
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['self_service_policy'],
|
|
1282
|
+
policyId=args['--policyId'])
|
|
1283
|
+
self.params = get_api_version_params('self_service_policies')
|
|
1284
|
+
|
|
1285
|
+
# ========== Policy Collections and Assignments ==========
|
|
1286
|
+
|
|
1287
|
+
@decorator
|
|
1288
|
+
def policystoreGetPolicyCollections(self, args):
|
|
1289
|
+
"""
|
|
1290
|
+
Retrieve policy information.
|
|
1291
|
+
|
|
1292
|
+
Retrieves detailed information about the specified policy.
|
|
1293
|
+
Returns complete policy metadata and properties.
|
|
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 policy information:
|
|
1302
|
+
{
|
|
1303
|
+
'guid': str, # Unique identifier
|
|
1304
|
+
'name': str, # Resource name
|
|
1305
|
+
'attributes': dict, # Resource attributes
|
|
1306
|
+
'status': str, # Resource status
|
|
1307
|
+
'updateTime': int # Last update 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
|
+
- 429: Rate limit exceeded
|
|
1327
|
+
- 500: Internal server error
|
|
1328
|
+
|
|
1329
|
+
NetworkError: When network connectivity fails
|
|
1330
|
+
|
|
1331
|
+
Example:
|
|
1332
|
+
# Basic usage
|
|
1333
|
+
client = CollectionsPolicyStore()
|
|
1334
|
+
|
|
1335
|
+
result = client.policystoreGetPolicyCollections(args=...)
|
|
1336
|
+
print(f"Result: {result}")
|
|
1337
|
+
|
|
1338
|
+
Use Cases:
|
|
1339
|
+
- Data Discovery: Find and explore data assets
|
|
1340
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1341
|
+
- Reporting: Generate catalog reports
|
|
1342
|
+
"""
|
|
1343
|
+
self.method = 'GET'
|
|
1344
|
+
self.endpoint = ENDPOINTS['policystore']['policy_collections']
|
|
1345
|
+
self.params = get_api_version_params('metadata_policies')
|
|
1346
|
+
|
|
1347
|
+
@decorator
|
|
1348
|
+
def policystoreGetPolicyAssignments(self, args):
|
|
1349
|
+
"""
|
|
1350
|
+
Retrieve policy information.
|
|
1351
|
+
|
|
1352
|
+
Retrieves detailed information about the specified policy.
|
|
1353
|
+
Returns complete policy metadata and properties.
|
|
1354
|
+
|
|
1355
|
+
Args:
|
|
1356
|
+
args: Dictionary of operation arguments.
|
|
1357
|
+
Contains operation-specific parameters.
|
|
1358
|
+
See method implementation for details.
|
|
1359
|
+
|
|
1360
|
+
Returns:
|
|
1361
|
+
Dictionary containing policy information:
|
|
1362
|
+
{
|
|
1363
|
+
'guid': str, # Unique identifier
|
|
1364
|
+
'name': str, # Resource name
|
|
1365
|
+
'attributes': dict, # Resource attributes
|
|
1366
|
+
'status': str, # Resource status
|
|
1367
|
+
'updateTime': int # Last update timestamp
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
Raises:
|
|
1371
|
+
ValueError: When required parameters are missing or invalid:
|
|
1372
|
+
- Empty or None values for required fields
|
|
1373
|
+
- Invalid GUID format
|
|
1374
|
+
- Out-of-range values
|
|
1375
|
+
|
|
1376
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1377
|
+
- DefaultAzureCredential not configured
|
|
1378
|
+
- Insufficient permissions
|
|
1379
|
+
- Expired authentication token
|
|
1380
|
+
|
|
1381
|
+
HTTPError: When Purview API returns error:
|
|
1382
|
+
- 400: Bad request (invalid parameters)
|
|
1383
|
+
- 401: Unauthorized (authentication failed)
|
|
1384
|
+
- 403: Forbidden (insufficient permissions)
|
|
1385
|
+
- 404: Resource not found
|
|
1386
|
+
- 429: Rate limit exceeded
|
|
1387
|
+
- 500: Internal server error
|
|
1388
|
+
|
|
1389
|
+
NetworkError: When network connectivity fails
|
|
1390
|
+
|
|
1391
|
+
Example:
|
|
1392
|
+
# Basic usage
|
|
1393
|
+
client = PolicyStore()
|
|
1394
|
+
|
|
1395
|
+
result = client.policystoreGetPolicyAssignments(args=...)
|
|
1396
|
+
print(f"Result: {result}")
|
|
1397
|
+
|
|
1398
|
+
Use Cases:
|
|
1399
|
+
- Data Discovery: Find and explore data assets
|
|
1400
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1401
|
+
- Reporting: Generate catalog reports
|
|
1402
|
+
"""
|
|
1403
|
+
self.method = 'GET'
|
|
1404
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['policy_assignments'],
|
|
1405
|
+
collectionName=args['--collectionName'])
|
|
1406
|
+
self.params = get_api_version_params('metadata_policies')
|
|
1407
|
+
|
|
1408
|
+
@decorator
|
|
1409
|
+
def policystoreCreatePolicyAssignment(self, args):
|
|
1410
|
+
"""
|
|
1411
|
+
Create a new policy.
|
|
1412
|
+
|
|
1413
|
+
Creates a new policy in Microsoft Purview Policy Store. Manage access and data policies.
|
|
1414
|
+
Requires appropriate permissions and valid policy definition.
|
|
1415
|
+
|
|
1416
|
+
Args:
|
|
1417
|
+
args: Dictionary of operation arguments.
|
|
1418
|
+
Contains operation-specific parameters.
|
|
1419
|
+
See method implementation for details.
|
|
1420
|
+
|
|
1421
|
+
Returns:
|
|
1422
|
+
Dictionary containing created policy:
|
|
1423
|
+
{
|
|
1424
|
+
'guid': str, # Unique identifier
|
|
1425
|
+
'name': str, # Resource name
|
|
1426
|
+
'status': str, # Creation status
|
|
1427
|
+
'attributes': dict, # Resource attributes
|
|
1428
|
+
'createTime': int # Creation timestamp
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
Raises:
|
|
1432
|
+
ValueError: When required parameters are missing or invalid:
|
|
1433
|
+
- Empty or None values for required fields
|
|
1434
|
+
- Invalid GUID format
|
|
1435
|
+
- Out-of-range values
|
|
1436
|
+
|
|
1437
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1438
|
+
- DefaultAzureCredential not configured
|
|
1439
|
+
- Insufficient permissions
|
|
1440
|
+
- Expired authentication token
|
|
1441
|
+
|
|
1442
|
+
HTTPError: When Purview API returns error:
|
|
1443
|
+
- 400: Bad request (invalid parameters)
|
|
1444
|
+
- 401: Unauthorized (authentication failed)
|
|
1445
|
+
- 403: Forbidden (insufficient permissions)
|
|
1446
|
+
- 404: Resource not found
|
|
1447
|
+
- 409: Conflict (resource already exists)
|
|
1448
|
+
- 429: Rate limit exceeded
|
|
1449
|
+
- 500: Internal server error
|
|
1450
|
+
|
|
1451
|
+
NetworkError: When network connectivity fails
|
|
1452
|
+
|
|
1453
|
+
Example:
|
|
1454
|
+
# Basic usage
|
|
1455
|
+
client = PolicyStore()
|
|
1456
|
+
|
|
1457
|
+
result = client.policystoreCreatePolicyAssignment(args=...)
|
|
1458
|
+
print(f"Result: {result}")
|
|
1459
|
+
|
|
1460
|
+
# With detailed data
|
|
1461
|
+
data = {
|
|
1462
|
+
'name': 'My Resource',
|
|
1463
|
+
'description': 'Resource description',
|
|
1464
|
+
'attributes': {
|
|
1465
|
+
'key1': 'value1',
|
|
1466
|
+
'key2': 'value2'
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
result = client.policystoreCreatePolicyAssignment(data)
|
|
1471
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1472
|
+
|
|
1473
|
+
Use Cases:
|
|
1474
|
+
- Data Onboarding: Register new data sources in catalog
|
|
1475
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
1476
|
+
- Automation: Programmatically populate catalog
|
|
1477
|
+
"""
|
|
1478
|
+
self.method = 'PUT'
|
|
1479
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['policy_assignment'],
|
|
1480
|
+
collectionName=args['--collectionName'],
|
|
1481
|
+
policyId=args['--policyId'])
|
|
1482
|
+
self.params = get_api_version_params('metadata_policies')
|
|
1483
|
+
self.payload = get_json(args, '--payloadFile')
|
|
1484
|
+
|
|
1485
|
+
@decorator
|
|
1486
|
+
def policystoreDeletePolicyAssignment(self, args):
|
|
1487
|
+
"""
|
|
1488
|
+
Delete a policy.
|
|
1489
|
+
|
|
1490
|
+
Permanently deletes the specified policy.
|
|
1491
|
+
This operation cannot be undone. Use with caution.
|
|
1492
|
+
|
|
1493
|
+
Args:
|
|
1494
|
+
args: Dictionary of operation arguments.
|
|
1495
|
+
Contains operation-specific parameters.
|
|
1496
|
+
See method implementation for details.
|
|
1497
|
+
|
|
1498
|
+
Returns:
|
|
1499
|
+
Dictionary with deletion status:
|
|
1500
|
+
{
|
|
1501
|
+
'guid': str, # Deleted resource ID
|
|
1502
|
+
'status': str, # Deletion status
|
|
1503
|
+
'message': str # Confirmation message
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
Raises:
|
|
1507
|
+
ValueError: When required parameters are missing or invalid:
|
|
1508
|
+
- Empty or None values for required fields
|
|
1509
|
+
- Invalid GUID format
|
|
1510
|
+
- Out-of-range values
|
|
1511
|
+
|
|
1512
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1513
|
+
- DefaultAzureCredential not configured
|
|
1514
|
+
- Insufficient permissions
|
|
1515
|
+
- Expired authentication token
|
|
1516
|
+
|
|
1517
|
+
HTTPError: When Purview API returns error:
|
|
1518
|
+
- 400: Bad request (invalid parameters)
|
|
1519
|
+
- 401: Unauthorized (authentication failed)
|
|
1520
|
+
- 403: Forbidden (insufficient permissions)
|
|
1521
|
+
- 404: Resource not found
|
|
1522
|
+
- 429: Rate limit exceeded
|
|
1523
|
+
- 500: Internal server error
|
|
1524
|
+
|
|
1525
|
+
NetworkError: When network connectivity fails
|
|
1526
|
+
|
|
1527
|
+
Example:
|
|
1528
|
+
# Basic usage
|
|
1529
|
+
client = PolicyStore()
|
|
1530
|
+
|
|
1531
|
+
result = client.policystoreDeletePolicyAssignment(args=...)
|
|
1532
|
+
print(f"Result: {result}")
|
|
1533
|
+
|
|
1534
|
+
Use Cases:
|
|
1535
|
+
- Data Cleanup: Remove obsolete or test data
|
|
1536
|
+
- Decommissioning: Delete resources no longer in use
|
|
1537
|
+
- Testing: Clean up test environments
|
|
1538
|
+
"""
|
|
1539
|
+
self.method = 'DELETE'
|
|
1540
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['policy_assignment'],
|
|
1541
|
+
collectionName=args['--collectionName'],
|
|
1542
|
+
policyId=args['--policyId'])
|
|
1543
|
+
self.params = get_api_version_params('metadata_policies')
|
|
1544
|
+
|
|
1545
|
+
# ========== Policy Effects and Evaluation ==========
|
|
1546
|
+
|
|
1547
|
+
@decorator
|
|
1548
|
+
def policystoreGetPolicyEffects(self, args):
|
|
1549
|
+
"""
|
|
1550
|
+
Retrieve policy information.
|
|
1551
|
+
|
|
1552
|
+
Retrieves detailed information about the specified policy.
|
|
1553
|
+
Returns complete policy metadata and properties.
|
|
1554
|
+
|
|
1555
|
+
Args:
|
|
1556
|
+
args: Dictionary of operation arguments.
|
|
1557
|
+
Contains operation-specific parameters.
|
|
1558
|
+
See method implementation for details.
|
|
1559
|
+
|
|
1560
|
+
Returns:
|
|
1561
|
+
Dictionary containing policy information:
|
|
1562
|
+
{
|
|
1563
|
+
'guid': str, # Unique identifier
|
|
1564
|
+
'name': str, # Resource name
|
|
1565
|
+
'attributes': dict, # Resource attributes
|
|
1566
|
+
'status': str, # Resource status
|
|
1567
|
+
'updateTime': int # Last update timestamp
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
Raises:
|
|
1571
|
+
ValueError: When required parameters are missing or invalid:
|
|
1572
|
+
- Empty or None values for required fields
|
|
1573
|
+
- Invalid GUID format
|
|
1574
|
+
- Out-of-range values
|
|
1575
|
+
|
|
1576
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1577
|
+
- DefaultAzureCredential not configured
|
|
1578
|
+
- Insufficient permissions
|
|
1579
|
+
- Expired authentication token
|
|
1580
|
+
|
|
1581
|
+
HTTPError: When Purview API returns error:
|
|
1582
|
+
- 400: Bad request (invalid parameters)
|
|
1583
|
+
- 401: Unauthorized (authentication failed)
|
|
1584
|
+
- 403: Forbidden (insufficient permissions)
|
|
1585
|
+
- 404: Resource not found
|
|
1586
|
+
- 429: Rate limit exceeded
|
|
1587
|
+
- 500: Internal server error
|
|
1588
|
+
|
|
1589
|
+
NetworkError: When network connectivity fails
|
|
1590
|
+
|
|
1591
|
+
Example:
|
|
1592
|
+
# Basic usage
|
|
1593
|
+
client = PolicyStore()
|
|
1594
|
+
|
|
1595
|
+
result = client.policystoreGetPolicyEffects(args=...)
|
|
1596
|
+
print(f"Result: {result}")
|
|
1597
|
+
|
|
1598
|
+
Use Cases:
|
|
1599
|
+
- Data Discovery: Find and explore data assets
|
|
1600
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1601
|
+
- Reporting: Generate catalog reports
|
|
1602
|
+
"""
|
|
1603
|
+
self.method = 'POST'
|
|
1604
|
+
self.endpoint = ENDPOINTS['policystore']['policy_effects']
|
|
1605
|
+
self.params = get_api_version_params('metadata_policies')
|
|
1606
|
+
self.payload = get_json(args, '--payloadFile')
|
|
1607
|
+
|
|
1608
|
+
@decorator
|
|
1609
|
+
def policystoreEvaluatePolicies(self, args):
|
|
1610
|
+
"""
|
|
1611
|
+
Perform operation on resource.
|
|
1612
|
+
|
|
1613
|
+
|
|
1614
|
+
|
|
1615
|
+
Args:
|
|
1616
|
+
args: Dictionary of operation arguments.
|
|
1617
|
+
Contains operation-specific parameters.
|
|
1618
|
+
See method implementation for details.
|
|
1619
|
+
|
|
1620
|
+
Returns:
|
|
1621
|
+
[TODO: Specify return type and structure]
|
|
1622
|
+
[TODO: Document nested fields]
|
|
1623
|
+
|
|
1624
|
+
Raises:
|
|
1625
|
+
ValueError: When required parameters are missing or invalid:
|
|
1626
|
+
- Empty or None values for required fields
|
|
1627
|
+
- Invalid GUID format
|
|
1628
|
+
- Out-of-range values
|
|
1629
|
+
|
|
1630
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1631
|
+
- DefaultAzureCredential not configured
|
|
1632
|
+
- Insufficient permissions
|
|
1633
|
+
- Expired authentication token
|
|
1634
|
+
|
|
1635
|
+
HTTPError: When Purview API returns error:
|
|
1636
|
+
- 400: Bad request (invalid parameters)
|
|
1637
|
+
- 401: Unauthorized (authentication failed)
|
|
1638
|
+
- 403: Forbidden (insufficient permissions)
|
|
1639
|
+
- 404: Resource not found
|
|
1640
|
+
- 429: Rate limit exceeded
|
|
1641
|
+
- 500: Internal server error
|
|
1642
|
+
|
|
1643
|
+
NetworkError: When network connectivity fails
|
|
1644
|
+
|
|
1645
|
+
Example:
|
|
1646
|
+
# Basic usage
|
|
1647
|
+
client = PolicyStore()
|
|
1648
|
+
|
|
1649
|
+
result = client.policystoreEvaluatePolicies(args=...)
|
|
1650
|
+
print(f"Result: {result}")
|
|
1651
|
+
|
|
1652
|
+
Use Cases:
|
|
1653
|
+
- [TODO: Add specific use cases for this operation]
|
|
1654
|
+
- [TODO: Include business context]
|
|
1655
|
+
- [TODO: Explain when to use this method]
|
|
1656
|
+
"""
|
|
1657
|
+
self.method = 'POST'
|
|
1658
|
+
self.endpoint = ENDPOINTS['policystore']['evaluate_policies']
|
|
1659
|
+
self.params = get_api_version_params('metadata_policies')
|
|
1660
|
+
self.payload = get_json(args, '--payloadFile')
|
|
1661
|
+
|
|
1662
|
+
# ========== Access Control and Permissions ==========
|
|
1663
|
+
|
|
1664
|
+
@decorator
|
|
1665
|
+
def policystoreGetUserPermissions(self, args):
|
|
1666
|
+
"""
|
|
1667
|
+
Retrieve policy information.
|
|
1668
|
+
|
|
1669
|
+
Retrieves detailed information about the specified policy.
|
|
1670
|
+
Returns complete policy metadata and properties.
|
|
1671
|
+
|
|
1672
|
+
Args:
|
|
1673
|
+
args: Dictionary of operation arguments.
|
|
1674
|
+
Contains operation-specific parameters.
|
|
1675
|
+
See method implementation for details.
|
|
1676
|
+
|
|
1677
|
+
Returns:
|
|
1678
|
+
Dictionary containing policy information:
|
|
1679
|
+
{
|
|
1680
|
+
'guid': str, # Unique identifier
|
|
1681
|
+
'name': str, # Resource name
|
|
1682
|
+
'attributes': dict, # Resource attributes
|
|
1683
|
+
'status': str, # Resource status
|
|
1684
|
+
'updateTime': int # Last update timestamp
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
Raises:
|
|
1688
|
+
ValueError: When required parameters are missing or invalid:
|
|
1689
|
+
- Empty or None values for required fields
|
|
1690
|
+
- Invalid GUID format
|
|
1691
|
+
- Out-of-range values
|
|
1692
|
+
|
|
1693
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1694
|
+
- DefaultAzureCredential not configured
|
|
1695
|
+
- Insufficient permissions
|
|
1696
|
+
- Expired authentication token
|
|
1697
|
+
|
|
1698
|
+
HTTPError: When Purview API returns error:
|
|
1699
|
+
- 400: Bad request (invalid parameters)
|
|
1700
|
+
- 401: Unauthorized (authentication failed)
|
|
1701
|
+
- 403: Forbidden (insufficient permissions)
|
|
1702
|
+
- 404: Resource not found
|
|
1703
|
+
- 429: Rate limit exceeded
|
|
1704
|
+
- 500: Internal server error
|
|
1705
|
+
|
|
1706
|
+
NetworkError: When network connectivity fails
|
|
1707
|
+
|
|
1708
|
+
Example:
|
|
1709
|
+
# Basic usage
|
|
1710
|
+
client = PolicyStore()
|
|
1711
|
+
|
|
1712
|
+
result = client.policystoreGetUserPermissions(args=...)
|
|
1713
|
+
print(f"Result: {result}")
|
|
1714
|
+
|
|
1715
|
+
Use Cases:
|
|
1716
|
+
- Data Discovery: Find and explore data assets
|
|
1717
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1718
|
+
- Reporting: Generate catalog reports
|
|
1719
|
+
"""
|
|
1720
|
+
self.method = 'GET'
|
|
1721
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['user_permissions'],
|
|
1722
|
+
userId=args['--userId'])
|
|
1723
|
+
self.params = get_api_version_params('metadata_policies')
|
|
1724
|
+
if args.get('--resourcePath'):
|
|
1725
|
+
self.params['resourcePath'] = args['--resourcePath']
|
|
1726
|
+
|
|
1727
|
+
@decorator
|
|
1728
|
+
def policystoreCheckAccess(self, args):
|
|
1729
|
+
"""
|
|
1730
|
+
Perform operation on resource.
|
|
1731
|
+
|
|
1732
|
+
|
|
1733
|
+
|
|
1734
|
+
Args:
|
|
1735
|
+
args: Dictionary of operation arguments.
|
|
1736
|
+
Contains operation-specific parameters.
|
|
1737
|
+
See method implementation for details.
|
|
1738
|
+
|
|
1739
|
+
Returns:
|
|
1740
|
+
[TODO: Specify return type and structure]
|
|
1741
|
+
[TODO: Document nested fields]
|
|
1742
|
+
|
|
1743
|
+
Raises:
|
|
1744
|
+
ValueError: When required parameters are missing or invalid:
|
|
1745
|
+
- Empty or None values for required fields
|
|
1746
|
+
- Invalid GUID format
|
|
1747
|
+
- Out-of-range values
|
|
1748
|
+
|
|
1749
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1750
|
+
- DefaultAzureCredential not configured
|
|
1751
|
+
- Insufficient permissions
|
|
1752
|
+
- Expired authentication token
|
|
1753
|
+
|
|
1754
|
+
HTTPError: When Purview API returns error:
|
|
1755
|
+
- 400: Bad request (invalid parameters)
|
|
1756
|
+
- 401: Unauthorized (authentication failed)
|
|
1757
|
+
- 403: Forbidden (insufficient permissions)
|
|
1758
|
+
- 404: Resource not found
|
|
1759
|
+
- 429: Rate limit exceeded
|
|
1760
|
+
- 500: Internal server error
|
|
1761
|
+
|
|
1762
|
+
NetworkError: When network connectivity fails
|
|
1763
|
+
|
|
1764
|
+
Example:
|
|
1765
|
+
# Basic usage
|
|
1766
|
+
client = PolicyStore()
|
|
1767
|
+
|
|
1768
|
+
result = client.policystoreCheckAccess(args=...)
|
|
1769
|
+
print(f"Result: {result}")
|
|
1770
|
+
|
|
1771
|
+
Use Cases:
|
|
1772
|
+
- [TODO: Add specific use cases for this operation]
|
|
1773
|
+
- [TODO: Include business context]
|
|
1774
|
+
- [TODO: Explain when to use this method]
|
|
1775
|
+
"""
|
|
1776
|
+
self.method = 'POST'
|
|
1777
|
+
self.endpoint = ENDPOINTS['policystore']['check_access']
|
|
1778
|
+
self.params = get_api_version_params('metadata_policies')
|
|
1779
|
+
self.payload = get_json(args, '--payloadFile')
|
|
1780
|
+
|
|
1781
|
+
# ========== Policy Templates and Definitions ==========
|
|
1782
|
+
|
|
1783
|
+
@decorator
|
|
1784
|
+
def policystoreGetPolicyTemplates(self, args):
|
|
1785
|
+
"""
|
|
1786
|
+
Retrieve policy information.
|
|
1787
|
+
|
|
1788
|
+
Retrieves detailed information about the specified policy.
|
|
1789
|
+
Returns complete policy metadata and properties.
|
|
1790
|
+
|
|
1791
|
+
Args:
|
|
1792
|
+
args: Dictionary of operation arguments.
|
|
1793
|
+
Contains operation-specific parameters.
|
|
1794
|
+
See method implementation for details.
|
|
1795
|
+
|
|
1796
|
+
Returns:
|
|
1797
|
+
Dictionary containing policy information:
|
|
1798
|
+
{
|
|
1799
|
+
'guid': str, # Unique identifier
|
|
1800
|
+
'name': str, # Resource name
|
|
1801
|
+
'attributes': dict, # Resource attributes
|
|
1802
|
+
'status': str, # Resource status
|
|
1803
|
+
'updateTime': int # Last update timestamp
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
Raises:
|
|
1807
|
+
ValueError: When required parameters are missing or invalid:
|
|
1808
|
+
- Empty or None values for required fields
|
|
1809
|
+
- Invalid GUID format
|
|
1810
|
+
- Out-of-range values
|
|
1811
|
+
|
|
1812
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1813
|
+
- DefaultAzureCredential not configured
|
|
1814
|
+
- Insufficient permissions
|
|
1815
|
+
- Expired authentication token
|
|
1816
|
+
|
|
1817
|
+
HTTPError: When Purview API returns error:
|
|
1818
|
+
- 400: Bad request (invalid parameters)
|
|
1819
|
+
- 401: Unauthorized (authentication failed)
|
|
1820
|
+
- 403: Forbidden (insufficient permissions)
|
|
1821
|
+
- 404: Resource not found
|
|
1822
|
+
- 429: Rate limit exceeded
|
|
1823
|
+
- 500: Internal server error
|
|
1824
|
+
|
|
1825
|
+
NetworkError: When network connectivity fails
|
|
1826
|
+
|
|
1827
|
+
Example:
|
|
1828
|
+
# Basic usage
|
|
1829
|
+
client = PolicyStore()
|
|
1830
|
+
|
|
1831
|
+
result = client.policystoreGetPolicyTemplates(args=...)
|
|
1832
|
+
print(f"Result: {result}")
|
|
1833
|
+
|
|
1834
|
+
Use Cases:
|
|
1835
|
+
- Data Discovery: Find and explore data assets
|
|
1836
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1837
|
+
- Reporting: Generate catalog reports
|
|
1838
|
+
"""
|
|
1839
|
+
self.method = 'GET'
|
|
1840
|
+
self.endpoint = ENDPOINTS['policystore']['policy_templates']
|
|
1841
|
+
self.params = get_api_version_params('metadata_policies')
|
|
1842
|
+
|
|
1843
|
+
@decorator
|
|
1844
|
+
def policystoreGetPolicyDefinitions(self, args):
|
|
1845
|
+
"""
|
|
1846
|
+
Retrieve policy information.
|
|
1847
|
+
|
|
1848
|
+
Retrieves detailed information about the specified policy.
|
|
1849
|
+
Returns complete policy metadata and properties.
|
|
1850
|
+
|
|
1851
|
+
Args:
|
|
1852
|
+
args: Dictionary of operation arguments.
|
|
1853
|
+
Contains operation-specific parameters.
|
|
1854
|
+
See method implementation for details.
|
|
1855
|
+
|
|
1856
|
+
Returns:
|
|
1857
|
+
Dictionary containing policy information:
|
|
1858
|
+
{
|
|
1859
|
+
'guid': str, # Unique identifier
|
|
1860
|
+
'name': str, # Resource name
|
|
1861
|
+
'attributes': dict, # Resource attributes
|
|
1862
|
+
'status': str, # Resource status
|
|
1863
|
+
'updateTime': int # Last update timestamp
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
Raises:
|
|
1867
|
+
ValueError: When required parameters are missing or invalid:
|
|
1868
|
+
- Empty or None values for required fields
|
|
1869
|
+
- Invalid GUID format
|
|
1870
|
+
- Out-of-range values
|
|
1871
|
+
|
|
1872
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1873
|
+
- DefaultAzureCredential not configured
|
|
1874
|
+
- Insufficient permissions
|
|
1875
|
+
- Expired authentication token
|
|
1876
|
+
|
|
1877
|
+
HTTPError: When Purview API returns error:
|
|
1878
|
+
- 400: Bad request (invalid parameters)
|
|
1879
|
+
- 401: Unauthorized (authentication failed)
|
|
1880
|
+
- 403: Forbidden (insufficient permissions)
|
|
1881
|
+
- 404: Resource not found
|
|
1882
|
+
- 429: Rate limit exceeded
|
|
1883
|
+
- 500: Internal server error
|
|
1884
|
+
|
|
1885
|
+
NetworkError: When network connectivity fails
|
|
1886
|
+
|
|
1887
|
+
Example:
|
|
1888
|
+
# Basic usage
|
|
1889
|
+
client = PolicyStore()
|
|
1890
|
+
|
|
1891
|
+
result = client.policystoreGetPolicyDefinitions(args=...)
|
|
1892
|
+
print(f"Result: {result}")
|
|
1893
|
+
|
|
1894
|
+
Use Cases:
|
|
1895
|
+
- Data Discovery: Find and explore data assets
|
|
1896
|
+
- Compliance Auditing: Review metadata and classifications
|
|
1897
|
+
- Reporting: Generate catalog reports
|
|
1898
|
+
"""
|
|
1899
|
+
self.method = 'GET'
|
|
1900
|
+
self.endpoint = ENDPOINTS['policystore']['policy_definitions']
|
|
1901
|
+
self.params = get_api_version_params('metadata_policies')
|
|
1902
|
+
|
|
1903
|
+
@decorator
|
|
1904
|
+
def policystoreCreatePolicyDefinition(self, args):
|
|
1905
|
+
"""
|
|
1906
|
+
Create a new policy.
|
|
1907
|
+
|
|
1908
|
+
Creates a new policy in Microsoft Purview Policy Store. Manage access and data policies.
|
|
1909
|
+
Requires appropriate permissions and valid policy definition.
|
|
1910
|
+
|
|
1911
|
+
Args:
|
|
1912
|
+
args: Dictionary of operation arguments.
|
|
1913
|
+
Contains operation-specific parameters.
|
|
1914
|
+
See method implementation for details.
|
|
1915
|
+
|
|
1916
|
+
Returns:
|
|
1917
|
+
Dictionary containing created policy:
|
|
1918
|
+
{
|
|
1919
|
+
'guid': str, # Unique identifier
|
|
1920
|
+
'name': str, # Resource name
|
|
1921
|
+
'status': str, # Creation status
|
|
1922
|
+
'attributes': dict, # Resource attributes
|
|
1923
|
+
'createTime': int # Creation timestamp
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
Raises:
|
|
1927
|
+
ValueError: When required parameters are missing or invalid:
|
|
1928
|
+
- Empty or None values for required fields
|
|
1929
|
+
- Invalid GUID format
|
|
1930
|
+
- Out-of-range values
|
|
1931
|
+
|
|
1932
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
1933
|
+
- DefaultAzureCredential not configured
|
|
1934
|
+
- Insufficient permissions
|
|
1935
|
+
- Expired authentication token
|
|
1936
|
+
|
|
1937
|
+
HTTPError: When Purview API returns error:
|
|
1938
|
+
- 400: Bad request (invalid parameters)
|
|
1939
|
+
- 401: Unauthorized (authentication failed)
|
|
1940
|
+
- 403: Forbidden (insufficient permissions)
|
|
1941
|
+
- 404: Resource not found
|
|
1942
|
+
- 409: Conflict (resource already exists)
|
|
1943
|
+
- 429: Rate limit exceeded
|
|
1944
|
+
- 500: Internal server error
|
|
1945
|
+
|
|
1946
|
+
NetworkError: When network connectivity fails
|
|
1947
|
+
|
|
1948
|
+
Example:
|
|
1949
|
+
# Basic usage
|
|
1950
|
+
client = PolicyStore()
|
|
1951
|
+
|
|
1952
|
+
result = client.policystoreCreatePolicyDefinition(args=...)
|
|
1953
|
+
print(f"Result: {result}")
|
|
1954
|
+
|
|
1955
|
+
# With detailed data
|
|
1956
|
+
data = {
|
|
1957
|
+
'name': 'My Resource',
|
|
1958
|
+
'description': 'Resource description',
|
|
1959
|
+
'attributes': {
|
|
1960
|
+
'key1': 'value1',
|
|
1961
|
+
'key2': 'value2'
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
result = client.policystoreCreatePolicyDefinition(data)
|
|
1966
|
+
print(f"Created/Updated: {result['guid']}")
|
|
1967
|
+
|
|
1968
|
+
Use Cases:
|
|
1969
|
+
- Data Onboarding: Register new data sources in catalog
|
|
1970
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
1971
|
+
- Automation: Programmatically populate catalog
|
|
1972
|
+
"""
|
|
1973
|
+
self.method = 'PUT'
|
|
1974
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['policy_definition'],
|
|
1975
|
+
definitionId=args['--definitionId'])
|
|
1976
|
+
self.params = get_api_version_params('metadata_policies')
|
|
1977
|
+
self.payload = get_json(args, '--payloadFile')
|
|
1978
|
+
|
|
1979
|
+
# ========== Role Assignments and RBAC ==========
|
|
1980
|
+
|
|
1981
|
+
@decorator
|
|
1982
|
+
def policystoreListRoleAssignments(self, args):
|
|
1983
|
+
"""
|
|
1984
|
+
Retrieve policy information.
|
|
1985
|
+
|
|
1986
|
+
Retrieves detailed information about the specified policy.
|
|
1987
|
+
Returns complete policy metadata and properties.
|
|
1988
|
+
|
|
1989
|
+
Args:
|
|
1990
|
+
args: Dictionary of operation arguments.
|
|
1991
|
+
Contains operation-specific parameters.
|
|
1992
|
+
See method implementation for details.
|
|
1993
|
+
|
|
1994
|
+
Returns:
|
|
1995
|
+
List of resource dictionaries, each containing:
|
|
1996
|
+
- guid (str): Unique identifier
|
|
1997
|
+
- name (str): Resource name
|
|
1998
|
+
- attributes (dict): Resource attributes
|
|
1999
|
+
- status (str): Resource status
|
|
2000
|
+
|
|
2001
|
+
Returns empty list if no resources found.
|
|
2002
|
+
|
|
2003
|
+
Raises:
|
|
2004
|
+
ValueError: When required parameters are missing or invalid:
|
|
2005
|
+
- Empty or None values for required fields
|
|
2006
|
+
- Invalid GUID format
|
|
2007
|
+
- Out-of-range values
|
|
2008
|
+
|
|
2009
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2010
|
+
- DefaultAzureCredential not configured
|
|
2011
|
+
- Insufficient permissions
|
|
2012
|
+
- Expired authentication token
|
|
2013
|
+
|
|
2014
|
+
HTTPError: When Purview API returns error:
|
|
2015
|
+
- 400: Bad request (invalid parameters)
|
|
2016
|
+
- 401: Unauthorized (authentication failed)
|
|
2017
|
+
- 403: Forbidden (insufficient permissions)
|
|
2018
|
+
- 404: Resource not found
|
|
2019
|
+
- 429: Rate limit exceeded
|
|
2020
|
+
- 500: Internal server error
|
|
2021
|
+
|
|
2022
|
+
NetworkError: When network connectivity fails
|
|
2023
|
+
|
|
2024
|
+
Example:
|
|
2025
|
+
# Basic usage
|
|
2026
|
+
client = PolicyStore()
|
|
2027
|
+
|
|
2028
|
+
result = client.policystoreListRoleAssignments(args=...)
|
|
2029
|
+
print(f"Result: {result}")
|
|
2030
|
+
|
|
2031
|
+
Use Cases:
|
|
2032
|
+
- Data Discovery: Find and explore data assets
|
|
2033
|
+
- Compliance Auditing: Review metadata and classifications
|
|
2034
|
+
- Reporting: Generate catalog reports
|
|
2035
|
+
"""
|
|
2036
|
+
self.method = 'GET'
|
|
2037
|
+
self.endpoint = ENDPOINTS['policystore']['role_assignments']
|
|
2038
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2039
|
+
if args.get('--scope'):
|
|
2040
|
+
self.params['scope'] = args['--scope']
|
|
2041
|
+
|
|
2042
|
+
@decorator
|
|
2043
|
+
def policystoreCreateRoleAssignment(self, args):
|
|
2044
|
+
"""
|
|
2045
|
+
Create a new policy.
|
|
2046
|
+
|
|
2047
|
+
Creates a new policy in Microsoft Purview Policy Store. Manage access and data policies.
|
|
2048
|
+
Requires appropriate permissions and valid policy definition.
|
|
2049
|
+
|
|
2050
|
+
Args:
|
|
2051
|
+
args: Dictionary of operation arguments.
|
|
2052
|
+
Contains operation-specific parameters.
|
|
2053
|
+
See method implementation for details.
|
|
2054
|
+
|
|
2055
|
+
Returns:
|
|
2056
|
+
Dictionary containing created policy:
|
|
2057
|
+
{
|
|
2058
|
+
'guid': str, # Unique identifier
|
|
2059
|
+
'name': str, # Resource name
|
|
2060
|
+
'status': str, # Creation status
|
|
2061
|
+
'attributes': dict, # Resource attributes
|
|
2062
|
+
'createTime': int # Creation timestamp
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
Raises:
|
|
2066
|
+
ValueError: When required parameters are missing or invalid:
|
|
2067
|
+
- Empty or None values for required fields
|
|
2068
|
+
- Invalid GUID format
|
|
2069
|
+
- Out-of-range values
|
|
2070
|
+
|
|
2071
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2072
|
+
- DefaultAzureCredential not configured
|
|
2073
|
+
- Insufficient permissions
|
|
2074
|
+
- Expired authentication token
|
|
2075
|
+
|
|
2076
|
+
HTTPError: When Purview API returns error:
|
|
2077
|
+
- 400: Bad request (invalid parameters)
|
|
2078
|
+
- 401: Unauthorized (authentication failed)
|
|
2079
|
+
- 403: Forbidden (insufficient permissions)
|
|
2080
|
+
- 404: Resource not found
|
|
2081
|
+
- 409: Conflict (resource already exists)
|
|
2082
|
+
- 429: Rate limit exceeded
|
|
2083
|
+
- 500: Internal server error
|
|
2084
|
+
|
|
2085
|
+
NetworkError: When network connectivity fails
|
|
2086
|
+
|
|
2087
|
+
Example:
|
|
2088
|
+
# Basic usage
|
|
2089
|
+
client = PolicyStore()
|
|
2090
|
+
|
|
2091
|
+
result = client.policystoreCreateRoleAssignment(args=...)
|
|
2092
|
+
print(f"Result: {result}")
|
|
2093
|
+
|
|
2094
|
+
# With detailed data
|
|
2095
|
+
data = {
|
|
2096
|
+
'name': 'My Resource',
|
|
2097
|
+
'description': 'Resource description',
|
|
2098
|
+
'attributes': {
|
|
2099
|
+
'key1': 'value1',
|
|
2100
|
+
'key2': 'value2'
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
result = client.policystoreCreateRoleAssignment(data)
|
|
2105
|
+
print(f"Created/Updated: {result['guid']}")
|
|
2106
|
+
|
|
2107
|
+
Use Cases:
|
|
2108
|
+
- Data Onboarding: Register new data sources in catalog
|
|
2109
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
2110
|
+
- Automation: Programmatically populate catalog
|
|
2111
|
+
"""
|
|
2112
|
+
self.method = 'PUT'
|
|
2113
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['role_assignment'],
|
|
2114
|
+
roleAssignmentId=args['--roleAssignmentId'])
|
|
2115
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2116
|
+
self.payload = get_json(args, '--payloadFile')
|
|
2117
|
+
|
|
2118
|
+
@decorator
|
|
2119
|
+
def policystoreDeleteRoleAssignment(self, args):
|
|
2120
|
+
"""
|
|
2121
|
+
Delete a policy.
|
|
2122
|
+
|
|
2123
|
+
Permanently deletes the specified policy.
|
|
2124
|
+
This operation cannot be undone. Use with caution.
|
|
2125
|
+
|
|
2126
|
+
Args:
|
|
2127
|
+
args: Dictionary of operation arguments.
|
|
2128
|
+
Contains operation-specific parameters.
|
|
2129
|
+
See method implementation for details.
|
|
2130
|
+
|
|
2131
|
+
Returns:
|
|
2132
|
+
Dictionary with deletion status:
|
|
2133
|
+
{
|
|
2134
|
+
'guid': str, # Deleted resource ID
|
|
2135
|
+
'status': str, # Deletion status
|
|
2136
|
+
'message': str # Confirmation message
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
Raises:
|
|
2140
|
+
ValueError: When required parameters are missing or invalid:
|
|
2141
|
+
- Empty or None values for required fields
|
|
2142
|
+
- Invalid GUID format
|
|
2143
|
+
- Out-of-range values
|
|
2144
|
+
|
|
2145
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2146
|
+
- DefaultAzureCredential not configured
|
|
2147
|
+
- Insufficient permissions
|
|
2148
|
+
- Expired authentication token
|
|
2149
|
+
|
|
2150
|
+
HTTPError: When Purview API returns error:
|
|
2151
|
+
- 400: Bad request (invalid parameters)
|
|
2152
|
+
- 401: Unauthorized (authentication failed)
|
|
2153
|
+
- 403: Forbidden (insufficient permissions)
|
|
2154
|
+
- 404: Resource not found
|
|
2155
|
+
- 429: Rate limit exceeded
|
|
2156
|
+
- 500: Internal server error
|
|
2157
|
+
|
|
2158
|
+
NetworkError: When network connectivity fails
|
|
2159
|
+
|
|
2160
|
+
Example:
|
|
2161
|
+
# Basic usage
|
|
2162
|
+
client = PolicyStore()
|
|
2163
|
+
|
|
2164
|
+
result = client.policystoreDeleteRoleAssignment(args=...)
|
|
2165
|
+
print(f"Result: {result}")
|
|
2166
|
+
|
|
2167
|
+
Use Cases:
|
|
2168
|
+
- Data Cleanup: Remove obsolete or test data
|
|
2169
|
+
- Decommissioning: Delete resources no longer in use
|
|
2170
|
+
- Testing: Clean up test environments
|
|
2171
|
+
"""
|
|
2172
|
+
self.method = 'DELETE'
|
|
2173
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['role_assignment'],
|
|
2174
|
+
roleAssignmentId=args['--roleAssignmentId'])
|
|
2175
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2176
|
+
|
|
2177
|
+
@decorator
|
|
2178
|
+
def policystoreGetRoleDefinitions(self, args):
|
|
2179
|
+
"""
|
|
2180
|
+
Retrieve policy information.
|
|
2181
|
+
|
|
2182
|
+
Retrieves detailed information about the specified policy.
|
|
2183
|
+
Returns complete policy metadata and properties.
|
|
2184
|
+
|
|
2185
|
+
Args:
|
|
2186
|
+
args: Dictionary of operation arguments.
|
|
2187
|
+
Contains operation-specific parameters.
|
|
2188
|
+
See method implementation for details.
|
|
2189
|
+
|
|
2190
|
+
Returns:
|
|
2191
|
+
Dictionary containing policy information:
|
|
2192
|
+
{
|
|
2193
|
+
'guid': str, # Unique identifier
|
|
2194
|
+
'name': str, # Resource name
|
|
2195
|
+
'attributes': dict, # Resource attributes
|
|
2196
|
+
'status': str, # Resource status
|
|
2197
|
+
'updateTime': int # Last update timestamp
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
Raises:
|
|
2201
|
+
ValueError: When required parameters are missing or invalid:
|
|
2202
|
+
- Empty or None values for required fields
|
|
2203
|
+
- Invalid GUID format
|
|
2204
|
+
- Out-of-range values
|
|
2205
|
+
|
|
2206
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2207
|
+
- DefaultAzureCredential not configured
|
|
2208
|
+
- Insufficient permissions
|
|
2209
|
+
- Expired authentication token
|
|
2210
|
+
|
|
2211
|
+
HTTPError: When Purview API returns error:
|
|
2212
|
+
- 400: Bad request (invalid parameters)
|
|
2213
|
+
- 401: Unauthorized (authentication failed)
|
|
2214
|
+
- 403: Forbidden (insufficient permissions)
|
|
2215
|
+
- 404: Resource not found
|
|
2216
|
+
- 429: Rate limit exceeded
|
|
2217
|
+
- 500: Internal server error
|
|
2218
|
+
|
|
2219
|
+
NetworkError: When network connectivity fails
|
|
2220
|
+
|
|
2221
|
+
Example:
|
|
2222
|
+
# Basic usage
|
|
2223
|
+
client = PolicyStore()
|
|
2224
|
+
|
|
2225
|
+
result = client.policystoreGetRoleDefinitions(args=...)
|
|
2226
|
+
print(f"Result: {result}")
|
|
2227
|
+
|
|
2228
|
+
Use Cases:
|
|
2229
|
+
- Data Discovery: Find and explore data assets
|
|
2230
|
+
- Compliance Auditing: Review metadata and classifications
|
|
2231
|
+
- Reporting: Generate catalog reports
|
|
2232
|
+
"""
|
|
2233
|
+
self.method = 'GET'
|
|
2234
|
+
self.endpoint = ENDPOINTS['policystore']['role_definitions']
|
|
2235
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2236
|
+
|
|
2237
|
+
# ========== Data Access Policies ==========
|
|
2238
|
+
|
|
2239
|
+
@decorator
|
|
2240
|
+
def policystoreListDataAccessPolicies(self, args):
|
|
2241
|
+
"""
|
|
2242
|
+
Retrieve policy information.
|
|
2243
|
+
|
|
2244
|
+
Retrieves detailed information about the specified policy.
|
|
2245
|
+
Returns complete policy metadata and properties.
|
|
2246
|
+
|
|
2247
|
+
Args:
|
|
2248
|
+
args: Dictionary of operation arguments.
|
|
2249
|
+
Contains operation-specific parameters.
|
|
2250
|
+
See method implementation for details.
|
|
2251
|
+
|
|
2252
|
+
Returns:
|
|
2253
|
+
List of resource dictionaries, each containing:
|
|
2254
|
+
- guid (str): Unique identifier
|
|
2255
|
+
- name (str): Resource name
|
|
2256
|
+
- attributes (dict): Resource attributes
|
|
2257
|
+
- status (str): Resource status
|
|
2258
|
+
|
|
2259
|
+
Returns empty list if no resources found.
|
|
2260
|
+
|
|
2261
|
+
Raises:
|
|
2262
|
+
ValueError: When required parameters are missing or invalid:
|
|
2263
|
+
- Empty or None values for required fields
|
|
2264
|
+
- Invalid GUID format
|
|
2265
|
+
- Out-of-range values
|
|
2266
|
+
|
|
2267
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2268
|
+
- DefaultAzureCredential not configured
|
|
2269
|
+
- Insufficient permissions
|
|
2270
|
+
- Expired authentication token
|
|
2271
|
+
|
|
2272
|
+
HTTPError: When Purview API returns error:
|
|
2273
|
+
- 400: Bad request (invalid parameters)
|
|
2274
|
+
- 401: Unauthorized (authentication failed)
|
|
2275
|
+
- 403: Forbidden (insufficient permissions)
|
|
2276
|
+
- 404: Resource not found
|
|
2277
|
+
- 429: Rate limit exceeded
|
|
2278
|
+
- 500: Internal server error
|
|
2279
|
+
|
|
2280
|
+
NetworkError: When network connectivity fails
|
|
2281
|
+
|
|
2282
|
+
Example:
|
|
2283
|
+
# Basic usage
|
|
2284
|
+
client = PolicyStore()
|
|
2285
|
+
|
|
2286
|
+
result = client.policystoreListDataAccessPolicies(args=...)
|
|
2287
|
+
print(f"Result: {result}")
|
|
2288
|
+
|
|
2289
|
+
Use Cases:
|
|
2290
|
+
- Data Discovery: Find and explore data assets
|
|
2291
|
+
- Compliance Auditing: Review metadata and classifications
|
|
2292
|
+
- Reporting: Generate catalog reports
|
|
2293
|
+
"""
|
|
2294
|
+
self.method = 'GET'
|
|
2295
|
+
self.endpoint = ENDPOINTS['policystore']['data_access_policies']
|
|
2296
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2297
|
+
|
|
2298
|
+
@decorator
|
|
2299
|
+
def policystoreGetDataAccessPolicy(self, args):
|
|
2300
|
+
"""
|
|
2301
|
+
Retrieve policy information.
|
|
2302
|
+
|
|
2303
|
+
Retrieves detailed information about the specified policy.
|
|
2304
|
+
Returns complete policy metadata and properties.
|
|
2305
|
+
|
|
2306
|
+
Args:
|
|
2307
|
+
args: Dictionary of operation arguments.
|
|
2308
|
+
Contains operation-specific parameters.
|
|
2309
|
+
See method implementation for details.
|
|
2310
|
+
|
|
2311
|
+
Returns:
|
|
2312
|
+
Dictionary containing policy information:
|
|
2313
|
+
{
|
|
2314
|
+
'guid': str, # Unique identifier
|
|
2315
|
+
'name': str, # Resource name
|
|
2316
|
+
'attributes': dict, # Resource attributes
|
|
2317
|
+
'status': str, # Resource status
|
|
2318
|
+
'updateTime': int # Last update timestamp
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
Raises:
|
|
2322
|
+
ValueError: When required parameters are missing or invalid:
|
|
2323
|
+
- Empty or None values for required fields
|
|
2324
|
+
- Invalid GUID format
|
|
2325
|
+
- Out-of-range values
|
|
2326
|
+
|
|
2327
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2328
|
+
- DefaultAzureCredential not configured
|
|
2329
|
+
- Insufficient permissions
|
|
2330
|
+
- Expired authentication token
|
|
2331
|
+
|
|
2332
|
+
HTTPError: When Purview API returns error:
|
|
2333
|
+
- 400: Bad request (invalid parameters)
|
|
2334
|
+
- 401: Unauthorized (authentication failed)
|
|
2335
|
+
- 403: Forbidden (insufficient permissions)
|
|
2336
|
+
- 404: Resource not found
|
|
2337
|
+
- 429: Rate limit exceeded
|
|
2338
|
+
- 500: Internal server error
|
|
2339
|
+
|
|
2340
|
+
NetworkError: When network connectivity fails
|
|
2341
|
+
|
|
2342
|
+
Example:
|
|
2343
|
+
# Basic usage
|
|
2344
|
+
client = PolicyStore()
|
|
2345
|
+
|
|
2346
|
+
result = client.policystoreGetDataAccessPolicy(args=...)
|
|
2347
|
+
print(f"Result: {result}")
|
|
2348
|
+
|
|
2349
|
+
Use Cases:
|
|
2350
|
+
- Data Discovery: Find and explore data assets
|
|
2351
|
+
- Compliance Auditing: Review metadata and classifications
|
|
2352
|
+
- Reporting: Generate catalog reports
|
|
2353
|
+
"""
|
|
2354
|
+
self.method = 'GET'
|
|
2355
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['data_access_policy'],
|
|
2356
|
+
policyId=args['--policyId'])
|
|
2357
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2358
|
+
|
|
2359
|
+
@decorator
|
|
2360
|
+
def policystoreCreateDataAccessPolicy(self, args):
|
|
2361
|
+
"""
|
|
2362
|
+
Create a new policy.
|
|
2363
|
+
|
|
2364
|
+
Creates a new policy in Microsoft Purview Policy Store. Manage access and data policies.
|
|
2365
|
+
Requires appropriate permissions and valid policy definition.
|
|
2366
|
+
|
|
2367
|
+
Args:
|
|
2368
|
+
args: Dictionary of operation arguments.
|
|
2369
|
+
Contains operation-specific parameters.
|
|
2370
|
+
See method implementation for details.
|
|
2371
|
+
|
|
2372
|
+
Returns:
|
|
2373
|
+
Dictionary containing created policy:
|
|
2374
|
+
{
|
|
2375
|
+
'guid': str, # Unique identifier
|
|
2376
|
+
'name': str, # Resource name
|
|
2377
|
+
'status': str, # Creation status
|
|
2378
|
+
'attributes': dict, # Resource attributes
|
|
2379
|
+
'createTime': int # Creation timestamp
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
Raises:
|
|
2383
|
+
ValueError: When required parameters are missing or invalid:
|
|
2384
|
+
- Empty or None values for required fields
|
|
2385
|
+
- Invalid GUID format
|
|
2386
|
+
- Out-of-range values
|
|
2387
|
+
|
|
2388
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2389
|
+
- DefaultAzureCredential not configured
|
|
2390
|
+
- Insufficient permissions
|
|
2391
|
+
- Expired authentication token
|
|
2392
|
+
|
|
2393
|
+
HTTPError: When Purview API returns error:
|
|
2394
|
+
- 400: Bad request (invalid parameters)
|
|
2395
|
+
- 401: Unauthorized (authentication failed)
|
|
2396
|
+
- 403: Forbidden (insufficient permissions)
|
|
2397
|
+
- 404: Resource not found
|
|
2398
|
+
- 409: Conflict (resource already exists)
|
|
2399
|
+
- 429: Rate limit exceeded
|
|
2400
|
+
- 500: Internal server error
|
|
2401
|
+
|
|
2402
|
+
NetworkError: When network connectivity fails
|
|
2403
|
+
|
|
2404
|
+
Example:
|
|
2405
|
+
# Basic usage
|
|
2406
|
+
client = PolicyStore()
|
|
2407
|
+
|
|
2408
|
+
result = client.policystoreCreateDataAccessPolicy(args=...)
|
|
2409
|
+
print(f"Result: {result}")
|
|
2410
|
+
|
|
2411
|
+
# With detailed data
|
|
2412
|
+
data = {
|
|
2413
|
+
'name': 'My Resource',
|
|
2414
|
+
'description': 'Resource description',
|
|
2415
|
+
'attributes': {
|
|
2416
|
+
'key1': 'value1',
|
|
2417
|
+
'key2': 'value2'
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
result = client.policystoreCreateDataAccessPolicy(data)
|
|
2422
|
+
print(f"Created/Updated: {result['guid']}")
|
|
2423
|
+
|
|
2424
|
+
Use Cases:
|
|
2425
|
+
- Data Onboarding: Register new data sources in catalog
|
|
2426
|
+
- Metadata Management: Add descriptive metadata to assets
|
|
2427
|
+
- Automation: Programmatically populate catalog
|
|
2428
|
+
"""
|
|
2429
|
+
self.method = 'PUT'
|
|
2430
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['data_access_policy'],
|
|
2431
|
+
policyId=args['--policyId'])
|
|
2432
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2433
|
+
self.payload = get_json(args, '--payloadFile')
|
|
2434
|
+
|
|
2435
|
+
# ========== Policy Audit and Compliance ==========
|
|
2436
|
+
|
|
2437
|
+
@decorator
|
|
2438
|
+
def policystoreGetPolicyAuditLogs(self, args):
|
|
2439
|
+
"""
|
|
2440
|
+
Retrieve policy information.
|
|
2441
|
+
|
|
2442
|
+
Retrieves detailed information about the specified policy.
|
|
2443
|
+
Returns complete policy metadata and properties.
|
|
2444
|
+
|
|
2445
|
+
Args:
|
|
2446
|
+
args: Dictionary of operation arguments.
|
|
2447
|
+
Contains operation-specific parameters.
|
|
2448
|
+
See method implementation for details.
|
|
2449
|
+
|
|
2450
|
+
Returns:
|
|
2451
|
+
Dictionary containing policy information:
|
|
2452
|
+
{
|
|
2453
|
+
'guid': str, # Unique identifier
|
|
2454
|
+
'name': str, # Resource name
|
|
2455
|
+
'attributes': dict, # Resource attributes
|
|
2456
|
+
'status': str, # Resource status
|
|
2457
|
+
'updateTime': int # Last update timestamp
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
Raises:
|
|
2461
|
+
ValueError: When required parameters are missing or invalid:
|
|
2462
|
+
- Empty or None values for required fields
|
|
2463
|
+
- Invalid GUID format
|
|
2464
|
+
- Out-of-range values
|
|
2465
|
+
|
|
2466
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2467
|
+
- DefaultAzureCredential not configured
|
|
2468
|
+
- Insufficient permissions
|
|
2469
|
+
- Expired authentication token
|
|
2470
|
+
|
|
2471
|
+
HTTPError: When Purview API returns error:
|
|
2472
|
+
- 400: Bad request (invalid parameters)
|
|
2473
|
+
- 401: Unauthorized (authentication failed)
|
|
2474
|
+
- 403: Forbidden (insufficient permissions)
|
|
2475
|
+
- 404: Resource not found
|
|
2476
|
+
- 429: Rate limit exceeded
|
|
2477
|
+
- 500: Internal server error
|
|
2478
|
+
|
|
2479
|
+
NetworkError: When network connectivity fails
|
|
2480
|
+
|
|
2481
|
+
Example:
|
|
2482
|
+
# Basic usage
|
|
2483
|
+
client = PolicyStore()
|
|
2484
|
+
|
|
2485
|
+
result = client.policystoreGetPolicyAuditLogs(args=...)
|
|
2486
|
+
print(f"Result: {result}")
|
|
2487
|
+
|
|
2488
|
+
Use Cases:
|
|
2489
|
+
- Data Discovery: Find and explore data assets
|
|
2490
|
+
- Compliance Auditing: Review metadata and classifications
|
|
2491
|
+
- Reporting: Generate catalog reports
|
|
2492
|
+
"""
|
|
2493
|
+
self.method = 'GET'
|
|
2494
|
+
self.endpoint = ENDPOINTS['policystore']['policy_audit_logs']
|
|
2495
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2496
|
+
if args.get('--startTime'):
|
|
2497
|
+
self.params['startTime'] = args['--startTime']
|
|
2498
|
+
if args.get('--endTime'):
|
|
2499
|
+
self.params['endTime'] = args['--endTime']
|
|
2500
|
+
|
|
2501
|
+
@decorator
|
|
2502
|
+
def policystoreGetComplianceReport(self, args):
|
|
2503
|
+
"""
|
|
2504
|
+
Retrieve policy information.
|
|
2505
|
+
|
|
2506
|
+
Retrieves detailed information about the specified policy.
|
|
2507
|
+
Returns complete policy metadata and properties.
|
|
2508
|
+
|
|
2509
|
+
Args:
|
|
2510
|
+
args: Dictionary of operation arguments.
|
|
2511
|
+
Contains operation-specific parameters.
|
|
2512
|
+
See method implementation for details.
|
|
2513
|
+
|
|
2514
|
+
Returns:
|
|
2515
|
+
Dictionary containing policy information:
|
|
2516
|
+
{
|
|
2517
|
+
'guid': str, # Unique identifier
|
|
2518
|
+
'name': str, # Resource name
|
|
2519
|
+
'attributes': dict, # Resource attributes
|
|
2520
|
+
'status': str, # Resource status
|
|
2521
|
+
'updateTime': int # Last update timestamp
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
Raises:
|
|
2525
|
+
ValueError: When required parameters are missing or invalid:
|
|
2526
|
+
- Empty or None values for required fields
|
|
2527
|
+
- Invalid GUID format
|
|
2528
|
+
- Out-of-range values
|
|
2529
|
+
|
|
2530
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2531
|
+
- DefaultAzureCredential not configured
|
|
2532
|
+
- Insufficient permissions
|
|
2533
|
+
- Expired authentication token
|
|
2534
|
+
|
|
2535
|
+
HTTPError: When Purview API returns error:
|
|
2536
|
+
- 400: Bad request (invalid parameters)
|
|
2537
|
+
- 401: Unauthorized (authentication failed)
|
|
2538
|
+
- 403: Forbidden (insufficient permissions)
|
|
2539
|
+
- 404: Resource not found
|
|
2540
|
+
- 429: Rate limit exceeded
|
|
2541
|
+
- 500: Internal server error
|
|
2542
|
+
|
|
2543
|
+
NetworkError: When network connectivity fails
|
|
2544
|
+
|
|
2545
|
+
Example:
|
|
2546
|
+
# Basic usage
|
|
2547
|
+
client = PolicyStore()
|
|
2548
|
+
|
|
2549
|
+
result = client.policystoreGetComplianceReport(args=...)
|
|
2550
|
+
print(f"Result: {result}")
|
|
2551
|
+
|
|
2552
|
+
Use Cases:
|
|
2553
|
+
- Data Discovery: Find and explore data assets
|
|
2554
|
+
- Compliance Auditing: Review metadata and classifications
|
|
2555
|
+
- Reporting: Generate catalog reports
|
|
2556
|
+
"""
|
|
2557
|
+
self.method = 'GET'
|
|
2558
|
+
self.endpoint = ENDPOINTS['policystore']['compliance_report']
|
|
2559
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2560
|
+
if args.get('--reportType'):
|
|
2561
|
+
self.params['reportType'] = args['--reportType']
|
|
2562
|
+
|
|
2563
|
+
# ========== Advanced Policy Operations ==========
|
|
2564
|
+
|
|
2565
|
+
@decorator
|
|
2566
|
+
def policystoreBulkPolicyOperation(self, args):
|
|
2567
|
+
"""
|
|
2568
|
+
Perform batch operation on resources.
|
|
2569
|
+
|
|
2570
|
+
Processes multiple resources in a single operation.
|
|
2571
|
+
More efficient than individual operations for bulk data.
|
|
2572
|
+
|
|
2573
|
+
Args:
|
|
2574
|
+
args: Dictionary of operation arguments.
|
|
2575
|
+
Contains operation-specific parameters.
|
|
2576
|
+
See method implementation for details.
|
|
2577
|
+
|
|
2578
|
+
Returns:
|
|
2579
|
+
Dictionary with batch operation results:
|
|
2580
|
+
{
|
|
2581
|
+
'succeeded': int, # Success count
|
|
2582
|
+
'failed': int, # Failure count
|
|
2583
|
+
'results': [...], # Per-item results
|
|
2584
|
+
'errors': [...] # Error details
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
Raises:
|
|
2588
|
+
ValueError: When required parameters are missing or invalid:
|
|
2589
|
+
- Empty or None values for required fields
|
|
2590
|
+
- Invalid GUID format
|
|
2591
|
+
- Out-of-range values
|
|
2592
|
+
|
|
2593
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2594
|
+
- DefaultAzureCredential not configured
|
|
2595
|
+
- Insufficient permissions
|
|
2596
|
+
- Expired authentication token
|
|
2597
|
+
|
|
2598
|
+
HTTPError: When Purview API returns error:
|
|
2599
|
+
- 400: Bad request (invalid parameters)
|
|
2600
|
+
- 401: Unauthorized (authentication failed)
|
|
2601
|
+
- 403: Forbidden (insufficient permissions)
|
|
2602
|
+
- 404: Resource not found
|
|
2603
|
+
- 429: Rate limit exceeded
|
|
2604
|
+
- 500: Internal server error
|
|
2605
|
+
|
|
2606
|
+
NetworkError: When network connectivity fails
|
|
2607
|
+
|
|
2608
|
+
Example:
|
|
2609
|
+
# Basic usage
|
|
2610
|
+
client = PolicyStore()
|
|
2611
|
+
|
|
2612
|
+
result = client.policystoreBulkPolicyOperation(args=...)
|
|
2613
|
+
print(f"Result: {result}")
|
|
2614
|
+
|
|
2615
|
+
Use Cases:
|
|
2616
|
+
- Bulk Import: Load large volumes of metadata
|
|
2617
|
+
- Migration: Transfer catalog from other systems
|
|
2618
|
+
- Mass Updates: Apply changes to many resources
|
|
2619
|
+
"""
|
|
2620
|
+
self.method = 'POST'
|
|
2621
|
+
self.endpoint = ENDPOINTS['policystore']['bulk_policy_operations']
|
|
2622
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2623
|
+
self.payload = get_json(args, '--payloadFile')
|
|
2624
|
+
|
|
2625
|
+
@decorator
|
|
2626
|
+
def policystoreValidatePolicy(self, args):
|
|
2627
|
+
"""
|
|
2628
|
+
Perform operation on resource.
|
|
2629
|
+
|
|
2630
|
+
|
|
2631
|
+
|
|
2632
|
+
Args:
|
|
2633
|
+
args: Dictionary of operation arguments.
|
|
2634
|
+
Contains operation-specific parameters.
|
|
2635
|
+
See method implementation for details.
|
|
2636
|
+
|
|
2637
|
+
Returns:
|
|
2638
|
+
[TODO: Specify return type and structure]
|
|
2639
|
+
[TODO: Document nested fields]
|
|
2640
|
+
|
|
2641
|
+
Raises:
|
|
2642
|
+
ValueError: When required parameters are missing or invalid:
|
|
2643
|
+
- Empty or None values for required fields
|
|
2644
|
+
- Invalid GUID format
|
|
2645
|
+
- Out-of-range values
|
|
2646
|
+
|
|
2647
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2648
|
+
- DefaultAzureCredential not configured
|
|
2649
|
+
- Insufficient permissions
|
|
2650
|
+
- Expired authentication token
|
|
2651
|
+
|
|
2652
|
+
HTTPError: When Purview API returns error:
|
|
2653
|
+
- 400: Bad request (invalid parameters)
|
|
2654
|
+
- 401: Unauthorized (authentication failed)
|
|
2655
|
+
- 403: Forbidden (insufficient permissions)
|
|
2656
|
+
- 404: Resource not found
|
|
2657
|
+
- 429: Rate limit exceeded
|
|
2658
|
+
- 500: Internal server error
|
|
2659
|
+
|
|
2660
|
+
NetworkError: When network connectivity fails
|
|
2661
|
+
|
|
2662
|
+
Example:
|
|
2663
|
+
# Basic usage
|
|
2664
|
+
client = PolicyStore()
|
|
2665
|
+
|
|
2666
|
+
result = client.policystoreValidatePolicy(args=...)
|
|
2667
|
+
print(f"Result: {result}")
|
|
2668
|
+
|
|
2669
|
+
Use Cases:
|
|
2670
|
+
- [TODO: Add specific use cases for this operation]
|
|
2671
|
+
- [TODO: Include business context]
|
|
2672
|
+
- [TODO: Explain when to use this method]
|
|
2673
|
+
"""
|
|
2674
|
+
self.method = 'POST'
|
|
2675
|
+
self.endpoint = ENDPOINTS['policystore']['validate_policy']
|
|
2676
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2677
|
+
self.payload = get_json(args, '--payloadFile')
|
|
2678
|
+
|
|
2679
|
+
@decorator
|
|
2680
|
+
def policystoreSimulatePolicy(self, args):
|
|
2681
|
+
"""
|
|
2682
|
+
Perform operation on resource.
|
|
2683
|
+
|
|
2684
|
+
|
|
2685
|
+
|
|
2686
|
+
Args:
|
|
2687
|
+
args: Dictionary of operation arguments.
|
|
2688
|
+
Contains operation-specific parameters.
|
|
2689
|
+
See method implementation for details.
|
|
2690
|
+
|
|
2691
|
+
Returns:
|
|
2692
|
+
[TODO: Specify return type and structure]
|
|
2693
|
+
[TODO: Document nested fields]
|
|
2694
|
+
|
|
2695
|
+
Raises:
|
|
2696
|
+
ValueError: When required parameters are missing or invalid:
|
|
2697
|
+
- Empty or None values for required fields
|
|
2698
|
+
- Invalid GUID format
|
|
2699
|
+
- Out-of-range values
|
|
2700
|
+
|
|
2701
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2702
|
+
- DefaultAzureCredential not configured
|
|
2703
|
+
- Insufficient permissions
|
|
2704
|
+
- Expired authentication token
|
|
2705
|
+
|
|
2706
|
+
HTTPError: When Purview API returns error:
|
|
2707
|
+
- 400: Bad request (invalid parameters)
|
|
2708
|
+
- 401: Unauthorized (authentication failed)
|
|
2709
|
+
- 403: Forbidden (insufficient permissions)
|
|
2710
|
+
- 404: Resource not found
|
|
2711
|
+
- 429: Rate limit exceeded
|
|
2712
|
+
- 500: Internal server error
|
|
2713
|
+
|
|
2714
|
+
NetworkError: When network connectivity fails
|
|
2715
|
+
|
|
2716
|
+
Example:
|
|
2717
|
+
# Basic usage
|
|
2718
|
+
client = PolicyStore()
|
|
2719
|
+
|
|
2720
|
+
result = client.policystoreSimulatePolicy(args=...)
|
|
2721
|
+
print(f"Result: {result}")
|
|
2722
|
+
|
|
2723
|
+
Use Cases:
|
|
2724
|
+
- [TODO: Add specific use cases for this operation]
|
|
2725
|
+
- [TODO: Include business context]
|
|
2726
|
+
- [TODO: Explain when to use this method]
|
|
2727
|
+
"""
|
|
2728
|
+
self.method = 'POST'
|
|
2729
|
+
self.endpoint = ENDPOINTS['policystore']['simulate_policy']
|
|
2730
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2731
|
+
self.payload = get_json(args, '--payloadFile')
|
|
2732
|
+
|
|
2733
|
+
@decorator
|
|
2734
|
+
def policystoreGetPolicyChanges(self, args):
|
|
2735
|
+
"""
|
|
2736
|
+
Retrieve policy information.
|
|
2737
|
+
|
|
2738
|
+
Retrieves detailed information about the specified policy.
|
|
2739
|
+
Returns complete policy metadata and properties.
|
|
2740
|
+
|
|
2741
|
+
Args:
|
|
2742
|
+
args: Dictionary of operation arguments.
|
|
2743
|
+
Contains operation-specific parameters.
|
|
2744
|
+
See method implementation for details.
|
|
2745
|
+
|
|
2746
|
+
Returns:
|
|
2747
|
+
Dictionary containing policy information:
|
|
2748
|
+
{
|
|
2749
|
+
'guid': str, # Unique identifier
|
|
2750
|
+
'name': str, # Resource name
|
|
2751
|
+
'attributes': dict, # Resource attributes
|
|
2752
|
+
'status': str, # Resource status
|
|
2753
|
+
'updateTime': int # Last update timestamp
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2756
|
+
Raises:
|
|
2757
|
+
ValueError: When required parameters are missing or invalid:
|
|
2758
|
+
- Empty or None values for required fields
|
|
2759
|
+
- Invalid GUID format
|
|
2760
|
+
- Out-of-range values
|
|
2761
|
+
|
|
2762
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2763
|
+
- DefaultAzureCredential not configured
|
|
2764
|
+
- Insufficient permissions
|
|
2765
|
+
- Expired authentication token
|
|
2766
|
+
|
|
2767
|
+
HTTPError: When Purview API returns error:
|
|
2768
|
+
- 400: Bad request (invalid parameters)
|
|
2769
|
+
- 401: Unauthorized (authentication failed)
|
|
2770
|
+
- 403: Forbidden (insufficient permissions)
|
|
2771
|
+
- 404: Resource not found
|
|
2772
|
+
- 429: Rate limit exceeded
|
|
2773
|
+
- 500: Internal server error
|
|
2774
|
+
|
|
2775
|
+
NetworkError: When network connectivity fails
|
|
2776
|
+
|
|
2777
|
+
Example:
|
|
2778
|
+
# Basic usage
|
|
2779
|
+
client = PolicyStore()
|
|
2780
|
+
|
|
2781
|
+
result = client.policystoreGetPolicyChanges(args=...)
|
|
2782
|
+
print(f"Result: {result}")
|
|
2783
|
+
|
|
2784
|
+
Use Cases:
|
|
2785
|
+
- Data Discovery: Find and explore data assets
|
|
2786
|
+
- Compliance Auditing: Review metadata and classifications
|
|
2787
|
+
- Reporting: Generate catalog reports
|
|
2788
|
+
"""
|
|
2789
|
+
self.method = 'GET'
|
|
2790
|
+
self.endpoint = format_endpoint(ENDPOINTS['policystore']['policy_changes'],
|
|
2791
|
+
policyId=args['--policyId'])
|
|
2792
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2793
|
+
|
|
2794
|
+
@decorator
|
|
2795
|
+
def policystoreExportPolicies(self, args):
|
|
2796
|
+
"""
|
|
2797
|
+
Perform batch operation on resources.
|
|
2798
|
+
|
|
2799
|
+
Processes multiple resources in a single operation.
|
|
2800
|
+
More efficient than individual operations for bulk data.
|
|
2801
|
+
|
|
2802
|
+
Args:
|
|
2803
|
+
args: Dictionary of operation arguments.
|
|
2804
|
+
Contains operation-specific parameters.
|
|
2805
|
+
See method implementation for details.
|
|
2806
|
+
|
|
2807
|
+
Returns:
|
|
2808
|
+
Dictionary with batch operation results:
|
|
2809
|
+
{
|
|
2810
|
+
'succeeded': int, # Success count
|
|
2811
|
+
'failed': int, # Failure count
|
|
2812
|
+
'results': [...], # Per-item results
|
|
2813
|
+
'errors': [...] # Error details
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
Raises:
|
|
2817
|
+
ValueError: When required parameters are missing or invalid:
|
|
2818
|
+
- Empty or None values for required fields
|
|
2819
|
+
- Invalid GUID format
|
|
2820
|
+
- Out-of-range values
|
|
2821
|
+
|
|
2822
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2823
|
+
- DefaultAzureCredential not configured
|
|
2824
|
+
- Insufficient permissions
|
|
2825
|
+
- Expired authentication token
|
|
2826
|
+
|
|
2827
|
+
HTTPError: When Purview API returns error:
|
|
2828
|
+
- 400: Bad request (invalid parameters)
|
|
2829
|
+
- 401: Unauthorized (authentication failed)
|
|
2830
|
+
- 403: Forbidden (insufficient permissions)
|
|
2831
|
+
- 404: Resource not found
|
|
2832
|
+
- 429: Rate limit exceeded
|
|
2833
|
+
- 500: Internal server error
|
|
2834
|
+
|
|
2835
|
+
NetworkError: When network connectivity fails
|
|
2836
|
+
|
|
2837
|
+
Example:
|
|
2838
|
+
# Basic usage
|
|
2839
|
+
client = PolicyStore()
|
|
2840
|
+
|
|
2841
|
+
result = client.policystoreExportPolicies(args=...)
|
|
2842
|
+
print(f"Result: {result}")
|
|
2843
|
+
|
|
2844
|
+
Use Cases:
|
|
2845
|
+
- Bulk Import: Load large volumes of metadata
|
|
2846
|
+
- Migration: Transfer catalog from other systems
|
|
2847
|
+
- Mass Updates: Apply changes to many resources
|
|
2848
|
+
"""
|
|
2849
|
+
self.method = 'POST'
|
|
2850
|
+
self.endpoint = ENDPOINTS['policystore']['export_policies']
|
|
2851
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2852
|
+
self.payload = {
|
|
2853
|
+
'format': args.get('--format', 'json'),
|
|
2854
|
+
'includeAssignments': args.get('--includeAssignments', True)
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
@decorator
|
|
2858
|
+
def policystoreImportPolicies(self, args):
|
|
2859
|
+
"""
|
|
2860
|
+
Perform batch operation on resources.
|
|
2861
|
+
|
|
2862
|
+
Processes multiple resources in a single operation.
|
|
2863
|
+
More efficient than individual operations for bulk data.
|
|
2864
|
+
|
|
2865
|
+
Args:
|
|
2866
|
+
args: Dictionary of operation arguments.
|
|
2867
|
+
Contains operation-specific parameters.
|
|
2868
|
+
See method implementation for details.
|
|
2869
|
+
|
|
2870
|
+
Returns:
|
|
2871
|
+
Dictionary with batch operation results:
|
|
2872
|
+
{
|
|
2873
|
+
'succeeded': int, # Success count
|
|
2874
|
+
'failed': int, # Failure count
|
|
2875
|
+
'results': [...], # Per-item results
|
|
2876
|
+
'errors': [...] # Error details
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
Raises:
|
|
2880
|
+
ValueError: When required parameters are missing or invalid:
|
|
2881
|
+
- Empty or None values for required fields
|
|
2882
|
+
- Invalid GUID format
|
|
2883
|
+
- Out-of-range values
|
|
2884
|
+
|
|
2885
|
+
AuthenticationError: When Azure credentials are invalid:
|
|
2886
|
+
- DefaultAzureCredential not configured
|
|
2887
|
+
- Insufficient permissions
|
|
2888
|
+
- Expired authentication token
|
|
2889
|
+
|
|
2890
|
+
HTTPError: When Purview API returns error:
|
|
2891
|
+
- 400: Bad request (invalid parameters)
|
|
2892
|
+
- 401: Unauthorized (authentication failed)
|
|
2893
|
+
- 403: Forbidden (insufficient permissions)
|
|
2894
|
+
- 404: Resource not found
|
|
2895
|
+
- 429: Rate limit exceeded
|
|
2896
|
+
- 500: Internal server error
|
|
2897
|
+
|
|
2898
|
+
NetworkError: When network connectivity fails
|
|
2899
|
+
|
|
2900
|
+
Example:
|
|
2901
|
+
# Basic usage
|
|
2902
|
+
client = PolicyStore()
|
|
2903
|
+
|
|
2904
|
+
result = client.policystoreImportPolicies(args=...)
|
|
2905
|
+
print(f"Result: {result}")
|
|
2906
|
+
|
|
2907
|
+
Use Cases:
|
|
2908
|
+
- Bulk Import: Load large volumes of metadata
|
|
2909
|
+
- Migration: Transfer catalog from other systems
|
|
2910
|
+
- Mass Updates: Apply changes to many resources
|
|
2911
|
+
"""
|
|
2912
|
+
self.method = 'POST'
|
|
2913
|
+
self.endpoint = ENDPOINTS['policystore']['import_policies']
|
|
2914
|
+
self.params = get_api_version_params('metadata_policies')
|
|
2915
|
+
self.payload = get_json(args, '--payloadFile')
|