pyegeria 0.2.4__py3-none-any.whl → 0.3.0__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.
- pyegeria/__init__.py +13 -8
- pyegeria/_client.py +164 -105
- pyegeria/_exceptions.py +2 -1
- pyegeria/_validators.py +2 -2
- pyegeria/automated_curation_omvs.py +2188 -0
- pyegeria/core_omag_server_config.py +38 -7
- pyegeria/full_omag_server_config.py +1075 -0
- pyegeria/glossary_omvs.py +204 -66
- pyegeria/gov_engine.py +92 -201
- pyegeria/governance_author.py +184 -0
- pyegeria/my_profile_omvs.py +976 -0
- pyegeria/platform_services.py +67 -35
- pyegeria/server_operations.py +92 -25
- pyegeria/utils.py +5 -17
- {pyegeria-0.2.4.dist-info → pyegeria-0.3.0.dist-info}/METADATA +21 -17
- pyegeria-0.3.0.dist-info/RECORD +21 -0
- {pyegeria-0.2.4.dist-info → pyegeria-0.3.0.dist-info}/WHEEL +2 -1
- pyegeria-0.3.0.dist-info/top_level.txt +1 -0
- pyegeria/config.toml +0 -11
- pyegeria/curation_omvs.py +0 -458
- pyegeria/exceptions.py +0 -382
- pyegeria-0.2.4.dist-info/RECORD +0 -19
- {pyegeria-0.2.4.dist-info/licenses → pyegeria-0.3.0.dist-info}/LICENSE +0 -0
@@ -0,0 +1,2188 @@
|
|
1
|
+
"""
|
2
|
+
SPDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
Automated Curation View Service Methods - this file is in active development...
|
6
|
+
|
7
|
+
"""
|
8
|
+
import asyncio
|
9
|
+
import json
|
10
|
+
from datetime import datetime
|
11
|
+
from httpx import AsyncClient, Response
|
12
|
+
|
13
|
+
from pyegeria import Client, max_paging_size, body_slimmer
|
14
|
+
from ._validators import validate_name, validate_guid, validate_search_string
|
15
|
+
from pyegeria._exceptions import (
|
16
|
+
InvalidParameterException,
|
17
|
+
)
|
18
|
+
|
19
|
+
|
20
|
+
class AutomatedCuration(Client):
|
21
|
+
""" Set up and maintain automation services in Egeria.
|
22
|
+
class AutomatedCuration(Platform):
|
23
|
+
|
24
|
+
def __init__(
|
25
|
+
self,
|
26
|
+
server_name: str,
|
27
|
+
platform_url: str,
|
28
|
+
user_id: str,
|
29
|
+
user_pwd: str = None,
|
30
|
+
verify_flag: bool = False,
|
31
|
+
):
|
32
|
+
"""
|
33
|
+
|
34
|
+
def __init__(
|
35
|
+
self,
|
36
|
+
server_name: str,
|
37
|
+
platform_url: str,
|
38
|
+
user_id: str,
|
39
|
+
user_pwd: str = None,
|
40
|
+
verify_flag: bool = False,
|
41
|
+
):
|
42
|
+
Client.__init__(self, server_name, platform_url, user_id, user_pwd, verify_flag)
|
43
|
+
self.cur_command_root = f"{platform_url}/servers/"
|
44
|
+
|
45
|
+
async def _async_create_element_from_template(self, body: dict, server: str = None) -> str:
|
46
|
+
""" Create a new metadata element from a template. Async version.
|
47
|
+
Parameters
|
48
|
+
----------
|
49
|
+
body : str
|
50
|
+
The json body used to instantiate the template.
|
51
|
+
server : str, optional
|
52
|
+
The name of the view server to use. If not provided, the default server name will be used.
|
53
|
+
|
54
|
+
Returns
|
55
|
+
-------
|
56
|
+
Response
|
57
|
+
The guid of the resulting element
|
58
|
+
|
59
|
+
Raises
|
60
|
+
------
|
61
|
+
InvalidParameterException
|
62
|
+
PropertyServerException
|
63
|
+
UserNotAuthorizedException
|
64
|
+
|
65
|
+
Notes
|
66
|
+
-----
|
67
|
+
See also: https://egeria-project.org/features/templated-cataloguing/overview/
|
68
|
+
The full description of the body is shown below:
|
69
|
+
{
|
70
|
+
"typeName" : "",
|
71
|
+
"initialStatus" : "",
|
72
|
+
"initialClassifications" : "",
|
73
|
+
"anchorGUID" : "",
|
74
|
+
"isOwnAnchor" : "",
|
75
|
+
"effectiveFrom" : "",
|
76
|
+
"effectiveTo" : "",
|
77
|
+
"templateGUID" : "",
|
78
|
+
"templateProperties" : {},
|
79
|
+
"placeholderPropertyValues" : {
|
80
|
+
"placeholderPropertyName1" : "placeholderPropertyValue1",
|
81
|
+
"placeholderPropertyName2" : "placeholderPropertyValue2"
|
82
|
+
},
|
83
|
+
"parentGUID" : "",
|
84
|
+
"parentRelationshipTypeName" : "",
|
85
|
+
"parentRelationshipProperties" : "",
|
86
|
+
"parentAtEnd1" : "",
|
87
|
+
"effectiveTime" : ""
|
88
|
+
}
|
89
|
+
"""
|
90
|
+
|
91
|
+
server = self.server_name if server is None else server
|
92
|
+
|
93
|
+
url = f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/catalog-templates/new-element"
|
94
|
+
response = await self._async_make_request("POST", url, body)
|
95
|
+
return response.json().get("guid","GUID failed to be returned")
|
96
|
+
|
97
|
+
def create_element_from_template(self, body: dict, server: str = None) -> str:
|
98
|
+
""" Create a new metadata element from a template. Async version.
|
99
|
+
Parameters
|
100
|
+
----------
|
101
|
+
body : str
|
102
|
+
The json body used to instantiate the template.
|
103
|
+
server : str, optional
|
104
|
+
The name of the view server to use. If not provided, the default server name will be used.
|
105
|
+
|
106
|
+
Returns
|
107
|
+
-------
|
108
|
+
Response
|
109
|
+
The guid of the resulting element
|
110
|
+
|
111
|
+
Raises
|
112
|
+
------
|
113
|
+
InvalidParameterException
|
114
|
+
PropertyServerException
|
115
|
+
UserNotAuthorizedException
|
116
|
+
|
117
|
+
Notes
|
118
|
+
-----
|
119
|
+
See also: https://egeria-project.org/features/templated-cataloguing/overview/
|
120
|
+
The full description of the body is shown below:
|
121
|
+
{
|
122
|
+
"typeName" : "",
|
123
|
+
"initialStatus" : "",
|
124
|
+
"initialClassifications" : "",
|
125
|
+
"anchorGUID" : "",
|
126
|
+
"isOwnAnchor" : "",
|
127
|
+
"effectiveFrom" : "",
|
128
|
+
"effectiveTo" : "",
|
129
|
+
"templateGUID" : "",
|
130
|
+
"templateProperties" : {},
|
131
|
+
"placeholderPropertyValues" : {
|
132
|
+
"placeholderPropertyName1" : "placeholderPropertyValue1",
|
133
|
+
"placeholderPropertyName2" : "placeholderPropertyValue2"
|
134
|
+
},
|
135
|
+
"parentGUID" : "",
|
136
|
+
"parentRelationshipTypeName" : "",
|
137
|
+
"parentRelationshipProperties" : "",
|
138
|
+
"parentAtEnd1" : "",
|
139
|
+
"effectiveTime" : ""
|
140
|
+
}
|
141
|
+
"""
|
142
|
+
loop = asyncio.get_event_loop()
|
143
|
+
response = loop.run_until_complete(
|
144
|
+
self._async_create_element_from_template(body, server)
|
145
|
+
)
|
146
|
+
return response
|
147
|
+
|
148
|
+
async def _async_create_kafka_server_element_from_template(self, kafka_server:str, host_name: str, port: str,
|
149
|
+
server:str = None) -> str:
|
150
|
+
""" Create a Kafka server element from a template. Async version.
|
151
|
+
|
152
|
+
Parameters
|
153
|
+
----------
|
154
|
+
kafka_server : str
|
155
|
+
The name of the Kafka server.
|
156
|
+
|
157
|
+
host_name : str
|
158
|
+
The host name of the Kafka server.
|
159
|
+
|
160
|
+
port : str
|
161
|
+
The port number of the Kafka server.
|
162
|
+
|
163
|
+
server : str, optional
|
164
|
+
The name of the view server to use. Default uses the client instance.
|
165
|
+
|
166
|
+
Returns
|
167
|
+
-------
|
168
|
+
str
|
169
|
+
The GUID of the Kafka server element.
|
170
|
+
"""
|
171
|
+
|
172
|
+
body = {
|
173
|
+
"templateGUID": "5e1ff810-5418-43f7-b7c4-e6e062f9aff7",
|
174
|
+
"isOwnAnchor": 'true',
|
175
|
+
"placeholderPropertyValues": {
|
176
|
+
"serverName": kafka_server,
|
177
|
+
"hostIdentifier": host_name,
|
178
|
+
"portNumber": port
|
179
|
+
}
|
180
|
+
}
|
181
|
+
response = await self._async_create_element_from_template(body, server)
|
182
|
+
return response
|
183
|
+
|
184
|
+
def create_kafka_server_element_from_template(self, kafka_server: str, host_name: str, port: str,
|
185
|
+
server: str = None) -> str:
|
186
|
+
""" Create a Kafka server element from a template.
|
187
|
+
|
188
|
+
Parameters
|
189
|
+
----------
|
190
|
+
kafka_server : str
|
191
|
+
The name of the Kafka server.
|
192
|
+
|
193
|
+
host_name : str
|
194
|
+
The host name of the Kafka server.
|
195
|
+
|
196
|
+
port : str
|
197
|
+
The port number of the Kafka server.
|
198
|
+
|
199
|
+
server : str, optional
|
200
|
+
The name of the view server to use. Default uses the client instance.
|
201
|
+
|
202
|
+
Returns
|
203
|
+
-------
|
204
|
+
str
|
205
|
+
The GUID of the Kafka server element.
|
206
|
+
"""
|
207
|
+
loop = asyncio.get_event_loop()
|
208
|
+
response = loop.run_until_complete(
|
209
|
+
self._async_create_kafka_server_element_from_template(kafka_server, host_name, port, server)
|
210
|
+
)
|
211
|
+
return response
|
212
|
+
|
213
|
+
|
214
|
+
async def _async_create_postgres_server_element_from_template(self, postgres_server: str, host_name: str, port: str,
|
215
|
+
db_user: str, db_pwd: str, server: str = None) -> str:
|
216
|
+
""" Create a Postgres server element from a template. Async version.
|
217
|
+
|
218
|
+
Parameters
|
219
|
+
----------
|
220
|
+
postgres_server : str
|
221
|
+
The name of the Postgres server.
|
222
|
+
|
223
|
+
host_name : str
|
224
|
+
The host name of the Postgres server.
|
225
|
+
|
226
|
+
port : str
|
227
|
+
The port number of the Postgres server.
|
228
|
+
|
229
|
+
db_user: str
|
230
|
+
User name to connect to the database
|
231
|
+
|
232
|
+
db_pwd: str
|
233
|
+
User password to connect to the database
|
234
|
+
|
235
|
+
server : str, optional
|
236
|
+
The name of the view server to use. Default uses the client instance.
|
237
|
+
|
238
|
+
Returns
|
239
|
+
-------
|
240
|
+
str
|
241
|
+
The GUID of the Kafka server element.
|
242
|
+
"""
|
243
|
+
body = {
|
244
|
+
"templateGUID": "542134e6-b9ce-4dce-8aef-22e8daf34fdb",
|
245
|
+
"isOwnAnchor": 'true',
|
246
|
+
"placeholderPropertyValues": {
|
247
|
+
"serverName": postgres_server,
|
248
|
+
"hostIdentifier": host_name,
|
249
|
+
"portNumber": port,
|
250
|
+
"databaseUserId" : db_user,
|
251
|
+
"databasePassword": db_pwd
|
252
|
+
}
|
253
|
+
}
|
254
|
+
response = await self._async_create_element_from_template(body, server)
|
255
|
+
return response
|
256
|
+
|
257
|
+
def create_postgres_server_element_from_template(self, postgres_server: str, host_name: str, port: str,
|
258
|
+
db_user: str, db_pwd: str, server: str = None) -> str:
|
259
|
+
""" Create a Postgres server element from a template.
|
260
|
+
|
261
|
+
Parameters
|
262
|
+
----------
|
263
|
+
postgres_server : str
|
264
|
+
The name of the Postgres server.
|
265
|
+
|
266
|
+
host_name : str
|
267
|
+
The host name of the Postgres server.
|
268
|
+
|
269
|
+
port : str
|
270
|
+
The port number of the Postgres server.
|
271
|
+
|
272
|
+
server : str, optional
|
273
|
+
The name of the view server to use. Default uses the client instance.
|
274
|
+
|
275
|
+
db_user: str
|
276
|
+
User name to connect to the database
|
277
|
+
|
278
|
+
db_pwd: str
|
279
|
+
User password to connect to the database
|
280
|
+
|
281
|
+
Returns
|
282
|
+
-------
|
283
|
+
str
|
284
|
+
The GUID of the Postgres server element.
|
285
|
+
"""
|
286
|
+
loop = asyncio.get_event_loop()
|
287
|
+
response = loop.run_until_complete(
|
288
|
+
self._async_create_postgres_server_element_from_template(postgres_server,host_name,
|
289
|
+
port, db_user,db_pwd,server)
|
290
|
+
)
|
291
|
+
return response
|
292
|
+
|
293
|
+
#
|
294
|
+
# Engine Actions
|
295
|
+
#
|
296
|
+
async def _async_get_engine_actions(self, server: str = None, start_from: int = 0,
|
297
|
+
page_size: int = max_paging_size) -> list:
|
298
|
+
""" Retrieve the engine actions that are known to the server. Async version.
|
299
|
+
Parameters
|
300
|
+
----------
|
301
|
+
server : str, optional
|
302
|
+
The name of the server. If not provided, it uses the default server name.
|
303
|
+
start_from : int, optional
|
304
|
+
The starting index of the actions to retrieve. Default is 0.
|
305
|
+
page_size : int, optional
|
306
|
+
The maximum number of actions to retrieve per page. Default is the global maximum paging size.
|
307
|
+
|
308
|
+
Returns
|
309
|
+
-------
|
310
|
+
[dict]
|
311
|
+
A list of engine action descriptions as JSON.
|
312
|
+
|
313
|
+
Raises
|
314
|
+
------
|
315
|
+
InvalidParameterException
|
316
|
+
PropertyServerException
|
317
|
+
UserNotAuthorizedException
|
318
|
+
|
319
|
+
Notes
|
320
|
+
-----
|
321
|
+
For more information see: https://egeria-project.org/concepts/engine-action
|
322
|
+
"""
|
323
|
+
server = self.server_name if server is None else server
|
324
|
+
|
325
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/engine-actions?"
|
326
|
+
f"startFrom={start_from}&pageSize={page_size}")
|
327
|
+
|
328
|
+
response = await self._async_make_request("GET", url)
|
329
|
+
return response.json().get("elements", "No elements")
|
330
|
+
|
331
|
+
def get_engine_actions(self, server: str = None, start_from: int = 0, page_size: int = max_paging_size) -> list:
|
332
|
+
""" Retrieve the engine actions that are known to the server.
|
333
|
+
Parameters
|
334
|
+
----------
|
335
|
+
server : str, optional
|
336
|
+
The name of the server. If not provided, it uses the default server name.
|
337
|
+
start_from : int, optional
|
338
|
+
The starting index of the actions to retrieve. Default is 0.
|
339
|
+
page_size : int, optional
|
340
|
+
The maximum number of actions to retrieve per page. Default is the global maximum paging size.
|
341
|
+
|
342
|
+
Returns
|
343
|
+
-------
|
344
|
+
[dict]
|
345
|
+
A list of engine action descriptions as JSON.
|
346
|
+
|
347
|
+
Raises
|
348
|
+
------
|
349
|
+
InvalidParameterException
|
350
|
+
PropertyServerException
|
351
|
+
UserNotAuthorizedException
|
352
|
+
|
353
|
+
Notes
|
354
|
+
-----
|
355
|
+
For more information see: https://egeria-project.org/concepts/engine-action
|
356
|
+
"""
|
357
|
+
loop = asyncio.get_event_loop()
|
358
|
+
response = loop.run_until_complete(
|
359
|
+
self._async_get_engine_actions(server, start_from, page_size)
|
360
|
+
)
|
361
|
+
return response
|
362
|
+
|
363
|
+
async def _async_get_engine_action(self, engine_action_guid: str, server: str = None) -> dict:
|
364
|
+
""" Request the status and properties of an executing engine action request. Async version.
|
365
|
+
Parameters
|
366
|
+
----------
|
367
|
+
engine_action_guid : str
|
368
|
+
The GUID of the engine action to retrieve.
|
369
|
+
|
370
|
+
server : str, optional
|
371
|
+
The name of the server. If not provided, the default server name will be used.
|
372
|
+
|
373
|
+
Returns
|
374
|
+
-------
|
375
|
+
dict
|
376
|
+
The JSON representation of the engine action.
|
377
|
+
|
378
|
+
Raises
|
379
|
+
------
|
380
|
+
InvalidParameterException
|
381
|
+
PropertyServerException
|
382
|
+
UserNotAuthorizedException
|
383
|
+
|
384
|
+
Notes
|
385
|
+
-----
|
386
|
+
For more information see: https://egeria-project.org/concepts/engine-action
|
387
|
+
"""
|
388
|
+
server = self.server_name if server is None else server
|
389
|
+
|
390
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/engine-actions/"
|
391
|
+
f"{engine_action_guid}")
|
392
|
+
|
393
|
+
response = await self._async_make_request("GET", url)
|
394
|
+
return response.json().get("element", "No element found")
|
395
|
+
|
396
|
+
def get_engine_action(self, engine_action_guid: str, server: str = None) -> dict:
|
397
|
+
""" Request the status and properties of an executing engine action request.
|
398
|
+
Parameters
|
399
|
+
----------
|
400
|
+
engine_action_guid : str
|
401
|
+
The GUID of the engine action to retrieve.
|
402
|
+
|
403
|
+
server : str, optional
|
404
|
+
The name of the server. If not provided, the default server name will be used.
|
405
|
+
|
406
|
+
Returns
|
407
|
+
-------
|
408
|
+
dict
|
409
|
+
The JSON representation of the engine action.
|
410
|
+
|
411
|
+
Raises
|
412
|
+
------
|
413
|
+
InvalidParameterException
|
414
|
+
PropertyServerException
|
415
|
+
UserNotAuthorizedException
|
416
|
+
|
417
|
+
Notes
|
418
|
+
-----
|
419
|
+
For more information see: https://egeria-project.org/concepts/engine-action
|
420
|
+
"""
|
421
|
+
loop = asyncio.get_event_loop()
|
422
|
+
response = loop.run_until_complete(
|
423
|
+
self._async_get_engine_action(engine_action_guid, server)
|
424
|
+
)
|
425
|
+
return response
|
426
|
+
|
427
|
+
async def _async_cancel_engine_action(self, engine_action_guid: str, server: str = None) -> None:
|
428
|
+
""" Request that an engine action request is cancelled and any running governance service is stopped. Async Ver.
|
429
|
+
Parameters
|
430
|
+
----------
|
431
|
+
engine_action_guid : str
|
432
|
+
The GUID of the engine action to retrieve.
|
433
|
+
|
434
|
+
server : str, optional
|
435
|
+
The name of the server. If not provided, the default server name will be used.
|
436
|
+
|
437
|
+
Returns
|
438
|
+
-------
|
439
|
+
dict
|
440
|
+
The JSON representation of the engine action.
|
441
|
+
|
442
|
+
Raises
|
443
|
+
------
|
444
|
+
InvalidParameterException
|
445
|
+
PropertyServerException
|
446
|
+
UserNotAuthorizedException
|
447
|
+
|
448
|
+
Notes
|
449
|
+
-----
|
450
|
+
For more information see: https://egeria-project.org/concepts/engine-action
|
451
|
+
"""
|
452
|
+
server = self.server_name if server is None else server
|
453
|
+
validate_guid(engine_action_guid)
|
454
|
+
|
455
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/engine-actions/"
|
456
|
+
f"{engine_action_guid}/cancel")
|
457
|
+
|
458
|
+
await self._async_make_request("POST", url)
|
459
|
+
|
460
|
+
def cancel_engine_action(self, engine_action_guid: str, server: str = None) -> None:
|
461
|
+
""" Request that an engine action request is cancelled and any running governance service is stopped.
|
462
|
+
Parameters
|
463
|
+
----------
|
464
|
+
engine_action_guid : str
|
465
|
+
The GUID of the engine action to retrieve.
|
466
|
+
|
467
|
+
server : str, optional
|
468
|
+
The name of the server. If not provided, the default server name will be used.
|
469
|
+
|
470
|
+
Returns
|
471
|
+
-------
|
472
|
+
dict
|
473
|
+
The JSON representation of the engine action.
|
474
|
+
|
475
|
+
Raises
|
476
|
+
------
|
477
|
+
InvalidParameterException
|
478
|
+
PropertyServerException
|
479
|
+
UserNotAuthorizedException
|
480
|
+
|
481
|
+
Notes
|
482
|
+
-----
|
483
|
+
For more information see: https://egeria-project.org/concepts/engine-action
|
484
|
+
"""
|
485
|
+
loop = asyncio.get_event_loop()
|
486
|
+
loop.run_until_complete(
|
487
|
+
self._async_cancel_engine_action(engine_action_guid, server))
|
488
|
+
return
|
489
|
+
|
490
|
+
async def _async_get_active_engine_actions(self, server: str = None, start_from: int = 0,
|
491
|
+
page_size: int = max_paging_size) -> list | str:
|
492
|
+
""" Retrieve the engine actions that are still in process. Async Version.
|
493
|
+
|
494
|
+
Parameters:
|
495
|
+
----------
|
496
|
+
server : str, optional
|
497
|
+
The name of the server. If not provided, it uses the default server name.
|
498
|
+
start_from : int, optional
|
499
|
+
The starting index of the actions to retrieve. Default is 0.
|
500
|
+
page_size : int, optional
|
501
|
+
The maximum number of actions to retrieve per page. Default is the global maximum paging size.
|
502
|
+
|
503
|
+
Returns:
|
504
|
+
-------
|
505
|
+
List[dict]: A list of JSON representations of governance action processes matching the provided name.
|
506
|
+
|
507
|
+
Raises:
|
508
|
+
------
|
509
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
510
|
+
this exception is raised with details from the response content.
|
511
|
+
|
512
|
+
Notes
|
513
|
+
-----
|
514
|
+
For more information see: https://egeria-project.org/concepts/engine-action
|
515
|
+
|
516
|
+
"""
|
517
|
+
server = self.server_name if server is None else server
|
518
|
+
|
519
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/engine-actions/active?"
|
520
|
+
f"startFrom={start_from}&pageSize={page_size}")
|
521
|
+
|
522
|
+
response = await self._async_make_request("GET", url)
|
523
|
+
return response.json().get("elements", "no actions")
|
524
|
+
|
525
|
+
def get_active_engine_actions(self, server: str = None, start_from: int = 0, page_size: int = 0) -> list | str:
|
526
|
+
""" Retrieve the engine actions that are still in process.
|
527
|
+
|
528
|
+
Parameters:
|
529
|
+
----------
|
530
|
+
server : str, optional
|
531
|
+
The name of the server. If not provided, it uses the default server name.
|
532
|
+
start_from : int, optional
|
533
|
+
The starting index of the actions to retrieve. Default is 0.
|
534
|
+
page_size : int, optional
|
535
|
+
The maximum number of actions to retrieve per page. Default is the global maximum paging size.
|
536
|
+
|
537
|
+
Returns
|
538
|
+
-------
|
539
|
+
List[dict]: A list of JSON representations of governance action processes matching the provided name.
|
540
|
+
|
541
|
+
Raises
|
542
|
+
------
|
543
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
544
|
+
this exception is raised with details from the response content.
|
545
|
+
Notes
|
546
|
+
-----
|
547
|
+
For more information see: https://egeria-project.org/concepts/engine-action
|
548
|
+
|
549
|
+
"""
|
550
|
+
loop = asyncio.get_event_loop()
|
551
|
+
response = loop.run_until_complete(
|
552
|
+
self._async_get_active_engine_actions(server, start_from, page_size)
|
553
|
+
)
|
554
|
+
return response
|
555
|
+
|
556
|
+
async def _async_get_engine_actions_by_name(self, name: str, server: str = None, start_from: int = 0,
|
557
|
+
page_size: int = max_paging_size) -> list | str:
|
558
|
+
""" Retrieve the list of engine action metadata elements with a matching qualified or display name.
|
559
|
+
There are no wildcards supported on this request. Async Version.
|
560
|
+
Parameters
|
561
|
+
----------
|
562
|
+
name : str
|
563
|
+
The name of the engine action to retrieve.
|
564
|
+
server : str, optional
|
565
|
+
The name of the server to retrieve the engine action from. If not provided, the default server specified in the instance will be used.
|
566
|
+
start_from : int, optional
|
567
|
+
The index to start retrieving engine actions from. If not provided, the default value will be used.
|
568
|
+
page_size : int, optional
|
569
|
+
The maximum number of engine actions to retrieve in a single request. If not provided, the default global maximum paging size will be used.
|
570
|
+
|
571
|
+
Returns
|
572
|
+
-------
|
573
|
+
list of dict | str
|
574
|
+
A list of dictionaries representing the retrieved engine actions, or "no actions" if no engine actions were found with the given name.
|
575
|
+
Raises:
|
576
|
+
------
|
577
|
+
InvalidParameterException
|
578
|
+
PropertyServerException
|
579
|
+
UserNotAuthorizedException
|
580
|
+
|
581
|
+
Notes
|
582
|
+
-----
|
583
|
+
For more information see: https://egeria-project.org/concepts/engine-action
|
584
|
+
|
585
|
+
"""
|
586
|
+
server = self.server_name if server is None else server
|
587
|
+
validate_name(name)
|
588
|
+
|
589
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/engine-actions/by-name?"
|
590
|
+
f"startFrom={start_from}&pageSize={page_size}")
|
591
|
+
body = {
|
592
|
+
"string": name
|
593
|
+
}
|
594
|
+
response = await self._async_make_request("POST", url, body)
|
595
|
+
return response.json().get("elements", "no actions")
|
596
|
+
|
597
|
+
def get_engine_actions_by_name(self, name: str, server: str = None, start_from: int = 0,
|
598
|
+
page_size: int = max_paging_size) -> list | str:
|
599
|
+
""" Retrieve the list of engine action metadata elements with a matching qualified or display name.
|
600
|
+
There are no wildcards supported on this request.
|
601
|
+
|
602
|
+
Parameters
|
603
|
+
----------
|
604
|
+
name : str
|
605
|
+
The name of the engine action to retrieve.
|
606
|
+
server : str, optional
|
607
|
+
The name of the server to retrieve the engine action from. If not provided, the default server specified in the instance will be used.
|
608
|
+
start_from : int, optional
|
609
|
+
The index to start retrieving engine actions from. If not provided, the default value will be used.
|
610
|
+
page_size : int, optional
|
611
|
+
The maximum number of engine actions to retrieve in a single request. If not provided, the default global maximum paging size will be used.
|
612
|
+
|
613
|
+
Returns
|
614
|
+
-------
|
615
|
+
list of dict | str
|
616
|
+
A list of dictionaries representing the retrieved engine actions, or "no actions" if no engine actions were found with the given name.
|
617
|
+
Raises:
|
618
|
+
------
|
619
|
+
InvalidParameterException
|
620
|
+
PropertyServerException
|
621
|
+
UserNotAuthorizedException
|
622
|
+
|
623
|
+
Notes
|
624
|
+
-----
|
625
|
+
For more information see: https://egeria-project.org/concepts/engine-action
|
626
|
+
|
627
|
+
"""
|
628
|
+
loop = asyncio.get_event_loop()
|
629
|
+
response = loop.run_until_complete(
|
630
|
+
self._async_get_engine_actions_by_name(name, server, start_from, page_size)
|
631
|
+
)
|
632
|
+
return response
|
633
|
+
|
634
|
+
async def _async_find_engine_actions(self, search_string: str, server: str = None, starts_with: bool = False,
|
635
|
+
ends_with: bool = False, ignore_case: bool = False, start_from: int = 0,
|
636
|
+
page_size: int = max_paging_size) -> list | str:
|
637
|
+
""" Retrieve the list of engine action metadata elements that contain the search string. Async Version.
|
638
|
+
Parameters
|
639
|
+
----------
|
640
|
+
search_string : str
|
641
|
+
The string used for searching engine actions by name.
|
642
|
+
|
643
|
+
server : str, optional
|
644
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
645
|
+
|
646
|
+
starts_with : bool, optional
|
647
|
+
Whether to search engine actions that start with the given search string. Default is False.
|
648
|
+
|
649
|
+
ends_with : bool, optional
|
650
|
+
Whether to search engine actions that end with the given search string. Default is False.
|
651
|
+
|
652
|
+
ignore_case : bool, optional
|
653
|
+
Whether to ignore case while searching engine actions. Default is False.
|
654
|
+
|
655
|
+
start_from : int, optional
|
656
|
+
The index from which to start fetching the engine actions. Default is 0.
|
657
|
+
|
658
|
+
page_size : int, optional
|
659
|
+
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
660
|
+
|
661
|
+
Returns
|
662
|
+
-------
|
663
|
+
List[dict] or str
|
664
|
+
A list of dictionaries representing the engine actions found based on the search query.
|
665
|
+
If no actions are found, returns the string "no actions".
|
666
|
+
|
667
|
+
Raises:
|
668
|
+
------
|
669
|
+
InvalidParameterException
|
670
|
+
PropertyServerException
|
671
|
+
UserNotAuthorizedException
|
672
|
+
|
673
|
+
Notes
|
674
|
+
-----
|
675
|
+
For more information see: https://egeria-project.org/concepts/engine-action
|
676
|
+
"""
|
677
|
+
server = self.server_name if server is None else server
|
678
|
+
validate_search_string(search_string)
|
679
|
+
if search_string == "*":
|
680
|
+
search_string = None
|
681
|
+
starts_with_s = str(starts_with).lower()
|
682
|
+
ends_with_s = str(ends_with).lower()
|
683
|
+
ignore_case_s = str(ignore_case).lower()
|
684
|
+
|
685
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/engine-actions/"
|
686
|
+
f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
687
|
+
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}"
|
688
|
+
)
|
689
|
+
body = {
|
690
|
+
"class": "SearchStringRequestBody",
|
691
|
+
"name": search_string
|
692
|
+
}
|
693
|
+
response = await self._async_make_request("POST", url, body)
|
694
|
+
return response.json().get("elements", "no actions")
|
695
|
+
|
696
|
+
def find_engine_actions(self, search_string: str = "*", server: str = None, starts_with: bool = False,
|
697
|
+
ends_with: bool = False, ignore_case: bool = False, start_from: int = 0,
|
698
|
+
page_size: int = max_paging_size) -> list | str:
|
699
|
+
""" Retrieve the list of engine action metadata elements that contain the search string.
|
700
|
+
Parameters
|
701
|
+
----------
|
702
|
+
search_string : str
|
703
|
+
The string used for searching engine actions by name.
|
704
|
+
|
705
|
+
server : str, optional
|
706
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
707
|
+
|
708
|
+
starts_with : bool, optional
|
709
|
+
Whether to search engine actions that start with the given search string. Default is False.
|
710
|
+
|
711
|
+
ends_with : bool, optional
|
712
|
+
Whether to search engine actions that end with the given search string. Default is False.
|
713
|
+
|
714
|
+
ignore_case : bool, optional
|
715
|
+
Whether to ignore case while searching engine actions. Default is False.
|
716
|
+
|
717
|
+
start_from : int, optional
|
718
|
+
The index from which to start fetching the engine actions. Default is 0.
|
719
|
+
|
720
|
+
page_size : int, optional
|
721
|
+
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
722
|
+
|
723
|
+
Returns
|
724
|
+
-------
|
725
|
+
List[dict] or str
|
726
|
+
A list of dictionaries representing the engine actions found based on the search query.
|
727
|
+
If no actions are found, returns the string "no actions".
|
728
|
+
|
729
|
+
Raises:
|
730
|
+
------
|
731
|
+
InvalidParameterException
|
732
|
+
PropertyServerException
|
733
|
+
UserNotAuthorizedException
|
734
|
+
|
735
|
+
Notes
|
736
|
+
-----
|
737
|
+
For more information see: https://egeria-project.org/concepts/engine-action
|
738
|
+
"""
|
739
|
+
|
740
|
+
loop = asyncio.get_event_loop()
|
741
|
+
response = loop.run_until_complete(
|
742
|
+
self._async_find_engine_actions(search_string, server, starts_with,
|
743
|
+
ends_with, ignore_case, start_from,
|
744
|
+
page_size)
|
745
|
+
)
|
746
|
+
return response
|
747
|
+
|
748
|
+
#
|
749
|
+
# Governance action processes
|
750
|
+
#
|
751
|
+
|
752
|
+
async def _async_get_governance_action_process_by_guid(self, process_guid: str, server: str = None) -> dict | str:
|
753
|
+
""" Retrieve the governance action process metadata element with the supplied unique identifier. Async Version.
|
754
|
+
|
755
|
+
Parameters:
|
756
|
+
----------
|
757
|
+
process_guid: str
|
758
|
+
The GUID (Globally Unique Identifier) of the governance action process.
|
759
|
+
server: str, optional
|
760
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
761
|
+
|
762
|
+
Returns:
|
763
|
+
-------
|
764
|
+
dict: The JSON representation of the governance action process element.
|
765
|
+
|
766
|
+
Raises:
|
767
|
+
------
|
768
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
769
|
+
this exception is raised with details from the response content.
|
770
|
+
PropertyServerException: If the API response indicates a server side error.
|
771
|
+
UserNotAuthorizedException:
|
772
|
+
"""
|
773
|
+
|
774
|
+
server = self.server_name if server is None else server
|
775
|
+
validate_guid(process_guid)
|
776
|
+
|
777
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/"
|
778
|
+
f"governance-action-processes/{process_guid}")
|
779
|
+
|
780
|
+
response = await self._async_make_request("GET", url)
|
781
|
+
return response.json().get("element", "no actions")
|
782
|
+
|
783
|
+
def get_governance_action_process_by_guid(self, process_guid: str, server: str = None) -> dict | str:
|
784
|
+
""" Retrieve the governance action process metadata element with the supplied unique identifier.
|
785
|
+
|
786
|
+
Parameters:
|
787
|
+
----------
|
788
|
+
process_guid: str
|
789
|
+
The GUID (Globally Unique Identifier) of the governance action process.
|
790
|
+
server: str, optional
|
791
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
792
|
+
Returns:
|
793
|
+
-------
|
794
|
+
dict: The JSON representation of the governance action process element.
|
795
|
+
|
796
|
+
Raises:
|
797
|
+
------
|
798
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
799
|
+
this exception is raised with details from the response content.
|
800
|
+
PropertyServerException: If the API response indicates a server side error.
|
801
|
+
UserNotAuthorizedException:
|
802
|
+
"""
|
803
|
+
loop = asyncio.get_event_loop()
|
804
|
+
response = loop.run_until_complete(
|
805
|
+
self._async_get_governance_action_process_by_guid(process_guid, server)
|
806
|
+
)
|
807
|
+
return response
|
808
|
+
|
809
|
+
async def _async_gov_action_process_graph(self, process_guid: str, server: str = None) -> dict | str:
|
810
|
+
""" Retrieve the governance action process metadata element with the supplied unique
|
811
|
+
identifier along with the flow definition describing its implementation. Async Version.
|
812
|
+
Parameters
|
813
|
+
----------
|
814
|
+
process_guid : str
|
815
|
+
The process GUID to retrieve the graph for.
|
816
|
+
server : str, optional
|
817
|
+
The name of the server to retrieve the graph from. If not provided, the default server name will be used.
|
818
|
+
|
819
|
+
Returns
|
820
|
+
-------
|
821
|
+
dict or str
|
822
|
+
A dictionary representing the graph of the governance action process, or the string "no actions"
|
823
|
+
if no actions are found.
|
824
|
+
Raises:
|
825
|
+
------
|
826
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
827
|
+
this exception is raised with details from the response content.
|
828
|
+
PropertyServerException: If the API response indicates a server side error.
|
829
|
+
UserNotAuthorizedException:
|
830
|
+
|
831
|
+
"""
|
832
|
+
server = self.server_name if server is None else server
|
833
|
+
validate_guid(process_guid)
|
834
|
+
|
835
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/"
|
836
|
+
f"governance-action-processes/{process_guid}/graph")
|
837
|
+
|
838
|
+
response = await self._async_make_request("GET", url)
|
839
|
+
return response.json().get("element", "no actions")
|
840
|
+
|
841
|
+
def gov_action_process_graph(self, process_guid: str, server: str = None) -> dict | str:
|
842
|
+
""" Retrieve the governance action process metadata element with the supplied unique
|
843
|
+
identifier along with the flow definition describing its implementation.
|
844
|
+
Parameters
|
845
|
+
----------
|
846
|
+
process_guid : str
|
847
|
+
The process GUID to retrieve the graph for.
|
848
|
+
server : str, optional
|
849
|
+
The name of the server to retrieve the graph from. If not provided, the default server name will be used.
|
850
|
+
|
851
|
+
Returns
|
852
|
+
-------
|
853
|
+
dict or str
|
854
|
+
A dictionary representing the graph of the governance action process, or the string "no actions"
|
855
|
+
if no actions are found.
|
856
|
+
Raises:
|
857
|
+
------
|
858
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
859
|
+
this exception is raised with details from the response content.
|
860
|
+
PropertyServerException: If the API response indicates a server side error.
|
861
|
+
UserNotAuthorizedException:
|
862
|
+
|
863
|
+
"""
|
864
|
+
loop = asyncio.get_event_loop()
|
865
|
+
response = loop.run_until_complete(
|
866
|
+
self._async_get_gov_action_process_graph(process_guid, server)
|
867
|
+
)
|
868
|
+
return response
|
869
|
+
|
870
|
+
async def _async_get_gov_action_processes_by_name(self, name: str, server: str = None, start_from: int = None,
|
871
|
+
page_size: int = max_paging_size) -> list | str:
|
872
|
+
""" Retrieve the list of governance action process metadata elements with a matching qualified or display name.
|
873
|
+
There are no wildcards supported on this request. Async Version.
|
874
|
+
|
875
|
+
Parameters
|
876
|
+
----------
|
877
|
+
name : str
|
878
|
+
The name of the engine action to retrieve.
|
879
|
+
server : str, optional
|
880
|
+
The name of the server to retrieve the engine action from. If not provided, the default server specified in the instance will be used.
|
881
|
+
start_from : int, optional
|
882
|
+
The index to start retrieving engine actions from. If not provided, the default value will be used.
|
883
|
+
page_size : int, optional
|
884
|
+
The maximum number of engine actions to retrieve in a single request. If not provided, the default global maximum paging size will be used.
|
885
|
+
|
886
|
+
Returns
|
887
|
+
-------
|
888
|
+
list of dict | str
|
889
|
+
A list of dictionaries representing the retrieved engine actions,
|
890
|
+
or "no actions" if no engine actions were found with the given name.
|
891
|
+
Raises:
|
892
|
+
------
|
893
|
+
InvalidParameterException
|
894
|
+
PropertyServerException
|
895
|
+
UserNotAuthorizedException
|
896
|
+
"""
|
897
|
+
server = self.server_name if server is None else server
|
898
|
+
validate_name(name)
|
899
|
+
|
900
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-action-processes/"
|
901
|
+
f"by-name?startFrom={start_from}&pageSize={page_size}")
|
902
|
+
body = {
|
903
|
+
"class": "NameRequestBody",
|
904
|
+
"name": name
|
905
|
+
}
|
906
|
+
response = await self._async_make_request("GET", url, body)
|
907
|
+
return response.json().get("elements", "no actions")
|
908
|
+
|
909
|
+
def get_gov_action_processes_by_name(self, name: str, server: str = None, start_from: int = 0,
|
910
|
+
page_size: int = max_paging_size) -> list | str:
|
911
|
+
""" Retrieve the list of governance action process metadata elements with a matching qualified or display name.
|
912
|
+
There are no wildcards supported on this request.
|
913
|
+
|
914
|
+
Parameters
|
915
|
+
----------
|
916
|
+
name : str
|
917
|
+
The name of the engine action to retrieve.
|
918
|
+
server : str, optional
|
919
|
+
The name of the server to retrieve the engine action from. If not provided, the default server specified in the instance will be used.
|
920
|
+
start_from : int, optional
|
921
|
+
The index to start retrieving engine actions from. If not provided, the default value will be used.
|
922
|
+
page_size : int, optional
|
923
|
+
The maximum number of engine actions to retrieve in a single request. If not provided, the default global maximum paging size will be used.
|
924
|
+
|
925
|
+
Returns
|
926
|
+
-------
|
927
|
+
list of dict | str
|
928
|
+
A list of dictionaries representing the retrieved engine actions,
|
929
|
+
or "no actions" if no engine actions were found with the given name.
|
930
|
+
Raises:
|
931
|
+
------
|
932
|
+
InvalidParameterException
|
933
|
+
PropertyServerException
|
934
|
+
UserNotAuthorizedException
|
935
|
+
"""
|
936
|
+
loop = asyncio.get_event_loop()
|
937
|
+
response = loop.run_until_complete(
|
938
|
+
self._async_get_gov_action_processes_by_name(name, server, start_from, page_size)
|
939
|
+
)
|
940
|
+
return response
|
941
|
+
|
942
|
+
async def _async_find_gov_action_processes(self, search_string: str, server: str = None, starts_with: bool = False,
|
943
|
+
ends_with: bool = False, ignore_case: bool = False, start_from: int = 0,
|
944
|
+
page_size: int = max_paging_size) -> list | str:
|
945
|
+
""" Retrieve the list of governance action process metadata elements that contain the search string. Async ver.
|
946
|
+
|
947
|
+
Parameters
|
948
|
+
----------
|
949
|
+
search_string : str
|
950
|
+
The string used for searching engine actions by name.
|
951
|
+
|
952
|
+
server : str, optional
|
953
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
954
|
+
|
955
|
+
starts_with : bool, optional
|
956
|
+
Whether to search engine actions that start with the given search string. Default is False.
|
957
|
+
|
958
|
+
ends_with : bool, optional
|
959
|
+
Whether to search engine actions that end with the given search string. Default is False.
|
960
|
+
|
961
|
+
ignore_case : bool, optional
|
962
|
+
Whether to ignore case while searching engine actions. Default is False.
|
963
|
+
|
964
|
+
start_from : int, optional
|
965
|
+
The index from which to start fetching the engine actions. Default is 0.
|
966
|
+
|
967
|
+
page_size : int, optional
|
968
|
+
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
969
|
+
|
970
|
+
Returns
|
971
|
+
-------
|
972
|
+
List[dict] or str
|
973
|
+
A list of dictionaries representing the governance action processes found based on the search query.
|
974
|
+
If no actions are found, returns the string "no actions".
|
975
|
+
|
976
|
+
Raises:
|
977
|
+
------
|
978
|
+
InvalidParameterException
|
979
|
+
PropertyServerException
|
980
|
+
UserNotAuthorizedException
|
981
|
+
"""
|
982
|
+
server = self.server_name if server is None else server
|
983
|
+
validate_search_string(search_string)
|
984
|
+
if search_string == "*":
|
985
|
+
search_string = None
|
986
|
+
starts_with_s = str(starts_with).lower()
|
987
|
+
ends_with_s = str(ends_with).lower()
|
988
|
+
ignore_case_s = str(ignore_case).lower()
|
989
|
+
|
990
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-action-process/"
|
991
|
+
f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
992
|
+
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}"
|
993
|
+
)
|
994
|
+
body = {
|
995
|
+
"class": "SearchStringRequestBody",
|
996
|
+
"name": search_string
|
997
|
+
}
|
998
|
+
response = await self._async_make_request("GET", url, body)
|
999
|
+
return response.json().get("elements", "no actions")
|
1000
|
+
|
1001
|
+
def find_gov_action_processes(self, search_string: str = "*", server: str = None, starts_with: bool = False,
|
1002
|
+
ends_with: bool = False, ignore_case: bool = False, start_from: int = 0,
|
1003
|
+
page_size: int = max_paging_size) -> list | str:
|
1004
|
+
""" Retrieve the list of governance action process metadata elements that contain the search string.
|
1005
|
+
|
1006
|
+
Parameters
|
1007
|
+
----------
|
1008
|
+
search_string : str
|
1009
|
+
The string used for searching engine actions by name.
|
1010
|
+
|
1011
|
+
server : str, optional
|
1012
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1013
|
+
|
1014
|
+
starts_with : bool, optional
|
1015
|
+
Whether to search engine actions that start with the given search string. Default is False.
|
1016
|
+
|
1017
|
+
ends_with : bool, optional
|
1018
|
+
Whether to search engine actions that end with the given search string. Default is False.
|
1019
|
+
|
1020
|
+
ignore_case : bool, optional
|
1021
|
+
Whether to ignore case while searching engine actions. Default is False.
|
1022
|
+
|
1023
|
+
start_from : int, optional
|
1024
|
+
The index from which to start fetching the engine actions. Default is 0.
|
1025
|
+
|
1026
|
+
page_size : int, optional
|
1027
|
+
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
1028
|
+
|
1029
|
+
Returns
|
1030
|
+
-------
|
1031
|
+
List[dict] or str
|
1032
|
+
A list of dictionaries representing the governance action processes found based on the search query.
|
1033
|
+
If no actions are found, returns the string "no actions".
|
1034
|
+
|
1035
|
+
Raises:
|
1036
|
+
------
|
1037
|
+
InvalidParameterException
|
1038
|
+
PropertyServerException
|
1039
|
+
UserNotAuthorizedException
|
1040
|
+
"""
|
1041
|
+
|
1042
|
+
loop = asyncio.get_event_loop()
|
1043
|
+
response = loop.run_until_complete(
|
1044
|
+
self._async_get_gov_action_processes(search_string, server, starts_with, ends_with, ignore_case,
|
1045
|
+
start_from, page_size)
|
1046
|
+
)
|
1047
|
+
return response
|
1048
|
+
|
1049
|
+
async def _async_initiate_gov_action_process(self, action_type_qualified_name: str, request_source_guids: [str],
|
1050
|
+
action_targets: list, start_time: datetime, request_parameters: dict,
|
1051
|
+
orig_service_name: str, orig_engine_name: str,
|
1052
|
+
server: str = None) -> str:
|
1053
|
+
""" Using the named governance action process as a template, initiate a chain of engine actions. Async version.
|
1054
|
+
|
1055
|
+
Parameters
|
1056
|
+
----------
|
1057
|
+
action_type_qualified_name: str
|
1058
|
+
- unique name for the governance process
|
1059
|
+
request_source_guids: [str]
|
1060
|
+
- request source elements for the resulting governance action service
|
1061
|
+
action_targets: [str]
|
1062
|
+
-list of action target names to GUIDs for the resulting governance action service
|
1063
|
+
start_time: datetime
|
1064
|
+
- time to start the process
|
1065
|
+
request_parameters: [str]
|
1066
|
+
- parameters passed into the process
|
1067
|
+
orig_service_name: str
|
1068
|
+
- unique name of the requesting governance service (if initiated by a governance engine)
|
1069
|
+
orig_engine_name: str
|
1070
|
+
- optional unique name of the governance engine (if initiated by a governance engine).
|
1071
|
+
|
1072
|
+
Returns
|
1073
|
+
-------
|
1074
|
+
Unique id (guid) of the newly started governance engine process
|
1075
|
+
|
1076
|
+
Raises
|
1077
|
+
------
|
1078
|
+
InvalidParameterException
|
1079
|
+
PropertyServerException
|
1080
|
+
UserNotAuthorizedException
|
1081
|
+
|
1082
|
+
"""
|
1083
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-action-processes/"
|
1084
|
+
f"initiate")
|
1085
|
+
body = {
|
1086
|
+
"class": "GovernanceActionProcessRequestBody",
|
1087
|
+
"processQualifiedName": action_type_qualified_name,
|
1088
|
+
"requestSourceGUIDs": request_source_guids,
|
1089
|
+
"actionTargets": action_targets,
|
1090
|
+
"startTime": int(start_time.timestamp() * 1000),
|
1091
|
+
"requestParameters": request_parameters,
|
1092
|
+
"originatorServiceName": orig_service_name,
|
1093
|
+
"originatorEngineName": orig_engine_name
|
1094
|
+
}
|
1095
|
+
new_body = body_slimmer(body)
|
1096
|
+
response = await self._async_make_request("POST", url, new_body)
|
1097
|
+
return response.json().get("guid", "Action not initiated")
|
1098
|
+
|
1099
|
+
def initiate_governance_action_process(self, action_type_qualified_name: str, request_source_guids: [str],
|
1100
|
+
action_targets: [str], start_time: datetime, request_parameters: dict,
|
1101
|
+
orig_service_name: str, orig_engine_name: str, server: str = None) -> str:
|
1102
|
+
""" Using the named governance action process as a template, initiate a chain of engine actions.
|
1103
|
+
|
1104
|
+
Parameters
|
1105
|
+
----------
|
1106
|
+
action_type_qualified_name: str
|
1107
|
+
- unique name for the governance process
|
1108
|
+
request_source_guids: [str]
|
1109
|
+
- request source elements for the resulting governance action service
|
1110
|
+
action_targets: [str]
|
1111
|
+
-list of action target names to GUIDs for the resulting governance action service
|
1112
|
+
start_time: datetime
|
1113
|
+
- time to start the process
|
1114
|
+
request_parameters: [str]
|
1115
|
+
- parameters passed into the process
|
1116
|
+
orig_service_name: str
|
1117
|
+
- unique name of the requesting governance service (if initiated by a governance engine)
|
1118
|
+
orig_engine_name: str
|
1119
|
+
- optional unique name of the governance engine (if initiated by a governance engine).
|
1120
|
+
|
1121
|
+
Returns
|
1122
|
+
-------
|
1123
|
+
Unique id (guid) of the newly started governance engine process
|
1124
|
+
|
1125
|
+
Raises
|
1126
|
+
------
|
1127
|
+
InvalidParameterException
|
1128
|
+
PropertyServerException
|
1129
|
+
UserNotAuthorizedException
|
1130
|
+
|
1131
|
+
"""
|
1132
|
+
loop = asyncio.get_event_loop()
|
1133
|
+
response = loop.run_until_complete(
|
1134
|
+
self._async_initiate_gov_action_process(action_type_qualified_name, request_source_guids,
|
1135
|
+
action_targets, start_time, request_parameters,
|
1136
|
+
orig_service_name, orig_engine_name, server)
|
1137
|
+
)
|
1138
|
+
return response
|
1139
|
+
|
1140
|
+
async def _async_get_gov_action_type_by_guid(self, gov_action_type_guid: str, server: str = None) -> dict | str:
|
1141
|
+
""" Retrieve the governance action type metadata element with the supplied unique identifier. Async version.
|
1142
|
+
|
1143
|
+
Parameters:
|
1144
|
+
----------
|
1145
|
+
gov_action_type_guid: str
|
1146
|
+
The GUID (Globally Unique Identifier) of the governance action type to retrieve.
|
1147
|
+
server: str, optional
|
1148
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1149
|
+
Returns:
|
1150
|
+
-------
|
1151
|
+
dict: The JSON representation of the governance action type element.
|
1152
|
+
|
1153
|
+
Raises:
|
1154
|
+
------
|
1155
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1156
|
+
this exception is raised with details from the response content.
|
1157
|
+
PropertyServerException: If the API response indicates a server side error.
|
1158
|
+
UserNotAuthorizedException:
|
1159
|
+
"""
|
1160
|
+
server = self.server_name if server is None else server
|
1161
|
+
validate_guid(gov_action_type_guid)
|
1162
|
+
|
1163
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/"
|
1164
|
+
f"governance-action-types/{gov_action_type_guid}")
|
1165
|
+
|
1166
|
+
response = await self._async_make_request("GET", url)
|
1167
|
+
return response.json().get("element", "no actions")
|
1168
|
+
|
1169
|
+
def get_gov_action_type_by_guid(self, gov_action_type_guid: str, server: str = None) -> dict | str:
|
1170
|
+
""" Retrieve the governance action type metadata element with the supplied unique identifier.
|
1171
|
+
|
1172
|
+
Parameters:
|
1173
|
+
----------
|
1174
|
+
gov_action_type_guid: str
|
1175
|
+
The GUID (Globally Unique Identifier) of the governance action type to retrieve.
|
1176
|
+
server: str, optional
|
1177
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1178
|
+
Returns:
|
1179
|
+
-------
|
1180
|
+
dict: The JSON representation of the governance action type element.
|
1181
|
+
|
1182
|
+
Raises:
|
1183
|
+
------
|
1184
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1185
|
+
this exception is raised with details from the response content.
|
1186
|
+
PropertyServerException: If the API response indicates a server side error.
|
1187
|
+
UserNotAuthorizedException:
|
1188
|
+
"""
|
1189
|
+
loop = asyncio.get_event_loop()
|
1190
|
+
response = loop.run_until_complete(
|
1191
|
+
self._async_get_gov_action_type_by_guid(gov_action_type_guid, server)
|
1192
|
+
)
|
1193
|
+
return response
|
1194
|
+
|
1195
|
+
async def _async_get_gov_action_types_by_name(self, action_type_name, server: str = None,
|
1196
|
+
start_from: int = 0, page_size: int = max_paging_size) -> list | str:
|
1197
|
+
""" Retrieve the list of governance action type metadata elements with a matching qualified or display name.
|
1198
|
+
There are no wildcards supported on this request. Async version.
|
1199
|
+
|
1200
|
+
Parameters:
|
1201
|
+
----------
|
1202
|
+
action_type_name: str
|
1203
|
+
The name of the governance action type to retrieve.
|
1204
|
+
server: str, optional
|
1205
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1206
|
+
Returns:
|
1207
|
+
-------
|
1208
|
+
dict: The JSON representation of the governance action type element.
|
1209
|
+
|
1210
|
+
Raises:
|
1211
|
+
------
|
1212
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1213
|
+
this exception is raised with details from the response content.
|
1214
|
+
PropertyServerException: If the API response indicates a server side error.
|
1215
|
+
UserNotAuthorizedException:
|
1216
|
+
"""
|
1217
|
+
server = self.server_name if server is None else server
|
1218
|
+
validate_name(action_type_name)
|
1219
|
+
|
1220
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/"
|
1221
|
+
f"governance-action-types/by-name?startFrom={start_from}&pageSize={page_size}")
|
1222
|
+
|
1223
|
+
body = {
|
1224
|
+
"class": "NameRequestBody",
|
1225
|
+
"name": action_type_name
|
1226
|
+
}
|
1227
|
+
|
1228
|
+
response = await self._async_make_request("POST", url, body)
|
1229
|
+
return response.json().get("elements", "no actions")
|
1230
|
+
|
1231
|
+
def get_gov_action_types_by_name(self, action_type_name, server: str = None,
|
1232
|
+
start_from: int = 0, page_size: int = max_paging_size) -> list | str:
|
1233
|
+
""" Retrieve the list of governance action type metadata elements with a matching qualified or display name.
|
1234
|
+
There are no wildcards supported on this request. Async version.
|
1235
|
+
|
1236
|
+
Parameters:
|
1237
|
+
----------
|
1238
|
+
action_type_name: str
|
1239
|
+
The name of the governance action type to retrieve.
|
1240
|
+
server: str, optional
|
1241
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1242
|
+
Returns:
|
1243
|
+
-------
|
1244
|
+
dict: The JSON representation of the governance action type element.
|
1245
|
+
|
1246
|
+
Raises:
|
1247
|
+
------
|
1248
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1249
|
+
this exception is raised with details from the response content.
|
1250
|
+
PropertyServerException: If the API response indicates a server side error.
|
1251
|
+
UserNotAuthorizedException:
|
1252
|
+
"""
|
1253
|
+
loop = asyncio.get_event_loop()
|
1254
|
+
response = loop.run_until_complete(
|
1255
|
+
self._async_get_gov_action_types_by_name(action_type_name, server,
|
1256
|
+
start_from, page_size)
|
1257
|
+
)
|
1258
|
+
return response
|
1259
|
+
|
1260
|
+
async def _async_find_gov_action_types(self, search_string: str = "*", server: str = None,
|
1261
|
+
starts_with: bool = False,
|
1262
|
+
ends_with: bool = False, ignore_case: bool = False, start_from: int = 0,
|
1263
|
+
page_size: int = max_paging_size) -> list | str:
|
1264
|
+
""" Retrieve the list of governance action type metadata elements that contain the search string.
|
1265
|
+
Async Version.
|
1266
|
+
|
1267
|
+
Parameters
|
1268
|
+
----------
|
1269
|
+
search_string : str
|
1270
|
+
The string used for searching engine actions by name.
|
1271
|
+
|
1272
|
+
server : str, optional
|
1273
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1274
|
+
|
1275
|
+
starts_with : bool, optional
|
1276
|
+
Whether to search engine actions that start with the given search string. Default is False.
|
1277
|
+
|
1278
|
+
ends_with : bool, optional
|
1279
|
+
Whether to search engine actions that end with the given search string. Default is False.
|
1280
|
+
|
1281
|
+
ignore_case : bool, optional
|
1282
|
+
Whether to ignore case while searching engine actions. Default is False.
|
1283
|
+
|
1284
|
+
start_from : int, optional
|
1285
|
+
The index from which to start fetching the engine actions. Default is 0.
|
1286
|
+
|
1287
|
+
page_size : int, optional
|
1288
|
+
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
1289
|
+
|
1290
|
+
Returns
|
1291
|
+
-------
|
1292
|
+
List[dict] or str
|
1293
|
+
A list of dictionaries representing the governance action types found based on the search query.
|
1294
|
+
If no actions are found, returns the string "no action types".
|
1295
|
+
|
1296
|
+
Raises
|
1297
|
+
------
|
1298
|
+
InvalidParameterException
|
1299
|
+
PropertyServerException
|
1300
|
+
UserNotAuthorizedException
|
1301
|
+
|
1302
|
+
"""
|
1303
|
+
|
1304
|
+
server = self.server_name if server is None else server
|
1305
|
+
validate_search_string(search_string)
|
1306
|
+
if search_string == "*":
|
1307
|
+
search_string = None
|
1308
|
+
starts_with_s = str(starts_with).lower()
|
1309
|
+
ends_with_s = str(ends_with).lower()
|
1310
|
+
ignore_case_s = str(ignore_case).lower()
|
1311
|
+
|
1312
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-action-types/"
|
1313
|
+
f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
1314
|
+
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}"
|
1315
|
+
)
|
1316
|
+
body = {
|
1317
|
+
"class": "SearchStringRequestBody",
|
1318
|
+
"name": search_string
|
1319
|
+
}
|
1320
|
+
response = await self._async_make_request("GET", url, body)
|
1321
|
+
return response.json().get("elements", "no action types")
|
1322
|
+
|
1323
|
+
def find_gov_action_types(self, search_string: str = "*", server: str = None, starts_with: bool = False,
|
1324
|
+
ends_with: bool = False, ignore_case: bool = False, start_from: int = 0,
|
1325
|
+
page_size: int = max_paging_size) -> list | str:
|
1326
|
+
""" Retrieve the list of governance action type metadata elements that contain the search string.
|
1327
|
+
|
1328
|
+
Parameters
|
1329
|
+
----------
|
1330
|
+
search_string : str
|
1331
|
+
The string used for searching engine actions by name.
|
1332
|
+
|
1333
|
+
server : str, optional
|
1334
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1335
|
+
|
1336
|
+
starts_with : bool, optional
|
1337
|
+
Whether to search engine actions that start with the given search string. Default is False.
|
1338
|
+
|
1339
|
+
ends_with : bool, optional
|
1340
|
+
Whether to search engine actions that end with the given search string. Default is False.
|
1341
|
+
|
1342
|
+
ignore_case : bool, optional
|
1343
|
+
Whether to ignore case while searching engine actions. Default is False.
|
1344
|
+
|
1345
|
+
start_from : int, optional
|
1346
|
+
The index from which to start fetching the engine actions. Default is 0.
|
1347
|
+
|
1348
|
+
page_size : int, optional
|
1349
|
+
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
1350
|
+
|
1351
|
+
Returns
|
1352
|
+
-------
|
1353
|
+
List[dict] or str
|
1354
|
+
A list of dictionaries representing the governance action types found based on the search query.
|
1355
|
+
If no actions are found, returns the string "no action types".
|
1356
|
+
|
1357
|
+
Raises
|
1358
|
+
------
|
1359
|
+
InvalidParameterException
|
1360
|
+
PropertyServerException
|
1361
|
+
UserNotAuthorizedException
|
1362
|
+
|
1363
|
+
"""
|
1364
|
+
loop = asyncio.get_event_loop()
|
1365
|
+
response = loop.run_until_complete(
|
1366
|
+
self._async_find_gov_action_types(search_string, server, starts_with, ends_with,
|
1367
|
+
ignore_case, start_from, page_size)
|
1368
|
+
)
|
1369
|
+
return response
|
1370
|
+
|
1371
|
+
async def _async_initiate_gov_action_type(self, action_type_qualified_name: str, request_source_guids: [str],
|
1372
|
+
action_targets: list, start_time: datetime= None, request_parameters: dict= None,
|
1373
|
+
orig_service_name: str= None, orig_engine_name: str = None, server: str = None) -> str:
|
1374
|
+
""" Using the named governance action type as a template, initiate an engine action. Async version.
|
1375
|
+
|
1376
|
+
Parameters
|
1377
|
+
----------
|
1378
|
+
action_type_qualified_name: str
|
1379
|
+
- unique name for the governance process
|
1380
|
+
request_source_guids: [str]
|
1381
|
+
- request source elements for the resulting governance action service
|
1382
|
+
action_targets: [str]
|
1383
|
+
-list of action target names to GUIDs for the resulting governance action service
|
1384
|
+
start_time: datetime
|
1385
|
+
- time to start the process
|
1386
|
+
request_parameters: [str]
|
1387
|
+
- parameters passed into the process
|
1388
|
+
orig_service_name: str
|
1389
|
+
- unique name of the requesting governance service (if initiated by a governance engine)
|
1390
|
+
orig_engine_name: str
|
1391
|
+
- optional unique name of the governance engine (if initiated by a governance engine).
|
1392
|
+
|
1393
|
+
Returns
|
1394
|
+
-------
|
1395
|
+
Unique id (guid) of the newly started governance engine process
|
1396
|
+
|
1397
|
+
Raises
|
1398
|
+
------
|
1399
|
+
InvalidParameterException
|
1400
|
+
PropertyServerException
|
1401
|
+
UserNotAuthorizedException
|
1402
|
+
|
1403
|
+
"""
|
1404
|
+
server = self.server_name if server is None else server
|
1405
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-action-types/"
|
1406
|
+
f"initiate")
|
1407
|
+
body = {
|
1408
|
+
"class": "InitiateGovernanceActionTypeRequestBody",
|
1409
|
+
"governanceActionTypeQualifiedName": action_type_qualified_name,
|
1410
|
+
"requestSourceGUIDs": request_source_guids,
|
1411
|
+
"actionTargets": action_targets,
|
1412
|
+
"startDate": int(start_time.timestamp() * 1000),
|
1413
|
+
"requestParameters": request_parameters,
|
1414
|
+
"originatorServiceName": orig_service_name,
|
1415
|
+
"originatorEngineName": orig_engine_name
|
1416
|
+
}
|
1417
|
+
new_body = body_slimmer(body)
|
1418
|
+
response = await self._async_make_request("POST", url, new_body)
|
1419
|
+
return response.json().get("guid", "Action not initiated")
|
1420
|
+
|
1421
|
+
def initiate_gov_action_type(self, action_type_qualified_name: str, request_source_guids: [str],
|
1422
|
+
action_targets: list, start_time: datetime, request_parameters: dict,
|
1423
|
+
orig_service_name: str, orig_engine_name: str, server: str = None) -> str:
|
1424
|
+
""" Using the named governance action type as a template, initiate an engine action.
|
1425
|
+
|
1426
|
+
Parameters
|
1427
|
+
----------
|
1428
|
+
action_type_qualified_name: str
|
1429
|
+
- unique name for the governance process
|
1430
|
+
request_source_guids: [str]
|
1431
|
+
- request source elements for the resulting governance action service
|
1432
|
+
action_targets: [str]
|
1433
|
+
-list of action target names to GUIDs for the resulting governance action service
|
1434
|
+
start_time: datetime
|
1435
|
+
- time to start the process
|
1436
|
+
request_parameters: [str]
|
1437
|
+
- parameters passed into the process
|
1438
|
+
orig_service_name: str
|
1439
|
+
- unique name of the requesting governance service (if initiated by a governance engine)
|
1440
|
+
orig_engine_name: str
|
1441
|
+
- optional unique name of the governance engine (if initiated by a governance engine).
|
1442
|
+
|
1443
|
+
Returns
|
1444
|
+
-------
|
1445
|
+
Unique id (guid) of the newly started governance engine process
|
1446
|
+
|
1447
|
+
Raises
|
1448
|
+
------
|
1449
|
+
InvalidParameterException
|
1450
|
+
PropertyServerException
|
1451
|
+
UserNotAuthorizedException
|
1452
|
+
"""
|
1453
|
+
loop = asyncio.get_event_loop()
|
1454
|
+
response = loop.run_until_complete(
|
1455
|
+
self._async_initiate_gov_action_type(action_type_qualified_name, request_source_guids,
|
1456
|
+
action_targets, start_time, request_parameters,
|
1457
|
+
orig_service_name, orig_engine_name, server)
|
1458
|
+
)
|
1459
|
+
return response
|
1460
|
+
|
1461
|
+
async def _async_initiate_postgres_server_survey(self, postgres_server_guid: str, server: str = None )-> str:
|
1462
|
+
server = self.server_name if server is None else server
|
1463
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-action-types/"
|
1464
|
+
f"initiate")
|
1465
|
+
|
1466
|
+
body = {
|
1467
|
+
"class": "InitiateGovernanceActionTypeRequestBody",
|
1468
|
+
"governanceActionTypeQualifiedName": "Egeria:GovernanceActionType:2adeb8f1-0f59-4970-b6f2-6cc25d4d2402survey-postgres-server",
|
1469
|
+
"actionTargets": [{
|
1470
|
+
"class" : "NewActionTarget",
|
1471
|
+
"actionTargetName" : "serverToSurvey",
|
1472
|
+
"actionTargetGUID" : postgres_server_guid
|
1473
|
+
}]
|
1474
|
+
}
|
1475
|
+
response = await self._async_make_request("POST", url, body)
|
1476
|
+
return response.json().get("guid", "Action not initiated")
|
1477
|
+
# Create/Retrieve the Postgres Server Element
|
1478
|
+
|
1479
|
+
# Run the survey using the information and return the engine action to monitor
|
1480
|
+
|
1481
|
+
def initiate_postgres_server_survey(self, postgres_server_guid: str, server: str = None) -> str:
|
1482
|
+
loop = asyncio.get_event_loop()
|
1483
|
+
response = loop.run_until_complete(
|
1484
|
+
self._async_initiate_postgres_server_survey(postgres_server_guid, server)
|
1485
|
+
)
|
1486
|
+
return response
|
1487
|
+
|
1488
|
+
async def _async_initiate_file_folder_survey(self, file_folder_guid: str,
|
1489
|
+
server: str = None) -> str:
|
1490
|
+
server = self.server_name if server is None else server
|
1491
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-action-types/"
|
1492
|
+
f"initiate")
|
1493
|
+
|
1494
|
+
body = {
|
1495
|
+
"class": "InitiateGovernanceActionTypeRequestBody",
|
1496
|
+
"governanceActionTypeQualifiedName":
|
1497
|
+
"Egeria:GovernanceActionType:2adeb8f1-0f59-4970-b6f2-6cc25d4d2402survey-folder",
|
1498
|
+
"actionTargets": [{
|
1499
|
+
"class": "NewActionTarget",
|
1500
|
+
"actionTargetName": "folderToSurvey",
|
1501
|
+
"actionTargetGUID": file_folder_guid
|
1502
|
+
}]
|
1503
|
+
}
|
1504
|
+
response = await self._async_make_request("POST", url, body)
|
1505
|
+
return response.json().get("guid", "Action not initiated")
|
1506
|
+
|
1507
|
+
def initiate_file_folder_survey(self, file_folder_guid: str, server: str = None) -> str:
|
1508
|
+
loop = asyncio.get_event_loop()
|
1509
|
+
response = loop.run_until_complete(
|
1510
|
+
self._async_initiate_file_folder_survey( file_folder_guid, server)
|
1511
|
+
)
|
1512
|
+
return response
|
1513
|
+
|
1514
|
+
async def _async_initiate_kafka_server_survey(self, kafka_server_guid: str, server: str = None) -> str:
|
1515
|
+
server = self.server_name if server is None else server
|
1516
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-action-types/"
|
1517
|
+
f"initiate")
|
1518
|
+
|
1519
|
+
body = {
|
1520
|
+
"class": "InitiateGovernanceActionTypeRequestBody",
|
1521
|
+
"governanceActionTypeQualifiedName":
|
1522
|
+
"Egeria:GovernanceActionType:2adeb8f1-0f59-4970-b6f2-6cc25d4d2402survey-kafka-server",
|
1523
|
+
"actionTargets": [{
|
1524
|
+
"class": "NewActionTarget",
|
1525
|
+
"actionTargetName": "serverToSurvey",
|
1526
|
+
"actionTargetGUID": kafka_server_guid
|
1527
|
+
}]
|
1528
|
+
}
|
1529
|
+
response = await self._async_make_request("POST", url, body)
|
1530
|
+
return response.json().get("guid", "Action not initiated")
|
1531
|
+
|
1532
|
+
def initiate_kafka_server_survey(self, kafka_server_guid: str, server: str = None) -> str:
|
1533
|
+
loop = asyncio.get_event_loop()
|
1534
|
+
response = loop.run_until_complete(
|
1535
|
+
self._async_initiate_file_folder_survey(kafka_server_guid, server)
|
1536
|
+
)
|
1537
|
+
return response
|
1538
|
+
|
1539
|
+
async def run_gov_action_postgres_server_survey(self, postgres_server: str, host_name: str, port: str,):
|
1540
|
+
pass
|
1541
|
+
# New combo process to do
|
1542
|
+
# run a process the creates the postgres server catalog entry, runs the server survey
|
1543
|
+
# creates a survey report
|
1544
|
+
# adds a to-do list element when done
|
1545
|
+
|
1546
|
+
|
1547
|
+
async def _async_initiate_engine_action(self, qualified_name: str, domain_identifier: int, display_name: str,
|
1548
|
+
description: str, request_source_guids: str, action_targets: str,
|
1549
|
+
received_guards: [str], start_time: datetime, gov_engine_name: str,
|
1550
|
+
request_type: str, request_parameters: dict, process_name: str,
|
1551
|
+
request_src_name: str = None, originator_svc_name: str = None,
|
1552
|
+
originator_eng_name: str = None, server: str = None) -> str:
|
1553
|
+
""" Create an engine action in the metadata store that will trigger the governance service associated with
|
1554
|
+
the supplied request type. The engine action remains to act as a record of the actions taken for auditing.
|
1555
|
+
Async version.
|
1556
|
+
|
1557
|
+
Parameters
|
1558
|
+
----------
|
1559
|
+
qualified_name (str): The qualified name of the governance action.
|
1560
|
+
domain_identifier (int): The domain identifier for the governance action.
|
1561
|
+
display_name (str): The display name of the governance action.
|
1562
|
+
description (str): The description of the governance action.
|
1563
|
+
request_source_guids (str): GUIDs of the sources initiating the request.
|
1564
|
+
action_targets (str): Targets of the governance action.
|
1565
|
+
received_guards (List[str]): List of guards received for the action.
|
1566
|
+
start_time (datetime): The start time for the governance action.
|
1567
|
+
gov_engine_name (str): The name of the governance engine associated with the action.
|
1568
|
+
request_type (str): The type of the governance action request.
|
1569
|
+
request_parameters (dict): Additional parameters for the governance action.
|
1570
|
+
process_name (str): The name of the associated governance action process.
|
1571
|
+
request_src_name (str, optional): The name of the request source. Defaults to None.
|
1572
|
+
originator_svc_name (str, optional): The name of the originator service. Defaults to None.
|
1573
|
+
originator_eng_name (str, optional): The name of the originator engine. Defaults to None.
|
1574
|
+
|
1575
|
+
Returns
|
1576
|
+
-------
|
1577
|
+
str: The GUID (Globally Unique Identifier) of the initiated governance action.
|
1578
|
+
|
1579
|
+
Raises
|
1580
|
+
------
|
1581
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1582
|
+
this exception is raised with details from the response content.
|
1583
|
+
|
1584
|
+
Note
|
1585
|
+
----
|
1586
|
+
The `start_time` parameter should be a `datetime` object representing the start time of the governance action.
|
1587
|
+
|
1588
|
+
|
1589
|
+
"""
|
1590
|
+
server = self.server_name if server is None else server
|
1591
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-engines/"
|
1592
|
+
f"engine-actions/initiate")
|
1593
|
+
body = {
|
1594
|
+
"class": "GovernanceActionRequestBody",
|
1595
|
+
"qualifiedName": qualified_name + str(int(start_time.timestamp())),
|
1596
|
+
"domainIdentifier": domain_identifier,
|
1597
|
+
"displayName": display_name,
|
1598
|
+
"description": description,
|
1599
|
+
"requestSourceGUIDs": request_source_guids,
|
1600
|
+
"actionTargets": action_targets,
|
1601
|
+
"receivedGuards": received_guards,
|
1602
|
+
"startTime": int(start_time.timestamp() * 1000),
|
1603
|
+
"requestType": request_type,
|
1604
|
+
"requestParameters": request_parameters,
|
1605
|
+
"processName": process_name,
|
1606
|
+
"requestSourceName": request_src_name,
|
1607
|
+
"originatorServiceName": originator_svc_name,
|
1608
|
+
"originatorEngineName": originator_eng_name
|
1609
|
+
}
|
1610
|
+
new_body = body_slimmer(body)
|
1611
|
+
response = await self._async_make_request("POST", url, new_body)
|
1612
|
+
return response.json().get("guid", "Action not initiated")
|
1613
|
+
|
1614
|
+
def initiate_engine_action(self, qualified_name: str, domain_identifier: int, display_name: str,
|
1615
|
+
description: str, request_source_guids: str, action_targets: str,
|
1616
|
+
received_guards: [str], start_time: datetime, gov_engine_name: str,
|
1617
|
+
request_type: str, request_parameters: dict, process_name: str,
|
1618
|
+
request_src_name: str = None, originator_svc_name: str = None,
|
1619
|
+
originator_eng_name: str = None, server: str = None) -> str:
|
1620
|
+
""" Create an engine action in the metadata store that will trigger the governance service associated with
|
1621
|
+
the supplied request type. The engine action remains to act as a record of the actions taken for auditing.
|
1622
|
+
|
1623
|
+
Parameters
|
1624
|
+
----------
|
1625
|
+
qualified_name (str): The qualified name of the governance action.
|
1626
|
+
domain_identifier (int): The domain identifier for the governance action.
|
1627
|
+
display_name (str): The display name of the governance action.
|
1628
|
+
description (str): The description of the governance action.
|
1629
|
+
request_source_guids (str): GUIDs of the sources initiating the request.
|
1630
|
+
action_targets (str): Targets of the governance action.
|
1631
|
+
received_guards (List[str]): List of guards received for the action.
|
1632
|
+
start_time (datetime): The start time for the governance action.
|
1633
|
+
gov_engine_name (str): The name of the governance engine associated with the action.
|
1634
|
+
request_type (str): The type of the governance action request.
|
1635
|
+
request_parameters (dict): Additional parameters for the governance action.
|
1636
|
+
process_name (str): The name of the associated governance action process.
|
1637
|
+
request_src_name (str, optional): The name of the request source. Defaults to None.
|
1638
|
+
originator_svc_name (str, optional): The name of the originator service. Defaults to None.
|
1639
|
+
originator_eng_name (str, optional): The name of the originator engine. Defaults to None.
|
1640
|
+
|
1641
|
+
Returns
|
1642
|
+
-------
|
1643
|
+
str: The GUID (Globally Unique Identifier) of the initiated governance action.
|
1644
|
+
|
1645
|
+
Raises
|
1646
|
+
------
|
1647
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1648
|
+
this exception is raised with details from the response content.
|
1649
|
+
|
1650
|
+
Note
|
1651
|
+
----
|
1652
|
+
The `start_time` parameter should be a `datetime` object representing the start time of the governance action.
|
1653
|
+
"""
|
1654
|
+
loop = asyncio.get_event_loop()
|
1655
|
+
response = loop.run_until_complete(
|
1656
|
+
self._async_initiate_engine_action(qualified_name, domain_identifier, display_name,
|
1657
|
+
description, request_source_guids, action_targets,
|
1658
|
+
received_guards, start_time, gov_engine_name,
|
1659
|
+
request_type, request_parameters, process_name,
|
1660
|
+
request_src_name, originator_svc_name,
|
1661
|
+
originator_eng_name, server)
|
1662
|
+
)
|
1663
|
+
return response
|
1664
|
+
|
1665
|
+
async def _async_get_catalog_targets(self, integ_connector_guid: str, server: str = None,
|
1666
|
+
start_from: int = 0, page_size: int = max_paging_size) -> list | str:
|
1667
|
+
""" Retrieve the details of the metadata elements identified as catalog targets with an integration connector.
|
1668
|
+
Async version.
|
1669
|
+
|
1670
|
+
Parameters:
|
1671
|
+
----------
|
1672
|
+
integ_connector_guid: str
|
1673
|
+
The GUID (Globally Unique Identifier) of the integration connector used to retrieve catalog targets.
|
1674
|
+
server: str, optional
|
1675
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1676
|
+
Returns:
|
1677
|
+
-------
|
1678
|
+
[dict]: The list of catalog targets JSON objects.
|
1679
|
+
|
1680
|
+
Raises:
|
1681
|
+
------
|
1682
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1683
|
+
this exception is raised with details from the response content.
|
1684
|
+
PropertyServerException: If the API response indicates a server side error.
|
1685
|
+
UserNotAuthorizedException:
|
1686
|
+
"""
|
1687
|
+
server = self.server_name if server is None else server
|
1688
|
+
validate_guid(integ_connector_guid)
|
1689
|
+
|
1690
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/integration-connectors/"
|
1691
|
+
f"{integ_connector_guid}/catalog-targets?startFrom={start_from}&pageSize={page_size}")
|
1692
|
+
|
1693
|
+
response = await self._async_make_request("GET", url)
|
1694
|
+
return response.json().get("elements", "no actions")
|
1695
|
+
|
1696
|
+
def get_catalog_targets(self, integ_connector_guid: str, server: str = None,
|
1697
|
+
start_from: int = 0, page_size: int = max_paging_size) -> list | str:
|
1698
|
+
""" Retrieve the details of the metadata elements identified as catalog targets with an integration connector.
|
1699
|
+
|
1700
|
+
Parameters:
|
1701
|
+
----------
|
1702
|
+
integ_connector_guid: str
|
1703
|
+
The GUID (Globally Unique Identifier) of the integration connector used to retrieve catalog targets.
|
1704
|
+
server: str, optional
|
1705
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1706
|
+
Returns:
|
1707
|
+
-------
|
1708
|
+
[dict]: The list of catalog targets JSON objects.
|
1709
|
+
|
1710
|
+
Raises:
|
1711
|
+
------
|
1712
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1713
|
+
this exception is raised with details from the response content.
|
1714
|
+
PropertyServerException: If the API response indicates a server side error.
|
1715
|
+
UserNotAuthorizedException:
|
1716
|
+
"""
|
1717
|
+
|
1718
|
+
loop = asyncio.get_event_loop()
|
1719
|
+
response = loop.run_until_complete(
|
1720
|
+
self._async_get_catalog_targets(integ_connector_guid, server,
|
1721
|
+
start_from, page_size)
|
1722
|
+
)
|
1723
|
+
return response
|
1724
|
+
|
1725
|
+
async def _async_get_catalog_target(self, integ_connector_guid: str, metadata_element_guid: str,
|
1726
|
+
server: str = None) -> dict | str:
|
1727
|
+
""" Retrieve a specific catalog target associated with an integration connector.
|
1728
|
+
Async version.
|
1729
|
+
|
1730
|
+
Parameters:
|
1731
|
+
----------
|
1732
|
+
integ_connector_guid: str
|
1733
|
+
The GUID (Globally Unique Identifier) of the integration connector used to retrieve catalog targets.
|
1734
|
+
metadata_element_guid: str
|
1735
|
+
The specific metadata element target we want to retrieve.
|
1736
|
+
server: str, optional
|
1737
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1738
|
+
Returns:
|
1739
|
+
-------
|
1740
|
+
dict: JSON structure of the catalog target.
|
1741
|
+
|
1742
|
+
Raises:
|
1743
|
+
------
|
1744
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1745
|
+
this exception is raised with details from the response content.
|
1746
|
+
PropertyServerException: If the API response indicates a server side error.
|
1747
|
+
UserNotAuthorizedException:
|
1748
|
+
"""
|
1749
|
+
server = self.server_name if server is None else server
|
1750
|
+
validate_guid(integ_connector_guid)
|
1751
|
+
validate_guid(metadata_element_guid)
|
1752
|
+
|
1753
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/integration-connectors/"
|
1754
|
+
f"{integ_connector_guid}/catalog-targets/{metadata_element_guid}")
|
1755
|
+
|
1756
|
+
response = await self._async_make_request("GET", url)
|
1757
|
+
return response.json().get("element", "no actions")
|
1758
|
+
|
1759
|
+
def get_catalog_target(self, integ_connector_guid: str, metadata_element_guid: str,
|
1760
|
+
server: str = None) -> dict | str:
|
1761
|
+
""" Retrieve a specific catalog target associated with an integration connector.
|
1762
|
+
|
1763
|
+
Parameters:
|
1764
|
+
----------
|
1765
|
+
integ_connector_guid: str
|
1766
|
+
The GUID (Globally Unique Identifier) of the integration connector used to retrieve catalog targets.
|
1767
|
+
metadata_element_guid: str
|
1768
|
+
The specific metadata element target we want to retrieve.
|
1769
|
+
server: str, optional
|
1770
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1771
|
+
Returns:
|
1772
|
+
-------
|
1773
|
+
dict: JSON structure of the catalog target.
|
1774
|
+
|
1775
|
+
Raises:
|
1776
|
+
------
|
1777
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1778
|
+
this exception is raised with details from the response content.
|
1779
|
+
PropertyServerException: If the API response indicates a server side error.
|
1780
|
+
UserNotAuthorizedException:
|
1781
|
+
"""
|
1782
|
+
|
1783
|
+
loop = asyncio.get_event_loop()
|
1784
|
+
response = loop.run_until_complete(
|
1785
|
+
self._async_get_catalog_target(integ_connector_guid, metadata_element_guid,
|
1786
|
+
server)
|
1787
|
+
)
|
1788
|
+
return response
|
1789
|
+
|
1790
|
+
async def _async_add_catalog_target(self, integ_connector_guid: str, metadata_element_guid: str,
|
1791
|
+
catalog_target_name: str, metadata_src_qual_name: str, config_properties: dict
|
1792
|
+
, server: str = None) -> None:
|
1793
|
+
""" Add a catalog target to an integration connector.
|
1794
|
+
Async version.
|
1795
|
+
|
1796
|
+
Parameters:
|
1797
|
+
----------
|
1798
|
+
integ_connector_guid: str
|
1799
|
+
The GUID (Globally Unique Identifier) of the integration connector used to retrieve catalog targets.
|
1800
|
+
metadata_element_guid: str
|
1801
|
+
The specific metadata element target we want to retrieve.
|
1802
|
+
catalog_target_name : dict
|
1803
|
+
Name of the catalog target to add.
|
1804
|
+
metadata_src_qual_name: str
|
1805
|
+
The qualified name of the metadata source for the catalog target
|
1806
|
+
config_properties: dict
|
1807
|
+
Configuration properties for the catalog target
|
1808
|
+
server: str, optional
|
1809
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1810
|
+
Returns:
|
1811
|
+
-------
|
1812
|
+
None
|
1813
|
+
|
1814
|
+
Raises:
|
1815
|
+
------
|
1816
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1817
|
+
this exception is raised with details from the response content.
|
1818
|
+
PropertyServerException: If the API response indicates a server side error.
|
1819
|
+
UserNotAuthorizedException:
|
1820
|
+
"""
|
1821
|
+
server = self.server_name if server is None else server
|
1822
|
+
validate_guid(integ_connector_guid)
|
1823
|
+
validate_guid(metadata_element_guid)
|
1824
|
+
|
1825
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/integration-connectors/"
|
1826
|
+
f"{integ_connector_guid}/catalog-targets/{metadata_element_guid}")
|
1827
|
+
body = {
|
1828
|
+
"catalogTargetName": catalog_target_name,
|
1829
|
+
"metadataSourceQualifiedName": metadata_src_qual_name,
|
1830
|
+
"configProperties": config_properties
|
1831
|
+
}
|
1832
|
+
await self._async_make_request("POST", url, body)
|
1833
|
+
return
|
1834
|
+
|
1835
|
+
def add_catalog_target(self, integ_connector_guid: str, metadata_element_guid: str, catalog_target_name: str,
|
1836
|
+
metadata_src_qual_name: str, config_properties: dict, server: str = None) -> None:
|
1837
|
+
""" Add a catalog target to an integration connector.
|
1838
|
+
|
1839
|
+
Parameters:
|
1840
|
+
----------
|
1841
|
+
integ_connector_guid: str
|
1842
|
+
The GUID (Globally Unique Identifier) of the integration connector used to retrieve catalog targets.
|
1843
|
+
metadata_element_guid: str
|
1844
|
+
The specific metadata element target we want to retrieve.
|
1845
|
+
catalog_target_name : dict
|
1846
|
+
Name of the catalog target to add.
|
1847
|
+
metadata_src_qual_name: str
|
1848
|
+
The qualified name of the metadata source for the catalog target
|
1849
|
+
config_properties: dict
|
1850
|
+
Configuration properties for the catalog target
|
1851
|
+
server: str, optional
|
1852
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1853
|
+
Returns:
|
1854
|
+
-------
|
1855
|
+
None
|
1856
|
+
|
1857
|
+
Raises:
|
1858
|
+
------
|
1859
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1860
|
+
this exception is raised with details from the response content.
|
1861
|
+
PropertyServerException: If the API response indicates a server side error.
|
1862
|
+
UserNotAuthorizedException:
|
1863
|
+
"""
|
1864
|
+
loop = asyncio.get_event_loop()
|
1865
|
+
loop.run_until_complete(
|
1866
|
+
self._async_add_catalog_target(integ_connector_guid, metadata_element_guid,
|
1867
|
+
metadata_src_qual_name, metadata_src_qual_name,
|
1868
|
+
config_properties, server)
|
1869
|
+
)
|
1870
|
+
return
|
1871
|
+
|
1872
|
+
async def _async_remove_catalog_target(self, integ_connector_guid: str, metadata_element_guid: str,
|
1873
|
+
catalog_target_name: str, server: str = None) -> None:
|
1874
|
+
""" Remove a catalog target to an integration connector. Async version.
|
1875
|
+
|
1876
|
+
Parameters:
|
1877
|
+
----------
|
1878
|
+
integ_connector_guid: str
|
1879
|
+
The GUID (Globally Unique Identifier) of the integration connector used to retrieve catalog targets.
|
1880
|
+
metadata_element_guid: str
|
1881
|
+
The specific metadata element target we want to retrieve.
|
1882
|
+
server: str, optional
|
1883
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1884
|
+
Returns:
|
1885
|
+
-------
|
1886
|
+
None
|
1887
|
+
|
1888
|
+
Raises:
|
1889
|
+
------
|
1890
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1891
|
+
this exception is raised with details from the response content.
|
1892
|
+
PropertyServerException: If the API response indicates a server side error.
|
1893
|
+
UserNotAuthorizedException:
|
1894
|
+
"""
|
1895
|
+
server = self.server_name if server is None else server
|
1896
|
+
validate_guid(integ_connector_guid)
|
1897
|
+
validate_guid(metadata_element_guid)
|
1898
|
+
|
1899
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/integration-connectors/"
|
1900
|
+
f"{integ_connector_guid}/catalog-targets/{metadata_element_guid}/remove")
|
1901
|
+
|
1902
|
+
await self._async_make_request("POST", url)
|
1903
|
+
return
|
1904
|
+
|
1905
|
+
def remove_catalog_target(self, integ_connector_guid: str, metadata_element_guid: str,
|
1906
|
+
catalog_target_name: str, server: str = None) -> None:
|
1907
|
+
""" Remove a catalog target to an integration connector.
|
1908
|
+
|
1909
|
+
Parameters:
|
1910
|
+
----------
|
1911
|
+
integ_connector_guid: str
|
1912
|
+
The GUID (Globally Unique Identifier) of the integration connector used to retrieve catalog targets.
|
1913
|
+
metadata_element_guid: str
|
1914
|
+
The specific metadata element target we want to retrieve.
|
1915
|
+
server: str, optional
|
1916
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1917
|
+
Returns:
|
1918
|
+
-------
|
1919
|
+
None
|
1920
|
+
|
1921
|
+
Raises:
|
1922
|
+
------
|
1923
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1924
|
+
this exception is raised with details from the response content.
|
1925
|
+
PropertyServerException: If the API response indicates a server side error.
|
1926
|
+
UserNotAuthorizedException:
|
1927
|
+
"""
|
1928
|
+
|
1929
|
+
loop = asyncio.get_event_loop()
|
1930
|
+
loop.run_until_complete(
|
1931
|
+
self._async_add_catalog_target(integ_connector_guid, metadata_element_guid,
|
1932
|
+
server)
|
1933
|
+
)
|
1934
|
+
return
|
1935
|
+
|
1936
|
+
#
|
1937
|
+
# Get information about technologies
|
1938
|
+
#
|
1939
|
+
|
1940
|
+
async def _async_get_tech_types_for_open_metadata_type(self, type_name: str, tech_name: str, server: str = None,
|
1941
|
+
start_from: int = 0,
|
1942
|
+
page_size: int = max_paging_size) -> list | str:
|
1943
|
+
""" Retrieve the list of deployed implementation type metadata elements linked to a particular
|
1944
|
+
open metadata type.. Async version.
|
1945
|
+
|
1946
|
+
Parameters:
|
1947
|
+
----------
|
1948
|
+
type_name: str
|
1949
|
+
The technology type we are looking for.
|
1950
|
+
tech_name: str
|
1951
|
+
The technology name we are looking for.
|
1952
|
+
server: str, optional
|
1953
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1954
|
+
Returns:
|
1955
|
+
-------
|
1956
|
+
[dict] | str: List of elements describing the technology - or "no tech found" if not found.
|
1957
|
+
|
1958
|
+
Raises:
|
1959
|
+
------
|
1960
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
1961
|
+
this exception is raised with details from the response content.
|
1962
|
+
PropertyServerException: If the API response indicates a server side error.
|
1963
|
+
UserNotAuthorizedException:
|
1964
|
+
|
1965
|
+
Notes
|
1966
|
+
-----
|
1967
|
+
More information can be found at: https://egeria-project.org/types
|
1968
|
+
"""
|
1969
|
+
server = self.server_name if server is None else server
|
1970
|
+
# validate_name(type_name)
|
1971
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/open-metadata-types/"
|
1972
|
+
f"{type_name}/technology-types?startFrom={start_from}&pageSize={page_size}")
|
1973
|
+
body = {
|
1974
|
+
"string": tech_name
|
1975
|
+
}
|
1976
|
+
|
1977
|
+
response = await self._async_make_request("GET", url, body)
|
1978
|
+
return response.json().get("elements", "no tech found")
|
1979
|
+
|
1980
|
+
def get_tech_types_for_open_metadata_type(self, type_name: str, tech_name: str, server: str = None,
|
1981
|
+
start_from: int = 0, page_size: int = max_paging_size) -> list | str:
|
1982
|
+
""" Retrieve the list of deployed implementation type metadata elements linked to a particular
|
1983
|
+
open metadata type.
|
1984
|
+
|
1985
|
+
Parameters:
|
1986
|
+
----------
|
1987
|
+
type_name: str
|
1988
|
+
The technology type we are looking for.
|
1989
|
+
tech_name: str
|
1990
|
+
The technology name we are looking for.
|
1991
|
+
server: str, optional
|
1992
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
1993
|
+
Returns:
|
1994
|
+
-------
|
1995
|
+
[dict] | str: List of elements describing the technology - or "no tech found" if not found.
|
1996
|
+
|
1997
|
+
Raises:
|
1998
|
+
------
|
1999
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
2000
|
+
this exception is raised with details from the response content.
|
2001
|
+
PropertyServerException: If the API response indicates a server side error.
|
2002
|
+
UserNotAuthorizedException:
|
2003
|
+
|
2004
|
+
Notes
|
2005
|
+
-----
|
2006
|
+
More information can be found at: https://egeria-project.org/types
|
2007
|
+
"""
|
2008
|
+
loop = asyncio.get_event_loop()
|
2009
|
+
response = loop.run_until_complete(
|
2010
|
+
self._async_get_tech_types_for_open_metadata_type(type_name, tech_name, server,
|
2011
|
+
start_from, page_size)
|
2012
|
+
)
|
2013
|
+
return response
|
2014
|
+
|
2015
|
+
async def _async_get_technology_type_detail(self, type_name: str, server: str = None) -> list | str:
|
2016
|
+
""" Retrieve the details of the named technology type. This name should be the name of the technology type
|
2017
|
+
and contain no wild cards. Async version.
|
2018
|
+
Parameters
|
2019
|
+
----------
|
2020
|
+
type_name : str
|
2021
|
+
The name of the technology type to retrieve detailed information for.
|
2022
|
+
server : str, optional
|
2023
|
+
The name of the server to fetch the technology type from. If not provided, the default server name will be used.
|
2024
|
+
|
2025
|
+
Returns
|
2026
|
+
-------
|
2027
|
+
list[dict] | str
|
2028
|
+
A list of dictionaries containing the detailed information for the specified technology type.
|
2029
|
+
If the technology type is not found, returns the string "no type found".
|
2030
|
+
Raises
|
2031
|
+
------
|
2032
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
2033
|
+
this exception is raised with details from the response content.
|
2034
|
+
PropertyServerException: If the API response indicates a server side error.
|
2035
|
+
UserNotAuthorizedException:
|
2036
|
+
|
2037
|
+
Notes
|
2038
|
+
-----
|
2039
|
+
More information can be found at: https://egeria-project.org/concepts/deployed-implementation-type
|
2040
|
+
"""
|
2041
|
+
server = self.server_name if server is None else server
|
2042
|
+
validate_name(type_name)
|
2043
|
+
url = f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/technology-types/by-name"
|
2044
|
+
|
2045
|
+
body = {"string": type_name}
|
2046
|
+
|
2047
|
+
response = await self._async_make_request("POST", url, body)
|
2048
|
+
return response.json().get("element", "no type found")
|
2049
|
+
|
2050
|
+
def get_technology_type_detail(self, type_name: str, server: str = None) -> list | str:
|
2051
|
+
""" Retrieve the details of the named technology type. This name should be the name of the technology type
|
2052
|
+
and contain no wild cards.
|
2053
|
+
Parameters
|
2054
|
+
----------
|
2055
|
+
type_name : str
|
2056
|
+
The name of the technology type to retrieve detailed information for.
|
2057
|
+
server : str, optional
|
2058
|
+
The name of the server to fetch the technology type from. If not provided, the default server name will be used.
|
2059
|
+
|
2060
|
+
Returns
|
2061
|
+
-------
|
2062
|
+
list[dict] | str
|
2063
|
+
A list of dictionaries containing the detailed information for the specified technology type.
|
2064
|
+
If the technology type is not found, returns the string "no type found".
|
2065
|
+
Raises
|
2066
|
+
------
|
2067
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
2068
|
+
this exception is raised with details from the response content.
|
2069
|
+
PropertyServerException: If the API response indicates a server side error.
|
2070
|
+
UserNotAuthorizedException:
|
2071
|
+
|
2072
|
+
Notes
|
2073
|
+
-----
|
2074
|
+
More information can be found at: https://egeria-project.org/concepts/deployed-implementation-type
|
2075
|
+
"""
|
2076
|
+
|
2077
|
+
loop = asyncio.get_event_loop()
|
2078
|
+
response = loop.run_until_complete(
|
2079
|
+
self._async_get_technology_type_detail(type_name, server)
|
2080
|
+
)
|
2081
|
+
return response
|
2082
|
+
|
2083
|
+
async def _async_find_technology_types(self, search_string: str = "*", server: str = None, start_from: int = 0,
|
2084
|
+
page_size: int = max_paging_size, starts_with: bool=False,
|
2085
|
+
ends_with: bool = False, ignore_case: bool = True) -> list | str:
|
2086
|
+
""" Retrieve the list of technology types that contain the search string. Async version.
|
2087
|
+
|
2088
|
+
Parameters:
|
2089
|
+
----------
|
2090
|
+
type_name: str
|
2091
|
+
The technology type we are looking for.
|
2092
|
+
server: str, optional
|
2093
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
2094
|
+
|
2095
|
+
starts_with : bool, optional
|
2096
|
+
Whether to search engine actions that start with the given search string. Default is False.
|
2097
|
+
|
2098
|
+
ends_with : bool, optional
|
2099
|
+
Whether to search engine actions that end with the given search string. Default is False.
|
2100
|
+
|
2101
|
+
ignore_case : bool, optional
|
2102
|
+
Whether to ignore case while searching engine actions. Default is True.
|
2103
|
+
|
2104
|
+
start_from : int, optional
|
2105
|
+
The index from which to start fetching the engine actions. Default is 0.
|
2106
|
+
|
2107
|
+
page_size : int, optional
|
2108
|
+
The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
|
2109
|
+
Returns:
|
2110
|
+
-------
|
2111
|
+
[dict] | str: List of elements describing the technology - or "no tech found" if not found.
|
2112
|
+
|
2113
|
+
Raises:
|
2114
|
+
------
|
2115
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
2116
|
+
this exception is raised with details from the response content.
|
2117
|
+
PropertyServerException: If the API response indicates a server side error.
|
2118
|
+
UserNotAuthorizedException:
|
2119
|
+
|
2120
|
+
Notes
|
2121
|
+
-----
|
2122
|
+
For more information see: https://egeria-project.org/concepts/deployed-implementation-type
|
2123
|
+
"""
|
2124
|
+
server = self.server_name if server is None else server
|
2125
|
+
|
2126
|
+
starts_with_s = str(starts_with).lower()
|
2127
|
+
ends_with_s = str(ends_with).lower()
|
2128
|
+
ignore_case_s = str(ignore_case).lower()
|
2129
|
+
validate_name(search_string)
|
2130
|
+
if search_string== "*":
|
2131
|
+
search_string = ""
|
2132
|
+
|
2133
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/technology-types/"
|
2134
|
+
f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
2135
|
+
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}")
|
2136
|
+
body = {"string": search_string}
|
2137
|
+
|
2138
|
+
response = await self._async_make_request("POST", url, body)
|
2139
|
+
return response.json().get("elements", "no tech found")
|
2140
|
+
|
2141
|
+
def find_technology_types(self, type_name: str = "*", server: str = None, start_from: int = 0,
|
2142
|
+
page_size: int = max_paging_size, starts_with: bool=False,
|
2143
|
+
ends_with: bool = False, ignore_case: bool = True) -> list | str:
|
2144
|
+
""" Retrieve the list of technology types that contain the search string. Async version.
|
2145
|
+
|
2146
|
+
Parameters:
|
2147
|
+
----------
|
2148
|
+
type_name: str
|
2149
|
+
The technology type we are looking for.
|
2150
|
+
server: str, optional
|
2151
|
+
The name of the server. If None, will use the default server specified in the instance will be used.
|
2152
|
+
Returns:
|
2153
|
+
-------
|
2154
|
+
[dict] | str: List of elements describing the technology - or "no tech found" if not found.
|
2155
|
+
|
2156
|
+
Raises:
|
2157
|
+
------
|
2158
|
+
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
2159
|
+
this exception is raised with details from the response content.
|
2160
|
+
PropertyServerException: If the API response indicates a server side error.
|
2161
|
+
UserNotAuthorizedException:
|
2162
|
+
|
2163
|
+
Notes
|
2164
|
+
-----
|
2165
|
+
For more information see: https://egeria-project.org/concepts/deployed-implementation-type
|
2166
|
+
"""
|
2167
|
+
|
2168
|
+
loop = asyncio.get_event_loop()
|
2169
|
+
response = loop.run_until_complete(
|
2170
|
+
self._async_find_technology_types(type_name, server, start_from,
|
2171
|
+
page_size, starts_with,ends_with, ignore_case)
|
2172
|
+
)
|
2173
|
+
return response
|
2174
|
+
|
2175
|
+
async def _async_get_all_technology_types(self, server: str = None, start_from: int = 0,
|
2176
|
+
page_size: int = max_paging_size) -> list | str:
|
2177
|
+
return await self._async_find_technology_types("*", server, start_from, page_size)
|
2178
|
+
|
2179
|
+
def get_all_technology_types(self, server: str = None, start_from: int = 0,
|
2180
|
+
page_size: int = max_paging_size) -> list | str:
|
2181
|
+
return self.find_technology_types("*", server, start_from, page_size)
|
2182
|
+
|
2183
|
+
|
2184
|
+
if __name__ == "__main__":
|
2185
|
+
p = AutomatedCuration("meow", "https://127.0.0.1:9443", "garygeeke", verify_flag=False)
|
2186
|
+
response = p.get_active_service_list_for_server()
|
2187
|
+
out = response.json()["result"]
|
2188
|
+
print(out)
|