pyegeria 0.3.8__py3-none-any.whl → 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyegeria/Xfeedback_manager_omvs.py +238 -0
- pyegeria/Xloaded_resources_omvs.py +91 -0
- pyegeria/__init__.py +15 -12
- pyegeria/_client.py +4 -6
- pyegeria/{gov_engine.py → _deprecated_gov_engine.py} +2 -59
- pyegeria/_exceptions.py +5 -6
- pyegeria/_globals.py +3 -1
- pyegeria/asset_catalog_omvs.py +672 -0
- pyegeria/automated_curation_omvs.py +627 -359
- pyegeria/collection_manager_omvs.py +187 -248
- pyegeria/core_guids.py +128 -0
- pyegeria/core_omag_server_config.py +1 -5
- pyegeria/full_omag_server_config.py +53 -83
- pyegeria/glossary_browser_omvs.py +2208 -0
- pyegeria/glossary_manager_omvs.py +3002 -0
- pyegeria/my_profile_omvs.py +2 -7
- pyegeria/platform_services.py +0 -3
- pyegeria/project_manager_omvs.py +9 -15
- pyegeria/registered_info.py +12 -52
- pyegeria/runtime_manager_omvs.py +967 -0
- pyegeria/server_operations.py +1 -5
- pyegeria/valid_metadata_omvs.py +204 -43
- pyegeria-0.4.0.data/scripts/Create_Collection_Sample.py +292 -0
- pyegeria-0.4.0.data/scripts/Create_Sustainability_Collection_Sample.py +115 -0
- pyegeria-0.4.0.data/scripts/get_guid_info.py +86 -0
- pyegeria-0.3.8.data/scripts/view_my_profile.py → pyegeria-0.4.0.data/scripts/get_my_profile.py +8 -34
- {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/get_tech_details.py +1 -37
- pyegeria-0.4.0.data/scripts/get_tech_type_elements.py +137 -0
- pyegeria-0.4.0.data/scripts/get_tech_type_template.py +137 -0
- {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/list_asset_types.py +3 -25
- pyegeria-0.4.0.data/scripts/list_assets.py +138 -0
- pyegeria-0.3.8.data/scripts/project_list_viewer.py → pyegeria-0.4.0.data/scripts/list_projects.py +13 -27
- pyegeria-0.4.0.data/scripts/list_registered_services.py +135 -0
- pyegeria-0.3.8.data/scripts/get_relationship_types.py → pyegeria-0.4.0.data/scripts/list_relationship_types.py +25 -43
- pyegeria-0.4.0.data/scripts/list_tech_templates.py +134 -0
- pyegeria-0.3.8.data/scripts/find_todos.py → pyegeria-0.4.0.data/scripts/list_todos.py +11 -39
- pyegeria-0.4.0.data/scripts/list_valid_metadata_values.py +144 -0
- pyegeria-0.4.0.data/scripts/view_asset_graph.py +236 -0
- pyegeria-0.3.8.data/scripts/multi-server_status.py → pyegeria-0.4.0.data/scripts/view_coco_status.py +17 -39
- pyegeria-0.3.8.data/scripts/collection_viewer.py → pyegeria-0.4.0.data/scripts/view_collection.py +12 -31
- pyegeria-0.3.8.data/scripts/engine_action_status.py → pyegeria-0.4.0.data/scripts/view_eng_action_status.py +17 -31
- pyegeria-0.3.8.data/scripts/glossary_view.py → pyegeria-0.4.0.data/scripts/view_glossary.py +2 -2
- pyegeria-0.3.8.data/scripts/gov_engine_status.py → pyegeria-0.4.0.data/scripts/view_gov_eng_status.py +0 -1
- pyegeria-0.3.8.data/scripts/integration_daemon_status.py → pyegeria-0.4.0.data/scripts/view_integ_daemon_status.py +30 -42
- pyegeria-0.3.8.data/scripts/my_todos.py → pyegeria-0.4.0.data/scripts/view_my_todos.py +1 -1
- pyegeria-0.3.8.data/scripts/open_todos.py → pyegeria-0.4.0.data/scripts/view_open_todos.py +3 -24
- pyegeria-0.4.0.data/scripts/view_platform_status.py +123 -0
- pyegeria-0.3.8.data/scripts/server_status.py → pyegeria-0.4.0.data/scripts/view_server_status.py +1 -20
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/METADATA +5 -4
- pyegeria-0.4.0.dist-info/RECORD +58 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/WHEEL +1 -1
- pyegeria/glossary_omvs.py +0 -789
- pyegeria/loaded_resources_omvs.py +0 -159
- pyegeria-0.3.8.dist-info/RECORD +0 -42
- /pyegeria/{governance_author.py → action_author_omvs.py} +0 -0
- /pyegeria-0.3.8.data/scripts/get_tech_types.py → /pyegeria-0.4.0.data/scripts/list_tech_types.py +0 -0
- /pyegeria-0.3.8.data/scripts/server_status_widget.py → /pyegeria-0.4.0.data/scripts/view_server_list.py +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/LICENSE +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,238 @@
|
|
1
|
+
"""
|
2
|
+
SPDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
Feedback Manager View Service Methods - Add comments, reviews, tags and notes to elements of interest.
|
6
|
+
|
7
|
+
This work is being actively developed..
|
8
|
+
|
9
|
+
"""
|
10
|
+
import asyncio
|
11
|
+
from datetime import datetime
|
12
|
+
|
13
|
+
from httpx import Response
|
14
|
+
|
15
|
+
from pyegeria import Client, max_paging_size, body_slimmer
|
16
|
+
from pyegeria._exceptions import (
|
17
|
+
InvalidParameterException,
|
18
|
+
)
|
19
|
+
from ._validators import validate_name, validate_guid, validate_search_string
|
20
|
+
|
21
|
+
|
22
|
+
class FeedbackManager(Client):
|
23
|
+
""" Set up and maintain automation services in Egeria.
|
24
|
+
|
25
|
+
Attributes:
|
26
|
+
server_name : str
|
27
|
+
The name of the View Server to use.
|
28
|
+
platform_url : str
|
29
|
+
URL of the server platform to connect to
|
30
|
+
user_id : str
|
31
|
+
The identity of the user calling the method - this sets a default optionally used by the methods
|
32
|
+
when the user doesn't pass the user_id on a method call.
|
33
|
+
user_pwd: str
|
34
|
+
The password associated with the user_id. Defaults to None
|
35
|
+
verify_flag: bool
|
36
|
+
Flag to indicate if SSL Certificates should be verified in the HTTP requests.
|
37
|
+
Defaults to False.
|
38
|
+
|
39
|
+
"""
|
40
|
+
|
41
|
+
def __init__(
|
42
|
+
self,
|
43
|
+
server_name: str,
|
44
|
+
platform_url: str,
|
45
|
+
user_id: str,
|
46
|
+
user_pwd: str = None,
|
47
|
+
verify_flag: bool = False,
|
48
|
+
):
|
49
|
+
Client.__init__(self, server_name, platform_url, user_id, user_pwd, verify_flag)
|
50
|
+
self.cur_command_root = f"{platform_url}/servers/"
|
51
|
+
|
52
|
+
|
53
|
+
async def _async_get_comment_by_guid(self, comment_guid: str, view_server: str, server: str = None,
|
54
|
+
access_service: str = 'asset-manager',for_lineage: bool = False,
|
55
|
+
for_duplicate_processing: bool = False, effective_time: str = None) -> dict:
|
56
|
+
""" Create a new metadata element from a template. Async version.
|
57
|
+
Parameters
|
58
|
+
----------
|
59
|
+
body : str
|
60
|
+
The json body used to instantiate the template.
|
61
|
+
server : str, optional
|
62
|
+
The name of the view server to use. If not provided, the default server name will be used.
|
63
|
+
|
64
|
+
Returns
|
65
|
+
-------
|
66
|
+
Response
|
67
|
+
The guid of the resulting element
|
68
|
+
|
69
|
+
Raises
|
70
|
+
------
|
71
|
+
InvalidParameterException
|
72
|
+
PropertyServerException
|
73
|
+
UserNotAuthorizedException
|
74
|
+
|
75
|
+
Notes
|
76
|
+
-----
|
77
|
+
|
78
|
+
"""
|
79
|
+
|
80
|
+
server = self.server_name if server is None else server
|
81
|
+
|
82
|
+
url = f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/catalog-templates/new-element"
|
83
|
+
response = await self._async_make_request("POST", url)
|
84
|
+
return response.json().get("guid", "GUID failed to be returned")
|
85
|
+
|
86
|
+
def get_comment_by_guid(self, comment_guid: str, view_server: str, server: str = None,
|
87
|
+
access_service: str = 'asset-manager',for_lineage: bool = False,
|
88
|
+
for_duplicate_processing: bool = False, effective_time: str = None) -> dict:
|
89
|
+
""" Create a new metadata element from a template. Async version.
|
90
|
+
Parameters
|
91
|
+
----------
|
92
|
+
body : str
|
93
|
+
The json body used to instantiate the template.
|
94
|
+
server : str, optional
|
95
|
+
The name of the view server to use. If not provided, the default server name will be used.
|
96
|
+
|
97
|
+
Returns
|
98
|
+
-------
|
99
|
+
Response
|
100
|
+
The guid of the resulting element
|
101
|
+
|
102
|
+
Raises
|
103
|
+
------
|
104
|
+
InvalidParameterException
|
105
|
+
PropertyServerException
|
106
|
+
UserNotAuthorizedException
|
107
|
+
|
108
|
+
Notes
|
109
|
+
-----
|
110
|
+
See also: https://egeria-project.org/features/templated-cataloguing/overview/
|
111
|
+
The full description of the body is shown below:
|
112
|
+
{
|
113
|
+
"typeName" : "",
|
114
|
+
"initialStatus" : "",
|
115
|
+
"initialClassifications" : "",
|
116
|
+
"anchorGUID" : "",
|
117
|
+
"isOwnAnchor" : "",
|
118
|
+
"effectiveFrom" : "",
|
119
|
+
"effectiveTo" : "",
|
120
|
+
"templateGUID" : "",
|
121
|
+
"templateProperties" : {},
|
122
|
+
"placeholderPropertyValues" : {
|
123
|
+
"placeholderPropertyName1" : "placeholderPropertyValue1",
|
124
|
+
"placeholderPropertyName2" : "placeholderPropertyValue2"
|
125
|
+
},
|
126
|
+
"parentGUID" : "",
|
127
|
+
"parentRelationshipTypeName" : "",
|
128
|
+
"parentRelationshipProperties" : "",
|
129
|
+
"parentAtEnd1" : "",
|
130
|
+
"effectiveTime" : ""
|
131
|
+
}
|
132
|
+
"""
|
133
|
+
loop = asyncio.get_event_loop()
|
134
|
+
response = loop.run_until_complete(
|
135
|
+
self._async_get_comment_by_guid(comment_guid, view_server,server,access_service,
|
136
|
+
for_lineage,for_duplicate_processing,effective_time)
|
137
|
+
)
|
138
|
+
return response
|
139
|
+
|
140
|
+
async def _async_add_comment_to_reply(self, comment_guid: str, view_server: str, comment: str, server: str = None,
|
141
|
+
access_service: str = 'asset-manager', is_public: bool = False,
|
142
|
+
for_lineage: bool = False, for_duplicate_processing: bool = False,
|
143
|
+
effective_time: str = None) -> str:
|
144
|
+
""" Add a reply to a comment. Async version.
|
145
|
+
See also: https://egeria-project.org/patterns/metadata-manager/overview/#asset-feedback
|
146
|
+
|
147
|
+
Parameters
|
148
|
+
----------
|
149
|
+
comment_guid : str
|
150
|
+
The GUID of the comment.
|
151
|
+
view_server : str
|
152
|
+
The server where the view is hosted.
|
153
|
+
comment : str
|
154
|
+
The text to add as the reply.
|
155
|
+
server : str, optional
|
156
|
+
The server to connect to. Default is None.
|
157
|
+
access_service : str, optional
|
158
|
+
The access service to use. Default is 'asset-manager'.
|
159
|
+
is_public : bool, optional
|
160
|
+
Determines if the comment is public. Default is False.
|
161
|
+
for_lineage : bool, optional
|
162
|
+
Determines if the comment is for lineage. Default is False.
|
163
|
+
for_duplicate_processing : bool, optional
|
164
|
+
Determines if the comment is for duplicate processing. Default is False.
|
165
|
+
effective_time : str, optional
|
166
|
+
The effective time for the comment. Default is None.
|
167
|
+
|
168
|
+
Returns
|
169
|
+
-------
|
170
|
+
str
|
171
|
+
The unique identifier (guid) of the new comment.
|
172
|
+
|
173
|
+
Raises
|
174
|
+
------
|
175
|
+
InvalidParameterException
|
176
|
+
PropertyServerException
|
177
|
+
UserNotAuthorizedException
|
178
|
+
|
179
|
+
"""
|
180
|
+
|
181
|
+
url = f"{self.cur_command_root}api/open-metadata/feedback-manager/comments/{comment_guid}/replies"
|
182
|
+
body = {
|
183
|
+
'parentGUID': comment_guid,
|
184
|
+
'effectiveTime': effective_time,
|
185
|
+
'updateDescription': comment
|
186
|
+
}
|
187
|
+
|
188
|
+
response = await self._async_make_request("POST",url,body)
|
189
|
+
return response
|
190
|
+
|
191
|
+
def add_comment_to_reply(self, comment_guid: str, view_server: str, comment: str, server: str = None,
|
192
|
+
access_service: str = 'asset-manager', is_public: bool = False,
|
193
|
+
for_lineage: bool = False, for_duplicate_processing: bool = False,
|
194
|
+
effective_time: str = None) -> str:
|
195
|
+
""" Add a reply to a comment. Async version.
|
196
|
+
See also: https://egeria-project.org/patterns/metadata-manager/overview/#asset-feedback
|
197
|
+
|
198
|
+
Parameters
|
199
|
+
----------
|
200
|
+
comment_guid : str
|
201
|
+
The GUID of the comment.
|
202
|
+
view_server : str
|
203
|
+
The server where the view is hosted.
|
204
|
+
comment : str
|
205
|
+
The text to add as the reply.
|
206
|
+
server : str, optional
|
207
|
+
The server to connect to. Default is None.
|
208
|
+
access_service : str, optional
|
209
|
+
The access service to use. Default is 'asset-manager'.
|
210
|
+
is_public : bool, optional
|
211
|
+
Determines if the comment is public. Default is False.
|
212
|
+
for_lineage : bool, optional
|
213
|
+
Determines if the comment is for lineage. Default is False.
|
214
|
+
for_duplicate_processing : bool, optional
|
215
|
+
Determines if the comment is for duplicate processing. Default is False.
|
216
|
+
effective_time : str, optional
|
217
|
+
The effective time for the comment. Default is None.
|
218
|
+
|
219
|
+
Returns
|
220
|
+
-------
|
221
|
+
str
|
222
|
+
The unique identifier (guid) of the new comment.
|
223
|
+
|
224
|
+
Raises
|
225
|
+
------
|
226
|
+
InvalidParameterException
|
227
|
+
PropertyServerException
|
228
|
+
UserNotAuthorizedException
|
229
|
+
|
230
|
+
"""
|
231
|
+
loop = asyncio.get_event_loop()
|
232
|
+
response = loop.run_until_complete(
|
233
|
+
self._async_add_comment_to_reply(comment_guid, view_server, comment,
|
234
|
+
server, access_service, is_public,)
|
235
|
+
)
|
236
|
+
return response
|
237
|
+
|
238
|
+
|
@@ -0,0 +1,91 @@
|
|
1
|
+
"""
|
2
|
+
SPDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
This module allows users to query the available (registered) capabilities of Egeria. Detailed information is returned
|
8
|
+
to provide both insight and understanding in how to use these capabilities. For example, when configuring an Egeria
|
9
|
+
integration service, it is importregistered_info.pyant to know what companion service it depends on so that you can make sure the
|
10
|
+
companion service is also configured and running.
|
11
|
+
|
12
|
+
"""
|
13
|
+
|
14
|
+
from pyegeria import (
|
15
|
+
Client, max_paging_size, InvalidParameterException, PropertyServerException, UserNotAuthorizedException,
|
16
|
+
print_exception_response
|
17
|
+
)
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
class LoadedResources(Client):
|
22
|
+
""" Client to search and retrieve currently loaded information about connectors, templates, governance actions,
|
23
|
+
etc.
|
24
|
+
|
25
|
+
Attributes:
|
26
|
+
----------
|
27
|
+
server_name: str
|
28
|
+
Name of the 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
|
+
Methods:
|
41
|
+
-------
|
42
|
+
|
43
|
+
"""
|
44
|
+
|
45
|
+
admin_command_root: str
|
46
|
+
|
47
|
+
def __init__(
|
48
|
+
self,
|
49
|
+
server_name: str,
|
50
|
+
platform_url: str,
|
51
|
+
user_id: str,
|
52
|
+
user_pwd: str = None,
|
53
|
+
verify_flag: bool = False,
|
54
|
+
):
|
55
|
+
if server_name is None:
|
56
|
+
server_name = "NA"
|
57
|
+
Client.__init__(self, server_name, platform_url,
|
58
|
+
user_id, user_pwd, verify_flag)
|
59
|
+
|
60
|
+
def get_all_templates(self, server: str = None, start_from: int = 0, page_size: int = 0) -> list | str:
|
61
|
+
""" Get Loaded templates for the Server.
|
62
|
+
|
63
|
+
Parameters
|
64
|
+
----------
|
65
|
+
|
66
|
+
Returns
|
67
|
+
-------
|
68
|
+
dict | str
|
69
|
+
A dictionary containing a simplified list of key template attributes.
|
70
|
+
|
71
|
+
Raises
|
72
|
+
------
|
73
|
+
InvalidParameterException
|
74
|
+
If the response code is not 200.
|
75
|
+
PropertyServerException:
|
76
|
+
Raised by the server when an issue arises in processing a valid request
|
77
|
+
NotAuthorizedException:
|
78
|
+
The principle specified by the user_id does not have authorization for the requested action
|
79
|
+
|
80
|
+
"""
|
81
|
+
server = self.server_name if server is None else server
|
82
|
+
url = (f"{self.platform_url}/servers/{server}/open-metadata/framework-services/asset-owner/open-metadata-store/"
|
83
|
+
f"users/{self.user_id}/metadata-elements/by-search-string?startFrom=start_from&pageSize=page_size")
|
84
|
+
body = {
|
85
|
+
"class" : "SearchStringRequestBody",
|
86
|
+
"searchString" : ".*Template.*"
|
87
|
+
}
|
88
|
+
response = self.make_request("POST", url, body)
|
89
|
+
return response.json().get("elementList", "No elements")
|
90
|
+
|
91
|
+
# def get_all_assets_in_archives(self, asset_type: str = None, archive_id: str = None, server: str= None, page_start:int = 0, page_size = max_paging_size):
|
pyegeria/__init__.py
CHANGED
@@ -11,17 +11,14 @@ the server platform and servers.
|
|
11
11
|
|
12
12
|
"""
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
except ModuleNotFoundError:
|
18
|
-
import tomli as tomllib
|
19
|
-
|
20
|
-
from ._globals import is_debug, disable_ssl_warnings, max_paging_size
|
14
|
+
from ._globals import (is_debug, disable_ssl_warnings, max_paging_size,
|
15
|
+
)
|
16
|
+
from .core_guids import *
|
21
17
|
|
22
18
|
if disable_ssl_warnings:
|
23
19
|
from urllib3.exceptions import InsecureRequestWarning
|
24
20
|
from urllib3 import disable_warnings
|
21
|
+
|
25
22
|
disable_warnings(InsecureRequestWarning)
|
26
23
|
|
27
24
|
from ._exceptions import (InvalidParameterException, PropertyServerException, UserNotAuthorizedException,
|
@@ -32,16 +29,22 @@ from .automated_curation_omvs import AutomatedCuration
|
|
32
29
|
from .core_omag_server_config import CoreServerConfig
|
33
30
|
from .platform_services import Platform
|
34
31
|
from .registered_info import RegisteredInfo
|
35
|
-
from .
|
32
|
+
from .glossary_browser_omvs import GlossaryBrowser
|
36
33
|
from ._validators import (validate_user_id, validate_name, validate_guid, validate_server_name, validate_search_string,
|
37
34
|
validate_url, is_json, validate_public)
|
38
|
-
|
39
|
-
|
35
|
+
from .asset_catalog_omvs import AssetCatalog
|
36
|
+
|
40
37
|
from .my_profile_omvs import MyProfile
|
41
38
|
from .full_omag_server_config import FullServerConfig
|
42
39
|
from .server_operations import ServerOps
|
43
40
|
from .collection_manager_omvs import CollectionManager
|
44
41
|
from .project_manager_omvs import ProjectManager
|
45
42
|
from .valid_metadata_omvs import ValidMetadataManager
|
46
|
-
from .
|
47
|
-
|
43
|
+
from .asset_catalog_omvs import AssetCatalog
|
44
|
+
from .Xloaded_resources_omvs import LoadedResources
|
45
|
+
from ._deprecated_gov_engine import GovEng
|
46
|
+
from .runtime_manager_omvs import RuntimeManager
|
47
|
+
from .action_author_omvs import GovernanceAuthor
|
48
|
+
from .glossary_manager_omvs import GlossaryManager
|
49
|
+
|
50
|
+
__version__ = "0.4"
|
pyegeria/_client.py
CHANGED
@@ -12,6 +12,7 @@ import json
|
|
12
12
|
import os
|
13
13
|
|
14
14
|
import httpx
|
15
|
+
from httpx import AsyncClient, Response
|
15
16
|
|
16
17
|
from pyegeria._exceptions import (
|
17
18
|
OMAGCommonErrorCode,
|
@@ -126,9 +127,6 @@ class Client:
|
|
126
127
|
self.headers["Authorization"] = f"Bearer {token}"
|
127
128
|
self.text_headers["Authorization"] = f"Bearer {token}"
|
128
129
|
|
129
|
-
calling_frame = inspect.currentframe().f_back
|
130
|
-
caller_method = inspect.getframeinfo(calling_frame).function
|
131
|
-
|
132
130
|
v_url = validate_url(platform_url)
|
133
131
|
|
134
132
|
if v_url:
|
@@ -139,7 +137,7 @@ class Client:
|
|
139
137
|
# self.session = httpx.Client(verify=self.ssl_verify)
|
140
138
|
# else:
|
141
139
|
# self.session = httpx.AsyncClient(verify=self.ssl_verify)
|
142
|
-
self.session =
|
140
|
+
self.session = AsyncClient(verify=self.ssl_verify)
|
143
141
|
|
144
142
|
def __enter__(self):
|
145
143
|
return self
|
@@ -334,7 +332,7 @@ class Client:
|
|
334
332
|
return self.text_headers["Authorization"]
|
335
333
|
|
336
334
|
def make_request(self, request_type: str, endpoint: str, payload: str | dict = None,
|
337
|
-
time_out: int = 30) ->
|
335
|
+
time_out: int = 30) -> Response | str:
|
338
336
|
""" Make a request to the Egeria API"""
|
339
337
|
loop = asyncio.get_event_loop()
|
340
338
|
response = loop.run_until_complete(self._async_make_request(request_type, endpoint,
|
@@ -342,7 +340,7 @@ class Client:
|
|
342
340
|
return response
|
343
341
|
|
344
342
|
async def _async_make_request(self, request_type: str, endpoint: str, payload: str | dict = None,
|
345
|
-
time_out: int = 30) ->
|
343
|
+
time_out: int = 30) -> Response | str:
|
346
344
|
""" Make a request to the Egeria API - Async Version
|
347
345
|
Function to make an API call via the self.session Library. Raise an exception if the HTTP response code
|
348
346
|
is not 200/201. IF there is a REST communication exception, raise InvalidParameterException.
|
@@ -3,6 +3,8 @@ SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
Copyright Contributors to the ODPi Egeria project.
|
4
4
|
|
5
5
|
Governance Engine functions. These functions initiate and manage Governance Actions and Processes
|
6
|
+
|
7
|
+
This module is deprecated - please use Automated Curation.
|
6
8
|
"""
|
7
9
|
|
8
10
|
from datetime import datetime
|
@@ -396,62 +398,3 @@ class GovEng(Client):
|
|
396
398
|
response = self.make_request("POST", url, new_body)
|
397
399
|
return response.json().get('guid')
|
398
400
|
|
399
|
-
def print_engine_action_summary(self, governance_action: dict):
|
400
|
-
""" print_governance_action_summary
|
401
|
-
|
402
|
-
Print all the governance actions with their status, in the server.
|
403
|
-
|
404
|
-
Parameters
|
405
|
-
----------
|
406
|
-
|
407
|
-
Returns
|
408
|
-
-------
|
409
|
-
|
410
|
-
Raises
|
411
|
-
------
|
412
|
-
InvalidParameterException
|
413
|
-
PropertyServerException
|
414
|
-
UserNotAuthorizedException
|
415
|
-
"""
|
416
|
-
if governance_action:
|
417
|
-
name = governance_action.get('displayName')
|
418
|
-
if not name:
|
419
|
-
name = governance_action.get('qualifiedName')
|
420
|
-
action_status = governance_action.get('action_status')
|
421
|
-
if governance_action.get('completion_guards'):
|
422
|
-
completion_guards = governance_action.get('completion_guards')
|
423
|
-
else:
|
424
|
-
completion_guards = "\t"
|
425
|
-
if governance_action.get('process_name'):
|
426
|
-
process_name = governance_action.get('process_name')
|
427
|
-
else:
|
428
|
-
process_name = "\t"
|
429
|
-
if governance_action.get('completion_message'):
|
430
|
-
completion_message = governance_action.get('completion_message')
|
431
|
-
else:
|
432
|
-
completion_message = ""
|
433
|
-
print(action_status + "\n\t| " + name + "\t| " + process_name + "\t| " + '%s' % ', '.join(
|
434
|
-
map(str, completion_guards)) + "\t| " + completion_message)
|
435
|
-
|
436
|
-
def print_engine_actions(self):
|
437
|
-
""" print_governance_actions
|
438
|
-
|
439
|
-
Print all the governance actions with their status, in the server.
|
440
|
-
|
441
|
-
Parameters
|
442
|
-
----------
|
443
|
-
|
444
|
-
Returns
|
445
|
-
-------
|
446
|
-
|
447
|
-
Raises
|
448
|
-
------
|
449
|
-
InvalidParameterException
|
450
|
-
PropertyServerException
|
451
|
-
UserNotAuthorizedException
|
452
|
-
|
453
|
-
"""
|
454
|
-
governance_actions = self.get_engine_actions(0, 0)
|
455
|
-
if governance_actions is not None:
|
456
|
-
for x in range(len(governance_actions)):
|
457
|
-
self.print_engine_action_summary(governance_actions[x])
|
pyegeria/_exceptions.py
CHANGED
@@ -323,6 +323,7 @@ class EgeriaException(Exception):
|
|
323
323
|
|
324
324
|
"""
|
325
325
|
raw_error_message = ""
|
326
|
+
|
326
327
|
def __init__(self, response_body) -> None:
|
327
328
|
response_dict = json.loads(response_body)
|
328
329
|
self.response_class = response_dict["class"]
|
@@ -330,14 +331,12 @@ class EgeriaException(Exception):
|
|
330
331
|
self.exception_class_name = response_dict["exceptionClassName"]
|
331
332
|
self.action_description = response_dict["actionDescription"]
|
332
333
|
self.exception_error_message = response_dict["exceptionErrorMessage"]
|
333
|
-
self.exception_error_message_id = response_dict
|
334
|
+
self.exception_error_message_id = response_dict.get("exceptionErrorMessageId", "UNKNOWN-ERROR-CODE")
|
334
335
|
|
335
336
|
# self.exception_error_message_id = response_dict["exceptionErrorMessageId"]
|
336
|
-
self.exception_error_message_parameters = response_dict
|
337
|
-
|
338
|
-
|
339
|
-
self.exception_system_action = response_dict["exceptionSystemAction"]
|
340
|
-
self.exception_user_action = response_dict["exceptionUserAction"]
|
337
|
+
self.exception_error_message_parameters = response_dict.get("exceptionErrorMessageParameters", "{}")
|
338
|
+
self.exception_system_action = response_dict.get("exceptionSystemAction", "UNKNOWN-SYSTEM-ACTION")
|
339
|
+
self.exception_user_action = response_dict.get("exceptionUserAction", "UNKNOWN-USER-ACTION")
|
341
340
|
|
342
341
|
def __str__(self):
|
343
342
|
return self.exception_error_message
|
pyegeria/_globals.py
CHANGED
@@ -8,10 +8,11 @@ This common file is used to set some global values and enumerations used by the
|
|
8
8
|
|
9
9
|
"""
|
10
10
|
|
11
|
+
|
11
12
|
is_debug = False
|
12
13
|
disable_ssl_warnings = True
|
13
14
|
enable_ssl_check = False
|
14
|
-
max_paging_size =
|
15
|
+
max_paging_size = 500
|
15
16
|
|
16
17
|
comment_types = (
|
17
18
|
"ANSWER",
|
@@ -29,3 +30,4 @@ star_ratings = (
|
|
29
30
|
"THREE_STARS",
|
30
31
|
"TWO_STARS",
|
31
32
|
)
|
33
|
+
|