pyegeria 0.3.2__tar.gz → 0.3.3__tar.gz

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 (42) hide show
  1. {pyegeria-0.3.2/src/pyegeria.egg-info → pyegeria-0.3.3}/PKG-INFO +1 -1
  2. {pyegeria-0.3.2 → pyegeria-0.3.3}/pyproject.toml +1 -1
  3. {pyegeria-0.3.2 → pyegeria-0.3.3}/setup.py +1 -1
  4. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/__init__.py +1 -1
  5. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/automated_curation_omvs.py +63 -46
  6. pyegeria-0.3.3/src/pyegeria/exceptions.py +382 -0
  7. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/registered_info.py +43 -8
  8. {pyegeria-0.3.2 → pyegeria-0.3.3/src/pyegeria.egg-info}/PKG-INFO +1 -1
  9. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria.egg-info/SOURCES.txt +1 -0
  10. {pyegeria-0.3.2 → pyegeria-0.3.3}/tests/test_core_omag_server_config.py +1 -1
  11. {pyegeria-0.3.2 → pyegeria-0.3.3}/tests/test_registered_info.py +26 -2
  12. {pyegeria-0.3.2 → pyegeria-0.3.3}/LICENSE +0 -0
  13. {pyegeria-0.3.2 → pyegeria-0.3.3}/MANIFEST.in +0 -0
  14. {pyegeria-0.3.2 → pyegeria-0.3.3}/README.md +0 -0
  15. {pyegeria-0.3.2 → pyegeria-0.3.3}/setup.cfg +0 -0
  16. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/_client.py +0 -0
  17. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/_exceptions.py +0 -0
  18. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/_globals.py +0 -0
  19. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/_validators.py +0 -0
  20. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/core_omag_server_config.py +0 -0
  21. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/full_omag_server_config.py +0 -0
  22. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/glossary_omvs.py +0 -0
  23. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/gov_engine.py +0 -0
  24. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/governance_author.py +0 -0
  25. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/my_profile_omvs.py +0 -0
  26. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/platform_services.py +0 -0
  27. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/server_operations.py +0 -0
  28. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria/utils.py +0 -0
  29. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria.egg-info/dependency_links.txt +0 -0
  30. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria.egg-info/requires.txt +0 -0
  31. {pyegeria-0.3.2 → pyegeria-0.3.3}/src/pyegeria.egg-info/top_level.txt +0 -0
  32. {pyegeria-0.3.2 → pyegeria-0.3.3}/tests/test_automated_curation_omvs.py +0 -0
  33. {pyegeria-0.3.2 → pyegeria-0.3.3}/tests/test_automated_curation_omvs_cray.py +0 -0
  34. {pyegeria-0.3.2 → pyegeria-0.3.3}/tests/test_client.py +0 -0
  35. {pyegeria-0.3.2 → pyegeria-0.3.3}/tests/test_full_omag_server_config.py +0 -0
  36. {pyegeria-0.3.2 → pyegeria-0.3.3}/tests/test_glossary_omvs.py +0 -0
  37. {pyegeria-0.3.2 → pyegeria-0.3.3}/tests/test_gov_engine.py +0 -0
  38. {pyegeria-0.3.2 → pyegeria-0.3.3}/tests/test_my_profile_omvs.py +0 -0
  39. {pyegeria-0.3.2 → pyegeria-0.3.3}/tests/test_platform_services.py +0 -0
  40. {pyegeria-0.3.2 → pyegeria-0.3.3}/tests/test_server_operations.py +0 -0
  41. {pyegeria-0.3.2 → pyegeria-0.3.3}/tests/test_util_exp.py +0 -0
  42. {pyegeria-0.3.2 → pyegeria-0.3.3}/tests/test_validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://egeria-project.org/egeria-python
6
6
  Author: Dan Wolfson
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
9
9
 
10
10
  [project]
11
11
  name = "pyegeria"
12
- version = "0.3.2"
12
+ version = "0.3.3"
13
13
  #license = 'Apache 2.0'
14
14
  authors = [
15
15
  {name ="Dan Wolfson", email= "dan.wolfson@pdr-associates.com"},
@@ -5,7 +5,7 @@ setup(
5
5
  extras_require=dict(tests=["pytest"]),
6
6
  # packages=find_packages(where="src"),
7
7
  package_dir={"": "src"},
8
- version='0.3.2',
8
+ version='0.3.3',
9
9
  packages=find_packages(where="src"),
10
10
  url="https://egeria-project.org/egeria-python",
11
11
  project_urls={
@@ -26,7 +26,7 @@ if disable_ssl_warnings:
26
26
 
27
27
  from ._exceptions import (InvalidParameterException, PropertyServerException, UserNotAuthorizedException,
28
28
  print_exception_response)
29
- from .utils import print_response, body_slimmer
29
+ from .utils import print_response, body_slimmer, wrap_text
30
30
  from ._client import Client
31
31
  from .automated_curation_omvs import AutomatedCuration
32
32
  from .core_omag_server_config import CoreServerConfig
@@ -6,15 +6,15 @@ Copyright Contributors to the ODPi Egeria project.
6
6
 
7
7
  """
8
8
  import asyncio
9
- import json
10
9
  from datetime import datetime
11
- from httpx import AsyncClient, Response
10
+
11
+ from httpx import Response
12
12
 
13
13
  from pyegeria import Client, max_paging_size, body_slimmer
14
- from ._validators import validate_name, validate_guid, validate_search_string
15
14
  from pyegeria._exceptions import (
16
15
  InvalidParameterException,
17
16
  )
17
+ from ._validators import validate_name, validate_guid, validate_search_string
18
18
 
19
19
 
20
20
  class AutomatedCuration(Client):
@@ -92,7 +92,7 @@ class AutomatedCuration(Client):
92
92
 
93
93
  url = f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/catalog-templates/new-element"
94
94
  response = await self._async_make_request("POST", url, body)
95
- return response.json().get("guid","GUID failed to be returned")
95
+ return response.json().get("guid", "GUID failed to be returned")
96
96
 
97
97
  def create_element_from_template(self, body: dict, server: str = None) -> str:
98
98
  """ Create a new metadata element from a template. Async version.
@@ -145,8 +145,8 @@ class AutomatedCuration(Client):
145
145
  )
146
146
  return response
147
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:
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
150
  """ Create a Kafka server element from a template. Async version.
151
151
 
152
152
  Parameters
@@ -210,7 +210,6 @@ class AutomatedCuration(Client):
210
210
  )
211
211
  return response
212
212
 
213
-
214
213
  async def _async_create_postgres_server_element_from_template(self, postgres_server: str, host_name: str, port: str,
215
214
  db_user: str, db_pwd: str, server: str = None) -> str:
216
215
  """ Create a Postgres server element from a template. Async version.
@@ -247,7 +246,7 @@ class AutomatedCuration(Client):
247
246
  "serverName": postgres_server,
248
247
  "hostIdentifier": host_name,
249
248
  "portNumber": port,
250
- "databaseUserId" : db_user,
249
+ "databaseUserId": db_user,
251
250
  "databasePassword": db_pwd
252
251
  }
253
252
  }
