pyegeria 0.2.3__py3-none-any.whl → 0.3.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/__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 +38 -7
- pyegeria/full_omag_server_config.py +99 -10
- 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.3.dist-info → pyegeria-0.3.0.dist-info}/METADATA +21 -17
- pyegeria-0.3.0.dist-info/RECORD +21 -0
- {pyegeria-0.2.3.dist-info → pyegeria-0.3.0.dist-info}/WHEEL +2 -1
- pyegeria-0.3.0.dist-info/top_level.txt +1 -0
- pyegeria/_client-orig.py +0 -480
- pyegeria/automated_curation.py +0 -446
- pyegeria/config.toml +0 -11
- pyegeria/curation_omvs.py +0 -458
- pyegeria/exceptions.py +0 -382
- pyegeria-0.2.3.dist-info/RECORD +0 -22
- {pyegeria-0.2.3.dist-info/licenses → pyegeria-0.3.0.dist-info}/LICENSE +0 -0
@@ -108,7 +108,7 @@ class CoreServerConfig(Client):
|
|
108
108
|
response = self.make_request("GET", url)
|
109
109
|
return response.json().get("omagserverConfig", "No configuration found")
|
110
110
|
|
111
|
-
def is_server_configured(self, server_name:str= None) -> bool:
|
111
|
+
def is_server_configured(self, server_name: str = None) -> bool:
|
112
112
|
""" Check if the server has a stored configuration
|
113
113
|
|
114
114
|
Parameters
|
@@ -131,7 +131,6 @@ class CoreServerConfig(Client):
|
|
131
131
|
else:
|
132
132
|
return False
|
133
133
|
|
134
|
-
|
135
134
|
def get_configured_access_services(self, server_name: str = None) -> list | str:
|
136
135
|
""" Return the list of access services that are configured for this server.
|
137
136
|
|
@@ -1135,7 +1134,41 @@ class CoreServerConfig(Client):
|
|
1135
1134
|
url = f"{self.admin_command_root}/servers/{server_name}/local-repository/mode/read-only-repository"
|
1136
1135
|
self.make_request("POST", url)
|
1137
1136
|
|
1138
|
-
def
|
1137
|
+
def set_repository_proxy_details(self, connector_provider: str, server_name: str = None) -> None:
|
1138
|
+
""" Sets the local repository to use the proxy repository specified by the connection.
|
1139
|
+
|
1140
|
+
Parameters
|
1141
|
+
----------
|
1142
|
+
connector_provider: str
|
1143
|
+
Specifies the class of the proxy connector provider.
|
1144
|
+
server_name : str, optional
|
1145
|
+
The name of the server. If not provided, the default server name of the instance will be used.
|
1146
|
+
|
1147
|
+
Returns
|
1148
|
+
-------
|
1149
|
+
None
|
1150
|
+
This method does not return anything.
|
1151
|
+
|
1152
|
+
Raises
|
1153
|
+
------
|
1154
|
+
InvalidParameterException
|
1155
|
+
If the response code is not 200.
|
1156
|
+
PropertyServerException:
|
1157
|
+
Raised by the server when an issue arises in processing a valid request
|
1158
|
+
NotAuthorizedException:
|
1159
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1160
|
+
|
1161
|
+
"""
|
1162
|
+
if server_name is None:
|
1163
|
+
server_name = self.server_name
|
1164
|
+
|
1165
|
+
validate_name(connector_provider)
|
1166
|
+
|
1167
|
+
url = (f"{self.admin_command_root}/servers/{server_name}/local-repository/mode/repository-proxy/"
|
1168
|
+
f"details?connectorProvider={connector_provider}")
|
1169
|
+
self.make_request("POST", url)
|
1170
|
+
|
1171
|
+
def set_plug_in_repository(self, config_body: dict, server_name: str = None) -> None:
|
1139
1172
|
""" Configure the metadata repository using a full repository connection body.
|
1140
1173
|
|
1141
1174
|
Parameters
|
@@ -1167,7 +1200,6 @@ class CoreServerConfig(Client):
|
|
1167
1200
|
url = f"{self.admin_command_root}/servers/{server_name}/local-repository/mode/plugin-repository/connection"
|
1168
1201
|
self.make_request("POST", url, config_body)
|
1169
1202
|
|
1170
|
-
|
1171
1203
|
def set_xtdb_in_mem_repository(self, server_name: str = None) -> None:
|
1172
1204
|
""" Set xtdb local repository connection to be XTDB with an in memory repository
|
1173
1205
|
|
@@ -1475,7 +1507,7 @@ class CoreServerConfig(Client):
|
|
1475
1507
|
"maxPageSize": max_page_size
|
1476
1508
|
}
|
1477
1509
|
url = self.admin_command_root + "/servers/" + server_name + "/server-properties"
|
1478
|
-
|
1510
|
+
|
1479
1511
|
self.make_request("POST", url, basic_props)
|
1480
1512
|
|
1481
1513
|
def get_basic_server_properties(self, server_name: str = None) -> dict | str:
|
@@ -2534,5 +2566,4 @@ class CoreServerConfig(Client):
|
|
2534
2566
|
|
2535
2567
|
"""
|
2536
2568
|
url = f"{self.admin_command_root}/stores/placeholder-variables"
|
2537
|
-
self.make_request("DELETE", url)
|
2538
|
-
|
2569
|
+
self.make_request("DELETE", url)
|
@@ -2,18 +2,20 @@
|
|
2
2
|
SPDX-License-Identifier: Apache-2.0
|
3
3
|
Copyright Contributors to the ODPi Egeria project.
|
4
4
|
|
5
|
-
OMAG Server configuration functions. These functions add definitions to an OMAG server's configuration document
|
5
|
+
OMAG Server configuration functions. These functions add definitions to an OMAG server's configuration document.
|
6
|
+
This class encompasses the full set of configuration methods.
|
6
7
|
"""
|
7
8
|
|
8
|
-
from pyegeria._validators import validate_name
|
9
|
-
from
|
10
|
-
InvalidParameterException
|
9
|
+
from pyegeria._validators import validate_name, validate_url
|
10
|
+
from pyegeria import (
|
11
|
+
InvalidParameterException
|
11
12
|
)
|
12
|
-
from ._globals import enable_ssl_check
|
13
|
-
from
|
13
|
+
from pyegeria._globals import enable_ssl_check
|
14
|
+
from pyegeria import Client
|
15
|
+
from .core_omag_server_config import CoreServerConfig
|
16
|
+
import json
|
14
17
|
|
15
|
-
|
16
|
-
class FullServerConfig(Client):
|
18
|
+
class FullServerConfig(CoreServerConfig):
|
17
19
|
"""
|
18
20
|
This class represents a client for configuring the OMAG Server.
|
19
21
|
|
@@ -525,7 +527,7 @@ class FullServerConfig(Client):
|
|
525
527
|
response = self.make_request("GET", url)
|
526
528
|
return response.json().get("config")
|
527
529
|
|
528
|
-
def
|
530
|
+
def set_event_bus_detailed(self, connector_provider: str, topic_url_root: str, server_name: str = None) -> None:
|
529
531
|
"""
|
530
532
|
Parameters
|
531
533
|
----------
|
@@ -600,7 +602,10 @@ class FullServerConfig(Client):
|
|
600
602
|
if server_name is None:
|
601
603
|
server_name = self.server_name
|
602
604
|
url = f"{self.admin_command_root}/servers/{server_name}/server-url-root-for-caller"
|
603
|
-
|
605
|
+
body = {
|
606
|
+
"urlRoot" : url_root
|
607
|
+
}
|
608
|
+
response = self.make_request("POST", url, payload=body)
|
604
609
|
related_code = response.json().get("relatedHTTPCode")
|
605
610
|
if related_code != 200:
|
606
611
|
raise InvalidParameterException(response.content)
|
@@ -984,3 +989,87 @@ class FullServerConfig(Client):
|
|
984
989
|
# pass a json list
|
985
990
|
pass
|
986
991
|
|
992
|
+
def config_integration_service(self, remote_omag_server: str, remote_omag_platform_url:str,
|
993
|
+
service_url_marker: str, integration_service_options: dict,
|
994
|
+
connector_configs: list, server_name: str = None) -> None:
|
995
|
+
|
996
|
+
if server_name is None:
|
997
|
+
server_name = self.server_name
|
998
|
+
|
999
|
+
if not isinstance(connector_configs, list):
|
1000
|
+
exc_msg = ' ==> connector_configs must be a list of dictionaries'
|
1001
|
+
raise Exception(exc_msg)
|
1002
|
+
|
1003
|
+
validate_name(remote_omag_server)
|
1004
|
+
validate_url(remote_omag_platform_url)
|
1005
|
+
|
1006
|
+
validate_name(service_url_marker)
|
1007
|
+
|
1008
|
+
request_body = {
|
1009
|
+
"class": "IntegrationServiceRequestBody",
|
1010
|
+
"omagserverPlatformRootURL": remote_omag_platform_url,
|
1011
|
+
"omagserverName": remote_omag_server,
|
1012
|
+
"integrationServiceOptions": integration_service_options,
|
1013
|
+
"integrationConnectorConfigs": connector_configs
|
1014
|
+
}
|
1015
|
+
|
1016
|
+
url = f"{self.admin_command_root}/servers/{server_name}/integration-services/{service_url_marker}"
|
1017
|
+
# print(f"URL is : {url}")
|
1018
|
+
# print(f"body is : \n{json.dumps(request_body, indent=4)}")
|
1019
|
+
|
1020
|
+
self.make_request("POST", url, request_body)
|
1021
|
+
return
|
1022
|
+
|
1023
|
+
|
1024
|
+
def config_all_integration_services(self, remote_omag_server: str, remote_omag_platform_url:str,
|
1025
|
+
integration_service_options: dict,
|
1026
|
+
connector_configs: dict, server_name: str = None) -> None:
|
1027
|
+
|
1028
|
+
if server_name is None:
|
1029
|
+
server_name = self.server_name
|
1030
|
+
validate_name(remote_omag_server)
|
1031
|
+
validate_url(remote_omag_platform_url)
|
1032
|
+
|
1033
|
+
request_body = {
|
1034
|
+
"IntegrationConnectorConfigs" : [
|
1035
|
+
{
|
1036
|
+
"class": "IntegrationServiceRequestBody",
|
1037
|
+
"omagserverPlatformRootURL": remote_omag_platform_url,
|
1038
|
+
"omagserverName": remote_omag_server,
|
1039
|
+
"integrationServiceOptions": integration_service_options,
|
1040
|
+
"integrationConnectorConfigs": connector_configs
|
1041
|
+
}
|
1042
|
+
]
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
url = f"{self.admin_command_root}/servers/{server_name}/integration-services"
|
1046
|
+
print(f"URL is : {url}")
|
1047
|
+
print(f"body is : \n{json.dumps(request_body, indent=4)}")
|
1048
|
+
|
1049
|
+
self.make_request("POST", url, request_body)
|
1050
|
+
|
1051
|
+
|
1052
|
+
def clear_integration_service(self, service_url_marker:str, server_name:str = None)-> None:
|
1053
|
+
if server_name is None:
|
1054
|
+
server_name = self.server_name
|
1055
|
+
validate_name(service_url_marker)
|
1056
|
+
|
1057
|
+
url = f"{self.admin_command_root}/servers/{server_name}/integration-services/{service_url_marker}"
|
1058
|
+
self.make_request("DELETE", url)
|
1059
|
+
|
1060
|
+
def get_integration_service_config(self, service_url_marker:str, server_name:str = None)-> dict | str:
|
1061
|
+
if server_name is None:
|
1062
|
+
server_name = self.server_name
|
1063
|
+
validate_name(service_url_marker)
|
1064
|
+
url = f"{self.admin_command_root}/servers/{server_name}/integration-services/{service_url_marker}/configuration"
|
1065
|
+
response = self.make_request("GET", url)
|
1066
|
+
return response.json().get("config","No configuration found")
|
1067
|
+
|
1068
|
+
def get_integration_services_configs(self, server_name: str = None)-> dict | str:
|
1069
|
+
if server_name is None:
|
1070
|
+
server_name = self.server_name
|
1071
|
+
|
1072
|
+
url = f"{self.admin_command_root}/servers/{server_name}/integration-services/configuration"
|
1073
|
+
response = self.make_request("GET", url)
|
1074
|
+
return response.json().get("services", "No configuration found")
|
1075
|
+
|
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")
|