pyegeria 0.2.4__py3-none-any.whl → 0.3.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyegeria/__init__.py +13 -8
- pyegeria/_client.py +164 -105
- pyegeria/_exceptions.py +2 -1
- pyegeria/_validators.py +2 -2
- pyegeria/automated_curation_omvs.py +2188 -0
- pyegeria/core_omag_server_config.py +43 -39
- pyegeria/full_omag_server_config.py +1180 -0
- pyegeria/glossary_omvs.py +204 -66
- pyegeria/gov_engine.py +92 -201
- pyegeria/governance_author.py +184 -0
- pyegeria/my_profile_omvs.py +976 -0
- pyegeria/platform_services.py +67 -35
- pyegeria/server_operations.py +92 -25
- pyegeria/utils.py +5 -17
- {pyegeria-0.2.4.dist-info → pyegeria-0.3.2.dist-info}/METADATA +22 -18
- pyegeria-0.3.2.dist-info/RECORD +21 -0
- {pyegeria-0.2.4.dist-info → pyegeria-0.3.2.dist-info}/WHEEL +2 -1
- pyegeria-0.3.2.dist-info/top_level.txt +1 -0
- pyegeria/config.toml +0 -11
- pyegeria/curation_omvs.py +0 -458
- pyegeria/exceptions.py +0 -382
- pyegeria-0.2.4.dist-info/RECORD +0 -19
- {pyegeria-0.2.4.dist-info/licenses → pyegeria-0.3.2.dist-info}/LICENSE +0 -0
pyegeria/curation_omvs.py
DELETED
@@ -1,458 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
|
3
|
-
This module contains the core OMAG configuration class and its methods.
|
4
|
-
|
5
|
-
"""
|
6
|
-
from datetime import datetime
|
7
|
-
|
8
|
-
# import json
|
9
|
-
from pyegeria._client import Client, max_paging_size
|
10
|
-
from pyegeria._globals import enable_ssl_check
|
11
|
-
from pyegeria._validators import (
|
12
|
-
validate_name,
|
13
|
-
validate_guid,
|
14
|
-
validate_url, validate_search_string,
|
15
|
-
)
|
16
|
-
from pyegeria.utils import body_slimmer
|
17
|
-
|
18
|
-
class AutomatedCuration(Client):
|
19
|
-
"""
|
20
|
-
This client provides methods to perform automated curation of assets.
|
21
|
-
|
22
|
-
Methods:
|
23
|
-
|
24
|
-
|
25
|
-
"""
|
26
|
-
|
27
|
-
def __init__(
|
28
|
-
self,
|
29
|
-
server_name: str,
|
30
|
-
platform_url: str,
|
31
|
-
token: str = None,
|
32
|
-
user_id: str = None,
|
33
|
-
user_pwd: str = None,
|
34
|
-
verify_flag: bool = enable_ssl_check,
|
35
|
-
):
|
36
|
-
self.curation_command_root: str
|
37
|
-
Client.__init__(self, server_name, platform_url, user_id = user_id, token=token)
|
38
|
-
|
39
|
-
self.curation_command_root = (
|
40
|
-
self.platform_url
|
41
|
-
+ "/servers/" + server_name
|
42
|
-
+ "/api/open-metadata/automated-curation/engine-actions"
|
43
|
-
)
|
44
|
-
|
45
|
-
def get_engine_actions(self, server_name:str = None, start_from: str = 0, page_size: str = 0) -> [dict]:
|
46
|
-
""" Get engine actions associated deployed on the server.
|
47
|
-
|
48
|
-
Parameters:
|
49
|
-
----------
|
50
|
-
server_name (str, optional):
|
51
|
-
start_from (int, optional): The index to start retrieving processes from. Defaults to 0.
|
52
|
-
page_size (int, optional): The number of processes to retrieve per page. Defaults to 0 (no pagination).
|
53
|
-
|
54
|
-
Returns:
|
55
|
-
-------
|
56
|
-
List[str]: A list of JSON representations of governance action processes matching the provided name.
|
57
|
-
|
58
|
-
Raises:
|
59
|
-
------
|
60
|
-
InvalidParameterException: If the API response indicates an error (non-200 status code),
|
61
|
-
this exception is raised with details from the response content.
|
62
|
-
|
63
|
-
Note:
|
64
|
-
----
|
65
|
-
Pagination of 0 defaults to server default.
|
66
|
-
|
67
|
-
"""
|
68
|
-
url = (self.engine_command_root + "/engine-actions?startFrom=" +
|
69
|
-
str(start_from) + "&pageSize=" + str(page_size))
|
70
|
-
response = self.make_request("GET", url)
|
71
|
-
|
72
|
-
if response.status_code != 200:
|
73
|
-
return response.json() # should never get here?
|
74
|
-
|
75
|
-
related_code = response.json().get("relatedHTTPCode")
|
76
|
-
if related_code == 200:
|
77
|
-
governanceActionElements = response.json().get('elements')
|
78
|
-
return governanceActionElements
|
79
|
-
else:
|
80
|
-
raise InvalidParameterException(response.content)
|
81
|
-
#
|
82
|
-
# Glossaries
|
83
|
-
#
|
84
|
-
def find_glossaries(self, search_string: str, effective_time: str = None, starts_with: bool = False,
|
85
|
-
ends_with:bool = False, ignore_case: bool = False, for_lineage:bool = False,
|
86
|
-
for_duplicate_processing: bool = False, type_name: str= None,server_name: str = None,
|
87
|
-
start_from: int = 0, page_size: int = None) -> list | str:
|
88
|
-
""" Retrieve the list of glossary metadata elements that contain the search string.
|
89
|
-
The search string is located in the request body and is interpreted as a plain string.
|
90
|
-
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
91
|
-
|
92
|
-
Parameters
|
93
|
-
----------
|
94
|
-
search_string: str,
|
95
|
-
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
96
|
-
|
97
|
-
effective_time: str, [default=None], optional
|
98
|
-
Effective time of the query. If not specified will default to any time.
|
99
|
-
server_name : str, optional
|
100
|
-
The name of the server to configure.
|
101
|
-
If not provided, the server name associated with the instance is used.
|
102
|
-
starts_with : bool, [default=False], optional
|
103
|
-
Starts with the supplied string.
|
104
|
-
ends_with : bool, [default=False], optional
|
105
|
-
Ends with the supplied string
|
106
|
-
ignore_case : bool, [default=False], optional
|
107
|
-
Ignore case when searching
|
108
|
-
for_lineage : bool, [default=False], optional
|
109
|
-
|
110
|
-
for_duplicate_processing : bool, [default=False], optional
|
111
|
-
type_name: str, [default=None], optional
|
112
|
-
An optional parameter indicating the subtype of the glossary to filter by.
|
113
|
-
Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
|
114
|
-
Returns
|
115
|
-
-------
|
116
|
-
List | str
|
117
|
-
|
118
|
-
A list of glossary definitions
|
119
|
-
|
120
|
-
Raises
|
121
|
-
------
|
122
|
-
|
123
|
-
InvalidParameterException
|
124
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
125
|
-
PropertyServerException
|
126
|
-
Raised by the server when an issue arises in processing a valid request
|
127
|
-
NotAuthorizedException
|
128
|
-
The principle specified by the user_id does not have authorization for the requested action
|
129
|
-
|
130
|
-
"""
|
131
|
-
if server_name is None:
|
132
|
-
server_name = self.server_name
|
133
|
-
if page_size is None:
|
134
|
-
page_size = self.page_size
|
135
|
-
starts_with_s = str(starts_with).lower()
|
136
|
-
ends_with_s = str(ends_with).lower()
|
137
|
-
ignore_case_s = str(ignore_case).lower()
|
138
|
-
for_lineage_s = str(for_lineage).lower()
|
139
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
140
|
-
|
141
|
-
validate_search_string(search_string)
|
142
|
-
|
143
|
-
if search_string is '*':
|
144
|
-
search_string = None
|
145
|
-
|
146
|
-
body = {
|
147
|
-
"class": "SearchStringRequestBody",
|
148
|
-
"searchString": search_string,
|
149
|
-
"effectiveTime": effective_time,
|
150
|
-
"typeName" : type_name
|
151
|
-
}
|
152
|
-
body = body_slimmer(body)
|
153
|
-
# print(f"\n\nBody is: \n{body}")
|
154
|
-
|
155
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
156
|
-
f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
157
|
-
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
|
158
|
-
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
159
|
-
|
160
|
-
response = self.make_request("POST", url, body)
|
161
|
-
return response.json().get("elementList","No glossaries found")
|
162
|
-
|
163
|
-
|
164
|
-
def get_glossary_by_guid(self, glossary_guid: str, server_name: str = None) -> dict:
|
165
|
-
""" Retrieves information about a glossary
|
166
|
-
Parameters
|
167
|
-
----------
|
168
|
-
glossary_guid : str
|
169
|
-
Unique idetifier for the glossary
|
170
|
-
server_name : str, optional
|
171
|
-
The name of the server to get the configured access services for.
|
172
|
-
If not provided, the server name associated with the instance is used.
|
173
|
-
Returns
|
174
|
-
-------
|
175
|
-
dict
|
176
|
-
The glossary definition associated with the glossary_guid
|
177
|
-
|
178
|
-
Raises
|
179
|
-
------
|
180
|
-
InvalidParameterException
|
181
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
182
|
-
PropertyServerException
|
183
|
-
Raised by the server when an issue arises in processing a valid request.
|
184
|
-
NotAuthorizedException
|
185
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
186
|
-
Notes
|
187
|
-
-----
|
188
|
-
"""
|
189
|
-
|
190
|
-
if server_name is None:
|
191
|
-
server_name = self.server_name
|
192
|
-
validate_guid(glossary_guid)
|
193
|
-
|
194
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glosaries/"
|
195
|
-
f"{glossary_guid}/retrieve")
|
196
|
-
|
197
|
-
response = self.make_request("GET", url)
|
198
|
-
return response.json()
|
199
|
-
|
200
|
-
|
201
|
-
def get_glossaries_by_name(self, glossary_name: str, effective_time: datetime = None, server_name: str = None,
|
202
|
-
start_from: int = 0, page_size: int = None) -> dict | str:
|
203
|
-
""" Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
|
204
|
-
There are no wildcards supported on this request.
|
205
|
-
|
206
|
-
Parameters
|
207
|
-
----------
|
208
|
-
glossary_name: str,
|
209
|
-
Name of the glossary to be retrieved
|
210
|
-
effective_time: datetime, [default=None], optional
|
211
|
-
Effective time of the query. If not specified will default to any effective time.
|
212
|
-
server_name : str, optional
|
213
|
-
The name of the server to configure.
|
214
|
-
If not provided, the server name associated with the instance is used.
|
215
|
-
|
216
|
-
Returns
|
217
|
-
-------
|
218
|
-
None
|
219
|
-
|
220
|
-
Raises
|
221
|
-
------
|
222
|
-
|
223
|
-
InvalidParameterException
|
224
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
225
|
-
PropertyServerException
|
226
|
-
Raised by the server when an issue arises in processing a valid request
|
227
|
-
NotAuthorizedException
|
228
|
-
The principle specified by the user_id does not have authorization for the requested action
|
229
|
-
ConfigurationErrorException
|
230
|
-
Raised when configuration parameters passed on earlier calls turn out to be
|
231
|
-
invalid or make the new call invalid.
|
232
|
-
"""
|
233
|
-
if server_name is None:
|
234
|
-
server_name = self.server_name
|
235
|
-
if page_size is None:
|
236
|
-
page_size = self.page_size
|
237
|
-
validate_name(glossary_name)
|
238
|
-
|
239
|
-
if effective_time is None:
|
240
|
-
body = {"name": glossary_name}
|
241
|
-
else:
|
242
|
-
body = {"name": glossary_name, "effectiveTime": effective_time}
|
243
|
-
|
244
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
245
|
-
f"by-name?startFrom={start_from}&pageSize={page_size}")
|
246
|
-
|
247
|
-
response = self.make_request("POST", url, body)
|
248
|
-
return response.json()
|
249
|
-
|
250
|
-
|
251
|
-
def get_terms_for_glossary(self, glossary_guid: str, server_name: str = None, effective_time: datetime= None,
|
252
|
-
start_from: int = 0, page_size: int = None) -> list | str:
|
253
|
-
""" Retrieve the list of glossary terms associated with a glossary.
|
254
|
-
The request body also supports the specification of an effective time for the query.
|
255
|
-
Parameters
|
256
|
-
----------
|
257
|
-
glossary_guid : str
|
258
|
-
Unique idetifier for the glossary
|
259
|
-
server_name : str, optional
|
260
|
-
The name of the server to get the configured access services for.
|
261
|
-
If not provided, the server name associated with the instance is used.
|
262
|
-
effective_time : str, optional
|
263
|
-
If specified, the query is performed as of the `effective_time`
|
264
|
-
start_from: int, optional defaults to 0
|
265
|
-
The page number to start retrieving elements from
|
266
|
-
page_size : int, optional defaults to None
|
267
|
-
The number of elements to retrieve
|
268
|
-
Returns
|
269
|
-
-------
|
270
|
-
dict
|
271
|
-
The glossary definition associated with the glossary_guid
|
272
|
-
|
273
|
-
Raises
|
274
|
-
------
|
275
|
-
InvalidParameterException
|
276
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
277
|
-
PropertyServerException
|
278
|
-
Raised by the server when an issue arises in processing a valid request.
|
279
|
-
NotAuthorizedException
|
280
|
-
The principle specified by the user_id does not have authorization for the requested action.
|
281
|
-
Notes
|
282
|
-
-----
|
283
|
-
"""
|
284
|
-
|
285
|
-
if server_name is None:
|
286
|
-
server_name = self.server_name
|
287
|
-
validate_guid(glossary_guid)
|
288
|
-
|
289
|
-
if page_size is None:
|
290
|
-
page_size = self.page_size
|
291
|
-
|
292
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
293
|
-
f"{glossary_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}")
|
294
|
-
|
295
|
-
if effective_time is not None:
|
296
|
-
body = {
|
297
|
-
"effectiveTime": str(effective_time)
|
298
|
-
}
|
299
|
-
response = self.make_request("POST", url, body)
|
300
|
-
else:
|
301
|
-
response = self.make_request("POST", url)
|
302
|
-
return response.json().get("elementList","No terms found")
|
303
|
-
|
304
|
-
def get_glossary_for_term(self, term_guid: str, server_name: str=None, effective_time: datetime = None,
|
305
|
-
for_lineage: bool=False, for_duplicate_processing: bool=False) ->dict:
|
306
|
-
if server_name is None:
|
307
|
-
server_name = self.server_name
|
308
|
-
validate_guid(term_guid)
|
309
|
-
for_lineage_s = str(for_lineage).lower()
|
310
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
311
|
-
|
312
|
-
body = {
|
313
|
-
"class" : "EffectiveTimeQueryRequestBody",
|
314
|
-
"effectiveTime" : effective_time
|
315
|
-
}
|
316
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
317
|
-
f"for-term/{term_guid}/retrieve?forLineage={for_lineage_s}&"
|
318
|
-
f"forDuplicateProcessing={for_duplicate_processing_s}"
|
319
|
-
|
320
|
-
)
|
321
|
-
|
322
|
-
response = self.make_request("POST", url, body)
|
323
|
-
return response.json()
|
324
|
-
|
325
|
-
|
326
|
-
def get_terms_by_name(self, term: str, glossary_guid:str = None, status_filter: list=[], server_name: str=None,
|
327
|
-
effective_time: datetime=None, for_lineage: bool=False, for_duplicate_processing: bool=False,
|
328
|
-
start_from: int=0, page_size: int=None) ->list:
|
329
|
-
if server_name is None:
|
330
|
-
server_name = self.server_name
|
331
|
-
if page_size is None:
|
332
|
-
page_size = self.page_size
|
333
|
-
|
334
|
-
validate_name(term)
|
335
|
-
|
336
|
-
for_lineage_s = str(for_lineage).lower()
|
337
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
338
|
-
|
339
|
-
|
340
|
-
body = {
|
341
|
-
"class": "GlossaryNameRequestBody",
|
342
|
-
"glossaryGUID": glossary_guid,
|
343
|
-
"name" : term,
|
344
|
-
"effectiveTime": effective_time,
|
345
|
-
"limitResultsByStatus" : status_filter
|
346
|
-
}
|
347
|
-
# body = body_slimmer(body)
|
348
|
-
|
349
|
-
|
350
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
351
|
-
f"terms/by-name?startFrom={start_from}&pageSize={page_size}&"
|
352
|
-
f"&forLineage={for_lineage_s}&forDuplicateProcessing={for_duplicate_processing_s}")
|
353
|
-
|
354
|
-
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
355
|
-
|
356
|
-
response = self.make_request("POST", url, body)
|
357
|
-
return response.json().get("elementList","No terms found")
|
358
|
-
|
359
|
-
def find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list=[],
|
360
|
-
effective_time: str = None, starts_with: bool = False,
|
361
|
-
ends_with:bool = False, ignore_case: bool = False, for_lineage:bool = False,
|
362
|
-
for_duplicate_processing: bool = False,server_name: str = None,
|
363
|
-
start_from: int = 0, page_size: int = None) -> list | str:
|
364
|
-
|
365
|
-
""" Retrieve the list of glossary term metadata elements that contain the search string.
|
366
|
-
|
367
|
-
Parameters
|
368
|
-
----------
|
369
|
-
search_string: str
|
370
|
-
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
371
|
-
glossary_guid str
|
372
|
-
Identifier of the glossary to search within. If None, then all glossaries are searched.
|
373
|
-
status_filter: list, default = [], optional
|
374
|
-
Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
|
375
|
-
the results will not be filtered.
|
376
|
-
effective_time: str, [default=None], optional
|
377
|
-
Effective time of the query. If not specified will default to any time.
|
378
|
-
If the effective time is not in the right format then it will be considered any.
|
379
|
-
server_name : str, optional
|
380
|
-
The name of the server to configure.
|
381
|
-
If not provided, the server name associated with the instance is used.
|
382
|
-
starts_with : bool, [default=False], optional
|
383
|
-
Starts with the supplied string.
|
384
|
-
ends_with : bool, [default=False], optional
|
385
|
-
Ends with the supplied string
|
386
|
-
ignore_case : bool, [default=False], optional
|
387
|
-
Ignore case when searching
|
388
|
-
for_lineage : bool, [default=False], optional
|
389
|
-
|
390
|
-
for_duplicate_processing : bool, [default=False], optional
|
391
|
-
|
392
|
-
start_from: str, [default=0], optional
|
393
|
-
Page of results to start from
|
394
|
-
page_size : int, optional
|
395
|
-
Number of elements to return per page - if None, then default for class will be used.
|
396
|
-
|
397
|
-
Returns
|
398
|
-
-------
|
399
|
-
List | str
|
400
|
-
|
401
|
-
A list of term definitions
|
402
|
-
|
403
|
-
Raises
|
404
|
-
------
|
405
|
-
InvalidParameterException
|
406
|
-
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
407
|
-
PropertyServerException
|
408
|
-
Raised by the server when an issue arises in processing a valid request
|
409
|
-
NotAuthorizedException
|
410
|
-
The principle specified by the user_id does not have authorization for the requested action
|
411
|
-
|
412
|
-
Notes
|
413
|
-
-----
|
414
|
-
The search string is located in the request body and is interpreted as a plain string.
|
415
|
-
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
416
|
-
The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
|
417
|
-
"""
|
418
|
-
if server_name is None:
|
419
|
-
server_name = self.server_name
|
420
|
-
if page_size is None:
|
421
|
-
page_size = self.page_size
|
422
|
-
if effective_time is None:
|
423
|
-
effective_time = datetime.now().isoformat()
|
424
|
-
starts_with_s = str(starts_with).lower()
|
425
|
-
ends_with_s = str(ends_with).lower()
|
426
|
-
ignore_case_s = str(ignore_case).lower()
|
427
|
-
for_lineage_s = str(for_lineage).lower()
|
428
|
-
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
429
|
-
if search_string is '*':
|
430
|
-
search_string = None
|
431
|
-
|
432
|
-
# validate_search_string(search_string)
|
433
|
-
|
434
|
-
|
435
|
-
body = {
|
436
|
-
"class": "GlossarySearchStringRequestBody",
|
437
|
-
"glossaryGUID": glossary_guid,
|
438
|
-
"searchString": search_string,
|
439
|
-
"effectiveTime": effective_time,
|
440
|
-
"limitResultsByStatus": status_filter
|
441
|
-
}
|
442
|
-
# body = body_slimmer(body)
|
443
|
-
|
444
|
-
|
445
|
-
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
446
|
-
f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
447
|
-
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
|
448
|
-
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
449
|
-
|
450
|
-
print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
451
|
-
|
452
|
-
response = self.make_request("POST", url, body)
|
453
|
-
return response.json().get("elementList","No terms found")
|
454
|
-
# return response.text
|
455
|
-
|
456
|
-
#
|
457
|
-
# Catagories
|
458
|
-
#
|