@@ -285,14 +284,14 @@ class AutomatedCuration(Client):
285
284
  """
286
285
  loop = asyncio.get_event_loop()
287
286
  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)
287
+ self._async_create_postgres_server_element_from_template(postgres_server, host_name,
288
+ port, db_user, db_pwd, server)
290
289
  )
291
290
  return response
292
291
 
293
292
  #
294
- # Engine Actions
295
- #
293
+ # Engine Actions
294
+ #
296
295
  async def _async_get_engine_actions(self, server: str = None, start_from: int = 0,
297
296
  page_size: int = max_paging_size) -> list:
298
297
  """ Retrieve the engine actions that are known to the server. Async version.
@@ -562,16 +561,19 @@ class AutomatedCuration(Client):
562
561
  name : str
563
562
  The name of the engine action to retrieve.
564
563
  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.
564
+ The name of the server to retrieve the engine action from. If not provided, the default server specified in
565
+ the instance will be used.
566
566
  start_from : int, optional
567
567
  The index to start retrieving engine actions from. If not provided, the default value will be used.
568
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.
569
+ The maximum number of engine actions to retrieve in a single request. If not provided, the default global
570
+ maximum paging size will be used.
570
571
 
571
572
  Returns
572
573
  -------
573
574
  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
+ A list of dictionaries representing the retrieved engine actions, or "no actions" if no engine actions were
576
+ found with the given name.
575
577
  Raises:
576
578
  ------
577
579
  InvalidParameterException
@@ -604,16 +606,19 @@ class AutomatedCuration(Client):
604
606
  name : str
605
607
  The name of the engine action to retrieve.
606
608
  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.
609
+ The name of the server to retrieve the engine action from. If not provided, the default server specified in
610
+ the instance will be used.
608
611
  start_from : int, optional
609
612
  The index to start retrieving engine actions from. If not provided, the default value will be used.
610
613
  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.
614
+ The maximum number of engine actions to retrieve in a single request. If not provided, the default global
615
+ maximum paging size will be used.
612
616
 
613
617
  Returns
614
618
  -------
615
619
  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.
620
+ A list of dictionaries representing the retrieved engine actions, or "no actions" if no engine actions were
621
+ found with the given name.
617
622
  Raises:
618
623
  ------
619
624
  InvalidParameterException
@@ -745,9 +750,9 @@ class AutomatedCuration(Client):
745
750
  )
746
751
  return response
747
752
 
748
- #
749
- # Governance action processes
750
- #
753
+ #
754
+ # Governance action processes
755
+ #
751
756
 
752
757
  async def _async_get_governance_action_process_by_guid(self, process_guid: str, server: str = None) -> dict | str:
753
758
  """ Retrieve the governance action process metadata element with the supplied unique identifier. Async Version.
@@ -863,7 +868,7 @@ class AutomatedCuration(Client):
863
868
  """
864
869
  loop = asyncio.get_event_loop()
865
870
  response = loop.run_until_complete(
866
- self._async_get_gov_action_process_graph(process_guid, server)
871
+ self._async_gov_action_process_graph(process_guid, server)
867
872
  )
868
873
  return response
869
874
 
@@ -877,11 +882,13 @@ class AutomatedCuration(Client):
877
882
  name : str
878
883
  The name of the engine action to retrieve.
879
884
  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.
885
+ The name of the server to retrieve the engine action from. If not provided, the default server specified
886
+ in the instance will be used.
881
887
  start_from : int, optional
882
888
  The index to start retrieving engine actions from. If not provided, the default value will be used.
883
889
  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.
890
+ The maximum number of engine actions to retrieve in a single request. If not provided, the default
891
+ global maximum paging size will be used.
885
892
 
886
893
  Returns
887
894
  -------
@@ -916,11 +923,13 @@ class AutomatedCuration(Client):
916
923
  name : str
917
924
  The name of the engine action to retrieve.
918
925
  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.
926
+ The name of the server to retrieve the engine action from. If not provided, the default server specified
927
+ in the instance will be used.
920
928
  start_from : int, optional
