pyegeria 0.3.8__py3-none-any.whl → 0.3.9__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.
Files changed (50) hide show
  1. pyegeria/Xasset_catalog_omvs.py +539 -0
  2. pyegeria/Xfeedback_manager_omvs.py +251 -0
  3. pyegeria/Xglossary_manager_omvs.py +3001 -0
  4. pyegeria/Xloaded_resources_omvs.py +91 -0
  5. pyegeria/__init__.py +6 -10
  6. pyegeria/_client.py +4 -6
  7. pyegeria/{gov_engine.py → _deprecated_gov_engine.py} +2 -59
  8. pyegeria/_exceptions.py +5 -6
  9. pyegeria/_globals.py +1 -1
  10. pyegeria/automated_curation_omvs.py +320 -315
  11. pyegeria/collection_manager_omvs.py +187 -248
  12. pyegeria/core_omag_server_config.py +1 -5
  13. pyegeria/full_omag_server_config.py +53 -83
  14. pyegeria/glossary_browser_omvs.py +2208 -0
  15. pyegeria/my_profile_omvs.py +2 -7
  16. pyegeria/platform_services.py +0 -3
  17. pyegeria/project_manager_omvs.py +9 -15
  18. pyegeria/registered_info.py +12 -52
  19. pyegeria/server_operations.py +1 -5
  20. pyegeria/valid_metadata_omvs.py +11 -23
  21. pyegeria-0.3.9.data/scripts/Create_Collection_Sample.py +292 -0
  22. pyegeria-0.3.9.data/scripts/Create_Sustainability_Collection_Sample.py +115 -0
  23. pyegeria-0.3.9.data/scripts/coco_status.py +98 -0
  24. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/collection_viewer.py +12 -31
  25. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/engine_action_status.py +9 -28
  26. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/find_todos.py +9 -38
  27. pyegeria-0.3.9.data/scripts/get_registered_services.py +135 -0
  28. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/get_relationship_types.py +16 -35
  29. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/glossary_view.py +2 -2
  30. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/gov_engine_status.py +0 -1
  31. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/list_asset_types.py +3 -25
  32. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/my_todos.py +1 -1
  33. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/open_todos.py +3 -24
  34. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/project_list_viewer.py +12 -26
  35. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/server_status.py +1 -20
  36. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/view_my_profile.py +8 -34
  37. {pyegeria-0.3.8.dist-info → pyegeria-0.3.9.dist-info}/METADATA +1 -3
  38. pyegeria-0.3.9.dist-info/RECORD +49 -0
  39. pyegeria/glossary_omvs.py +0 -789
  40. pyegeria/loaded_resources_omvs.py +0 -159
  41. pyegeria-0.3.8.dist-info/RECORD +0 -42
  42. /pyegeria/{governance_author.py → Xaction_author_omvs.py} +0 -0
  43. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/get_tech_details.py +0 -0
  44. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/get_tech_types.py +0 -0
  45. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/integration_daemon_status.py +0 -0
  46. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/multi-server_status.py +0 -0
  47. {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/server_status_widget.py +0 -0
  48. {pyegeria-0.3.8.dist-info → pyegeria-0.3.9.dist-info}/LICENSE +0 -0
  49. {pyegeria-0.3.8.dist-info → pyegeria-0.3.9.dist-info}/WHEEL +0 -0
  50. {pyegeria-0.3.8.dist-info → pyegeria-0.3.9.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,539 @@
1
+ """
2
+ SPDX-License-Identifier: Apache-2.0
3
+ Copyright Contributors to the ODPi Egeria project.
4
+
5
+ Asset Catalog View Service Methods - Search for assets, retrieve their properties, lineage and related glossary
6
+ information.
7
+
8
+ This file is in active development...
9
+
10
+ """
11
+ import asyncio
12
+ from datetime import datetime
13
+
14
+ from httpx import Response
15
+
16
+ from pyegeria import Client, max_paging_size, body_slimmer
17
+ from pyegeria._exceptions import (
18
+ InvalidParameterException,
19
+ )
20
+ from ._validators import validate_name, validate_guid, validate_search_string
21
+
22
+
23
+ class AssetCatalog(Client):
24
+ """ Set up and maintain automation services in Egeria.
25
+
26
+ Attributes:
27
+ server_name : str
28
+ The name of the View Server to use.
29
+ platform_url : str
30
+ URL of the server platform to connect to
31
+ user_id : str
32
+ The identity of the user calling the method - this sets a default optionally used by the methods
33
+ when the user doesn't pass the user_id on a method call.
34
+ user_pwd: str
35
+ The password associated with the user_id. Defaults to None
36
+ verify_flag: bool
37
+ Flag to indicate if SSL Certificates should be verified in the HTTP requests.
38
+ Defaults to False.
39
+
40
+ """
41
+
42
+ def __init__(
43
+ self,
44
+ server_name: str,
45
+ platform_url: str,
46
+ user_id: str,
47
+ user_pwd: str = None,
48
+ verify_flag: bool = False,
49
+ ):
50
+ Client.__init__(self, server_name, platform_url, user_id, user_pwd, verify_flag)
51
+ self.cur_command_root = f"{platform_url}/servers/"
52
+
53
+
54
+ async def _async_create_element_from_template(self, body: dict, server: str = None) -> str:
55
+ """ Create a new metadata element from a template. Async version.
56
+ Parameters
57
+ ----------
58
+ body : str
59
+ The json body used to instantiate the template.
60
+ server : str, optional
61
+ The name of the view server to use. If not provided, the default server name will be used.
62
+
63
+ Returns
64
+ -------
65
+ Response
66
+ The guid of the resulting element
67
+
68
+ Raises
69
+ ------
70
+ InvalidParameterException
71
+ PropertyServerException
72
+ UserNotAuthorizedException
73
+
74
+ Notes
75
+ -----
76
+ See also: https://egeria-project.org/features/templated-cataloguing/overview/
77
+ The full description of the body is shown below:
78
+ {
79
+ "typeName" : "",
80
+ "initialStatus" : "",
81
+ "initialClassifications" : "",
82
+ "anchorGUID" : "",
83
+ "isOwnAnchor" : "",
84
+ "effectiveFrom" : "",
85
+ "effectiveTo" : "",
86
+ "templateGUID" : "",
87
+ "templateProperties" : {},
88
+ "placeholderPropertyValues" : {
89
+ "placeholderPropertyName1" : "placeholderPropertyValue1",
90
+ "placeholderPropertyName2" : "placeholderPropertyValue2"
91
+ },
92
+ "parentGUID" : "",
93
+ "parentRelationshipTypeName" : "",
94
+ "parentRelationshipProperties" : "",
95
+ "parentAtEnd1" : "",
96
+ "effectiveTime" : ""
97
+ }
98
+ """
99
+
100
+ server = self.server_name if server is None else server
101
+
102
+ url = f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/catalog-templates/new-element"
103
+ response = await self._async_make_request("POST", url, body)
104
+ return response.json().get("guid", "GUID failed to be returned")
105
+
106
+ def create_element_from_template(self, body: dict, server: str = None) -> str:
107
+ """ Create a new metadata element from a template. Async version.
108
+ Parameters
109
+ ----------
110
+ body : str
111
+ The json body used to instantiate the template.
112
+ server : str, optional
113
+ The name of the view server to use. If not provided, the default server name will be used.
114
+
115
+ Returns
116
+ -------
117
+ Response
118
+ The guid of the resulting element
119
+
120
+ Raises
121
+ ------
122
+ InvalidParameterException
123
+ PropertyServerException
124
+ UserNotAuthorizedException
125
+
126
+ Notes
127
+ -----
128
+ See also: https://egeria-project.org/features/templated-cataloguing/overview/
129
+ The full description of the body is shown below:
130
+ {
131
+ "typeName" : "",
132
+ "initialStatus" : "",
133
+ "initialClassifications" : "",
134
+ "anchorGUID" : "",
135
+ "isOwnAnchor" : "",
136
+ "effectiveFrom" : "",
137
+ "effectiveTo" : "",
138
+ "templateGUID" : "",
139
+ "templateProperties" : {},
140
+ "placeholderPropertyValues" : {
141
+ "placeholderPropertyName1" : "placeholderPropertyValue1",
142
+ "placeholderPropertyName2" : "placeholderPropertyValue2"
143
+ },
144
+ "parentGUID" : "",
145
+ "parentRelationshipTypeName" : "",
146
+ "parentRelationshipProperties" : "",
147
+ "parentAtEnd1" : "",
148
+ "effectiveTime" : ""
149
+ }
150
+ """
151
+ loop = asyncio.get_event_loop()
152
+ response = loop.run_until_complete(
153
+ self._async_create_element_from_template(body, server)
154
+ )
155
+ return response
156
+
157
+ async def _async_create_kafka_server_element_from_template(self, kafka_server: str, host_name: str, port: str,
158
+ server: str = None) -> str:
159
+ """ Create a Kafka server element from a template. Async version.
160
+
161
+ Parameters
162
+ ----------
163
+ kafka_server : str
164
+ The name of the Kafka server.
165
+
166
+ host_name : str
167
+ The host name of the Kafka server.
168
+
169
+ port : str
170
+ The port number of the Kafka server.
171
+
172
+ server : str, optional
173
+ The name of the view server to use. Default uses the client instance.
174
+
175
+ Returns
176
+ -------
177
+ str
178
+ The GUID of the Kafka server element.
179
+ """
180
+
181
+ body = {
182
+ "templateGUID": "5e1ff810-5418-43f7-b7c4-e6e062f9aff7",
183
+ "isOwnAnchor": 'true',
184
+ "placeholderPropertyValues": {
185
+ "serverName": kafka_server,
186
+ "hostIdentifier": host_name,
187
+ "portNumber": port
188
+ }
189
+ }
190
+ response = await self._async_create_element_from_template(body, server)
191
+ return response
192
+
193
+ def create_kafka_server_element_from_template(self, kafka_server: str, host_name: str, port: str,
194
+ server: str = None) -> str:
195
+ """ Create a Kafka server element from a template.
196
+
197
+ Parameters
198
+ ----------
199
+ kafka_server : str
200
+ The name of the Kafka server.
201
+
202
+ host_name : str
203
+ The host name of the Kafka server.
204
+
205
+ port : str
206
+ The port number of the Kafka server.
207
+
208
+ server : str, optional
209
+ The name of the view server to use. Default uses the client instance.
210
+
211
+ Returns
212
+ -------
213
+ str
214
+ The GUID of the Kafka server element.
215
+ """
216
+ loop = asyncio.get_event_loop()
217
+ response = loop.run_until_complete(
218
+ self._async_create_kafka_server_element_from_template(kafka_server, host_name, port, server)
219
+ )
220
+ return response
221
+
222
+ async def _async_create_postgres_server_element_from_template(self, postgres_server: str, host_name: str, port: str,
223
+ db_user: str, db_pwd: str, server: str = None) -> str:
224
+ """ Create a Postgres server element from a template. Async version.
225
+
226
+ Parameters
227
+ ----------
228
+ postgres_server : str
229
+ The name of the Postgres server.
230
+
231
+ host_name : str
232
+ The host name of the Postgres server.
233
+
234
+ port : str
235
+ The port number of the Postgres server.
236
+
237
+ db_user: str
238
+ User name to connect to the database
239
+
240
+ db_pwd: str
241
+ User password to connect to the database
242
+
243
+ server : str, optional
244
+ The name of the view server to use. Default uses the client instance.
245
+
246
+ Returns
247
+ -------
248
+ str
249
+ The GUID of the Kafka server element.
250
+ """
251
+ body = {
252
+ "templateGUID": "542134e6-b9ce-4dce-8aef-22e8daf34fdb",
253
+ "isOwnAnchor": 'true',
254
+ "placeholderPropertyValues": {
255
+ "serverName": postgres_server,
256
+ "hostIdentifier": host_name,
257
+ "portNumber": port,
258
+ "databaseUserId": db_user,
259
+ "databasePassword": db_pwd
260
+ }
261
+ }
262
+ response = await self._async_create_element_from_template(body, server)
263
+ return response
264
+
265
+ def create_postgres_server_element_from_template(self, postgres_server: str, host_name: str, port: str,
266
+ db_user: str, db_pwd: str, server: str = None) -> str:
267
+ """ Create a Postgres server element from a template.
268
+
269
+ Parameters
270
+ ----------
271
+ postgres_server : str
272
+ The name of the Postgres server.
273
+
274
+ host_name : str
275
+ The host name of the Postgres server.
276
+
277
+ port : str
278
+ The port number of the Postgres server.
279
+
280
+ server : str, optional
281
+ The name of the view server to use. Default uses the client instance.
282
+
283
+ db_user: str
284
+ User name to connect to the database
285
+
286
+ db_pwd: str
287
+ User password to connect to the database
288
+
289
+ Returns
290
+ -------
291
+ str
292
+ The GUID of the Postgres server element.
293
+ """
294
+ loop = asyncio.get_event_loop()
295
+ response = loop.run_until_complete(
296
+ self._async_create_postgres_server_element_from_template(postgres_server, host_name,
297
+ port, db_user, db_pwd, server)
298
+ )
299
+ return response
300
+
301
+ #
302
+ # Engine Actions
303
+ #
304
+
305
+ async def _async_find_assets(self, search_string: str, server: str = None, start_from: int = 0,
306
+ page_size: int = max_paging_size) -> list | str:
307
+ """ Retrieve the list of engine action metadata elements that contain the search string. Async Version.
308
+ Parameters
309
+ ----------
310
+ search_string : str
311
+ The string used for searching engine actions by name.
312
+
313
+ server : str, optional
314
+ The name of the server. If None, will use the default server specified in the instance will be used.
315
+
316
+ starts_with : bool, optional
317
+ Whether to search engine actions that start with the given search string. Default is False.
318
+
319
+ ends_with : bool, optional
320
+ Whether to search engine actions that end with the given search string. Default is False.
321
+
322
+ ignore_case : bool, optional
323
+ Whether to ignore case while searching engine actions. Default is False.
324
+
325
+ start_from : int, optional
326
+ The index from which to start fetching the engine actions. Default is 0.
327
+
328
+ page_size : int, optional
329
+ The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
330
+
331
+ Returns
332
+ -------
333
+ List[dict] or str
334
+ A list of dictionaries representing the engine actions found based on the search query.
335
+ If no actions are found, returns the string "no actions".
336
+
337
+ Raises:
338
+ ------
339
+ InvalidParameterException
340
+ PropertyServerException
341
+ UserNotAuthorizedException
342
+
343
+ Notes
344
+ -----
345
+ For more information see: https://egeria-project.org/concepts/engine-action
346
+ """
347
+ server = self.server_name if server is None else server
348
+ # validate_search_string(search_string)
349
+ # if search_string == "*":
350
+ # search_string = None
351
+ # starts_with_s = str(starts_with).lower()
352
+ # ends_with_s = str(ends_with).lower()
353
+ # ignore_case_s = str(ignore_case).lower()
354
+
355
+ url = (f"{self.platform_url}/servers/{server}/open-metadata/access-services/asset-owner/users/erinoverview/"
356
+ f"assets/by-search-string?startFrom={start_from}&pageSize={page_size}"
357
+ )
358
+ body = {
359
+ "class": "SearchStringRequestBody",
360
+ "searchString": search_string
361
+ }
362
+ response = await self._async_make_request("POST", url, body)
363
+ return response.json().get("assets", "no assets")
364
+
365
+ def find_assets(self, search_string: str = "*", server: str = None, start_from: int = 0,
366
+ page_size: int = max_paging_size) -> list | str:
367
+ """ Retrieve the list of engine action metadata elements that contain the search string.
368
+ Parameters
369
+ ----------
370
+ search_string : str
371
+ The string used for searching engine actions by name.
372
+
373
+ server : str, optional
374
+ The name of the server. If None, will use the default server specified in the instance will be used.
375
+
376
+ starts_with : bool, optional
377
+ Whether to search engine actions that start with the given search string. Default is False.
378
+
379
+ ends_with : bool, optional
380
+ Whether to search engine actions that end with the given search string. Default is False.
381
+
382
+ ignore_case : bool, optional
383
+ Whether to ignore case while searching engine actions. Default is False.
384
+
385
+ start_from : int, optional
386
+ The index from which to start fetching the engine actions. Default is 0.
387
+
388
+ page_size : int, optional
389
+ The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
390
+
391
+ Returns
392
+ -------
393
+ List[dict] or str
394
+ A list of dictionaries representing the engine actions found based on the search query.
395
+ If no actions are found, returns the string "no actions".
396
+
397
+ Raises:
398
+ ------
399
+ InvalidParameterException
400
+ PropertyServerException
401
+ UserNotAuthorizedException
402
+
403
+ Notes
404
+ -----
405
+ For more information see: https://egeria-project.org/concepts/engine-action
406
+ """
407
+
408
+ loop = asyncio.get_event_loop()
409
+ response = loop.run_until_complete(
410
+ self._async_find_assets(search_string, server, start_from,
411
+ page_size)
412
+ )
413
+ return response
414
+
415
+
416
+ async def _async_find_engine_actions(self, search_string: str, server: str = None, starts_with: bool = False,
417
+ ends_with: bool = False, ignore_case: bool = False, start_from: int = 0,
418
+ page_size: int = max_paging_size) -> list | str:
419
+ """ Retrieve the list of engine action metadata elements that contain the search string. Async Version.
420
+ Parameters
421
+ ----------
422
+ search_string : str
423
+ The string used for searching engine actions by name.
424
+
425
+ server : str, optional
426
+ The name of the server. If None, will use the default server specified in the instance will be used.
427
+
428
+ starts_with : bool, optional
429
+ Whether to search engine actions that start with the given search string. Default is False.
430
+
431
+ ends_with : bool, optional
432
+ Whether to search engine actions that end with the given search string. Default is False.
433
+
434
+ ignore_case : bool, optional
435
+ Whether to ignore case while searching engine actions. Default is False.
436
+
437
+ start_from : int, optional
438
+ The index from which to start fetching the engine actions. Default is 0.
439
+
440
+ page_size : int, optional
441
+ The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
442
+
443
+ Returns
444
+ -------
445
+ List[dict] or str
446
+ A list of dictionaries representing the engine actions found based on the search query.
447
+ If no actions are found, returns the string "no actions".
448
+
449
+ Raises:
450
+ ------
451
+ InvalidParameterException
452
+ PropertyServerException
453
+ UserNotAuthorizedException
454
+
455
+ Notes
456
+ -----
457
+ For more information see: https://egeria-project.org/concepts/engine-action
458
+ """
459
+ server = self.server_name if server is None else server
460
+ validate_search_string(search_string)
461
+ if search_string == "*":
462
+ search_string = None
463
+ starts_with_s = str(starts_with).lower()
464
+ ends_with_s = str(ends_with).lower()
465
+ ignore_case_s = str(ignore_case).lower()
466
+
467
+ url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/engine-actions/"
468
+ f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
469
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}"
470
+ )
471
+ body = {
472
+ "class": "SearchStringRequestBody",
473
+ "name": search_string
474
+ }
475
+ response = await self._async_make_request("POST", url, body)
476
+ return response.json().get("elements", "no actions")
477
+
478
+ def find_engine_actions(self, search_string: str = "*", server: str = None, starts_with: bool = False,
479
+ ends_with: bool = False, ignore_case: bool = False, start_from: int = 0,
480
+ page_size: int = max_paging_size) -> list | str:
481
+ """ Retrieve the list of engine action metadata elements that contain the search string.
482
+ Parameters
483
+ ----------
484
+ search_string : str
485
+ The string used for searching engine actions by name.
486
+
487
+ server : str, optional
488
+ The name of the server. If None, will use the default server specified in the instance will be used.
489
+
490
+ starts_with : bool, optional
491
+ Whether to search engine actions that start with the given search string. Default is False.
492
+
493
+ ends_with : bool, optional
494
+ Whether to search engine actions that end with the given search string. Default is False.
495
+
496
+ ignore_case : bool, optional
497
+ Whether to ignore case while searching engine actions. Default is False.
498
+
499
+ start_from : int, optional
500
+ The index from which to start fetching the engine actions. Default is 0.
501
+
502
+ page_size : int, optional
503
+ The maximum number of engine actions to fetch in a single request. Default is `max_paging_size`.
504
+
505
+ Returns
506
+ -------
507
+ List[dict] or str
508
+ A list of dictionaries representing the engine actions found based on the search query.
509
+ If no actions are found, returns the string "no actions".
510
+
511
+ Raises:
512
+ ------
513
+ InvalidParameterException
514
+ PropertyServerException
515
+ UserNotAuthorizedException
516
+
517
+ Notes
518
+ -----
519
+ For more information see: https://egeria-project.org/concepts/engine-action
520
+ """
521
+
522
+ loop = asyncio.get_event_loop()
523
+ response = loop.run_until_complete(
524
+ self._async_find_engine_actions(search_string, server, starts_with,
525
+ ends_with, ignore_case, start_from,
526
+ page_size)
527
+ )
528
+ return response
529
+
530
+ async def _async_get_asset_by_guid(self, asset_guid:str, server: str = None) -> str| dict:
531
+ pass
532
+
533
+
534
+
535
+ if __name__ == "__main__":
536
+ p = AssetCatalog("active-metadata-store", "https://127.0.0.1:9443", "garygeeke", verify_flag=False)
537
+ response = p.get_active_engine_actions()
538
+ out = response.json()
539
+ print(out)