pyegeria 0.3.3__py3-none-any.whl → 0.3.5__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 (33) hide show
  1. pyegeria/__init__.py +3 -1
  2. pyegeria/automated_curation_omvs.py +15 -10
  3. pyegeria/collection_manager_omvs.py +2428 -0
  4. pyegeria/core_omag_server_config.py +15 -22
  5. pyegeria/full_omag_server_config.py +0 -1
  6. pyegeria/glossary_omvs.py +14 -2
  7. pyegeria/gov_engine.py +1 -8
  8. pyegeria/governance_author.py +2 -0
  9. pyegeria/my_profile_omvs.py +1 -1
  10. pyegeria/platform_services.py +2 -39
  11. pyegeria/project_manager_omvs.py +1689 -0
  12. pyegeria/registered_info.py +3 -1
  13. pyegeria/server_operations.py +2 -2
  14. pyegeria/valid_metadata_omvs.py +779 -0
  15. pyegeria-0.3.5.data/scripts/engine_action_status.py +145 -0
  16. pyegeria-0.3.5.data/scripts/find_todos.py +152 -0
  17. pyegeria-0.3.5.data/scripts/glossary_view.py +135 -0
  18. pyegeria-0.3.5.data/scripts/gov_engine_status.py +120 -0
  19. pyegeria-0.3.5.data/scripts/integration_daemon_status.py +130 -0
  20. pyegeria-0.3.5.data/scripts/list_asset_types.py +114 -0
  21. pyegeria-0.3.5.data/scripts/multi-server_status.py +120 -0
  22. pyegeria-0.3.5.data/scripts/my_todos.py +162 -0
  23. pyegeria-0.3.5.data/scripts/open_todos.py +140 -0
  24. pyegeria-0.3.5.data/scripts/server_status.py +105 -0
  25. pyegeria-0.3.5.data/scripts/server_status_widget.py +93 -0
  26. pyegeria-0.3.5.data/scripts/view_my_profile.py +140 -0
  27. {pyegeria-0.3.3.dist-info → pyegeria-0.3.5.dist-info}/METADATA +1 -1
  28. pyegeria-0.3.5.dist-info/RECORD +36 -0
  29. pyegeria/exceptions.py +0 -382
  30. pyegeria-0.3.3.dist-info/RECORD +0 -22
  31. {pyegeria-0.3.3.dist-info → pyegeria-0.3.5.dist-info}/LICENSE +0 -0
  32. {pyegeria-0.3.3.dist-info → pyegeria-0.3.5.dist-info}/WHEEL +0 -0
  33. {pyegeria-0.3.3.dist-info → pyegeria-0.3.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,93 @@
1
+ #!python
2
+ """
3
+ SPDX-License-Identifier: Apache-2.0
4
+ Copyright Contributors to the ODPi Egeria project.
5
+
6
+ Unit tests for the Utils helper functions using the Pytest framework.
7
+
8
+
9
+ A simple server status display
10
+ """
11
+
12
+ import time
13
+ import argparse
14
+
15
+ from pyegeria._exceptions import (
16
+ InvalidParameterException,
17
+ PropertyServerException,
18
+ UserNotAuthorizedException,
19
+ print_exception_response,
20
+ )
21
+ from rich.table import Table
22
+ from rich.live import Live
23
+
24
+ from pyegeria.server_operations import ServerOps
25
+ from pyegeria.core_omag_server_config import CoreServerConfig
26
+
27
+ disable_ssl_warnings = True
28
+
29
+ def display_status(server: str, url: str, username: str):
30
+ p_client = ServerOps(server, url, username)
31
+ c_client = CoreServerConfig(server, url, username)
32
+
33
+ def generate_table() -> Table:
34
+ """Make a new table."""
35
+ table = Table(
36
+ title=f"Server Status for Platform - {time.asctime()}",
37
+ # style = "black on grey66",
38
+ header_style="white on dark_blue",
39
+ caption=f"Server Status for Platform - '{url}'",
40
+ show_lines=True,
41
+ # expand=True
42
+ )
43
+
44
+ table.add_column("Known Server")
45
+ table.add_column("Status")
46
+ table.add_column("Server Type")
47
+ table.add_column("Server Description")
48
+ known_server_list = p_client.get_known_servers()
49
+ active_server_list = p_client.get_active_server_list()
50
+ if len(known_server_list) == 0:
51
+ return table
52
+
53
+ for server in known_server_list:
54
+ if server in active_server_list:
55
+ status = "Active"
56
+ else:
57
+ status = "Inactive"
58
+ server_type = c_client.get_server_type_classification(server)["serverTypeName"]
59
+ description = c_client.get_basic_server_properties(server).get("localServerDescription", " ")
60
+
61
+ table.add_row(server,
62
+ "[red]Inactive" if status == "Inactive" else "[green]Active",
63
+ server_type, description)
64
+
65
+ return table
66
+
67
+ try:
68
+ with Live(generate_table(), refresh_per_second=4, screen=True) as live:
69
+ while True:
70
+ time.sleep(2)
71
+ live.update(generate_table())
72
+
73
+ except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
74
+ print_exception_response(e)
75
+ assert e.related_http_code != "200", "Invalid parameters"
76
+
77
+ finally:
78
+ p_client.close_session()
79
+ c_client.close_session()
80
+
81
+
82
+ if __name__ == "__main__":
83
+ parser = argparse.ArgumentParser()
84
+ parser.add_argument("--server", help="Name of the server to display status for")
85
+ parser.add_argument("--url", help="URL Platform to connect to")
86
+ parser.add_argument("--userid", help="User Id")
87
+ args = parser.parse_args()
88
+
89
+ server = args.server if args.server is not None else "active-metadata-store"
90
+ url = args.url if args.url is not None else "https://localhost:9443"
91
+ userid = args.userid if args.userid is not None else 'garygeeke'
92
+
93
+ display_status(server, url, userid)
@@ -0,0 +1,140 @@
1
+ #!python
2
+ """
3
+ SPDX-License-Identifier: Apache-2.0
4
+ Copyright Contributors to the ODPi Egeria project.
5
+
6
+ Unit tests for the Utils helper functions using the Pytest framework.
7
+
8
+
9
+ A simple display for my profile
10
+ """
11
+
12
+ import time
13
+ import json
14
+ import argparse
15
+ from pyegeria import (
16
+ InvalidParameterException,
17
+ PropertyServerException,
18
+ UserNotAuthorizedException,
19
+ print_exception_response,
20
+ )
21
+ from rich.table import Table
22
+ from rich.live import Live
23
+ from rich import box
24
+ from rich.prompt import Prompt
25
+ from rich.tree import Tree
26
+ from rich import print
27
+ from rich.console import Console
28
+ from pyegeria.my_profile_omvs import MyProfile
29
+
30
+ from pyegeria.server_operations import ServerOps
31
+ from pyegeria.gov_engine import GovEng
32
+ from pyegeria.glossary_omvs import GlossaryBrowser
33
+ disable_ssl_warnings = True
34
+
35
+ good_platform1_url = "https://127.0.0.1:9443"
36
+ good_platform2_url = "https://egeria.pdr-associates.com:7443"
37
+ bad_platform1_url = "https://localhost:9443"
38
+
39
+ # good_platform1_url = "https://127.0.0.1:30080"
40
+ # good_platform2_url = "https://127.0.0.1:30081"
41
+ # bad_platform1_url = "https://localhost:9443"
42
+
43
+ good_user_1 = "garygeeke"
44
+ good_user_2 = "erinoverview"
45
+ bad_user_1 = "eviledna"
46
+ bad_user_2 = ""
47
+
48
+ good_server_1 = "active-metadata-store"
49
+ good_server_2 = "simple-metadata-store"
50
+ good_server_3 = "view-server"
51
+ good_server_4 = "engine-host"
52
+ bad_server_1 = "coco"
53
+ bad_server_2 = ""
54
+
55
+
56
+ def display_my_profiles(server: str = good_server_3, url: str = good_platform1_url, username: str = good_user_2):
57
+
58
+ m_client = MyProfile(server, url, user_id=username)
59
+ token = m_client.create_egeria_bearer_token(username, "secret")
60
+ my_profiles = m_client.get_my_profile()
61
+
62
+ def generate_table() -> Table:
63
+ """Make a new table."""
64
+ table = Table(
65
+ title=f"My Profile Information {good_platform1_url} @ {time.asctime()}",
66
+ # style = "black on grey66",
67
+ header_style="white on dark_blue",
68
+ show_lines=True,
69
+ box=box.ROUNDED,
70
+ caption=f"My Profile from Server '{server}' @ Platform - {url}\n Press 'q' to Quit",
71
+ expand=True
72
+ )
73
+
74
+ table.add_column("Name")
75
+ table.add_column("Job Title")
76
+ table.add_column("userId")
77
+ table.add_column("myGUID")
78
+ table.add_column("Role Type")
79
+ table.add_column("Role")
80
+ table.add_column("Role GUID")
81
+
82
+ if len(my_profiles) == 0:
83
+ name = " "
84
+ job_title = " "
85
+ user_id = " "
86
+ my_guid = " "
87
+ role_type = " "
88
+ role = " "
89
+ role_guid = " "
90
+ else:
91
+ name = my_profiles["profileProperties"]["fullName"]
92
+ job_title = my_profiles["profileProperties"]["jobTitle"]
93
+ id_list=" "
94
+ for identities in my_profiles["userIdentities"]:
95
+ id_list = f"{identities['userIdentity']['properties']['userId']} {id_list}"
96
+
97
+ my_guid = my_profiles["elementHeader"]["guid"]
98
+
99
+ my_roles = my_profiles["roles"]
100
+ for a_role in my_roles:
101
+ my_role_props = a_role["properties"]
102
+ role_type = my_role_props["typeName"]
103
+ role = my_role_props.get("title"," ")
104
+ role_guid = a_role["elementHeader"]["guid"]
105
+ table.add_row(
106
+ name, job_title, str(id_list), my_guid, role_type, role, role_guid
107
+ )
108
+
109
+ m_client.close_session()
110
+ return table
111
+
112
+ try:
113
+ # with Live(generate_table(), refresh_per_second=4, screen=True) as live:
114
+ # while True:
115
+ # time.sleep(2)
116
+ # live.update(generate_table())
117
+ console = Console()
118
+ with console.pager():
119
+ console.print(generate_table())
120
+
121
+
122
+ except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
123
+ print_exception_response(e)
124
+ assert e.related_http_code != "200", "Invalid parameters"
125
+
126
+ if __name__ == "__main__":
127
+ parser = argparse.ArgumentParser()
128
+ parser.add_argument("--server", help="Name of the server to display status for")
129
+ parser.add_argument("--url", help="URL Platform to connect to")
130
+ parser.add_argument("--userid", help="User Id")
131
+
132
+ args = parser.parse_args()
133
+
134
+ server = args.server if args.server is not None else "view-server"
135
+ url = args.url if args.url is not None else "https://localhost:9443"
136
+ userid = args.userid if args.userid is not None else 'erinoverview'
137
+ # guid = args.guid if args.guid is not None else None
138
+ guid = None
139
+
140
+ display_my_profiles(server, url, userid)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://egeria-project.org/egeria-python
6
6
  Author: Dan Wolfson
@@ -0,0 +1,36 @@
1
+ pyegeria/__init__.py,sha256=bBRHgbVWPZAt7yL150rrJm9UhELyXf8VMyycg4j3bOk,1769
2
+ pyegeria/_client.py,sha256=8-8r1-_fACDEGgmfJdkeODlPmftcdiKwb-bmrSA3ac4,23606
3
+ pyegeria/_exceptions.py,sha256=LImJPHy7MVgoH17LfqEL4ytLKcOhV7oCe66wZiDBzec,18399
4
+ pyegeria/_globals.py,sha256=WgJ6O7_ACiAG8CUUHT_AbGgahLhO0APU8Y4rCwv9DRw,558
5
+ pyegeria/_validators.py,sha256=DQuMsATRGxGSBtOrVtXlCgWXGhj6Nh-uqPtCsrUGLxk,12703
6
+ pyegeria/automated_curation_omvs.py,sha256=4Ukqe1eMJpUoEx-joJtRj-pyYq_ryVSaHOebYpe_6lo,100106
7
+ pyegeria/collection_manager_omvs.py,sha256=iTKN_MJFj2s1M8LyXDkSy8KUBS2uaPAikCz3ncE_3sE,114200
8
+ pyegeria/core_omag_server_config.py,sha256=hatwh_UWVlylaeD7q0M9ZzpZPOg9BLA6zfEJ-kXMT9E,93140
9
+ pyegeria/full_omag_server_config.py,sha256=sVBeG40Hp6ZG7dsz2BZqzO3bluPeu-j0fGTuinQ-SsY,46146
10
+ pyegeria/glossary_omvs.py,sha256=KcKRMNgm53suqbFLqsnThln5-zzAEJ8OseexiJ8BSsk,36500
11
+ pyegeria/gov_engine.py,sha256=3SBSZlbUTVG4x8OhlEIqipe8mB8_KEYOacHmxk7loSM,19697
12
+ pyegeria/governance_author.py,sha256=m0wsfmyO-VxRDaPpACeIDw8eVAFu3RVbo45RPCUel9M,6340
13
+ pyegeria/my_profile_omvs.py,sha256=gLIHiG0cO5fJKLK7EtVHtoC43WrABqDIJvdh91s_KDY,42441
14
+ pyegeria/platform_services.py,sha256=_povbV9ezjKv9TE-QE0iceuyI8aHqzJS_am1jjLlvHs,41955
15
+ pyegeria/project_manager_omvs.py,sha256=j-rlfoKZArghS1NPQT_sawn8Z-qvaV4MW7mwoRNeDoA,77305
16
+ pyegeria/registered_info.py,sha256=H7mgH83JKtMeDZ1vVOWoFM9iARD38Rnb6igvfEM46AA,8775
17
+ pyegeria/server_operations.py,sha256=iMBfIgPGqFM1TkABqFFJDt8tVUSY2qwSrRURrmWuma0,16323
18
+ pyegeria/utils.py,sha256=H0mew9IRcbsEi-pZfaT9HGuPO9CMOwnhOgIltyNvqTY,5240
19
+ pyegeria/valid_metadata_omvs.py,sha256=Li_XLLIXJTN9gUqB_H1WbVpnDMSgc7ne6yuzKoBW7sU,29710
20
+ pyegeria-0.3.5.data/scripts/engine_action_status.py,sha256=v0GaYkh7ee8LXwDlZlbGTVkZCiooWkEMscHIUwIhPjs,5192
21
+ pyegeria-0.3.5.data/scripts/find_todos.py,sha256=A75s7cwtXVukMCbVYFlbJoDYFg1A8fHU3dCTK2s6JtM,5171
22
+ pyegeria-0.3.5.data/scripts/glossary_view.py,sha256=tZvdX9Sc7Q2rL9oiEjRIFFt-saqwMs8PQ3BCgp-v710,4594
23
+ pyegeria-0.3.5.data/scripts/gov_engine_status.py,sha256=ZTVbhrvGsfzmN4j9Xz95rEMTjqTNvKi9Ojvy43Z5sI8,4000
24
+ pyegeria-0.3.5.data/scripts/integration_daemon_status.py,sha256=9XRQKdjmYqwfxwNoo4EUhX8vrplR0etS-5Yq89lXGMw,4575
25
+ pyegeria-0.3.5.data/scripts/list_asset_types.py,sha256=4PwaJXKgF4_bQhc3s3OOpppJRFIPHqIBqHDLlkfGjOU,3564
26
+ pyegeria-0.3.5.data/scripts/multi-server_status.py,sha256=XlBaIERVqYXjHO2x18WY64Oo0fUZS1onpOLAJcIlJk0,3690
27
+ pyegeria-0.3.5.data/scripts/my_todos.py,sha256=wzGKekUAT-DfzE-R8O1_byvh0trB_FMd0YvdNkTw10Q,5660
28
+ pyegeria-0.3.5.data/scripts/open_todos.py,sha256=f02BXZ-LgqjUOe5QiK1SKA9RDSH9m6-u_x0HTCQAD8E,4649
29
+ pyegeria-0.3.5.data/scripts/server_status.py,sha256=BgBLjYeMDN41zk9ADyPWZFBaQX0TqiCZ9pjesnByUhM,3346
30
+ pyegeria-0.3.5.data/scripts/server_status_widget.py,sha256=tyx1I7olr6e5kJF22ou9rqsztrRDdrPCq5uVa3hhPBU,3088
31
+ pyegeria-0.3.5.data/scripts/view_my_profile.py,sha256=KFeGAkR-DHX01jcOPOP7HMCTrAyY3i4mQKhq1dG86vE,4605
32
+ pyegeria-0.3.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
33
+ pyegeria-0.3.5.dist-info/METADATA,sha256=YjSdR1z5T7KMLBt_pEAmQkLlDv7j0kz664Oqp_1Ka7k,2398
34
+ pyegeria-0.3.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
35
+ pyegeria-0.3.5.dist-info/top_level.txt,sha256=tHowU8jow7WJGmbr4QdIk7gJWdslRgbWBiF2lMeduLQ,9
36
+ pyegeria-0.3.5.dist-info/RECORD,,
pyegeria/exceptions.py DELETED
@@ -1,382 +0,0 @@
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}")