921
929
  The index to start retrieving engine actions from. If not provided, the default value will be used.
922
930
  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.
931
+ The maximum number of engine actions to retrieve in a single request. If not provided, the default global
932
+ maximum paging size will be used.
924
933
 
925
934
  Returns
926
935
  -------
@@ -1041,8 +1050,8 @@ class AutomatedCuration(Client):
1041
1050
 
1042
1051
  loop = asyncio.get_event_loop()
1043
1052
  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)
1053
+ self._async_find_gov_action_processes(search_string, server, starts_with, ends_with, ignore_case,
1054
+ start_from, page_size)
1046
1055
  )
1047
1056
  return response
1048
1057
 
@@ -1117,6 +1126,8 @@ class AutomatedCuration(Client):
1117
1126
  - unique name of the requesting governance service (if initiated by a governance engine)
1118
1127
  orig_engine_name: str
1119
1128
  - optional unique name of the governance engine (if initiated by a governance engine).
1129
+ server: str, optional
1130
+ - if not specified, the server from the class instance will be used
1120
1131
 
1121
1132
  Returns
1122
1133
  -------
@@ -1202,7 +1213,8 @@ class AutomatedCuration(Client):
1202
1213
  action_type_name: str
1203
1214
  The name of the governance action type to retrieve.
1204
1215
  server: str, optional
1205
- The name of the server. If None, will use the default server specified in the instance will be used.
1216
+ The name of the server. If None, will use the default server specified in the instance
1217
+ will be used.
1206
1218
  Returns:
1207
1219
  -------
1208
1220
  dict: The JSON representation of the governance action type element.
@@ -1369,8 +1381,10 @@ class AutomatedCuration(Client):
1369
1381
  return response
1370
1382
 
1371
1383
  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:
1384
+ action_targets: list, start_time: datetime = None,
1385
+ request_parameters: dict = None,
1386
+ orig_service_name: str = None, orig_engine_name: str = None,
1387
+ server: str = None) -> str:
1374
1388
  """ Using the named governance action type as a template, initiate an engine action. Async version.
1375
1389
 
1376
1390
  Parameters
@@ -1389,6 +1403,8 @@ class AutomatedCuration(Client):
1389
1403
  - unique name of the requesting governance service (if initiated by a governance engine)
1390
1404
  orig_engine_name: str
1391
1405
  - optional unique name of the governance engine (if initiated by a governance engine).
1406
+ server : str, optional
1407
+ - The name of the server. If None, will use the default server specified in the instance will be used.
1392
1408
 
1393
1409
  Returns
1394
1410
  -------
@@ -1439,6 +1455,8 @@ class AutomatedCuration(Client):
1439
1455
  - unique name of the requesting governance service (if initiated by a governance engine)
1440
1456
  orig_engine_name: str
1441
1457
  - optional unique name of the governance engine (if initiated by a governance engine).
1458
+ server : str, optional
1459
+ - The name of the server. If None, will use the default server specified in the instance will be used.
1442
1460
 
1443
1461
  Returns
1444
1462
  -------
@@ -1458,7 +1476,7 @@ class AutomatedCuration(Client):
1458
1476
  )
1459
1477
  return response
1460
1478
 
1461
- async def _async_initiate_postgres_server_survey(self, postgres_server_guid: str, server: str = None )-> str:
1479
+ async def _async_initiate_postgres_server_survey(self, postgres_server_guid: str, server: str = None) -> str:
1462
1480
  server = self.server_name if server is None else server
1463
1481
  url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-action-types/"
1464
1482
  f"initiate")
@@ -1467,9 +1485,9 @@ class AutomatedCuration(Client):
1467
1485
  "class": "InitiateGovernanceActionTypeRequestBody",
1468
1486
  "governanceActionTypeQualifiedName": "Egeria:GovernanceActionType:2adeb8f1-0f59-4970-b6f2-6cc25d4d2402survey-postgres-server",
1469
1487
  "actionTargets": [{
1470
- "class" : "NewActionTarget",
1471
- "actionTargetName" : "serverToSurvey",
1472
- "actionTargetGUID" : postgres_server_guid
1488
+ "class": "NewActionTarget",
1489
+ "actionTargetName": "serverToSurvey",
1490
+ "actionTargetGUID": postgres_server_guid
1473
1491
  }]
1474
1492
  }
1475
1493
  response = await self._async_make_request("POST", url, body)
@@ -1507,7 +1525,7 @@ class AutomatedCuration(Client):
1507
1525
  def initiate_file_folder_survey(self, file_folder_guid: str, server: str = None) -> str:
1508
1526
  loop = asyncio.get_event_loop()
1509
1527
  response = loop.run_until_complete(
1510
- self._async_initiate_file_folder_survey( file_folder_guid, server)
1528
+ self._async_initiate_file_folder_survey(file_folder_guid, server)
1511
1529
  )
1512
1530
  return response
1513
1531
 
@@ -1536,14 +1554,13 @@ class AutomatedCuration(Client):
1536
1554
  )
1537
1555
  return response
1538
1556
 
1539
- async def run_gov_action_postgres_server_survey(self, postgres_server: str, host_name: str, port: str,):
1557
+ async def run_gov_action_postgres_server_survey(self, postgres_server: str, host_name: str, port: str, ):
1540
1558
  pass
1541
1559
  # New combo process to do
1542
1560
  # run a process the creates the postgres server catalog entry, runs the server survey
1543
1561
  # creates a survey report
1544
1562
  # adds a to-do list element when done
1545
1563
 
1546
-
1547
1564
  async def _async_initiate_engine_action(self, qualified_name: str, domain_identifier: int, display_name: str,
1548
1565
  description: str, request_source_guids: str, action_targets: str,
1549
1566
  received_guards: [str], start_time: datetime, gov_engine_name: str,
@@ -1928,8 +1945,8 @@ class AutomatedCuration(Client):
1928
1945
 
1929
1946
  loop = asyncio.get_event_loop()
1930
1947
  loop.run_until_complete(
1931
- self._async_add_catalog_target(integ_connector_guid, metadata_element_guid,
1932
- server)
1948
+ self._async_remove_catalog_target(integ_connector_guid, metadata_element_guid,
1949
+ server)
1933
1950
  )
1934
1951
  return
1935
1952
 
@@ -2081,7 +2098,7 @@ class AutomatedCuration(Client):
2081
2098
  return response
2082
2099
 
2083
2100
  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,
2101
+ page_size: int = max_paging_size, starts_with: bool = False,
2085
2102
  ends_with: bool = False, ignore_case: bool = True) -> list | str:
2086
2103
  """ Retrieve the list of technology types that contain the search string. Async version.
