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/glossary_omvs.py
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
"""
|
2
|
+
PDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
2
4
|
|
3
|
-
This module contains the
|
5
|
+
This module contains an initial version of the glossary_omvs module. There are additional methods that will be
|
6
|
+
added in subsequent versions of the glossary_omvs module.
|
4
7
|
|
5
8
|
"""
|
6
9
|
import json
|
@@ -20,32 +23,12 @@ from pyegeria.utils import body_slimmer
|
|
20
23
|
|
21
24
|
class GlossaryBrowser(Client):
|
22
25
|
"""
|
23
|
-
|
24
|
-
|
26
|
+
GlossaryBrowser is a class that extends the Client class. It provides methods to search and retrieve glossaries,
|
27
|
+
terms and categories.
|
25
28
|
|
26
29
|
Methods:
|
27
30
|
|
28
|
-
- get_stored_configuration(server_name: str = None) -> dict:
|
29
|
-
Retrieves all the configuration documents for a server.
|
30
31
|
|
31
|
-
- get_configured_access_services(server_name: str = None) -> dict:
|
32
|
-
Returns the list of access services that are configured for this server.
|
33
|
-
|
34
|
-
- configure_all_access_services(server_name: str = None) -> None:
|
35
|
-
Enables all access services that are registered with this server platform.
|
36
|
-
|
37
|
-
- configure_all_access_services_no_topics(server_name: str = None) -> None:
|
38
|
-
Configures all access services for the specified server with no cohort/Event Bus.
|
39
|
-
|
40
|
-
- clear_all_access_services(server_name: str = None) -> None:
|
41
|
-
Disables the access services. This removes all configuration for the access services and disables the
|
42
|
-
enterprise repository services.
|
43
|
-
|
44
|
-
- get_access_service_config(access_service_name: str, server_name: str = None) -> dict:
|
45
|
-
Retrieves the config for an access service.
|
46
|
-
|
47
|
-
- configure_access_service(access_service_name: str, server_name: str = None) -> None:
|
48
|
-
Enables a single access service.
|
49
32
|
"""
|
50
33
|
|
51
34
|
def __init__(
|
@@ -95,6 +78,11 @@ class GlossaryBrowser(Client):
|
|
95
78
|
type_name: str, [default=None], optional
|
96
79
|
An optional parameter indicating the subtype of the glossary to filter by.
|
97
80
|
Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
|
81
|
+
start_from: int, [default=0], optional
|
82
|
+
When multiple pages of results are available, the page number to start from.
|
83
|
+
page_size: int, [default=None]
|
84
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
85
|
+
the class instance.
|
98
86
|
Returns
|
99
87
|
-------
|
100
88
|
List | str
|
@@ -124,7 +112,7 @@ class GlossaryBrowser(Client):
|
|
124
112
|
|
125
113
|
validate_search_string(search_string)
|
126
114
|
|
127
|
-
if search_string
|
115
|
+
if search_string == '*':
|
128
116
|
search_string = None
|
129
117
|
|
130
118
|
body = {
|
@@ -152,48 +140,55 @@ class GlossaryBrowser(Client):
|
|
152
140
|
The search string is located in the request body and is interpreted as a plain string.
|
153
141
|
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
154
142
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
143
|
+
Parameters
|
144
|
+
----------
|
145
|
+
search_string: str,
|
146
|
+
Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
|
147
|
+
|
148
|
+
effective_time: str, [default=None], optional
|
149
|
+
Effective time of the query. If not specified will default to any time.
|
150
|
+
server_name : str, optional
|
151
|
+
The name of the server to configure.
|
152
|
+
If not provided, the server name associated with the instance is used.
|
153
|
+
starts_with : bool, [default=False], optional
|
154
|
+
Starts with the supplied string.
|
155
|
+
ends_with : bool, [default=False], optional
|
156
|
+
Ends with the supplied string
|
157
|
+
ignore_case : bool, [default=False], optional
|
158
|
+
Ignore case when searching
|
159
|
+
for_lineage : bool, [default=False], optional
|
160
|
+
Indicates the search is for lineage.
|
161
|
+
for_duplicate_processing : bool, [default=False], optional
|
162
|
+
type_name: str, [default=None], optional
|
163
|
+
An optional parameter indicating the subtype of the glossary to filter by.
|
164
|
+
Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
|
165
|
+
start_from: int, [default=0], optional
|
166
|
+
When multiple pages of results are available, the page number to start from.
|
167
|
+
page_size: int, [default=None]
|
168
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
169
|
+
the class instance.
|
170
|
+
Returns
|
171
|
+
-------
|
172
|
+
List | str
|
173
|
+
|
174
|
+
A list of glossary definitions active in the server.
|
175
|
+
|
176
|
+
Raises
|
177
|
+
------
|
178
|
+
|
179
|
+
InvalidParameterException
|
180
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
181
|
+
PropertyServerException
|
182
|
+
Raised by the server when an issue arises in processing a valid request
|
183
|
+
NotAuthorizedException
|
184
|
+
The principle specified by the user_id does not have authorization for the requested action
|
185
|
+
|
186
|
+
"""
|
194
187
|
loop = asyncio.get_event_loop()
|
195
188
|
response = loop.run_until_complete(self._async_find_glossaries(search_string, effective_time, starts_with,
|
196
|
-
|
189
|
+
ends_with, ignore_case, for_lineage,
|
190
|
+
for_duplicate_processing,type_name,
|
191
|
+
server_name,start_from, page_size))
|
197
192
|
|
198
193
|
return response.json().get("elementList", "No Glossaries found")
|
199
194
|
|
@@ -284,6 +279,11 @@ class GlossaryBrowser(Client):
|
|
284
279
|
server_name : str, optional
|
285
280
|
The name of the server to configure.
|
286
281
|
If not provided, the server name associated with the instance is used.
|
282
|
+
start_from: int, [default=0], optional
|
283
|
+
When multiple pages of results are available, the page number to start from.
|
284
|
+
page_size: int, [default=None]
|
285
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
286
|
+
the class instance.
|
287
287
|
|
288
288
|
Returns
|
289
289
|
-------
|
@@ -333,6 +333,11 @@ class GlossaryBrowser(Client):
|
|
333
333
|
server_name : str, optional
|
334
334
|
The name of the server to configure.
|
335
335
|
If not provided, the server name associated with the instance is used.
|
336
|
+
start_from: int, [default=0], optional
|
337
|
+
When multiple pages of results are available, the page number to start from.
|
338
|
+
page_size: int, [default=None]
|
339
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
340
|
+
he class instance.
|
336
341
|
|
337
342
|
Returns
|
338
343
|
-------
|
@@ -340,7 +345,6 @@ class GlossaryBrowser(Client):
|
|
340
345
|
|
341
346
|
Raises
|
342
347
|
------
|
343
|
-
|
344
348
|
InvalidParameterException
|
345
349
|
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
346
350
|
PropertyServerException
|
@@ -594,7 +598,7 @@ class GlossaryBrowser(Client):
|
|
594
598
|
ignore_case_s = str(ignore_case).lower()
|
595
599
|
for_lineage_s = str(for_lineage).lower()
|
596
600
|
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
597
|
-
if search_string
|
601
|
+
if search_string == '*':
|
598
602
|
search_string = None
|
599
603
|
|
600
604
|
# validate_search_string(search_string)
|
@@ -637,3 +641,137 @@ class GlossaryBrowser(Client):
|
|
637
641
|
#
|
638
642
|
# Catagories
|
639
643
|
#
|
644
|
+
|
645
|
+
#
|
646
|
+
# Feedback
|
647
|
+
#
|
648
|
+
async def _async_get_comment(self, commemtGUID: str, effective_time: datetime, server_name: str=None,
|
649
|
+
for_lineage: bool = False, for_duplicate_processing: bool = False) -> dict | list:
|
650
|
+
""" Retrieve the comment specified by the comment GUID """
|
651
|
+
if server_name is None:
|
652
|
+
server_name = self.server_name
|
653
|
+
|
654
|
+
validate_guid(commemtGUID)
|
655
|
+
|
656
|
+
if effective_time is None:
|
657
|
+
effective_time = datetime.now().isoformat()
|
658
|
+
|
659
|
+
for_lineage_s = str(for_lineage).lower()
|
660
|
+
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
661
|
+
|
662
|
+
body = {
|
663
|
+
"effective_time": effective_time
|
664
|
+
}
|
665
|
+
|
666
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
|
667
|
+
f"{commemtGUID}?forLineage={for_lineage_s}&"
|
668
|
+
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
669
|
+
|
670
|
+
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
671
|
+
|
672
|
+
response = await self._async_make_request("POST", url, body)
|
673
|
+
return response.json()
|
674
|
+
|
675
|
+
|
676
|
+
async def _async_add_comment_reply(self, commentGUID: str, is_public: bool, comment_type: str, comment_text: str,
|
677
|
+
server_name: str=None, for_lineage: bool = False,
|
678
|
+
for_duplicate_processing: bool = False ) -> str:
|
679
|
+
""" Reply to a comment """
|
680
|
+
|
681
|
+
if server_name is None:
|
682
|
+
server_name = self.server_name
|
683
|
+
|
684
|
+
validate_guid(commentGUID)
|
685
|
+
validate_name(comment_type)
|
686
|
+
|
687
|
+
is_public_s = str(is_public).lower()
|
688
|
+
for_lineage_s = str(for_lineage).lower()
|
689
|
+
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
690
|
+
|
691
|
+
body = {
|
692
|
+
"class": "CommentRequestBody",
|
693
|
+
"commentType": comment_type,
|
694
|
+
"commentText": comment_text,
|
695
|
+
"isPublic": is_public
|
696
|
+
}
|
697
|
+
|
698
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
|
699
|
+
f"{commentGUID}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
|
700
|
+
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
701
|
+
|
702
|
+
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
703
|
+
|
704
|
+
response = await self._async_make_request("POST", url, body)
|
705
|
+
return response
|
706
|
+
|
707
|
+
|
708
|
+
async def _async_update_comment(self, commentGUID: str, is_public: bool, comment_type: str, comment_text: str,
|
709
|
+
server_name: str=None, is_merge_update: bool = False, for_lineage: bool = False,
|
710
|
+
for_duplicate_processing: bool = False) -> str:
|
711
|
+
""" Update the specified comment"""
|
712
|
+
if server_name is None:
|
713
|
+
server_name = self.server_name
|
714
|
+
|
715
|
+
validate_guid(commentGUID)
|
716
|
+
validate_name(comment_type)
|
717
|
+
|
718
|
+
is_public_s = str(is_public).lower()
|
719
|
+
for_lineage_s = str(for_lineage).lower()
|
720
|
+
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
721
|
+
|
722
|
+
body = {
|
723
|
+
"class": "CommentRequestBody",
|
724
|
+
"commentType": comment_type,
|
725
|
+
"commentText": comment_text,
|
726
|
+
"isPublic": is_public
|
727
|
+
}
|
728
|
+
|
729
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
|
730
|
+
f"{commentGUID}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
|
731
|
+
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
732
|
+
|
733
|
+
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
734
|
+
|
735
|
+
response = await self._async_make_request("POST", url, body)
|
736
|
+
return response
|
737
|
+
|
738
|
+
async def _async_find_comment(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
|
739
|
+
effective_time: str = None, starts_with: bool = False,
|
740
|
+
ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
|
741
|
+
for_duplicate_processing: bool = False, server_name: str = None,
|
742
|
+
start_from: int = 0, page_size: int = None):
|
743
|
+
"""Find comments by search string"""
|
744
|
+
if server_name is None:
|
745
|
+
server_name = self.server_name
|
746
|
+
if page_size is None:
|
747
|
+
page_size = self.page_size
|
748
|
+
if effective_time is None:
|
749
|
+
effective_time = datetime.now().isoformat()
|
750
|
+
starts_with_s = str(starts_with).lower()
|
751
|
+
ends_with_s = str(ends_with).lower()
|
752
|
+
ignore_case_s = str(ignore_case).lower()
|
753
|
+
for_lineage_s = str(for_lineage).lower()
|
754
|
+
for_duplicate_processing_s = str(for_duplicate_processing).lower()
|
755
|
+
if search_string == '*':
|
756
|
+
search_string = None
|
757
|
+
|
758
|
+
# validate_search_string(search_string)
|
759
|
+
|
760
|
+
body = {
|
761
|
+
"class": "GlossarySearchStringRequestBody",
|
762
|
+
"glossaryGUID": glossary_guid,
|
763
|
+
"searchString": search_string,
|
764
|
+
"effectiveTime": effective_time,
|
765
|
+
"limitResultsByStatus": status_filter
|
766
|
+
}
|
767
|
+
# body = body_slimmer(body)
|
768
|
+
|
769
|
+
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
|
770
|
+
f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
771
|
+
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
|
772
|
+
f"forDuplicateProcessing={for_duplicate_processing_s}")
|
773
|
+
|
774
|
+
# print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
|
775
|
+
|
776
|
+
response = await self._async_make_request("POST", url, body)
|
777
|
+
return response.json().get("elementList", "No terms found")
|