2087
2104
 
@@ -2127,7 +2144,7 @@ class AutomatedCuration(Client):
2127
2144
  ends_with_s = str(ends_with).lower()
2128
2145
  ignore_case_s = str(ignore_case).lower()
2129
2146
  validate_name(search_string)
2130
- if search_string== "*":
2147
+ if search_string == "*":
2131
2148
  search_string = ""
2132
2149
 
2133
2150
  url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/technology-types/"
@@ -2139,7 +2156,7 @@ class AutomatedCuration(Client):
2139
2156
  return response.json().get("elements", "no tech found")
2140
2157
 
2141
2158
  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,
2159
+ page_size: int = max_paging_size, starts_with: bool = False,
2143
2160
  ends_with: bool = False, ignore_case: bool = True) -> list | str:
2144
2161
  """ Retrieve the list of technology types that contain the search string. Async version.
2145
2162
 
@@ -2168,7 +2185,7 @@ class AutomatedCuration(Client):
2168
2185
  loop = asyncio.get_event_loop()
2169
2186
  response = loop.run_until_complete(
2170
2187
  self._async_find_technology_types(type_name, server, start_from,
2171
- page_size, starts_with,ends_with, ignore_case)
2188
+ page_size, starts_with, ends_with, ignore_case)
2172
2189
  )
2173
2190
  return response
2174
2191
 
@@ -2183,6 +2200,6 @@ class AutomatedCuration(Client):
2183
2200
 
2184
2201
  if __name__ == "__main__":
2185
2202
  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"]
2203
+ response = p.get_active_engine_actions()
2204
+ out = response.json()
2188
2205
  print(out)
@@ -0,0 +1,382 @@
1
+ """
2
+ SPDX-License-Identifier: Apache-2.0
3
+ Copyright Contributors to the ODPi Egeria project.
4
+
5
+ Definitions, utilities and exceptions in support of the Egeria Python Client package.
6
+
7
+ """
8
+
9
+ import json
10
+ from enum import Enum
11
+
12
+ """
13
+
14
+ The following definitions are used in creating Exception messages.
15
+ They mirror similar definitions in the Egeria core.
16
+ Note that not all of the definitions are currently used - they merely serve as placeholders for future extensions.
17
+
18
+ """
19
+
20
+
21
+ class EgeriaErrorCode(Enum):
22
+ """ Egeria error codes """
23
+
24
+ def __str__(self):
25
+ return (
26
+ "http_error_code="
27
+ + self.value["http_error_code"]
28
+ + "messageId="
29
+ + self.value["message_id"]
30
+ + ", message="
31
+ + self.value["message_template"]
32
+ + ", systemAction="
33
+ + self.value["system_action"]
34
+ + ", userAction="
35
+ + self.value["user_action"]
36
+ )
37
+
38
+
39
+ class OMAGServerInstanceErrorCode(EgeriaErrorCode):
40
+ """ OMAGServer instance error codes """
41
+
42
+ BAD_SERVER_SECURITY_CONNECTION = dict(
43
+ https_error_code="400",
44
+ message_id="OMAG-MULTI-TENANT-400-001",
45
+ message_template="The OMAG server {0} has been configured with a bad connection to its security connector."
46
+ + " Error message is {1}. Connection is {2}",
47
+ system_action="The system is unable to validate the users issuing requests to this server.",
48
+ user_action="Review the error message to determine the cause of the problem.",
49
+ )
50
+
51
+ """
52
+ OMAG-MULTI-TENANT-400-002 - The OMAG server {0} has been requested to shut down but the following services are
53
+ still running: {1}
54
+ """
55
+ SERVICES_NOT_SHUTDOWN = dict(
56
+ https_error_code="400",
57
+ message_id="OMAG-MULTI-TENANT-400-002",
58
+ message_template="The OMAG server {0} has been requested to shutdown but the following services " +
59
+ "are still running: {1}",
60
+ system_action="The system is unable to shutdown the server correctly.",
61
+ user_action="Review other error messages to determine the cause of the problem."
62
+ + " This is likely to be a logic error in the services listed in the message",
63
+ )
64
+
65
+ """
66
+ OMAG-MULTI-TENANT-400-003 - Method {0} called on behalf of the {1} service is unable to create a client-side
67
+ open metadata topic connection because the topic name is not configured in the configuration for this service.
68
+ """
69
+ NO_TOPIC_INFORMATION = dict(
70
+ https_error_code="400",
71
+ message_id="OMAG-MULTI-TENANT-400-003",
72
+ message_template="Method {0} called on behalf of the {1} service is unable to create a client-side open "
73
+ + "metadata topic connection because the topic name is not configured in the configuration "
74
+ + "for this service.",
75
+ system_action="This is a configuration error and an exception is sent to the requester.",
76
+ user_action="Correct the configuration of the access service to include the name of the topic.",
77
+ )
78
+
79
+ """
80
+ OMAG-MULTI-TENANT-400-004 - The connector provider class name {0} does not create a connector of class {1}
81
+ which is required for the {2}
82
+ """
83
+ NOT_CORRECT_CONNECTOR_PROVIDER = dict(
84
+ https_error_code="400",
85
+ message_id="OMAG-MULTI-TENANT-400-004",
86
+ message_template="The connector provider class name {0} does not create a connector of class {1} which is"
87
+ + " required for the {2}",
88
+ system_action="An invalid parameter exception is returned to the caller.",
89
+ user_action="Either change the connector or the hosting environment because the current"
90
+ + " combination is not compatible.",
91
+ )
92
+
93
+ """
94
+ OMAG-MULTI-TENANT-404-001 - The OMAG Server {0} is not available to service a request from user {1}
95
+ """
96
+ SERVER_NOT_AVAILABLE = dict(
97
+ https_error_code="404",
98
+ message_id="OMAG-MULTI-TENANT-404-001",
99
+ message_template="The OMAG Server {0} is not available to service a request from user {1}",
100
+ system_action="The system is unable to process the request because the server"
101
+ + " is not running on the called platform.",
102
+ user_action="Verify that the correct server is being called on the correct platform and that this server "
103
+ + "is running. Retry the request when the server is available.",
104
+ )
105
+
106
+ """
107
+ OMAG-MULTI-TENANT-404-002- The {0} service is not available on OMAG Server {1} to handle a request from user {2}
108
+ """
109
+ SERVICE_NOT_AVAILABLE = dict(
110
+ https_error_code="404",
111
+ message_id="OMAG-MULTI-TENANT-404-002",
112
+ message_template="The {0} service is not available on OMAG Server {1} to handle a request from user {2}",
113
+ system_action="The system is unable to process the request because the service is not available.",
114
+ user_action="Verify that the correct server is being called on the correct platform and that the "
115
+ + "requested service is configured to run there. "
116
+ + "Once the correct environment is in place, retry the request.",
117
+ )
118
+
119
+ """
120
+ OMAG-MULTI-TENANT-404-003 - The server name is not available for the {0} operation
121
+ """
122
+ SERVER_NAME_NOT_AVAILABLE = dict(
123
+ https_error_code="404",
124
+ message_id="OMAG-MULTI-TENANT-404-003",
125
+ message_template="The server name is not available for the {0} operation",
126
+ system_action="The system is unable to return the server name because it is not available.",
127
+ user_action="Check that the server where the access service is running initialized correctly. "
128
+ + "Correct any errors discovered and retry the request when the open metadata services are available.",
129
+ )
130
+
131
+ """
132
+ OMAG-MULTI-TENANT-404-004 - The open metadata repository services are not initialized for the {0} operation
133
+ """
134
+ OMRS_NOT_INITIALIZED = dict(
135
+ https_error_code="404",
136
+ message_id="OMAG-MULTI-TENANT-404-004",
137
+ message_template="The open metadata repository services are not initialized for the {0} operation",
138
+ system_action="The system is unable to connect to the open metadata repository services because"
139
+ + " they are not running in this server.",
140
+ user_action="Check that the server where the called service is running initialized correctly. "
141
+ + "Correct any errors discovered and retry the request when the open metadata services are available.",
142
+ )
143
+
144
+ """
145
+ OMAG-MULTI-TENANT-404-005 - The open metadata repository services are not available for the {0} operation
146
+ """
147
+ OMRS_NOT_AVAILABLE = (
148
+ dict(
149
+ https_error_code="404",
150
+ message_id="OMAG-MULTI-TENANT-404-005",
151
+ message_template="The open metadata repository services are not available for the {0} operation",
152
+ system_action="The system is unable to connect to the open metadata repository services because"
153
+ " they are not in the correct state to be called.",
154
+ user_action="Check that the server where the called service is running initialized correctly and is not"
155
+ + " in the process of shutting down. Correct any errors discovered and retry the"
156
+ + " request when the open metadata repository services are available.",
157
+ ),
158
+ )
159
+
160
+ """
161
+ OMAG-MULTI-TENANT-500-003 - Method {0} called on behalf of the {1} service detected a {2} exception when
162
+ creating an open metadata topic connection because the connector provider is incorrect.
163
+ The error message was {3}
164
+ """
165
+ BAD_TOPIC_CONNECTOR_PROVIDER = dict(
166
+ http_error_code="500",
167
+ message_id="OMAG-MULTI-TENANT-500-003",
168
+ message_template="Method {0} called on behalf of the {1} service detected a {2} exception when creating an "
169
+ + "open metadata topic connection because the connector provider is incorrect. The error message was {3}",
170
+ system_action="This is an internal error. The access service is not using a valid connector provider.",
171
+ user_action="Raise an issue on Egeria's GitHub and work with the Egeria community to resolve.",
172
+ )
173
+
174
+
175
+ class OMAGCommonErrorCode(EgeriaErrorCode):
176
+ CLIENT_SIDE_REST_API_ERROR = dict(
177
+ http_error_code="503",
178
+ message_id="CLIENT-SIDE-REST-API-CONNECTOR-503-002",
179
+ message_template="A client-side error {0} was received by method {1} from API call {2} during the call {3}."
180
+ + " The error message was {4}",
181
+ system_action="The client has issued a call to the open metadata access service REST API in a remote server"
182
+ + " and has received an exception from the local client libraries.",
183
+ user_action="Review the error message to determine the cause of the error. Check that the server is running"
184
+ + " and the URL is correct. Look for errors in the local server's console to understand and"
185
+ + " correct the cause of the error. Then rerun the request",
186
+ )
187
+
188
+ EXCEPTION_RESPONSE_FROM_API = dict(
189
+ http_error_code="503",
190
+ message_id="SERVER-SIDE-REST-API-ERROR-503-003 ",
191
+ message_template="A {0} exception was received from REST API call {1} to server {2}: error message was: {3}",
192
+ system_action="The system has issued a call to an open metadata access service REST API in a remote server"
193
+ + " and has received an exception response.",
194
+ user_action="The error message should indicate the cause of the error. "
195
+ + "Otherwise look for errors in the remote server's audit log and console to understand and "
196
+ + "correct the source of the error.",
197
+ )
198
+
199
+ SERVER_URL_NOT_SPECIFIED = dict(
200
+ http_error_code="400",
201
+ message_id="OMAG-COMMON-400-001",
202
+ message_template="The OMAG Server Platform URL is null",
203
+ system_action="The system is unable to identify the OMAG Server Platform.",
204
+ user_action="Create a new client and pass the URL for the server on the constructor.",
205
+ )
206
+
207
+ SERVER_URL_MALFORMED = dict(
208
+ http_error_code="400",
209
+ message_id="OMAG-COMMON-400-002",
210
+ message_template="The OMAS Server URL: {0} is not in a recognized format",
211
+ system_action="The system is unable to connect to the OMAG Server Platform to fulfill any requests.",
212
+ user_action="Create a new client and pass the correct URL for the server on the constructor.",
213
+ )
214
+
215
+ SERVER_NAME_NOT_SPECIFIED = dict(
216
+ http_error_code="400",
217
+ message_id="OMAG-COMMON-400-003",
218
+ message_template="The OMAG Server name is null",
219
+ system_action="The system is unable to locate to the OMAG Server to fulfill any request.",
220
+ user_action="Create a new client and pass the correct name for the server on the constructor.",
221
+ )
222
+
223
+ NULL_USER_ID = dict(
224
+ http_error_code="400",
225
+ message_id="OMAG-COMMON-400-004",
226
+ message_template="The user identifier {0} passed on the operation is null",
227
+ system_action="The system is unable to process the request without a user id..",
228
+ user_action="Correct the code in the caller to provide the user id.",
229
+ )
230
+
231
+ NULL_GUID = dict(
232
+ http_error_code="400",
233
+ message_id="OMAG-COMMON-400-005",
234
+ message_template="The unique identifier (guid) passed is null or not a string",
235
+ system_action="The system is unable to process the request without a guid.",
236
+ user_action="Correct the code in the caller to provide the guid.",
237
+ )
238
+
239
+ NULL_NAME = dict(
240
+ http_error_code="400",
241
+ message_id="OMAG-COMMON-400-006",
242
+ message_template="The name passed on the parameter of the operation is null",
243
+ system_action="The system is unable to process the request without a name.",
244
+ user_action="Correct the code in the caller to provide the name on the parameter.",
245
+ )
246
+
247
+ NULL_ARRAY_PARAMETER = dict(
248
+ http_error_code="400",
249
+ message_id="OMAG-COMMON-400-007",
250
+ message_template="The array value passed on the {0} parameter of the {1} operation is null or empty",
251
+ system_action="The system is unable to process the request without this value.",
252
+ user_action="Correct the code in the caller to provide the array.",
253
+ )
254
+
255
+ NEGATIVE_START_FROM = dict(
256
+ http_error_code="400",
257
+ message_id="OMAG-COMMON-400-008",
258
+ message_template="The starting point for the results {0}, passed on the {1} parameter of the {2}"
259
+ + " operation, is negative",
260
+ system_action="The system is unable to process the request with this invalid value."
261
+ + "It should be zero for the start of the values, or a number greater than 0"
262
+ + "to start partway down the list.",
263
+ user_action="Correct the code in the caller to provide a non-negative value for the starting point.",
264
+ )
265
+
266
+ NEGATIVE_PAGE_SIZE = dict(
267
+ http_error_code="400",
268
+ message_id="OMAG-COMMON-400-009",
269
+ message_template="The page size for the results {0}, passed on the {1} parameter of the {2} operation, " +
270
+ "is negative",
271
+ system_action="The system is unable to process the request with this invalid value. "
272
+ + "It should be zero to return all the result, or greater than zero to set a maximum.",
273
+ user_action="Correct the code in the caller to provide a non-negative value for the page size.",
274
+ )
275
+
276
+ MAX_PAGE_SIZE = dict(
277
+ http_error_code="400",
278
+ message_id="OMAG-COMMON-400-010",
279
+ message_template=(
280
+ "The number of records to return, {0}, passed on the {1} parameter of the {2} operation, "
281
+ + "is greater than the allowable maximum of {3}"
282
+ ),
283
+ system_action="The system is unable to process the request with this page size value.",
284
+ user_action="Correct the code in the caller to provide a smaller page size.",
285
+ )
286
+
287
+ NULL_ENUM = dict(
288
+ http_error_code="400",
289
+ message_id="OMAG-COMMON-400-012",
290
+ message_template="The enumeration value passed on the {0} parameter of the {1} operation is null",
291
+ system_action="The system is unable to process the request without a enumeration value.",
292
+ user_action="Correct the code in the caller to provide the enumeration value.",
293
+ )
294
+
295
+ NULL_TEXT = dict(
296
+ http_error_code="400",
297
+ message_id="OMAG-COMMON-400-013",
298
+ message_template="The text field passed on the {0} parameter of the {1} operation is null",
299
+ system_action="The system is unable to process the request without this text value.",
300
+ user_action="Correct the code in the caller to provide a value in the text field.",
301
+ )
302
+
303
+ NULL_OBJECT = dict(
304
+ http_error_code="400",
305
+ message_id="OMAG-COMMON-400-015",
306
+ message_template="The object passed on the {0} parameter of the {1} operation is null",
307
+ system_action="The system is unable to process the request without this object.",
308
+ user_action="Correct the code in the caller to provide the object.",
309
+ )
310
+
311
+ NULL_SEARCH_STRING = dict(
312
+ http_error_code="400",
313
+ message_id="OMAG-COMMON-400-022",
314
+ message_template="The search string passed on the {0} parameter of the {1} operation is null",
315
+ system_action="The system is unable to process the request without a search string.",
316
+ user_action="Correct the code in the caller to provide the search string.",
317
+ )
318
+
319
+
320
+ class EgeriaException(Exception):
321
+ """
322
+ Define the Egeria exceptions raised during error handling. Modeled on the exceptions defined in the Egeria core.
323
+
324
+ """
325
+ raw_error_message = ""
326
+ def __init__(self, response_body) -> None:
327
+ response_dict = json.loads(response_body)
328
+ self.response_class = response_dict["class"]
329
+ self.related_http_code = response_dict["relatedHTTPCode"]
330
+ self.exception_class_name = response_dict["exceptionClassName"]
331
+ self.action_description = response_dict["actionDescription"]
332
+ self.exception_error_message = response_dict["exceptionErrorMessage"]
333
+ self.exception_error_message_id = response_dict["exceptionErrorMessageId"]
334
+
335
+ # self.exception_error_message_id = response_dict["exceptionErrorMessageId"]
336
+ self.exception_error_message_parameters = response_dict[
337
+ "exceptionErrorMessageParameters"
338
+ ]
339
+ self.exception_system_action = response_dict["exceptionSystemAction"]
340
+ self.exception_user_action = response_dict["exceptionUserAction"]
341
+
342
+ def __str__(self):
343
+ return self.exception_error_message
344
+
345
+
346
+ class InvalidParameterException(EgeriaException):
347
+ """Exception due to invalid parameters such as one of the parameters is null or invalid"""
348
+
349
+ def __init__(self, response_body):
350
+ EgeriaException.__init__(self, response_body)
351
+
352
+
353
+ class PropertyServerException(EgeriaException):
354
+ """Exception due to a problem retrieving information from the property server"""
355
+
356
+ def __init__(self, response_body):
357
+ EgeriaException.__init__(self, response_body)
358
+
359
+
360
+ class UserNotAuthorizedException(EgeriaException):
361
+ """Exception as the requesting user is not authorized to issue this request"""
362
+
363
+ def __init__(self, response_body):
364
+ EgeriaException.__init__(self, response_body)
365
+
366
+
367
+ def print_exception_response(e: EgeriaException):
368
+ """ Prints the exception response """
369
+
370
+ if isinstance(e, EgeriaException):
371
+ print(f"\n\nException: {e.response_class}")
372
+ print(f"\t\t Error Message: {e.exception_error_message}")
373
+ print(
374
+ f"\t\t Error Code: {e.exception_error_message_id} with http code {str(e.related_http_code)}"
375
+ )
376
+ # print(f"\t\t Raw Error Text is {e.raw_error_message}")
377
+ print(f"\t\t Class: {e.exception_class_name}")
378
+ print(f"\t\t Caller: {e.action_description}")
379
+ print(f"\t\t System Action: {e.exception_system_action}")
380
+ print(f"\t\t User Action: {e.exception_user_action}")
381
+ else:
382
+ print(f"\n\n\t Not an Egeria exception {e}")
@@ -10,12 +10,16 @@ integration service, it is important to know what companion service it depends o
10
10
  companion service is also configured and running.
11
11
 
12
12
  """
13
+ import json
14
+ from rich.console import Console
15
+ from rich import print, print_json
16
+
13
17
  import pandas as pd
14
18
  from tabulate import tabulate
15
19
 
16
- from .utils import wrap_text
20
+ from pyegeria.utils import wrap_text
17
21
 
18
- from ._client import Client
22
+ from pyegeria._client import Client
19
23
 
20
24
 
21
25
  class RegisteredInfo(Client):
@@ -42,6 +46,9 @@ class RegisteredInfo(Client):
42
46
 
43
47
  list_severity_definitions(self, fmt: str = 'json', skinny: bool = True, wrap_len: int = 30) -> list | str
44
48
  Returns a list of severity definitions for an OMAG Server used by the audit services.
49
+
50
+ list_asset_types(self, server: str = None) -> list | str
51
+ Lists the defined asset types.
45
52
  """
46
53
 
47
54
  admin_command_root: str
@@ -93,7 +100,7 @@ class RegisteredInfo(Client):
93
100
  The principle specified by the user_id does not have authorization for the requested action
94
101
 
95
102
  """
96
- if kind is None or kind is "help":
103
+ if kind is None or kind == "help":
97
104
  return ("""
98
105
  The kinds of services that you can get more information include:
99
106
  all.....................lists all registered services
@@ -107,15 +114,15 @@ class RegisteredInfo(Client):
107
114
  Pass in a parameter from the left-hand column into the function to
108
115
  get more details on the specified service category.
109
116
  """)
110
- if kind is "all":
117
+ if kind == "all":
111
118
  url = f"{self.admin_command_root}"
112
119
  else:
113
120
  url = f"{self.admin_command_root}/{kind}"
114
121
  response = self.make_request("GET", url)
115
122
 
116
- if fmt is 'json':
123
+ if fmt == 'json':
117
124
  return response.json().get("services", "No services found")
118
- elif fmt is 'table':
125
+ elif fmt == 'table':
119
126
  df = pd.DataFrame(response.json().get("services", []))
120
127
  if skinny:
121
128
  df = df.drop(columns=['serviceId', 'serviceDevelopmentStatus'])
@@ -155,10 +162,38 @@ class RegisteredInfo(Client):
155
162
  f"/users/{self.user_id}/audit-log/severity-definitions"
156
163
  )
157
164
  response = self.make_request("GET", url)
158
- if fmt is 'json':
165
+ if fmt == 'json':
159
166
  return response.json().get("severities", "No severities found")
160
- elif fmt is 'table':
167
+ elif fmt == 'table':
161
168
  df = pd.DataFrame(response.json().get("severities", []))
162
169
  if skinny:
163
170
  df = df.drop(columns=['ordinal'])
164
171
  return tabulate(wrap_text(df, wrap_len=wrap_len), headers='keys', tablefmt='psql')
172
+
173
+ def list_asset_types(self, server: str = None) -> list | str:
174
+ """ Get the registered severities for the OMAG Server
175
+
176
+ Parameters
177
+ ----------
178
+ server: str, optional, default = None
179
+
180
+ Returns
181
+ -------
182
+ dict | str
183
+ Returns a list of the asset types.
184
+
185
+ Raises
186
+ ------
187
+ InvalidParameterException
188
+ If the response code is not 200.
189
+ PropertyServerException:
190
+ Raised by the server when an issue arises in processing a valid request
191
+ NotAuthorizedException:
192
+ The principle specified by the user_id does not have authorization for the requested action
193
+
194
+ """
195
+ server = self.server_name if server is None else server
196
+ url = f"{self.platform_url}/servers/{self.server_name}/api/open-metadata/asset-catalog/assets/types"
197
+
198
+ response = self.make_request("GET", url)
199
+ return response.json().get('types', 'no types found')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://egeria-project.org/egeria-python
6
6
  Author: Dan Wolfson
@@ -10,6 +10,7 @@ src/pyegeria/_globals.py
10
10
  src/pyegeria/_validators.py
11
11
  src/pyegeria/automated_curation_omvs.py
12
12
  src/pyegeria/core_omag_server_config.py
13
+ src/pyegeria/exceptions.py
13
14
  src/pyegeria/full_omag_server_config.py
14
15
  src/pyegeria/glossary_omvs.py
15
16
  src/pyegeria/gov_engine.py
@@ -114,7 +114,7 @@ class TestCoreAdminServices:
114
114
  print_exception_response(e)
115
115
  assert False, "Invalid request"
116
116
 
117
- def test_configure_all_access_services_good(self, server:str = good_server_1):
117
+ def test_configure_all_access_services_good(self, server:str = good_server_3):
118
118
  try:
119
119
  o_client = CoreServerConfig(
120
120
  server, self.good_platform1_url,
@@ -10,6 +10,7 @@ The routines assume that pytest is being used as the test tool and framework.
10
10
  A running Egeria environment is needed to run these tests.
11
11
 
12
12
  """
13
+ import json
13
14
  import pytest
14
15
  from rich import print as rprint
15
16
  from rich.console import Console
@@ -28,7 +29,7 @@ disable_ssl_warnings = True
28
29
 
29
30
  class TestRegisteredInfoServices:
30
31
  good_platform1_url = "https://127.0.0.1:9443"
31
- good_platform2_url = "https://127.0.0.1:9444"
32
+ good_platform2_url = "https://cray.local:9443"
32
33
  bad_platform1_url = "https://localhost:9443"
33
34
 
34
35
  good_user_1 = "garygeeke"
@@ -37,7 +38,7 @@ class TestRegisteredInfoServices:
37
38
  bad_user_2 = ""
38
39
 
39
40
  good_server_1 = "simple-metadata-store"
40
- good_server_2 = "cocoMDS2"
41
+ good_server_2 = "view-server"
41
42
  good_server_3 = "active-metadata-store"
42
43
  bad_server_1 = "coco"
43
44
  bad_server_2 = ""
@@ -127,3 +128,26 @@ class TestRegisteredInfoServices:
127
128
  ) as e:
128
129
  print_exception_response(e)
129
130
  assert False, "Invalid request"
131
+
132
+ def test_list_asset_types(self):
133
+ user = self.good_user_2
134
+ try:
135
+ r_client = RegisteredInfo(self.good_platform1_url, user, "secret",
136
+ server_name =self.good_server_2,)
137
+ token = r_client.create_egeria_bearer_token(user, "secret")
138
+ response = r_client.list_asset_types()
139
+
140
+ assert type(response) is list, "No services found"
141
+ if type(response) is list:
142
+ print(f"\n\nAsset types are: \n\n")
143
+ print(json.dumps(response, indent=4))
144
+ else:
145
+ print(f"\n\n{response}: \n\n")
146
+
147
+ except (
148
+ InvalidParameterException,
149
+ PropertyServerException,
150
+ UserNotAuthorizedException
151
+ ) as e:
152
+ print_exception_response(e)
153
+ assert False, "Invalid request"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes