pyegeria 0.3.7__py3-none-any.whl → 0.3.9__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 (49) hide show
  1. pyegeria/Xasset_catalog_omvs.py +539 -0
  2. pyegeria/Xfeedback_manager_omvs.py +251 -0
  3. pyegeria/Xglossary_manager_omvs.py +3001 -0
  4. pyegeria/Xloaded_resources_omvs.py +91 -0
  5. pyegeria/__init__.py +6 -9
  6. pyegeria/_client.py +4 -6
  7. pyegeria/{gov_engine.py → _deprecated_gov_engine.py} +2 -59
  8. pyegeria/_exceptions.py +5 -6
  9. pyegeria/_globals.py +1 -1
  10. pyegeria/automated_curation_omvs.py +320 -315
  11. pyegeria/collection_manager_omvs.py +187 -248
  12. pyegeria/core_omag_server_config.py +1 -5
  13. pyegeria/full_omag_server_config.py +53 -83
  14. pyegeria/glossary_browser_omvs.py +2208 -0
  15. pyegeria/my_profile_omvs.py +8 -12
  16. pyegeria/platform_services.py +0 -3
  17. pyegeria/project_manager_omvs.py +9 -15
  18. pyegeria/registered_info.py +12 -52
  19. pyegeria/server_operations.py +1 -5
  20. pyegeria/valid_metadata_omvs.py +11 -23
  21. pyegeria-0.3.9.data/scripts/Create_Collection_Sample.py +292 -0
  22. pyegeria-0.3.9.data/scripts/Create_Sustainability_Collection_Sample.py +115 -0
  23. pyegeria-0.3.9.data/scripts/coco_status.py +98 -0
  24. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/collection_viewer.py +12 -31
  25. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/engine_action_status.py +14 -30
  26. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/find_todos.py +12 -41
  27. pyegeria-0.3.9.data/scripts/get_registered_services.py +135 -0
  28. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/get_relationship_types.py +16 -35
  29. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/glossary_view.py +2 -2
  30. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/gov_engine_status.py +0 -1
  31. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/list_asset_types.py +3 -25
  32. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/my_todos.py +1 -1
  33. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/open_todos.py +3 -24
  34. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/project_list_viewer.py +12 -26
  35. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/server_status.py +1 -20
  36. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/view_my_profile.py +8 -34
  37. {pyegeria-0.3.7.dist-info → pyegeria-0.3.9.dist-info}/METADATA +1 -3
  38. pyegeria-0.3.9.dist-info/RECORD +49 -0
  39. pyegeria/glossary_omvs.py +0 -789
  40. pyegeria-0.3.7.dist-info/RECORD +0 -41
  41. /pyegeria/{governance_author.py → Xaction_author_omvs.py} +0 -0
  42. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/get_tech_details.py +0 -0
  43. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/get_tech_types.py +0 -0
  44. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/integration_daemon_status.py +0 -0
  45. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/multi-server_status.py +0 -0
  46. {pyegeria-0.3.7.data → pyegeria-0.3.9.data}/scripts/server_status_widget.py +0 -0
  47. {pyegeria-0.3.7.dist-info → pyegeria-0.3.9.dist-info}/LICENSE +0 -0
  48. {pyegeria-0.3.7.dist-info → pyegeria-0.3.9.dist-info}/WHEEL +0 -0
  49. {pyegeria-0.3.7.dist-info → pyegeria-0.3.9.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,3001 @@
1
+ """
2
+ PDX-License-Identifier: Apache-2.0
3
+ Copyright Contributors to the ODPi Egeria project.
4
+
5
+ This module contains an initial version of the glossary_workflow omvs module. There are additional methods that will be
6
+ added in subsequent versions of the glossary_omvs module.
7
+
8
+ """
9
+ import asyncio
10
+ from datetime import datetime, time
11
+
12
+ # import json
13
+ from pyegeria._client import Client
14
+ from pyegeria._globals import enable_ssl_check
15
+ from pyegeria._validators import (validate_name, validate_guid, validate_search_string, )
16
+ from pyegeria.utils import body_slimmer
17
+ from pyegeria.glossary_browser_omvs import GlossaryBrowser
18
+
19
+ class GlossaryManager(GlossaryBrowser):
20
+ """
21
+ GlossaryManager is a class that extends the Client class. It provides methods to create and manage glossaries,
22
+ terms and categories.
23
+
24
+ Attributes:
25
+
26
+ server_name: str
27
+ The name of the View Server to connect to.
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__(self, server_name: str, platform_url: str, token: str = None, user_id: str = None,
42
+ user_pwd: str = None, verify_flag: bool = enable_ssl_check, sync_mode: bool = True):
43
+ self.admin_command_root: str
44
+ Client.__init__(self, server_name, platform_url, user_id=user_id, token=token, async_mode=sync_mode)
45
+
46
+ #
47
+ # Get Valid Values for Enumerations
48
+ #
49
+
50
+ async def _async_create_glossary(self, display_name: str, description: str, server_name: str = None) -> str:
51
+ """ Create a new glossary. Async version.
52
+
53
+ Parameters
54
+ ----------
55
+ display_name: str
56
+ The name of the new glossary. This will be used to produce a unique qualified name for the glossary.
57
+ description: str
58
+ A description of the glossary.
59
+ server_name : str, optional
60
+ The name of the server to query. If not provided, the server name associated with the instance is used.
61
+
62
+ Returns
63
+ -------
64
+ str
65
+ The GUID of the created glossary.
66
+
67
+ """
68
+ if server_name is None:
69
+ server_name = self.server_name
70
+
71
+ url = f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-workflow/glossaries/"
72
+ body = {
73
+ "class" : "ReferenceableRequestBody",
74
+ "elementProperties":
75
+ {
76
+ "class": "GlossaryProperties",
77
+ "qualifiedName": f"Glossary-{display_name}-{time.asctime()}",
78
+ "displayName": display_name,
79
+ "description": description
80
+ }
81
+ }
82
+ response = await self._async_make_request("POST", url, body)
83
+ return response.json().get("guid", None)
84
+
85
+ def create_glossary(self, display_name: str, description: str, server_name: str = None) -> str:
86
+ """ Create a new glossary.
87
+
88
+ Parameters
89
+ ----------
90
+ display_name: str
91
+ The name of the new glossary. This will be used to produce a unique qualified name for the glossary.
92
+ description: str
93
+ A description of the glossary.
94
+ server_name : str, optional
95
+ The name of the server to query. If not provided, the server name associated with the instance is used.
96
+
97
+ Returns
98
+ -------
99
+ str
100
+ The GUID of the created glossary.
101
+
102
+ """
103
+ loop = asyncio.get_event_loop()
104
+ response = loop.run_until_complete(self._async_create_glossary(display_name, description, server_name))
105
+ return response
106
+
107
+ async def _async_delete_glossary(self, glossary_guid: str, server_name: str = None) -> None:
108
+ """ Delete glossary. Async version.
109
+
110
+ Parameters
111
+ ----------
112
+ glossary_guid: str
113
+ The ID of the glossary to delete.
114
+ server_name : str, optional
115
+ The name of the server to query. If not provided, the server name associated with the instance is used.
116
+
117
+ Returns
118
+ -------
119
+ None
120
+
121
+ """
122
+ if server_name is None:
123
+ server_name = self.server_name
124
+
125
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-workflow/glossaries/"
126
+ f"{glossary_guid}/remove")
127
+
128
+ await self._async_make_request("POST", url)
129
+ return
130
+
131
+ def delete_glossary(self, glossary_guid: str, server_name: str = None) -> None:
132
+ """ Create a new glossary.
133
+
134
+ Parameters
135
+ ----------
136
+ glossary_guid: str
137
+ The ID of the glossary to delete.
138
+ server_name : str, optional
139
+ The name of the server to query. If not provided, the server name associated with the instance is used.
140
+
141
+ Returns
142
+ -------
143
+ None
144
+
145
+ """
146
+ loop = asyncio.get_event_loop()
147
+ response = loop.run_until_complete(self._async_delete_glossary(glossary_guid, server_name))
148
+ return response
149
+
150
+ #
151
+ # Glossaries
152
+ #
153
+
154
+ async def _async_find_glossaries(self, search_string: str, effective_time: str = None, starts_with: bool = False,
155
+ ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
156
+ for_duplicate_processing: bool = False, type_name: str = None,
157
+ server_name: str = None, start_from: int = 0, page_size: int = None) -> list | str:
158
+ """ Retrieve the list of glossary metadata elements that contain the search string. Async version.
159
+ The search string is located in the request body and is interpreted as a plain string.
160
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
161
+
162
+ Parameters
163
+ ----------
164
+ search_string: str,
165
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
166
+
167
+ effective_time: str, [default=None], optional
168
+ Effective time of the query. If not specified will default to any time. Time format is
169
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
170
+ server_name : str, optional
171
+ The name of the server to configure.
172
+ If not provided, the server name associated with the instance is used.
173
+ starts_with : bool, [default=False], optional
174
+ Starts with the supplied string.
175
+ ends_with : bool, [default=False], optional
176
+ Ends with the supplied string
177
+ ignore_case : bool, [default=False], optional
178
+ Ignore case when searching
179
+ for_lineage : bool, [default=False], optional
180
+
181
+ for_duplicate_processing : bool, [default=False], optional
182
+ type_name: str, [default=None], optional
183
+ An optional parameter indicating the subtype of the glossary to filter by.
184
+ Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
185
+ start_from: int, [default=0], optional
186
+ When multiple pages of results are available, the page number to start from.
187
+ page_size: int, [default=None]
188
+ The number of items to return in a single page. If not specified, the default will be taken from
189
+ the class instance.
190
+ Returns
191
+ -------
192
+ List | str
193
+
194
+ A list of glossary definitions active in the server.
195
+
196
+ Raises
197
+ ------
198
+
199
+ InvalidParameterException
200
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
201
+ PropertyServerException
202
+ Raised by the server when an issue arises in processing a valid request
203
+ NotAuthorizedException
204
+ The principle specified by the user_id does not have authorization for the requested action
205
+
206
+ """
207
+ if server_name is None:
208
+ server_name = self.server_name
209
+ if page_size is None:
210
+ page_size = self.page_size
211
+ starts_with_s = str(starts_with).lower()
212
+ ends_with_s = str(ends_with).lower()
213
+ ignore_case_s = str(ignore_case).lower()
214
+ for_lineage_s = str(for_lineage).lower()
215
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
216
+
217
+ validate_search_string(search_string)
218
+
219
+ if search_string == '*':
220
+ search_string = None
221
+
222
+ body = {"class": "SearchStringRequestBody", "searchString": search_string, "effectiveTime": effective_time,
223
+ "typeName": type_name}
224
+ body = body_slimmer(body)
225
+ # print(f"\n\nBody is: \n{body}")
226
+
227
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
228
+ f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
229
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
230
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
231
+
232
+ response = await self._async_make_request("POST", url, body)
233
+ return response.json().get("elementList", "No Glossaries found")
234
+
235
+ def find_glossaries(self, search_string: str, effective_time: str = None, starts_with: bool = False,
236
+ ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
237
+ for_duplicate_processing: bool = False, type_name: str = None, server_name: str = None,
238
+ start_from: int = 0, page_size: int = None) -> list | str:
239
+ """ Retrieve the list of glossary metadata elements that contain the search string.
240
+ The search string is located in the request body and is interpreted as a plain string.
241
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
242
+
243
+ Parameters
244
+ ----------
245
+ search_string: str,
246
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
247
+
248
+ effective_time: str, [default=None], optional
249
+ Effective time of the query. If not specified will default to any time. Time format is
250
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
251
+ server_name : str, optional
252
+ The name of the server to configure.
253
+ If not provided, the server name associated with the instance is used.
254
+ starts_with : bool, [default=False], optional
255
+ Starts with the supplied string.
256
+ ends_with : bool, [default=False], optional
257
+ Ends with the supplied string
258
+ ignore_case : bool, [default=False], optional
259
+ Ignore case when searching
260
+ for_lineage : bool, [default=False], optional
261
+ Indicates the search is for lineage.
262
+ for_duplicate_processing : bool, [default=False], optional
263
+ type_name: str, [default=None], optional
264
+ An optional parameter indicating the subtype of the glossary to filter by.
265
+ Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
266
+ start_from: int, [default=0], optional
267
+ When multiple pages of results are available, the page number to start from.
268
+ page_size: int, [default=None]
269
+ The number of items to return in a single page. If not specified, the default will be taken from
270
+ the class instance.
271
+ Returns
272
+ -------
273
+ List | str
274
+
275
+ A list of glossary definitions active in the server.
276
+
277
+ Raises
278
+ ------
279
+
280
+ InvalidParameterException
281
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
282
+ PropertyServerException
283
+ Raised by the server when an issue arises in processing a valid request
284
+ NotAuthorizedException
285
+ The principle specified by the user_id does not have authorization for the requested action
286
+
287
+ """
288
+ loop = asyncio.get_event_loop()
289
+ response = loop.run_until_complete(
290
+ self._async_find_glossaries(search_string, effective_time, starts_with, ends_with, ignore_case, for_lineage,
291
+ for_duplicate_processing, type_name, server_name, start_from, page_size))
292
+
293
+ return response
294
+
295
+ async def _async_get_glossary_by_guid(self, glossary_guid: str, server_name: str = None,
296
+ effective_time: str = None) -> dict:
297
+ """ Retrieves information about a glossary
298
+ Parameters
299
+ ----------
300
+ glossary_guid : str
301
+ Unique idetifier for the glossary
302
+ server_name : str, optional
303
+ The name of the server to get the configured access services for.
304
+ If not provided, the server name associated with the instance is used.
305
+ effective_time: str, optional
306
+ Effective time of the query. If not specified will default to any time. Time format is
307
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
308
+ Returns
309
+ -------
310
+ dict
311
+ The glossary definition associated with the glossary_guid
312
+
313
+ Raises
314
+ ------
315
+ InvalidParameterException
316
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
317
+ PropertyServerException
318
+ Raised by the server when an issue arises in processing a valid request.
319
+ NotAuthorizedException
320
+ The principle specified by the user_id does not have authorization for the requested action.
321
+ Notes
322
+ -----
323
+ """
324
+ if server_name is None:
325
+ server_name = self.server_name
326
+ validate_guid(glossary_guid)
327
+
328
+ body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
329
+
330
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
331
+ f"{glossary_guid}/retrieve")
332
+ print(url)
333
+ response = await self._async_make_request("POST", url, payload=body)
334
+ return response
335
+
336
+ def get_glossary_by_guid(self, glossary_guid: str, server_name: str = None) -> dict:
337
+ """ Retrieves information about a glossary
338
+ Parameters
339
+ ----------
340
+ glossary_guid : str
341
+ Unique idetifier for the glossary
342
+ server_name : str, optional
343
+ The name of the server to get the configured access services for.
344
+ If not provided, the server name associated with the instance is used.
345
+ Returns
346
+ -------
347
+ dict
348
+ The glossary definition associated with the glossary_guid
349
+
350
+ Raises
351
+ ------
352
+ InvalidParameterException
353
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
354
+ PropertyServerException
355
+ Raised by the server when an issue arises in processing a valid request.
356
+ NotAuthorizedException
357
+ The principle specified by the user_id does not have authorization for the requested action.
358
+ Notes
359
+ -----
360
+ """
361
+ loop = asyncio.get_event_loop()
362
+ response = loop.run_until_complete(self._async_get_glossary_by_guid(glossary_guid, server_name))
363
+ return response
364
+
365
+ async def _async_get_glossaries_by_name(self, glossary_name: str, effective_time: str = None,
366
+ server_name: str = None, start_from: int = 0,
367
+ page_size: int = None) -> dict | str:
368
+ """ Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
369
+ There are no wildcards supported on this request.
370
+
371
+ Parameters
372
+ ----------
373
+ glossary_name: str,
374
+ Name of the glossary to be retrieved
375
+ effective_time: datetime, [default=None], optional
376
+ Effective time of the query. If not specified will default to any effective time. Time format is
377
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
378
+ server_name : str, optional
379
+ The name of the server to configure.
380
+ If not provided, the server name associated with the instance is used.
381
+ start_from: int, [default=0], optional
382
+ When multiple pages of results are available, the page number to start from.
383
+ page_size: int, [default=None]
384
+ The number of items to return in a single page. If not specified, the default will be taken from
385
+ the class instance.
386
+
387
+ Returns
388
+ -------
389
+ None
390
+
391
+ Raises
392
+ ------
393
+
394
+ InvalidParameterException
395
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
396
+ PropertyServerException
397
+ Raised by the server when an issue arises in processing a valid request
398
+ NotAuthorizedException
399
+ The principle specified by the user_id does not have authorization for the requested action
400
+ ConfigurationErrorException
401
+ Raised when configuration parameters passed on earlier calls turn out to be
402
+ invalid or make the new call invalid.
403
+ """
404
+ if server_name is None:
405
+ server_name = self.server_name
406
+ if page_size is None:
407
+ page_size = self.page_size
408
+ validate_name(glossary_name)
409
+
410
+ if effective_time is None:
411
+ body = {"name": glossary_name}
412
+ else:
413
+ body = {"name": glossary_name, "effectiveTime": effective_time}
414
+
415
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
416
+ f"by-name?startFrom={start_from}&pageSize={page_size}")
417
+
418
+ response = await self._async_make_request("POST", url, body)
419
+ return response.json()
420
+
421
+ def get_glossaries_by_name(self, glossary_name: str, effective_time: str = None, server_name: str = None,
422
+ start_from: int = 0, page_size: int = None) -> dict | str:
423
+ """ Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
424
+ There are no wildcards supported on this request.
425
+
426
+ Parameters
427
+ ----------
428
+ glossary_name: str,
429
+ Name of the glossary to be retrieved
430
+ effective_time: datetime, [default=None], optional
431
+ Effective time of the query. If not specified will default to any effective time.
432
+ server_name : str, optional
433
+ The name of the server to configure.
434
+ If not provided, the server name associated with the instance is used.
435
+ start_from: int, [default=0], optional
436
+ When multiple pages of results are available, the page number to start from.
437
+ page_size: int, [default=None]
438
+ The number of items to return in a single page. If not specified, the default will be taken from
439
+ he class instance.
440
+
441
+ Returns
442
+ -------
443
+ None
444
+
445
+ Raises
446
+ ------
447
+ InvalidParameterException
448
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
449
+ PropertyServerException
450
+ Raised by the server when an issue arises in processing a valid request
451
+ NotAuthorizedException
452
+ The principle specified by the user_id does not have authorization for the requested action
453
+ ConfigurationErrorException
454
+ Raised when configuration parameters passed on earlier calls turn out to be
455
+ invalid or make the new call invalid.
456
+ """
457
+ loop = asyncio.get_event_loop()
458
+ response = loop.run_until_complete(
459
+ self._async_get_glossaries_by_name(glossary_name, effective_time, server_name, start_from, page_size))
460
+ return response
461
+
462
+ #
463
+ # Glossary Categories
464
+ #
465
+ async def _async_create_category(self, glossary_guid: str, display_name: str, description: str,
466
+ server_name: str = None) -> str:
467
+ """ Create a new category within the specified glossary. Async Version.
468
+
469
+ Parameters
470
+ ----------
471
+ glossary_guid: str,
472
+ Unique identifier for the glossary.
473
+ display_name: str,
474
+ Display name for the glossary category. Will be used as the base for a constructed unique qualified name.
475
+ description: str,
476
+ Description for the category.
477
+ server_name : str, optional
478
+ The name of the server to configure.
479
+ If not provided, the server name associated with the instance is used.
480
+
481
+ Returns
482
+ -------
483
+ A string with the GUID of the new category..
484
+
485
+ Raises
486
+ ------
487
+
488
+ InvalidParameterException
489
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
490
+ PropertyServerException
491
+ Raised by the server when an issue arises in processing a valid request
492
+ NotAuthorizedException
493
+ The principle specified by the user_id does not have authorization for the requested action
494
+ ConfigurationErrorException
495
+ Raised when configuration parameters passed on earlier calls turn out to be
496
+ invalid or make the new call invalid.
497
+ """
498
+ if server_name is None:
499
+ server_name = self.server_name
500
+
501
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
502
+ f"{glossary_guid}/categories")
503
+ body = {
504
+ "class": "ReferenceableRequestBody",
505
+ "elementProperties":
506
+ {
507
+ "class": "GlossaryCategoryProperties",
508
+ "qualifiedName": f"GlossaryCategory-{display_name}-{time.asctime()}",
509
+ "displayName": display_name,
510
+ "description": description
511
+ }
512
+ }
513
+ response = await self._async_make_request("POST", url, body)
514
+ return response.json().get("guid", None)
515
+
516
+ def create_category(self, glossary_guid: str, display_name: str, description: str,
517
+ server_name: str = None) -> str:
518
+ """ Create a new category within the specified glossary.
519
+
520
+ Parameters
521
+ ----------
522
+ glossary_guid: str,
523
+ Unique identifier for the glossary.
524
+ display_name: str,
525
+ Display name for the glossary category. Will be used as the base for a constructed unique qualified name.
526
+ description: str,
527
+ Description for the category.
528
+ server_name : str, optional
529
+ The name of the server to configure.
530
+ If not provided, the server name associated with the instance is used.
531
+
532
+ Returns
533
+ -------
534
+ A string with the GUID of the new category..
535
+
536
+ Raises
537
+ ------
538
+
539
+ InvalidParameterException
540
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
541
+ PropertyServerException
542
+ Raised by the server when an issue arises in processing a valid request
543
+ NotAuthorizedException
544
+ The principle specified by the user_id does not have authorization for the requested action
545
+ ConfigurationErrorException
546
+ Raised when configuration parameters passed on earlier calls turn out to be
547
+ invalid or make the new call invalid.
548
+ """
549
+ loop = asyncio.get_event_loop()
550
+ response = loop.run_until_complete(
551
+ self._async_create_category(glossary_guid, display_name, description, server_name))
552
+ return response
553
+
554
+
555
+
556
+ async def _async_get_glossary_for_category(self, glossary_category_guid: str, effective_time: str = None,
557
+ server_name: str = None) -> dict | str:
558
+ """ Retrieve the glossary metadata element for the requested category. The optional request body allows you to
559
+ specify that the glossary element should only be returned if it was effective at a particular time.
560
+
561
+ Parameters
562
+ ----------
563
+ glossary_category_guid: str,
564
+ Unique identifier for the glossary category.
565
+ effective_time: datetime, [default=None], optional
566
+ Effective time of the query. If not specified will default to any effective time. Time format is
567
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
568
+ server_name : str, optional
569
+ The name of the server to configure.
570
+ If not provided, the server name associated with the instance is used.
571
+
572
+ Returns
573
+ -------
574
+ A dict structure with the glossary metadata element for the requested category.
575
+
576
+ Raises
577
+ ------
578
+
579
+ InvalidParameterException
580
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
581
+ PropertyServerException
582
+ Raised by the server when an issue arises in processing a valid request
583
+ NotAuthorizedException
584
+ The principle specified by the user_id does not have authorization for the requested action
585
+ ConfigurationErrorException
586
+ Raised when configuration parameters passed on earlier calls turn out to be
587
+ invalid or make the new call invalid.
588
+ """
589
+ if server_name is None:
590
+ server_name = self.server_name
591
+
592
+ body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
593
+
594
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
595
+ f"for-category/{glossary_category_guid}/retrieve")
596
+
597
+ response = await self._async_make_request("POST", url, body)
598
+ return response.json()
599
+
600
+ def get_glossary_for_category(self, glossary_category_guid: str, effective_time: str = None,
601
+ server_name: str = None) -> dict | str:
602
+ """ Retrieve the glossary metadata element for the requested category. The optional request body allows you to
603
+ specify that the glossary element should only be returned if it was effective at a particular time.
604
+
605
+ Parameters
606
+ ----------
607
+ glossary_category_guid: str,
608
+ Unique identifier for the glossary category.
609
+ effective_time: datetime, [default=None], optional
610
+ Effective time of the query. If not specified will default to any effective time. Time format is
611
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
612
+ server_name : str, optional
613
+ The name of the server to configure.
614
+ If not provided, the server name associated with the instance is used.
615
+
616
+ Returns
617
+ -------
618
+ A dict structure with the glossary metadata element for the requested category.
619
+
620
+ Raises
621
+ ------
622
+
623
+ InvalidParameterException
624
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
625
+ PropertyServerException
626
+ Raised by the server when an issue arises in processing a valid request
627
+ NotAuthorizedException
628
+ The principle specified by the user_id does not have authorization for the requested action
629
+ ConfigurationErrorException
630
+ Raised when configuration parameters passed on earlier calls turn out to be
631
+ invalid or make the new call invalid.
632
+ """
633
+ loop = asyncio.get_event_loop()
634
+ response = loop.run_until_complete(
635
+ self._async_get_glossary_fpr_category(glossary_category_guid, effective_time, server_name))
636
+ return response
637
+
638
+ async def _async_find_glossary_categories(self, search_string: str, effective_time: str = None,
639
+ starts_with: bool = False, ends_with: bool = False,
640
+ ignore_case: bool = False, server_name: str = None, start_from: int = 0,
641
+ page_size: int = None) -> list | str:
642
+ """ Retrieve the list of glossary category metadata elements that contain the search string.
643
+ The search string is located in the request body and is interpreted as a plain string.
644
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
645
+ Async version.
646
+
647
+ Parameters
648
+ ----------
649
+ search_string: str,
650
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
651
+
652
+ effective_time: str, [default=None], optional
653
+ Effective time of the query. If not specified will default to any time. Time format is
654
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
655
+ server_name : str, optional
656
+ The name of the server to configure.
657
+ If not provided, the server name associated with the instance is used.
658
+ starts_with : bool, [default=False], optional
659
+ Starts with the supplied string.
660
+ ends_with : bool, [default=False], optional
661
+ Ends with the supplied string
662
+ ignore_case : bool, [default=False], optional
663
+ Ignore case when searching
664
+ start_from: int, [default=0], optional
665
+ When multiple pages of results are available, the page number to start from.
666
+ page_size: int, [default=None]
667
+ The number of items to return in a single page. If not specified, the default will be taken from
668
+ the class instance.
669
+ Returns
670
+ -------
671
+ List | str
672
+
673
+ A list of glossary definitions active in the server.
674
+
675
+ Raises
676
+ ------
677
+
678
+ InvalidParameterException
679
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
680
+ PropertyServerException
681
+ Raised by the server when an issue arises in processing a valid request
682
+ NotAuthorizedException
683
+ The principle specified by the user_id does not have authorization for the requested action
684
+
685
+ """
686
+ if server_name is None:
687
+ server_name = self.server_name
688
+ if page_size is None:
689
+ page_size = self.page_size
690
+ starts_with_s = str(starts_with).lower()
691
+ ends_with_s = str(ends_with).lower()
692
+ ignore_case_s = str(ignore_case).lower()
693
+
694
+ validate_search_string(search_string)
695
+
696
+ if search_string == '*':
697
+ search_string = None
698
+
699
+ body = {"class": "SearchStringRequestBody", "searchString": search_string, "effectiveTime": effective_time}
700
+ body = body_slimmer(body)
701
+
702
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
703
+ f"categories/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
704
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}")
705
+
706
+ response = await self._async_make_request("POST", url, body)
707
+ return response.json().get("elementList", "No Categories found")
708
+
709
+ def find_glossary_categories(self, search_string: str, effective_time: str = None, starts_with: bool = False,
710
+ ends_with: bool = False, ignore_case: bool = False, server_name: str = None,
711
+ start_from: int = 0, page_size: int = None) -> list | str:
712
+ """ Retrieve the list of glossary category metadata elements that contain the search string.
713
+ The search string is located in the request body and is interpreted as a plain string.
714
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
715
+
716
+ Parameters
717
+ ----------
718
+ search_string: str,
719
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
720
+
721
+ effective_time: str, [default=None], optional
722
+ Effective time of the query. If not specified will default to any time. Time format is
723
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
724
+ server_name : str, optional
725
+ The name of the server to configure.
726
+ If not provided, the server name associated with the instance is used.
727
+ starts_with : bool, [default=False], optional
728
+ Starts with the supplied string.
729
+ ends_with : bool, [default=False], optional
730
+ Ends with the supplied string
731
+ ignore_case : bool, [default=False], optional
732
+ Ignore case when searching
733
+ start_from: int, [default=0], optional
734
+ When multiple pages of results are available, the page number to start from.
735
+ page_size: int, [default=None]
736
+ The number of items to return in a single page. If not specified, the default will be taken from
737
+ the class instance.
738
+ Returns
739
+ -------
740
+ List | str
741
+
742
+ A list of glossary definitions active in the server.
743
+
744
+ Raises
745
+ ------
746
+
747
+ InvalidParameterException
748
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
749
+ PropertyServerException
750
+ Raised by the server when an issue arises in processing a valid request
751
+ NotAuthorizedException
752
+ The principle specified by the user_id does not have authorization for the requested action
753
+
754
+ """
755
+ loop = asyncio.get_event_loop()
756
+ response = loop.run_until_complete(
757
+ self._async_find_glossary_categories(search_string, effective_time, starts_with, ends_with, ignore_case,
758
+ server_name, start_from, page_size))
759
+
760
+ return response
761
+
762
+ async def _async_get_categories_for_glossary(self, glossary_guid: str, server_name: str = None, start_from: int = 0,
763
+ page_size: int = None) -> list | str:
764
+ """ Return the list of categories associated with a glossary.
765
+ Async version.
766
+
767
+ Parameters
768
+ ----------
769
+ glossary_guid: str,
770
+ Unique identity of the glossary
771
+ server_name : str, optional
772
+ The name of the server to configure.
773
+ If not provided, the server name associated with the instance is used.
774
+ start_from: int, [default=0], optional
775
+ When multiple pages of results are available, the page number to start from.
776
+ page_size: int, [default=None]
777
+ The number of items to return in a single page. If not specified, the default will be taken from
778
+ the class instance.
779
+ Returns
780
+ -------
781
+ List | str
782
+
783
+ A list of categories associated with a glossary.
784
+
785
+ Raises
786
+ ------
787
+
788
+ InvalidParameterException
789
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
790
+ PropertyServerException
791
+ Raised by the server when an issue arises in processing a valid request
792
+ NotAuthorizedException
793
+ The principle specified by the user_id does not have authorization for the requested action
794
+
795
+ """
796
+ if server_name is None:
797
+ server_name = self.server_name
798
+ if page_size is None:
799
+ page_size = self.page_size
800
+
801
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
802
+ f"{glossary_guid}/categories/retrieve?startFrom={start_from}&pageSize={page_size}")
803
+
804
+ response = await self._async_make_request("POST", url)
805
+ return response.json().get("elementList", "No Categories found")
806
+
807
+ def get_categories_for_glossary(self, glossary_guid: str, server_name: str = None, start_from: int = 0,
808
+ page_size: int = None) -> list | str:
809
+ """ Return the list of categories associated with a glossary.
810
+
811
+ Parameters
812
+ ----------
813
+ glossary_guid: str,
814
+ Unique identity of the glossary
815
+ server_name : str, optional
816
+ The name of the server to configure.
817
+ If not provided, the server name associated with the instance is used.
818
+ start_from: int, [default=0], optional
819
+ When multiple pages of results are available, the page number to start from.
820
+ page_size: int, [default=None]
821
+ The number of items to return in a single page. If not specified, the default will be taken from
822
+ the class instance.
823
+ Returns
824
+ -------
825
+ List | str
826
+
827
+ A list of categories associated with a glossary.
828
+
829
+ Raises
830
+ ------
831
+
832
+ InvalidParameterException
833
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
834
+ PropertyServerException
835
+ Raised by the server when an issue arises in processing a valid request
836
+ NotAuthorizedException
837
+ The principle specified by the user_id does not have authorization for the requested action
838
+
839
+ """
840
+ loop = asyncio.get_event_loop()
841
+ response = loop.run_until_complete(
842
+ self._async_get_categories_for_glossary(glossary_guid, server_name, start_from, page_size))
843
+ return response
844
+
845
+ async def _async_get_categories_for_term(self, glossary_term_guid: str, server_name: str = None,
846
+ start_from: int = 0, page_size: int = None) -> list | str:
847
+ """ Return the list of categories associated with a glossary term.
848
+ Async version.
849
+
850
+ Parameters
851
+ ----------
852
+ glossary_term_guid: str,
853
+ Unique identity of a glossary term
854
+ server_name : str, optional
855
+ The name of the server to use.
856
+ If not provided, the server name associated with the instance is used.
857
+ start_from: int, [default=0], optional
858
+ When multiple pages of results are available, the page number to start from.
859
+ page_size: int, [default=None]
860
+ The number of items to return in a single page. If not specified, the default will be taken from
861
+ the class instance.
862
+ Returns
863
+ -------
864
+ List | str
865
+
866
+ A list of categories associated with a glossary term.
867
+
868
+ Raises
869
+ ------
870
+
871
+ InvalidParameterException
872
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
873
+ PropertyServerException
874
+ Raised by the server when an issue arises in processing a valid request
875
+ NotAuthorizedException
876
+ The principle specified by the user_id does not have authorization for the requested action
877
+
878
+ """
879
+ if server_name is None:
880
+ server_name = self.server_name
881
+ if page_size is None:
882
+ page_size = self.page_size
883
+
884
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
885
+ f"{glossary_term_guid}/categories/retrieve?startFrom={start_from}&pageSize={page_size}")
886
+
887
+ response = await self._async_make_request("POST", url)
888
+ return response.json().get("elementList", "No Categories found")
889
+
890
+ def get_categories_for_term(self, glossary_term_guid: str, server_name: str = None, start_from: int = 0,
891
+ page_size: int = None) -> list | str:
892
+ """ Return the list of categories associated with a glossary term.
893
+
894
+ Parameters
895
+ ----------
896
+ glossary_term_guid: str,
897
+ Unique identity of a glossary term
898
+ server_name : str, optional
899
+ The name of the server to use.
900
+ If not provided, the server name associated with the instance is used.
901
+ start_from: int, [default=0], optional
902
+ When multiple pages of results are available, the page number to start from.
903
+ page_size: int, [default=None]
904
+ The number of items to return in a single page. If not specified, the default will be taken from
905
+ the class instance.
906
+ Returns
907
+ -------
908
+ List | str
909
+
910
+ A list of categories associated with a glossary term.
911
+
912
+ Raises
913
+ ------
914
+
915
+ InvalidParameterException
916
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
917
+ PropertyServerException
918
+ Raised by the server when an issue arises in processing a valid request
919
+ NotAuthorizedException
920
+ The principle specified by the user_id does not have authorization for the requested action
921
+
922
+ """
923
+ loop = asyncio.get_event_loop()
924
+ response = loop.run_until_complete(
925
+ self._async_get_categories_for_term(glossary_term_guid, server_name, start_from, page_size))
926
+ return response
927
+
928
+ async def _async_get_categories_by_name(self, name: str, glossary_guid: str = None, status: [str] = ["ACTIVE"],
929
+ server_name: str = None, start_from: int = 0,
930
+ page_size: int = None) -> list | str:
931
+ """ Retrieve the list of glossary category metadata elements that either have the requested qualified name or display name.
932
+ The name to search for is located in the request body and is interpreted as a plain string.
933
+ The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
934
+
935
+ Async version.
936
+
937
+ Parameters
938
+ ----------
939
+ name: str,
940
+ category name to search for.
941
+ glossary_guid: str, optional
942
+ The identity of the glossary to search. If not specified, all glossaries will be searched.
943
+ status: [str], optional
944
+ A list of statuses to optionally restrict results. Default is Active
945
+ server_name : str, optional
946
+ The name of the server to configure.
947
+ If not provided, the server name associated with the instance is used.
948
+ start_from: int, [default=0], optional
949
+ When multiple pages of results are available, the page number to start from.
950
+ page_size: int, [default=None]
951
+ The number of items to return in a single page. If not specified, the default will be taken from
952
+ the class instance.
953
+ Returns
954
+ -------
955
+ List | str
956
+
957
+ A list of categories with the corresponding display name or qualified name.
958
+
959
+ Raises
960
+ ------
961
+
962
+ InvalidParameterException
963
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
964
+ PropertyServerException
965
+ Raised by the server when an issue arises in processing a valid request
966
+ NotAuthorizedException
967
+ The principle specified by the user_id does not have authorization for the requested action
968
+
969
+ """
970
+ if server_name is None:
971
+ server_name = self.server_name
972
+ if page_size is None:
973
+ page_size = self.page_size
974
+ validate_name(name)
975
+
976
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/categories/"
977
+ f"by-name?startFrom={start_from}&pageSize={page_size}")
978
+
979
+ body = {"class": "GlossaryNameRequestBody", "name": name, "glossaryGUID": glossary_guid,
980
+ "limitResultsByStatus": status}
981
+
982
+ response = await self._async_make_request("POST", url)
983
+ return response.json().get("elementList", "No Categories found")
984
+
985
+ def get_categories_by_name(self, name: str, glossary_guid: str = None, status: [str] = ["ACTIVE"],
986
+ server_name: str = None, start_from: int = 0, page_size: int = None) -> list | str:
987
+ """ Retrieve the list of glossary category metadata elements that either have the requested qualified name or display name.
988
+ The name to search for is located in the request body and is interpreted as a plain string.
989
+ The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
990
+
991
+ Parameters
992
+ ----------
993
+ name: str,
994
+ category name to search for.
995
+ glossary_guid: str, optional
996
+ The identity of the glossary to search. If not specified, all glossaries will be searched.
997
+ status: [str], optional
998
+ A list of statuses to optionally restrict results. Default is Active
999
+ server_name : str, optional
1000
+ The name of the server to configure.
1001
+ If not provided, the server name associated with the instance is used.
1002
+ start_from: int, [default=0], optional
1003
+ When multiple pages of results are available, the page number to start from.
1004
+ page_size: int, [default=None]
1005
+ The number of items to return in a single page. If not specified, the default will be taken from
1006
+ the class instance.
1007
+ Returns
1008
+ -------
1009
+ List | str
1010
+
1011
+ A list of categories with the corresponding display name or qualified name.
1012
+
1013
+ Raises
1014
+ ------
1015
+
1016
+ InvalidParameterException
1017
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1018
+ PropertyServerException
1019
+ Raised by the server when an issue arises in processing a valid request
1020
+ NotAuthorizedException
1021
+ The principle specified by the user_id does not have authorization for the requested action
1022
+
1023
+ """
1024
+ loop = asyncio.get_event_loop()
1025
+ response = loop.run_until_complete(
1026
+ self._async_get_categories_by_name(name, glossary_guid, status, server_name, start_from, page_size))
1027
+ return response
1028
+
1029
+ async def _async_get_categories_by_guid(self, glossary_category_guid: str, effective_time: str = None,
1030
+ server_name: str = None) -> list | str:
1031
+ """ Retrieve the requested glossary category metadata element. The optional request body contain an effective
1032
+ time for the query..
1033
+
1034
+ Async version.
1035
+
1036
+ Parameters
1037
+ ----------
1038
+ glossary_category_guid: str
1039
+ The identity of the glossary category to search.
1040
+ effective_time, datetime, optional
1041
+ If specified, the category should only be returned if it was effective at the specified time.
1042
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1043
+ server_name : str, optional
1044
+ The name of the server to configure.
1045
+ If not provided, the server name associated with the instance is used.
1046
+
1047
+ Returns
1048
+ -------
1049
+ List | str
1050
+
1051
+ Details for the category with the glossary category GUID.
1052
+
1053
+ Raises
1054
+ ------
1055
+
1056
+ InvalidParameterException
1057
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1058
+ PropertyServerException
1059
+ Raised by the server when an issue arises in processing a valid request
1060
+ NotAuthorizedException
1061
+ The principle specified by the user_id does not have authorization for the requested action
1062
+
1063
+ """
1064
+ if server_name is None:
1065
+ server_name = self.server_name
1066
+
1067
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/categories/"
1068
+ f"{glossary_category_guid}/retrieve")
1069
+
1070
+ body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
1071
+
1072
+ response = await self._async_make_request("POST", url, body)
1073
+ return response.json().get("element", "No Category found")
1074
+
1075
+ def get_categories_by_guid(self, glossary_category_guid: str, effective_time: str = None,
1076
+ server_name: str = None) -> list | str:
1077
+ """ Retrieve the requested glossary category metadata element. The optional request body contain an effective
1078
+ time for the query..
1079
+
1080
+ Parameters
1081
+ ----------
1082
+ glossary_category_guid: str
1083
+ The identity of the glossary category to search.
1084
+ effective_time, datetime, optional
1085
+ If specified, the category should only be returned if it was effective at the specified time.
1086
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1087
+ server_name : str, optional
1088
+ The name of the server to configure.
1089
+ If not provided, the server name associated with the instance is used.
1090
+
1091
+ Returns
1092
+ -------
1093
+ List | str
1094
+
1095
+ Details for the category with the glossary category GUID.
1096
+
1097
+ Raises
1098
+ ------
1099
+
1100
+ InvalidParameterException
1101
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1102
+ PropertyServerException
1103
+ Raised by the server when an issue arises in processing a valid request
1104
+ NotAuthorizedException
1105
+ The principle specified by the user_id does not have authorization for the requested action
1106
+
1107
+ """
1108
+ loop = asyncio.get_event_loop()
1109
+ response = loop.run_until_complete(
1110
+ self._async_get_categories_by_guid(glossary_category_guid, effective_time, server_name))
1111
+ return response
1112
+
1113
+ async def _async_get_category_parent(self, glossary_category_guid: str, effective_time: str = None,
1114
+ server_name: str = None) -> list | str:
1115
+ """ Glossary categories can be organized in a hierarchy. Retrieve the parent glossary category metadata
1116
+ element for the glossary category with the supplied unique identifier. If the requested category
1117
+ does not have a parent category, null is returned. The optional request body contain an effective time
1118
+ for the query.
1119
+
1120
+ Async version.
1121
+
1122
+ Parameters
1123
+ ----------
1124
+ glossary_category_guid: str
1125
+ The identity of the glossary category to search.
1126
+ effective_time, datetime, optional
1127
+ If specified, the category should only be returned if it was effective at the specified time.
1128
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1129
+ server_name : str, optional
1130
+ The name of the server to configure.
1131
+ If not provided, the server name associated with the instance is used.
1132
+
1133
+ Returns
1134
+ -------
1135
+ List | str
1136
+
1137
+ Details for the parent category with the glossary category GUID.
1138
+
1139
+ Raises
1140
+ ------
1141
+
1142
+ InvalidParameterException
1143
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1144
+ PropertyServerException
1145
+ Raised by the server when an issue arises in processing a valid request
1146
+ NotAuthorizedException
1147
+ The principle specified by the user_id does not have authorization for the requested action
1148
+
1149
+ """
1150
+ if server_name is None:
1151
+ server_name = self.server_name
1152
+
1153
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/categories/"
1154
+ f"{glossary_category_guid}/parent/retrieve")
1155
+
1156
+ body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
1157
+
1158
+ response = await self._async_make_request("POST", url, body)
1159
+ return response.json().get("element", "No Parent Category found")
1160
+
1161
+ def get_category_parent(self, glossary_category_guid: str, effective_time: str = None,
1162
+ server_name: str = None) -> list | str:
1163
+ """ Glossary categories can be organized in a hierarchy. Retrieve the parent glossary category metadata
1164
+ element for the glossary category with the supplied unique identifier. If the requested category
1165
+ does not have a parent category, null is returned. The optional request body contain an effective time
1166
+ for the query.
1167
+
1168
+ Parameters
1169
+ ----------
1170
+ glossary_category_guid: str
1171
+ The identity of the glossary category to search.
1172
+ effective_time, datetime, optional
1173
+ If specified, the category should only be returned if it was effective at the specified time.
1174
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
1175
+ server_name : str, optional
1176
+ The name of the server to configure.
1177
+ If not provided, the server name associated with the instance is used.
1178
+
1179
+ Returns
1180
+ -------
1181
+ List | str
1182
+
1183
+ Details for the parent category with the glossary category GUID.
1184
+
1185
+ Raises
1186
+ ------
1187
+
1188
+ InvalidParameterException
1189
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1190
+ PropertyServerException
1191
+ Raised by the server when an issue arises in processing a valid request
1192
+ NotAuthorizedException
1193
+ The principle specified by the user_id does not have authorization for the requested action
1194
+
1195
+ """
1196
+ loop = asyncio.get_event_loop()
1197
+ response = loop.run_until_complete(
1198
+ self._async_get_category_parent(glossary_category_guid, effective_time, server_name))
1199
+ return response
1200
+
1201
+ #
1202
+ # Terms
1203
+ #
1204
+ async def _async_create_controlled_glossary_term(self, glossary_guid: str, body: dict, server_name: str = None) -> str:
1205
+ """ Create a term for a controlled glossary.
1206
+ See also: https://egeria-project.org/types/3/0385-Controlled-Glossary-Development/?h=controlled
1207
+ The request body also supports the specification of an effective time for the query.
1208
+
1209
+ Async Version.
1210
+
1211
+ Parameters
1212
+ ----------
1213
+ glossary_guid : str
1214
+ Unique identifier for the glossary category to retrieve terms from.
1215
+ body: dict
1216
+ The dictionary to create te controlled glossary term for. Example below.
1217
+ server_name : str, optional
1218
+ The name of the server to get the configured access services for.
1219
+ If not provided, the server name associated with the instance is used.
1220
+
1221
+ Returns
1222
+ -------
1223
+ str:
1224
+ The unique guid for the created term.
1225
+
1226
+ Raises
1227
+ ------
1228
+ InvalidParameterException
1229
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1230
+ PropertyServerException
1231
+ Raised by the server when an issue arises in processing a valid request.
1232
+ NotAuthorizedException
1233
+ The principle specified by the user_id does not have authorization for the requested action.
1234
+ Notes
1235
+ -----
1236
+
1237
+ Sample body like:
1238
+ {
1239
+ "class" : "ReferenceableRequestBody",
1240
+ "elementProperties" :
1241
+ {
1242
+ "class" : "GlossaryTermProperties",
1243
+ "qualifiedName" : "GlossaryTerm: term name : {$isoTimestamp}",
1244
+ "displayName" : "term name",
1245
+ "summary" : "This is the short description.",
1246
+ "description" : "This is the long description of the term.",
1247
+ "abbreviation" : "GT",
1248
+ "examples" : "Add examples and descriptions here.",
1249
+ "usage" : "This is how the concept described by the glossary term is used.",
1250
+ "publishVersionIdentifier" : "V1.0",
1251
+ "additionalProperties" :
1252
+ {
1253
+ "propertyName1" : "xxxx",
1254
+ "propertyName2" : "xxxx"
1255
+ }
1256
+ },
1257
+ "initialStatus" : "DRAFT"
1258
+ }
1259
+
1260
+ """
1261
+
1262
+ if server_name is None:
1263
+ server_name = self.server_name
1264
+ validate_guid(glossary_guid)
1265
+
1266
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
1267
+ f"{glossary_guid}/terms/new-controlled"
1268
+ )
1269
+
1270
+ response = await self._async_make_request("POST", url, body)
1271
+
1272
+ return response.json().get("guid", "Term not created")
1273
+
1274
+ def create_controlled_glossary_term(self, glossary_guid: str, body: dict, server_name: str = None) -> str:
1275
+ """ Create a term for a controlled glossary.
1276
+ See also: https://egeria-project.org/types/3/0385-Controlled-Glossary-Development/?h=controlled
1277
+ The request body also supports the specification of an effective time for the query.
1278
+
1279
+ Parameters
1280
+ ----------
1281
+ glossary_guid : str
1282
+ Unique identifier for the glossary category to retrieve terms from.
1283
+ body: dict
1284
+ The dictionary to create te controlled glossary term for. Example below.
1285
+ server_name : str, optional
1286
+ The name of the server to get the configured access services for.
1287
+ If not provided, the server name associated with the instance is used.
1288
+
1289
+ Returns
1290
+ -------
1291
+ str:
1292
+ The unique guid for the created term.
1293
+
1294
+ Raises
1295
+ ------
1296
+ InvalidParameterException
1297
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1298
+ PropertyServerException
1299
+ Raised by the server when an issue arises in processing a valid request.
1300
+ NotAuthorizedException
1301
+ The principle specified by the user_id does not have authorization for the requested action.
1302
+ Notes
1303
+ -----
1304
+
1305
+ Sample body like:
1306
+ {
1307
+ "class" : "ReferenceableRequestBody",
1308
+ "elementProperties" :
1309
+ {
1310
+ "class" : "GlossaryTermProperties",
1311
+ "qualifiedName" : "GlossaryTerm: term name : {$isoTimestamp}",
1312
+ "displayName" : "term name",
1313
+ "summary" : "This is the short description.",
1314
+ "description" : "This is the long description of the term.",
1315
+ "abbreviation" : "GT",
1316
+ "examples" : "Add examples and descriptions here.",
1317
+ "usage" : "This is how the concept described by the glossary term is used.",
1318
+ "publishVersionIdentifier" : "V1.0",
1319
+ "additionalProperties" :
1320
+ {
1321
+ "propertyName1" : "xxxx",
1322
+ "propertyName2" : "xxxx"
1323
+ }
1324
+ },
1325
+ "initialStatus" : "DRAFT"
1326
+ }
1327
+
1328
+ """
1329
+ loop = asyncio.get_event_loop()
1330
+ response = loop.run_until_complete(
1331
+ self._async_create_controlled_glossary_term(glossary_guid, body, server_name))
1332
+
1333
+ return response
1334
+
1335
+ async def _async_create_term_copy(self, glossary_guid: str, glossary_term_guid: str, new_display_name:str,
1336
+ version_id: str, term_status: str = "PROPOSED", server_name: str = None) -> str:
1337
+ """ Create a new term from an existing term.
1338
+
1339
+ Async Version.
1340
+
1341
+ Parameters
1342
+ ----------
1343
+ glossary_guid : str
1344
+ Unique identifier for the glossary category to retrieve terms from.
1345
+ glossary_term_guid: str
1346
+ Unique identifier for the source glossary term.
1347
+ new_display_named: str
1348
+ The display name of the new term.
1349
+ version_id: str
1350
+ The version identifier of the new term.
1351
+ term_status: str, optional, default = "PROPOSED"
1352
+ The status of the term
1353
+ server_name : str, optional
1354
+ The name of the server to get the configured access services for.
1355
+ If not provided, the server name associated with the instance is used.
1356
+
1357
+ Returns
1358
+ -------
1359
+ str:
1360
+ The unique guid for the created term.
1361
+
1362
+ Raises
1363
+ ------
1364
+ InvalidParameterException
1365
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1366
+ PropertyServerException
1367
+ Raised by the server when an issue arises in processing a valid request.
1368
+ NotAuthorizedException
1369
+ The principle specified by the user_id does not have authorization for the requested action.
1370
+ Notes
1371
+ -----
1372
+
1373
+ """
1374
+
1375
+ if server_name is None:
1376
+ server_name = self.server_name
1377
+ validate_guid(glossary_guid)
1378
+ validate_guid(glossary_term_guid)
1379
+
1380
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
1381
+ f"{glossary_guid}/terms/from-template/{glossary_term_guid}"
1382
+ )
1383
+
1384
+ body = {
1385
+ "class" : "GlossaryTemplateRequestBody",
1386
+ "elementProperties" :
1387
+ {
1388
+ "class" : "TemplateProperties",
1389
+ "qualifiedName" : f"Term-{new_display_name}-{time.asctime()}",
1390
+ "displayName" : new_display_name,
1391
+ "versionIdentifier" : version_id
1392
+ },
1393
+ "glossaryTermStatus" : term_status
1394
+ }
1395
+
1396
+ response = await self._async_make_request("POST", url, body)
1397
+
1398
+ return response.json().get("guid", "Term not created")
1399
+
1400
+ def create_term_copy(self, glossary_guid: str, glossary_term_guid: str, new_display_name:str,
1401
+ version_id: str, term_status: str = "PROPOSED", server_name: str = None) -> str:
1402
+ """ Create a new term from an existing term.
1403
+
1404
+ Parameters
1405
+ ----------
1406
+ glossary_guid : str
1407
+ Unique identifier for the glossary category to retrieve terms from.
1408
+ glossary_term_guid: str
1409
+ Unique identifier for the source glossary term.
1410
+ new_display_named: str
1411
+ The display name of the new term.
1412
+ version_id: str
1413
+ The version identifier of the new term.
1414
+ term_status: str, optional, default = "PROPOSED"
1415
+ The status of the term
1416
+ server_name : str, optional
1417
+ The name of the server to get the configured access services for.
1418
+ If not provided, the server name associated with the instance is used.
1419
+
1420
+ Returns
1421
+ -------
1422
+ str:
1423
+ The unique guid for the created term.
1424
+
1425
+ Raises
1426
+ ------
1427
+ InvalidParameterException
1428
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1429
+ PropertyServerException
1430
+ Raised by the server when an issue arises in processing a valid request.
1431
+ NotAuthorizedException
1432
+ The principle specified by the user_id does not have authorization for the requested action.
1433
+ Notes
1434
+ -----
1435
+
1436
+ """
1437
+ loop = asyncio.get_event_loop()
1438
+ response = loop.run_until_complete(
1439
+ self._async_create_term_copy(glossary_guid, glossary_term_guid, new_display_name,
1440
+ version_id, term_status,server_name))
1441
+
1442
+ return response
1443
+
1444
+ async def _async_add_data_field_to_term(self, glossary_term_guid: str, body: dict,
1445
+ server_name: str = None) -> None:
1446
+ """ Add the data field values classification to a glossary term
1447
+
1448
+ Async Version.
1449
+
1450
+ Parameters
1451
+ ----------
1452
+ glossary_guid : str
1453
+ Unique identifier for the glossary category to retrieve terms from.
1454
+ glossary_term_guid: str
1455
+ Unique identifier for the source glossary term.
1456
+ body: dict
1457
+ Body containing information about the data field to add
1458
+ server_name : str, optional
1459
+ The name of the server to get the configured access services for.
1460
+ If not provided, the server name associated with the instance is used.
1461
+
1462
+ Returns
1463
+ -------
1464
+ None
1465
+
1466
+ Raises
1467
+ ------
1468
+ InvalidParameterException
1469
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1470
+ PropertyServerException
1471
+ Raised by the server when an issue arises in processing a valid request.
1472
+ NotAuthorizedException
1473
+ The principle specified by the user_id does not have authorization for the requested action.
1474
+ Notes
1475
+ -----
1476
+ Body is of the structure:
1477
+
1478
+ {
1479
+ "class" : "ClassificationRequestBody",
1480
+ "properties" :
1481
+ {
1482
+ "class" : "DataFieldValuesProperties",
1483
+ "defaultValue" : "Add default value here",
1484
+ "sampleValues" : [ "Sample Value 1", "Sample Value 2"],
1485
+ "dataPattern" : ["add data pattern here"],
1486
+ "namePattern" : ["add column pattern here"]
1487
+ }
1488
+ }
1489
+ """
1490
+
1491
+ if server_name is None:
1492
+ server_name = self.server_name
1493
+ validate_guid(glossary_term_guid)
1494
+
1495
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
1496
+ f"terms/{glossary_term_guid}/is-data-field"
1497
+ )
1498
+
1499
+ await self._async_make_request("POST", url, body)
1500
+ return
1501
+
1502
+ def add_data_field_to_term(self, glossary_term_guid: str, body: dict, server_name: str = None) -> None:
1503
+ """ Add the data field values classification to a glossary term
1504
+
1505
+ Parameters
1506
+ ----------
1507
+ glossary_term_guid: str
1508
+ Unique identifier for the source glossary term.
1509
+ body: dict
1510
+ Body containing information about the data field to add
1511
+ server_name : str, optional
1512
+ The name of the server to get the configured access services for.
1513
+ If not provided, the server name associated with the instance is used.
1514
+
1515
+ Returns
1516
+ -------
1517
+ None
1518
+
1519
+ Raises
1520
+ ------
1521
+ InvalidParameterException
1522
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1523
+ PropertyServerException
1524
+ Raised by the server when an issue arises in processing a valid request.
1525
+ NotAuthorizedException
1526
+ The principle specified by the user_id does not have authorization for the requested action.
1527
+ Notes
1528
+ -----
1529
+ Body is of the structure:
1530
+
1531
+ {
1532
+ "class" : "ClassificationRequestBody",
1533
+ "properties" :
1534
+ {
1535
+ "class" : "DataFieldValuesProperties",
1536
+ "defaultValue" : "Add default value here",
1537
+ "sampleValues" : [ "Sample Value 1", "Sample Value 2"],
1538
+ "dataPattern" : ["add data pattern here"],
1539
+ "namePattern" : ["add column pattern here"]
1540
+ }
1541
+ }
1542
+ """
1543
+ loop = asyncio.get_event_loop()
1544
+ loop.run_until_complete(
1545
+ self._async_add_data_field_to_term( glossary_term_guid, body,server_name))
1546
+
1547
+ return
1548
+
1549
+ async def _async_add_confidentiality_to_term(self, glossary_term_guid: str,
1550
+ confidentiality_level: int, server_name: str = None) -> None:
1551
+ """ Add the confidentiality classification to a glossary term
1552
+
1553
+ Async Version.
1554
+
1555
+ Parameters
1556
+ ----------
1557
+ glossary_term_guid: str
1558
+ Unique identifier for the source glossary term.
1559
+ confidentiality_level: int
1560
+ The level of confidentiality to classify the term with.
1561
+ server_name : str, optional
1562
+ The name of the server to get the configured access services for.
1563
+ If not provided, the server name associated with the instance is used.
1564
+
1565
+ Returns
1566
+ -------
1567
+ None
1568
+
1569
+ Raises
1570
+ ------
1571
+ InvalidParameterException
1572
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1573
+ PropertyServerException
1574
+ Raised by the server when an issue arises in processing a valid request.
1575
+ NotAuthorizedException
1576
+ The principle specified by the user_id does not have authorization for the requested action.
1577
+ Notes
1578
+ -----
1579
+ See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
1580
+ for a list of default confidentiality levels.
1581
+
1582
+ """
1583
+
1584
+ if server_name is None:
1585
+ server_name = self.server_name
1586
+ validate_guid(glossary_term_guid)
1587
+
1588
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/elements/"
1589
+ f"{glossary_term_guid}/confidentiality"
1590
+ )
1591
+
1592
+ body = {
1593
+ "class" : "ClassificationRequestBody",
1594
+ "properties" :
1595
+ {
1596
+ "class" : "GovernanceClassificationProperties",
1597
+ "levelIdentifier" : confidentiality_level
1598
+ }
1599
+ }
1600
+
1601
+ await self._async_make_request("POST", url, body)
1602
+ return
1603
+
1604
+ def add_confidentiality_to_term(self, glossary_term_guid: str,
1605
+ confidentiality_level: int, server_name: str = None) -> str:
1606
+ """ Add the confidentiality classification to a glossary term
1607
+
1608
+ Parameters
1609
+ ----------
1610
+ glossary_term_guid: str
1611
+ Unique identifier for the source glossary term.
1612
+ confidentiality_level: int
1613
+ The level of confidentiality to classify the term with.
1614
+ server_name : str, optional
1615
+ The name of the server to get the configured access services for.
1616
+ If not provided, the server name associated with the instance is used.
1617
+
1618
+ Returns
1619
+ -------
1620
+ None
1621
+
1622
+ Raises
1623
+ ------
1624
+ InvalidParameterException
1625
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1626
+ PropertyServerException
1627
+ Raised by the server when an issue arises in processing a valid request.
1628
+ NotAuthorizedException
1629
+ The principle specified by the user_id does not have authorization for the requested action.
1630
+ Notes
1631
+ -----
1632
+ See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
1633
+ for a list of default confidentiality levels.
1634
+
1635
+ """
1636
+ loop = asyncio.get_event_loop()
1637
+ response = loop.run_until_complete(
1638
+ self._async_add_confidentiality_to_term( glossary_term_guid, confidentiality_level,
1639
+ server_name))
1640
+
1641
+ return
1642
+
1643
+ async def _async_add_subject_area_to_term(self, glossary_term_guid: str, subject_area: str, server_name: str = None) -> None:
1644
+ """ Add the confidentiality classification to a glossary term
1645
+
1646
+ Async Version.
1647
+
1648
+ Parameters
1649
+ ----------
1650
+ glossary_term_guid: str
1651
+ Unique identifier for the source glossary term.
1652
+ subject_area: str
1653
+ The subject area to classify the term with.
1654
+ server_name : str, optional
1655
+ The name of the server to get the configured access services for.
1656
+ If not provided, the server name associated with the instance is used.
1657
+
1658
+ Returns
1659
+ -------
1660
+ None
1661
+
1662
+ Raises
1663
+ ------
1664
+ InvalidParameterException
1665
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1666
+ PropertyServerException
1667
+ Raised by the server when an issue arises in processing a valid request.
1668
+ NotAuthorizedException
1669
+ The principle specified by the user_id does not have authorization for the requested action.
1670
+ Notes
1671
+ -----
1672
+ See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
1673
+ for a list of default confidentiality levels.
1674
+
1675
+ """
1676
+
1677
+ if server_name is None:
1678
+ server_name = self.server_name
1679
+ validate_guid(glossary_term_guid)
1680
+
1681
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/elements/"
1682
+ f"{glossary_term_guid}/subject-area-member"
1683
+ )
1684
+
1685
+ body = {
1686
+ "class": "ClassificationRequestBody",
1687
+ "properties":
1688
+ {
1689
+ "class": "SubjectAreaMemberProperties",
1690
+ "subjectAreaName": subject_area
1691
+ }
1692
+ }
1693
+
1694
+ await self._async_make_request("POST", url, body)
1695
+ return
1696
+
1697
+ def add_subject_area_to_term(self, glossary_term_guid: str, subject_area: str, server_name: str = None) -> None:
1698
+ """ Add the confidentiality classification to a glossary term
1699
+
1700
+ Parameters
1701
+ ----------
1702
+ glossary_term_guid: str
1703
+ Unique identifier for the source glossary term.
1704
+ subject_area: str
1705
+ The subject area to classify the term with.
1706
+ server_name : str, optional
1707
+ The name of the server to get the configured access services for.
1708
+ If not provided, the server name associated with the instance is used.
1709
+
1710
+ Returns
1711
+ -------
1712
+ None
1713
+
1714
+ Raises
1715
+ ------
1716
+ InvalidParameterException
1717
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1718
+ PropertyServerException
1719
+ Raised by the server when an issue arises in processing a valid request.
1720
+ NotAuthorizedException
1721
+ The principle specified by the user_id does not have authorization for the requested action.
1722
+ Notes
1723
+ -----
1724
+ See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
1725
+ for a list of default confidentiality levels.
1726
+
1727
+ """
1728
+ loop = asyncio.get_event_loop()
1729
+ response = loop.run_until_complete(
1730
+ self._async_add_subject_area_to_term( glossary_term_guid, subject_area,
1731
+ server_name))
1732
+
1733
+ return
1734
+
1735
+ async def _async_update_term(self, glossary_term_guid: str, body: dict, is_merge_update: bool,
1736
+ server_name: str = None) -> None:
1737
+ """ Add the data field values classification to a glossary term
1738
+
1739
+ Async Version.
1740
+
1741
+ Parameters
1742
+ ----------
1743
+ glossary_term_guid: str
1744
+ Unique identifier for the source glossary term.
1745
+ body: dict
1746
+ Body containing information about the data field to add
1747
+ is_merge_update: bool
1748
+ Whether the data field values should be merged with existing definition or replace it.
1749
+ server_name : str, optional
1750
+ The name of the server to get the configured access services for.
1751
+ If not provided, the server name associated with the instance is used.
1752
+
1753
+ Returns
1754
+ -------
1755
+ None
1756
+
1757
+ Raises
1758
+ ------
1759
+ InvalidParameterException
1760
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1761
+ PropertyServerException
1762
+ Raised by the server when an issue arises in processing a valid request.
1763
+ NotAuthorizedException
1764
+ The principle specified by the user_id does not have authorization for the requested action.
1765
+ Notes
1766
+ -----
1767
+ An example body is:
1768
+
1769
+ {
1770
+ "class" : "ReferenceableRequestBody",
1771
+ "elementProperties" :
1772
+ {
1773
+ "class" : "GlossaryTermProperties",
1774
+ "description" : "This is the long description of the term. And this is some more text."
1775
+ },
1776
+ "updateDescription" : "Final updates based on in-house review comments."
1777
+ }
1778
+
1779
+ """
1780
+
1781
+ if server_name is None:
1782
+ server_name = self.server_name
1783
+ validate_guid(glossary_term_guid)
1784
+ is_merge_update_s = str(is_merge_update).lower()
1785
+
1786
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/terms/{glossary_term_guid}/"
1787
+ f"update?isMergeUpdate={is_merge_update_s}"
1788
+ )
1789
+
1790
+ await self._async_make_request("POST", url, body)
1791
+ return
1792
+
1793
+ def update_term(self, glossary_term_guid: str, body: dict, is_merge_update: bool,
1794
+ server_name: str = None) -> None:
1795
+ """ Add the data field values classification to a glossary term
1796
+
1797
+ Async Version.
1798
+
1799
+ Parameters
1800
+ ----------
1801
+ glossary_term_guid: str
1802
+ Unique identifier for the source glossary term.
1803
+ body: dict
1804
+ Body containing information about the data field to add
1805
+ is_merge_update: bool
1806
+ Whether the data field values should be merged with existing definition or replace it.
1807
+ server_name : str, optional
1808
+ The name of the server to get the configured access services for.
1809
+ If not provided, the server name associated with the instance is used.
1810
+
1811
+ Returns
1812
+ -------
1813
+ None
1814
+
1815
+ Raises
1816
+ ------
1817
+ InvalidParameterException
1818
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1819
+ PropertyServerException
1820
+ Raised by the server when an issue arises in processing a valid request.
1821
+ NotAuthorizedException
1822
+ The principle specified by the user_id does not have authorization for the requested action.
1823
+ Notes
1824
+ -----
1825
+ An example body is:
1826
+
1827
+ {
1828
+ "class" : "ReferenceableRequestBody",
1829
+ "elementProperties" :
1830
+ {
1831
+ "class" : "GlossaryTermProperties",
1832
+ "description" : "This is the long description of the term. And this is some more text."
1833
+ },
1834
+ "updateDescription" : "Final updates based on in-house review comments."
1835
+ }
1836
+
1837
+ """
1838
+ loop = asyncio.get_event_loop()
1839
+ loop.run_until_complete(
1840
+ self._async_update_term( glossary_term_guid, body,is_merge_update,server_name))
1841
+
1842
+ return
1843
+
1844
+ async def _async_update_term_version_id(self, glossary_term_guid: str, new_version_identifier: str,
1845
+ server_name: str = None) -> None:
1846
+ """ Update a glossary term's version identifier
1847
+
1848
+ Async Version.
1849
+
1850
+ Parameters
1851
+ ----------
1852
+ glossary_term_guid: str
1853
+ Unique identifier for the source glossary term.
1854
+ new_version_identifier: str
1855
+ The new version identifier to update the term with.
1856
+ server_name : str, optional
1857
+ The name of the server to get the configured access services for.
1858
+ If not provided, the server name associated with the instance is used.
1859
+
1860
+ Returns
1861
+ -------
1862
+ None
1863
+
1864
+ Raises
1865
+ ------
1866
+ InvalidParameterException
1867
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1868
+ PropertyServerException
1869
+ Raised by the server when an issue arises in processing a valid request.
1870
+ NotAuthorizedException
1871
+ The principle specified by the user_id does not have authorization for the requested action.
1872
+ Notes
1873
+ -----
1874
+ This is a useful example of a term update, specifying a new version identifier.
1875
+
1876
+ """
1877
+
1878
+ if server_name is None:
1879
+ server_name = self.server_name
1880
+ validate_guid(glossary_term_guid)
1881
+
1882
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/terms/{glossary_term_guid}/"
1883
+ f"update?isMergeUpdate=true"
1884
+ )
1885
+
1886
+ body = {
1887
+ "class" : "ReferenceableRequestBody",
1888
+ "elementProperties" :
1889
+ {
1890
+ "class" : "GlossaryTermProperties",
1891
+ "publishVersionIdentifier" : new_version_identifier
1892
+ }
1893
+ }
1894
+ await self._async_make_request("POST", url, body)
1895
+ return
1896
+
1897
+ def update_term_version_id(self, glossary_term_guid: str, new_version_identifier: str,
1898
+ server_name: str = None) -> None:
1899
+ """ Update a glossary term's version identifier
1900
+
1901
+ Async Version.
1902
+
1903
+ Parameters
1904
+ ----------
1905
+ glossary_term_guid: str
1906
+ Unique identifier for the source glossary term.
1907
+ new_version_identifier: str
1908
+ The new version identifier to update the term with.
1909
+ server_name : str, optional
1910
+ The name of the server to get the configured access services for.
1911
+ If not provided, the server name associated with the instance is used.
1912
+
1913
+ Returns
1914
+ -------
1915
+ None
1916
+
1917
+ Raises
1918
+ ------
1919
+ InvalidParameterException
1920
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1921
+ PropertyServerException
1922
+ Raised by the server when an issue arises in processing a valid request.
1923
+ NotAuthorizedException
1924
+ The principle specified by the user_id does not have authorization for the requested action.
1925
+ Notes
1926
+ -----
1927
+ This is a useful example of a term update, specifying a new version identifier.
1928
+
1929
+ """
1930
+ loop = asyncio.get_event_loop()
1931
+ loop.run_until_complete(
1932
+ self._async_update_term_version_id( glossary_term_guid, new_version_identifier,server_name))
1933
+
1934
+ return
1935
+
1936
+
1937
+
1938
+ async def _async_get_terms_for_category(self, glossary_category_guid: str, server_name: str = None,
1939
+ effective_time: str = None, start_from: int = 0,
1940
+ page_size: int = None) -> list | str:
1941
+ """ Retrieve ALL the glossary terms in a category.
1942
+ The request body also supports the specification of an effective time for the query.
1943
+
1944
+ Async Version.
1945
+
1946
+ Parameters
1947
+ ----------
1948
+ glossary_category_guid : str
1949
+ Unique identifier for the glossary category to retrieve terms from.
1950
+ server_name : str, optional
1951
+ The name of the server to get the configured access services for.
1952
+ If not provided, the server name associated with the instance is used.
1953
+ effective_time : str, optional
1954
+ If specified, the terms are returned if they are active at the `effective_time
1955
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1956
+ start_from: int, optional defaults to 0
1957
+ The page number to start retrieving elements from
1958
+ page_size : int, optional defaults to None
1959
+ The number of elements to retrieve
1960
+ Returns
1961
+ -------
1962
+ dict
1963
+ The glossary definition associated with the glossary_guid
1964
+
1965
+ Raises
1966
+ ------
1967
+ InvalidParameterException
1968
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1969
+ PropertyServerException
1970
+ Raised by the server when an issue arises in processing a valid request.
1971
+ NotAuthorizedException
1972
+ The principle specified by the user_id does not have authorization for the requested action.
1973
+ Notes
1974
+ -----
1975
+ """
1976
+
1977
+ if server_name is None:
1978
+ server_name = self.server_name
1979
+ validate_guid(glossary_category_guid)
1980
+
1981
+ if page_size is None:
1982
+ page_size = self.page_size
1983
+
1984
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
1985
+ f"{glossary_category_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}")
1986
+
1987
+ if effective_time is not None:
1988
+ body = {"effectiveTime": effective_time}
1989
+ response = await self._async_make_request("POST", url, body)
1990
+ else:
1991
+ response = await self._async_make_request("POST", url)
1992
+
1993
+ return response.json().get("elementList", "No terms found")
1994
+
1995
+ def get_terms_for_category(self, glossary_category_guid: str, server_name: str = None,
1996
+ effective_time:str = None, start_from: int = 0,
1997
+ page_size: int = None) -> list | str:
1998
+ """ Retrieve ALL the glossary terms in a category.
1999
+ The request body also supports the specification of an effective time for the query.
2000
+
2001
+ Async Version.
2002
+
2003
+ Parameters
2004
+ ----------
2005
+ glossary_category_guid : str
2006
+ Unique identifier for the glossary category to retrieve terms from.
2007
+ server_name : str, optional
2008
+ The name of the server to get the configured access services for.
2009
+ If not provided, the server name associated with the instance is used.
2010
+ effective_time : str, optional
2011
+ If specified, the terms are returned if they are active at the `effective_time.
2012
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)`.
2013
+ start_from: int, optional defaults to 0
2014
+ The page number to start retrieving elements from
2015
+ page_size : int, optional defaults to None
2016
+ The number of elements to retrieve
2017
+ Returns
2018
+ -------
2019
+ dict
2020
+ The glossary definition associated with the glossary_guid
2021
+
2022
+ Raises
2023
+ ------
2024
+ InvalidParameterException
2025
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2026
+ PropertyServerException
2027
+ Raised by the server when an issue arises in processing a valid request.
2028
+ NotAuthorizedException
2029
+ The principle specified by the user_id does not have authorization for the requested action.
2030
+ Notes
2031
+ -----
2032
+ """
2033
+ loop = asyncio.get_event_loop()
2034
+ response = loop.run_until_complete(
2035
+ self._async_get_terms_for_category(glossary_category_guid, server_name, effective_time, start_from,
2036
+ page_size))
2037
+
2038
+ return response
2039
+
2040
+ async def _async_get_terms_for_glossary(self, glossary_guid: str, server_name: str = None,
2041
+ effective_time: str = None, start_from: int = 0,
2042
+ page_size: int = None) -> list | str:
2043
+ """ Retrieve the list of glossary terms associated with a glossary.
2044
+ The request body also supports the specification of an effective time for the query.
2045
+ Parameters
2046
+ ----------
2047
+ glossary_guid : str
2048
+ Unique identifier for the glossary
2049
+ server_name : str, optional
2050
+ The name of the server to get the configured access services for.
2051
+ If not provided, the server name associated with the instance is used.
2052
+ effective_time : str, optional
2053
+ If specified, terms are potentially included if they are active at the`effective_time.
2054
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)`
2055
+ start_from: int, optional defaults to 0
2056
+ The page number to start retrieving elements from
2057
+ page_size : int, optional defaults to None
2058
+ The number of elements to retrieve
2059
+ Returns
2060
+ -------
2061
+ dict
2062
+ The glossary definition associated with the glossary_guid
2063
+
2064
+ Raises
2065
+ ------
2066
+ InvalidParameterException
2067
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2068
+ PropertyServerException
2069
+ Raised by the server when an issue arises in processing a valid request.
2070
+ NotAuthorizedException
2071
+ The principle specified by the user_id does not have authorization for the requested action.
2072
+ Notes
2073
+ -----
2074
+ """
2075
+
2076
+ if server_name is None:
2077
+ server_name = self.server_name
2078
+ validate_guid(glossary_guid)
2079
+
2080
+ if page_size is None:
2081
+ page_size = self.page_size
2082
+
2083
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
2084
+ f"{glossary_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}")
2085
+
2086
+ if effective_time is not None:
2087
+ body = {"effectiveTime": effective_time}
2088
+ response = await self._async_make_request("POST", url, body)
2089
+ else:
2090
+ response = await self._async_make_request("POST", url)
2091
+
2092
+ return response.json().get("elementList", "No terms found")
2093
+
2094
+ def get_terms_for_glossary(self, glossary_guid: str, server_name: str = None, effective_time: str = None,
2095
+ start_from: int = 0, page_size: int = None) -> list | str:
2096
+ """ Retrieve the list of glossary terms associated with a glossary.
2097
+ The request body also supports the specification of an effective time for the query.
2098
+ Parameters
2099
+ ----------
2100
+ glossary_guid : str
2101
+ Unique identifier for the glossary
2102
+ server_name : str, optional
2103
+ The name of the server to get the configured access services for.
2104
+ If not provided, the server name associated with the instance is used.
2105
+ effective_time : str, optional
2106
+ If specified, terms are potentially returned if they are active at the `effective_time`
2107
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2108
+ start_from: int, optional defaults to 0
2109
+ The page number to start retrieving elements from
2110
+ page_size : int, optional defaults to None
2111
+ The number of elements to retrieve
2112
+ Returns
2113
+ -------
2114
+ dict
2115
+ The glossary definition associated with the glossary_guid
2116
+
2117
+ Raises
2118
+ ------
2119
+ InvalidParameterException
2120
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2121
+ PropertyServerException
2122
+ Raised by the server when an issue arises in processing a valid request.
2123
+ NotAuthorizedException
2124
+ The principle specified by the user_id does not have authorization for the requested action.
2125
+ Notes
2126
+ -----
2127
+ """
2128
+ loop = asyncio.get_event_loop()
2129
+ response = loop.run_until_complete(
2130
+ self._async_get_terms_for_glossary(glossary_guid, server_name, effective_time, start_from, page_size))
2131
+
2132
+ return response
2133
+
2134
+ async def _async_get_term_relationships(self, term_guid: str, server_name: str = None,
2135
+ effective_time: str = None, start_from: int = 0,
2136
+ page_size: int = None) -> list | str:
2137
+
2138
+ """ This call retrieves details of the glossary terms linked to this glossary term.
2139
+ Notice the original org 1 glossary term is linked via the "SourcedFrom" relationship..
2140
+ Parameters
2141
+ ----------
2142
+ term_guid : str
2143
+ Unique identifier for the glossary term
2144
+ server_name : str, optional
2145
+ The name of the server to get the configured access services for.
2146
+ If not provided, the server name associated with the instance is used.
2147
+ effective_time : str, optional
2148
+ If specified, term relationships are included if they are active at the `effective_time`.
2149
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2150
+ start_from: int, optional defaults to 0
2151
+ The page number to start retrieving elements from
2152
+ page_size : int, optional defaults to None
2153
+ The number of elements to retrieve
2154
+ Returns
2155
+ -------
2156
+ dict
2157
+ The glossary definition associated with the glossary_guid
2158
+
2159
+ Raises
2160
+ ------
2161
+ InvalidParameterException
2162
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2163
+ PropertyServerException
2164
+ Raised by the server when an issue arises in processing a valid request.
2165
+ NotAuthorizedException
2166
+ The principle specified by the user_id does not have authorization for the requested action.
2167
+ Notes
2168
+ -----
2169
+ """
2170
+
2171
+ if server_name is None:
2172
+ server_name = self.server_name
2173
+ validate_guid(term_guid)
2174
+
2175
+ if page_size is None:
2176
+ page_size = self.page_size
2177
+
2178
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
2179
+ f"{term_guid}/related-terms?startFrom={start_from}&pageSize={page_size}")
2180
+
2181
+ if effective_time is not None:
2182
+ body = {"effectiveTime": effective_time}
2183
+ response = await self._async_make_request("POST", url, body)
2184
+ else:
2185
+ response = await self._async_make_request("POST", url)
2186
+
2187
+ return response.json().get("elementList", "No terms found")
2188
+
2189
+ def get_term_relationships(self, term_guid: str, server_name: str = None, effective_time: str = None,
2190
+ start_from: int = 0, page_size: int = None) -> list | str:
2191
+
2192
+ """ This call retrieves details of the glossary terms linked to this glossary term.
2193
+ Notice the original org 1 glossary term is linked via the "SourcedFrom" relationship..
2194
+ Parameters
2195
+ ----------
2196
+ term_guid : str
2197
+ Unique identifier for the glossary term
2198
+ server_name : str, optional
2199
+ The name of the server to get the configured access services for.
2200
+ If not provided, the server name associated with the instance is used.
2201
+ effective_time : str, optional
2202
+ If specified, term relationships are included if they are active at the `effective_time`.
2203
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2204
+ start_from: int, optional defaults to 0
2205
+ The page number to start retrieving elements from
2206
+ page_size : int, optional defaults to None
2207
+ The number of elements to retrieve
2208
+ Returns
2209
+ -------
2210
+ dict
2211
+ The glossary definition associated with the glossary_guid
2212
+
2213
+ Raises
2214
+ ------
2215
+ InvalidParameterException
2216
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2217
+ PropertyServerException
2218
+ Raised by the server when an issue arises in processing a valid request.
2219
+ NotAuthorizedException
2220
+ The principle specified by the user_id does not have authorization for the requested action.
2221
+ Notes
2222
+ -----
2223
+ """
2224
+ loop = asyncio.get_event_loop()
2225
+ response = loop.run_until_complete(
2226
+ self._async_get_term_relationships(term_guid, server_name, effective_time, start_from, page_size))
2227
+
2228
+ return response
2229
+
2230
+ async def _async_get_glossary_for_term(self, term_guid: str, server_name: str = None,
2231
+ effective_time: str = None) -> dict | str:
2232
+ """ Retrieve the glossary metadata element for the requested term. The optional request body allows you to specify
2233
+ that the glossary element should only be returned if it was effective at a particular time.
2234
+
2235
+ Async Version.
2236
+
2237
+ Parameters
2238
+ ----------
2239
+ term_guid : str
2240
+ The unique identifier for the term.
2241
+ server_name : str, optional
2242
+ The name of the server. If not specified, the default server name will be used.
2243
+ effective_time : datetime, optional
2244
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
2245
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2246
+
2247
+ Returns
2248
+ -------
2249
+ dict
2250
+ The glossary information retrieved for the specified term.
2251
+ Raises
2252
+ ------
2253
+ InvalidParameterException
2254
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2255
+ PropertyServerException
2256
+ Raised by the server when an issue arises in processing a valid request.
2257
+ NotAuthorizedException
2258
+ The principle specified by the user_id does not have authorization for the requested action.
2259
+ Notes
2260
+ -----
2261
+ """
2262
+ if server_name is None:
2263
+ server_name = self.server_name
2264
+ validate_guid(term_guid)
2265
+
2266
+ body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
2267
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
2268
+ f"for-term/{term_guid}/retrieve")
2269
+
2270
+ response = await self._async_make_request("POST", url, body)
2271
+ return response.json().get("element", "No glossary found")
2272
+
2273
+ def get_glossary_for_term(self, term_guid: str, server_name: str = None,
2274
+ effective_time: str = None) -> dict | str:
2275
+ """ Retrieve the glossary metadata element for the requested term. The optional request body allows you to specify
2276
+ that the glossary element should only be returned if it was effective at a particular time.
2277
+
2278
+ Async Version.
2279
+
2280
+ Parameters
2281
+ ----------
2282
+ term_guid : str
2283
+ The unique identifier for the term.
2284
+ server_name : str, optional
2285
+ The name of the server. If not specified, the default server name will be used.
2286
+ effective_time : datetime, optional
2287
+ TIf specified, the term information will be retrieved if it is active at the `effective_time`.
2288
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
2289
+
2290
+ Returns
2291
+ -------
2292
+ dict
2293
+ The glossary information retrieved for the specified term.
2294
+ Raises
2295
+ ------
2296
+ InvalidParameterException
2297
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2298
+ PropertyServerException
2299
+ Raised by the server when an issue arises in processing a valid request.
2300
+ NotAuthorizedException
2301
+ The principle specified by the user_id does not have authorization for the requested action.
2302
+ Notes
2303
+ -----
2304
+ """
2305
+ loop = asyncio.get_event_loop()
2306
+ response = loop.run_until_complete(self._async_get_glossary_for_term(term_guid, server_name, effective_time))
2307
+ return response
2308
+
2309
+ async def _async_get_terms_by_name(self, term: str, glossary_guid: str = None, status_filter: list = [],
2310
+ server_name: str = None, effective_time: str = None,
2311
+ for_lineage: bool = False, for_duplicate_processing: bool = False,
2312
+ start_from: int = 0, page_size: int = None) -> list:
2313
+ """ Retrieve glossary terms by display name or qualified name. Async Version.
2314
+
2315
+ Parameters
2316
+ ----------
2317
+ term : str
2318
+ The term to search for in the glossaries.
2319
+ glossary_guid : str, optional
2320
+ The GUID of the glossary to search in. If not provided, the search will be performed in all glossaries.
2321
+ status_filter : list, optional
2322
+ A list of status values to filter the search results. Default is an empty list, which means no filtering.
2323
+ server_name : str, optional
2324
+ The name of the server where the glossaries reside. If not provided, it will use the default server name.
2325
+ effective_time : datetime, optional
2326
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
2327
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2328
+ for_lineage : bool, optional
2329
+ Flag to indicate whether the search should include lineage information. Default is False.
2330
+ for_duplicate_processing : bool, optional
2331
+ Flag to indicate whether the search should include duplicate processing information. Default is False.
2332
+ start_from : int, optional
2333
+ The index of the first term to retrieve. Default is 0.
2334
+ page_size : int, optional
2335
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
2336
+
2337
+ Returns
2338
+ -------
2339
+ list
2340
+ A list of terms matching the search criteria. If no terms are found, it returns the string "No terms found".
2341
+
2342
+ Raises
2343
+ ------
2344
+ InvalidParameterException
2345
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2346
+ PropertyServerException
2347
+ Raised by the server when an issue arises in processing a valid request.
2348
+ NotAuthorizedException
2349
+ The principle specified by the user_id does not have authorization for the requested action.
2350
+ """
2351
+ if server_name is None:
2352
+ server_name = self.server_name
2353
+ if page_size is None:
2354
+ page_size = self.page_size
2355
+
2356
+ validate_name(term)
2357
+
2358
+ for_lineage_s = str(for_lineage).lower()
2359
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
2360
+
2361
+ body = {"class": "GlossaryNameRequestBody", "glossaryGUID": glossary_guid, "name": term,
2362
+ "effectiveTime": effective_time, "limitResultsByStatus": status_filter}
2363
+ # body = body_slimmer(body)
2364
+
2365
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
2366
+ f"terms/by-name?startFrom={start_from}&pageSize={page_size}&"
2367
+ f"&forLineage={for_lineage_s}&forDuplicateProcessing={for_duplicate_processing_s}")
2368
+
2369
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
2370
+
2371
+ response = await self._async_make_request("POST", url, body)
2372
+ return response.json().get("elementList", "No terms found")
2373
+
2374
+ def get_terms_by_name(self, term: str, glossary_guid: str = None, status_filter: list = [], server_name: str = None,
2375
+ effective_time: str = None, for_lineage: bool = False,
2376
+ for_duplicate_processing: bool = False, start_from: int = 0, page_size: int = None) -> list:
2377
+ """ Retrieve glossary terms by display name or qualified name.
2378
+
2379
+ Parameters
2380
+ ----------
2381
+ term : str
2382
+ The term to search for in the glossaries.
2383
+ glossary_guid : str, optional
2384
+ The GUID of the glossary to search in. If not provided, the search will be performed in all glossaries.
2385
+ status_filter : list, optional
2386
+ A list of status values to filter the search results. Default is an empty list, which means no filtering.
2387
+ server_name : str, optional
2388
+ The name of the server where the glossaries reside. If not provided, it will use the default server name.
2389
+ effective_time : datetime, optional
2390
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
2391
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2392
+ for_lineage : bool, optional
2393
+ Flag to indicate whether the search should include lineage information. Default is False.
2394
+ for_duplicate_processing : bool, optional
2395
+ Flag to indicate whether the search should include duplicate processing information. Default is False.
2396
+ start_from : int, optional
2397
+ The index of the first term to retrieve. Default is 0.
2398
+ page_size : int, optional
2399
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
2400
+
2401
+ Returns
2402
+ -------
2403
+ list
2404
+ A list of terms matching the search criteria. If no terms are found,
2405
+ it returns the string "No terms found".
2406
+
2407
+ Raises
2408
+ ------
2409
+ InvalidParameterException
2410
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2411
+ PropertyServerException
2412
+ Raised by the server when an issue arises in processing a valid request.
2413
+ NotAuthorizedException
2414
+ The principle specified by the user_id does not have authorization for the requested action.
2415
+ """
2416
+ loop = asyncio.get_event_loop()
2417
+ response = loop.run_until_complete(
2418
+ self._async_get_terms_by_name(term, glossary_guid, status_filter, server_name, effective_time, for_lineage,
2419
+ for_duplicate_processing, start_from, page_size))
2420
+ return response
2421
+
2422
+ async def _async_get_terms_by_guid(self, term_guid: str, server_name: str = None) -> dict | str:
2423
+ """ Retrieve a term using its unique id. Async version.
2424
+ Parameters
2425
+ ----------
2426
+ term_guid : str
2427
+ The GUID of the glossary term to retrieve.
2428
+ server_name : str, optional
2429
+ The name of the server to connect to. If not provided, the default server name will be used.
2430
+
2431
+ Returns
2432
+ -------
2433
+ dict | str
2434
+ A dict detailing the glossary term represented by the GUID. If no term is found, the string
2435
+ "No term found" will be returned.
2436
+
2437
+ Raises
2438
+ ------
2439
+ InvalidParameterException
2440
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2441
+ PropertyServerException
2442
+ Raised by the server when an issue arises in processing a valid request.
2443
+ NotAuthorizedException
2444
+ The principle specified by the user_id does not have authorization for the requested action.
2445
+ """
2446
+ if server_name is None:
2447
+ server_name = self.server_name
2448
+
2449
+ validate_guid(term_guid)
2450
+
2451
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
2452
+ f"{term_guid}/retrieve")
2453
+
2454
+ response = await self._async_make_request("POST", url)
2455
+ return response.json().get("element", "No term found")
2456
+
2457
+ def get_terms_by_guid(self, term_guid: str, server_name: str = None) -> dict | str:
2458
+ """ Retrieve a term using its unique id. Async version.
2459
+ Parameters
2460
+ ----------
2461
+ term_guid : str
2462
+ The GUID of the glossary term to retrieve.
2463
+ server_name : str, optional
2464
+ The name of the server to connect to. If not provided, the default server name will be used.
2465
+
2466
+ Returns
2467
+ -------
2468
+ dict | str
2469
+ A dict detailing the glossary term represented by the GUID. If no term is found, the string
2470
+ "No term found" will be returned.
2471
+
2472
+ Raises
2473
+ ------
2474
+ InvalidParameterException
2475
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2476
+ PropertyServerException
2477
+ Raised by the server when an issue arises in processing a valid request.
2478
+ NotAuthorizedException
2479
+ The principle specified by the user_id does not have authorization for the requested action.
2480
+ """
2481
+
2482
+ loop = asyncio.get_event_loop()
2483
+ response = loop.run_until_complete(self._async_get_terms_by_guid(term_guid, server_name))
2484
+
2485
+ return response
2486
+
2487
+ async def _async_get_terms_versions(self, term_guid: str, server_name: str = None, start_from: int = 0,
2488
+ page_size=None) -> dict | str:
2489
+ """ Retrieve the versions of a glossary term. Async version.
2490
+ Parameters
2491
+ ----------
2492
+ term_guid : str
2493
+ The GUID of the glossary term to retrieve.
2494
+ server_name : str, optional
2495
+ The name of the server to connect to. If not provided, the default server name will be used.
2496
+ start_from : int, optional
2497
+ The index of the first term to retrieve. Default is 0.
2498
+ page_size : int, optional
2499
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
2500
+ Returns
2501
+ -------
2502
+ dict | str
2503
+ A dict detailing the glossary term represented by the GUID. If no term is found, the string
2504
+ "No term found" will be returned.
2505
+
2506
+ Raises
2507
+ ------
2508
+ InvalidParameterException
2509
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2510
+ PropertyServerException
2511
+ Raised by the server when an issue arises in processing a valid request.
2512
+ NotAuthorizedException
2513
+ The principle specified by the user_id does not have authorization for the requested action.
2514
+ """
2515
+ if server_name is None:
2516
+ server_name = self.server_name
2517
+
2518
+ if page_size is None:
2519
+ page_size = self.page_size
2520
+
2521
+ validate_guid(term_guid)
2522
+
2523
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
2524
+ f"{term_guid}/history?startFrom={start_from}&pageSize={page_size}")
2525
+
2526
+ response = await self._async_make_request("POST", url)
2527
+ return response.json().get("element", "No term found")
2528
+
2529
+ def get_terms_versions(self, term_guid: str, server_name: str = None, start_from: int = 0,
2530
+ page_size=None) -> dict | str:
2531
+ """ Retrieve the versions of a glossary term.
2532
+ Parameters
2533
+ ----------
2534
+ term_guid : str
2535
+ The GUID of the glossary term to retrieve.
2536
+ server_name : str, optional
2537
+ The name of the server to connect to. If not provided, the default server name will be used.
2538
+ start_from : int, optional
2539
+ The index of the first term to retrieve. Default is 0.
2540
+ page_size : int, optional
2541
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
2542
+ Returns
2543
+ -------
2544
+ dict | str
2545
+ A dict detailing the glossary term represented by the GUID. If no term is found, the string
2546
+ "No term found" will be returned.
2547
+
2548
+ Raises
2549
+ ------
2550
+ InvalidParameterException
2551
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2552
+ PropertyServerException
2553
+ Raised by the server when an issue arises in processing a valid request.
2554
+ NotAuthorizedException
2555
+ The principle specified by the user_id does not have authorization for the requested action.
2556
+ """
2557
+
2558
+ loop = asyncio.get_event_loop()
2559
+ response = loop.run_until_complete(
2560
+ self._async_get_terms_versions(term_guid, server_name, start_from, page_size))
2561
+
2562
+ return response
2563
+
2564
+ async def _async_get_term_revision_logs(self, term_guid: str, server_name: str = None, start_from: int = 0,
2565
+ page_size=None) -> dict | str:
2566
+ """ Retrieve the revision log history for a term. Async version.
2567
+ Parameters
2568
+ ----------
2569
+ term_guid : str
2570
+ The GUID of the glossary term to retrieve.
2571
+ server_name : str, optional
2572
+ The name of the server to connect to. If not provided, the default server name will be used.
2573
+ start_from : int, optional
2574
+ The index of the first term to retrieve. Default is 0.
2575
+ page_size : int, optional
2576
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
2577
+ Returns
2578
+ -------
2579
+ dict | str
2580
+ A dict detailing the glossary term revision log history. If no term is found, the string
2581
+ "No log found" will be returned.
2582
+
2583
+ Raises
2584
+ ------
2585
+ InvalidParameterException
2586
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2587
+ PropertyServerException
2588
+ Raised by the server when an issue arises in processing a valid request.
2589
+ NotAuthorizedException
2590
+ The principle specified by the user_id does not have authorization for the requested action.
2591
+ """
2592
+ if server_name is None:
2593
+ server_name = self.server_name
2594
+
2595
+ if page_size is None:
2596
+ page_size = self.page_size
2597
+
2598
+ validate_guid(term_guid)
2599
+
2600
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/elements/"
2601
+ f"{term_guid}/notes/retrieve?startFrom={start_from}&pageSize={page_size}")
2602
+
2603
+ response = await self._async_make_request("POST", url)
2604
+ return response.json().get("elementList", "No log found")
2605
+
2606
+ def get_term_revision_logs(self, term_guid: str, server_name: str = None, start_from: int = 0,
2607
+ page_size=None) -> dict | str:
2608
+ """ Retrieve the revision log history for a term.
2609
+ Parameters
2610
+ ----------
2611
+ term_guid : str
2612
+ The GUID of the glossary term to retrieve.
2613
+ server_name : str, optional
2614
+ The name of the server to connect to. If not provided, the default server name will be used.
2615
+ start_from : int, optional
2616
+ The index of the first term to retrieve. Default is 0.
2617
+ page_size : int, optional
2618
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
2619
+ Returns
2620
+ -------
2621
+ dict | str
2622
+ A dict detailing the glossary term revision log history. If no term is found, the string
2623
+ "No log found" will be returned.
2624
+
2625
+ Raises
2626
+ ------
2627
+ InvalidParameterException
2628
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2629
+ PropertyServerException
2630
+ Raised by the server when an issue arises in processing a valid request.
2631
+ NotAuthorizedException
2632
+ The principle specified by the user_id does not have authorization for the requested action.
2633
+ """
2634
+
2635
+ loop = asyncio.get_event_loop()
2636
+ response = loop.run_until_complete(
2637
+ self._async_get_term_revision_logs(term_guid, server_name, start_from, page_size))
2638
+
2639
+ return response
2640
+
2641
+ async def _async_get_term_revision_history(self, term_revision_log_guid: str, server_name: str = None,
2642
+ start_from: int = 0, page_size=None) -> dict | str:
2643
+ """ Retrieve the revision history for a glossary term. Async version.
2644
+
2645
+ Parameters
2646
+ ----------
2647
+ term_revision_log_guid : str
2648
+ The GUID of the glossary term revision log to retrieve.
2649
+ server_name : str, optional
2650
+ The name of the server to connect to. If not provided, the default server name will be used.
2651
+ start_from : int, optional
2652
+ The index of the first term to retrieve. Default is 0.
2653
+ page_size : int, optional
2654
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
2655
+ Returns
2656
+ -------
2657
+ dict | str
2658
+ A dict detailing the glossary term revision history.
2659
+
2660
+ Raises
2661
+ ------
2662
+ InvalidParameterException
2663
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2664
+ PropertyServerException
2665
+ Raised by the server when an issue arises in processing a valid request.
2666
+ NotAuthorizedException
2667
+ The principle specified by the user_id does not have authorization for the requested action.
2668
+
2669
+
2670
+ Notes
2671
+ -----
2672
+ This revision history is created automatically. The text is supplied on the update request.
2673
+ If no text is supplied, the value "None" is show.
2674
+ """
2675
+ if server_name is None:
2676
+ server_name = self.server_name
2677
+
2678
+ if page_size is None:
2679
+ page_size = self.page_size
2680
+
2681
+ validate_guid(term_revision_log_guid)
2682
+
2683
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/note-logs/"
2684
+ f"{term_revision_log_guid}/notes/retrieve?startFrom={start_from}&pageSize={page_size}")
2685
+
2686
+ response = await self._async_make_request("POST", url)
2687
+ return response.json().get("elementList", "No logs found")
2688
+
2689
+ def get_term_revision_history(self, term_revision_log_guid: str, server_name: str = None, start_from: int = 0,
2690
+ page_size=None) -> dict | str:
2691
+ """ Retrieve the revision history for a glossary term.
2692
+
2693
+ Parameters
2694
+ ----------
2695
+ term_revision_log_guid : str
2696
+ The GUID of the glossary term revision log to retrieve.
2697
+ server_name : str, optional
2698
+ The name of the server to connect to. If not provided, the default server name will be used.
2699
+ start_from : int, optional
2700
+ The index of the first term to retrieve. Default is 0.
2701
+ page_size : int, optional
2702
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
2703
+ Returns
2704
+ -------
2705
+ dict | str
2706
+ A dict detailing the glossary term revision history.
2707
+
2708
+ Raises
2709
+ ------
2710
+ InvalidParameterException
2711
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2712
+ PropertyServerException
2713
+ Raised by the server when an issue arises in processing a valid request.
2714
+ NotAuthorizedException
2715
+ The principle specified by the user_id does not have authorization for the requested action.
2716
+
2717
+
2718
+ Notes
2719
+ -----
2720
+ This revision history is created automatically. The text is supplied on the update request.
2721
+ If no text is supplied, the value "None" is show.
2722
+ """
2723
+
2724
+ loop = asyncio.get_event_loop()
2725
+ response = loop.run_until_complete(
2726
+ self._async_get_term_revision_history(term_revision_log_guid, server_name, start_from, page_size))
2727
+
2728
+ return response
2729
+
2730
+ async def _async_find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
2731
+ effective_time: str = None, starts_with: bool = False, ends_with: bool = False,
2732
+ ignore_case: bool = False, for_lineage: bool = False,
2733
+ for_duplicate_processing: bool = False, server_name: str = None,
2734
+ start_from: int = 0, page_size: int = None) -> list | str:
2735
+
2736
+ """ Retrieve the list of glossary term metadata elements that contain the search string.
2737
+
2738
+ Parameters
2739
+ ----------
2740
+ search_string: str
2741
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
2742
+ glossary_guid str
2743
+ Identifier of the glossary to search within. If None, then all glossaries are searched.
2744
+ status_filter: list, default = [], optional
2745
+ Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
2746
+ the results will not be filtered.
2747
+ effective_time: str, [default=None], optional
2748
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
2749
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2750
+ server_name : str, optional
2751
+ The name of the server to configure.
2752
+ If not provided, the server name associated with the instance is used.
2753
+ starts_with : bool, [default=False], optional
2754
+ Starts with the supplied string.
2755
+ ends_with : bool, [default=False], optional
2756
+ Ends with the supplied string
2757
+ ignore_case : bool, [default=False], optional
2758
+ Ignore case when searching
2759
+ for_lineage : bool, [default=False], optional
2760
+
2761
+ for_duplicate_processing : bool, [default=False], optional
2762
+
2763
+ start_from: str, [default=0], optional
2764
+ Page of results to start from
2765
+ page_size : int, optional
2766
+ Number of elements to return per page - if None, then default for class will be used.
2767
+
2768
+ Returns
2769
+ -------
2770
+ List | str
2771
+
2772
+ A list of term definitions
2773
+
2774
+ Raises
2775
+ ------
2776
+ InvalidParameterException
2777
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2778
+ PropertyServerException
2779
+ Raised by the server when an issue arises in processing a valid request
2780
+ NotAuthorizedException
2781
+ The principle specified by the user_id does not have authorization for the requested action
2782
+
2783
+ Notes
2784
+ -----
2785
+ The search string is located in the request body and is interpreted as a plain string.
2786
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
2787
+ The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
2788
+ """
2789
+ if server_name is None:
2790
+ server_name = self.server_name
2791
+ if page_size is None:
2792
+ page_size = self.page_size
2793
+ if effective_time is None:
2794
+ effective_time = datetime.now().isoformat()
2795
+ starts_with_s = str(starts_with).lower()
2796
+ ends_with_s = str(ends_with).lower()
2797
+ ignore_case_s = str(ignore_case).lower()
2798
+ for_lineage_s = str(for_lineage).lower()
2799
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
2800
+ if search_string == '*':
2801
+ search_string = None
2802
+
2803
+ # validate_search_string(search_string)
2804
+
2805
+ body = {"class": "GlossarySearchStringRequestBody", "glossaryGUID": glossary_guid,
2806
+ "searchString": search_string, "effectiveTime": effective_time, "limitResultsByStatus": status_filter}
2807
+ # body = body_slimmer(body)
2808
+
2809
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
2810
+ f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
2811
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
2812
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
2813
+
2814
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
2815
+
2816
+ response = await self._async_make_request("POST", url, body)
2817
+ return response.json().get("elementList", "No terms found") # return response.text
2818
+
2819
+ def find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
2820
+ effective_time: str = None, starts_with: bool = False, ends_with: bool = False,
2821
+ ignore_case: bool = False, for_lineage: bool = False,
2822
+ for_duplicate_processing: bool = False, server_name: str = None, start_from: int = 0,
2823
+ page_size: int = None) -> list | str:
2824
+ """ Retrieve the list of glossary term metadata elements that contain the search string.
2825
+
2826
+ Parameters
2827
+ ----------
2828
+ search_string: str
2829
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
2830
+ glossary_guid str
2831
+ Identifier of the glossary to search within. If None, then all glossaries are searched.
2832
+ status_filter: list, default = [], optional
2833
+ Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
2834
+ the results will not be filtered.
2835
+ effective_time: str, [default=None], optional
2836
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
2837
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2838
+ server_name : str, optional
2839
+ The name of the server to configure.
2840
+ If not provided, the server name associated with the instance is used.
2841
+ starts_with : bool, [default=False], optional
2842
+ Starts with the supplied string.
2843
+ ends_with : bool, [default=False], optional
2844
+ Ends with the supplied string
2845
+ ignore_case : bool, [default=False], optional
2846
+ Ignore case when searching
2847
+ for_lineage : bool, [default=False], optional
2848
+
2849
+ for_duplicate_processing : bool, [default=False], optional
2850
+
2851
+ start_from: str, [default=0], optional
2852
+ Page of results to start from
2853
+ page_size : int, optional
2854
+ Number of elements to return per page - if None, then default for class will be used.
2855
+
2856
+ Returns
2857
+ -------
2858
+ List | str
2859
+
2860
+ A list of term definitions
2861
+
2862
+ Raises
2863
+ ------
2864
+ InvalidParameterException
2865
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2866
+ PropertyServerException
2867
+ Raised by the server when an issue arises in processing a valid request
2868
+ NotAuthorizedException
2869
+ The principle specified by the user_id does not have authorization for the requested action
2870
+
2871
+ Notes
2872
+ -----
2873
+ The search string is located in the request body and is interpreted as a plain string.
2874
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
2875
+ The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
2876
+ """
2877
+
2878
+ loop = asyncio.get_event_loop()
2879
+ response = loop.run_until_complete(
2880
+ self._async_find_glossary_terms(search_string, glossary_guid, status_filter, effective_time, starts_with,
2881
+ ends_with, ignore_case, for_lineage, for_duplicate_processing, server_name,
2882
+ start_from, page_size))
2883
+
2884
+ return response
2885
+
2886
+ #
2887
+ # Feedback
2888
+ #
2889
+ async def _async_get_comment(self, commemtGUID: str, effective_time: str, server_name: str = None,
2890
+ for_lineage: bool = False, for_duplicate_processing: bool = False) -> dict | list:
2891
+ """ Retrieve the comment specified by the comment GUID """
2892
+ if server_name is None:
2893
+ server_name = self.server_name
2894
+
2895
+ validate_guid(commemtGUID)
2896
+
2897
+ if effective_time is None:
2898
+ effective_time = datetime.now().isoformat()
2899
+
2900
+ for_lineage_s = str(for_lineage).lower()
2901
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
2902
+
2903
+ body = {"effective_time": effective_time}
2904
+
2905
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
2906
+ f"{commemtGUID}?forLineage={for_lineage_s}&"
2907
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
2908
+
2909
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
2910
+
2911
+ response = await self._async_make_request("POST", url, body)
2912
+ return response.json()
2913
+
2914
+ async def _async_add_comment_reply(self, commentGUID: str, is_public: bool, comment_type: str, comment_text: str,
2915
+ server_name: str = None, for_lineage: bool = False,
2916
+ for_duplicate_processing: bool = False) -> str:
2917
+ """ Reply to a comment """
2918
+
2919
+ if server_name is None:
2920
+ server_name = self.server_name
2921
+
2922
+ validate_guid(commentGUID)
2923
+ validate_name(comment_type)
2924
+
2925
+ is_public_s = str(is_public).lower()
2926
+ for_lineage_s = str(for_lineage).lower()
2927
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
2928
+
2929
+ body = {"class": "CommentRequestBody", "commentType": comment_type, "commentText": comment_text,
2930
+ "isPublic": is_public}
2931
+
2932
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
2933
+ f"{commentGUID}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
2934
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
2935
+
2936
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
2937
+
2938
+ response = await self._async_make_request("POST", url, body)
2939
+ return response
2940
+
2941
+ async def _async_update_comment(self, commentGUID: str, is_public: bool, comment_type: str, comment_text: str,
2942
+ server_name: str = None, is_merge_update: bool = False, for_lineage: bool = False,
2943
+ for_duplicate_processing: bool = False) -> str:
2944
+ """ Update the specified comment"""
2945
+ if server_name is None:
2946
+ server_name = self.server_name
2947
+
2948
+ validate_guid(commentGUID)
2949
+ validate_name(comment_type)
2950
+
2951
+ is_public_s = str(is_public).lower()
2952
+ for_lineage_s = str(for_lineage).lower()
2953
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
2954
+
2955
+ body = {"class": "CommentRequestBody", "commentType": comment_type, "commentText": comment_text,
2956
+ "isPublic": is_public}
2957
+
2958
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
2959
+ f"{commentGUID}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
2960
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
2961
+
2962
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
2963
+
2964
+ response = await self._async_make_request("POST", url, body)
2965
+ return response
2966
+
2967
+ async def _async_find_comment(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
2968
+ effective_time: str = None, starts_with: bool = False, ends_with: bool = False,
2969
+ ignore_case: bool = False, for_lineage: bool = False,
2970
+ for_duplicate_processing: bool = False, server_name: str = None, start_from: int = 0,
2971
+ page_size: int = None):
2972
+ """Find comments by search string"""
2973
+ if server_name is None:
2974
+ server_name = self.server_name
2975
+ if page_size is None:
2976
+ page_size = self.page_size
2977
+ if effective_time is None:
2978
+ effective_time = datetime.now().isoformat()
2979
+ starts_with_s = str(starts_with).lower()
2980
+ ends_with_s = str(ends_with).lower()
2981
+ ignore_case_s = str(ignore_case).lower()
2982
+ for_lineage_s = str(for_lineage).lower()
2983
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
2984
+ if search_string == '*':
2985
+ search_string = None
2986
+
2987
+ # validate_search_string(search_string)
2988
+
2989
+ body = {"class": "GlossarySearchStringRequestBody", "glossaryGUID": glossary_guid,
2990
+ "searchString": search_string, "effectiveTime": effective_time, "limitResultsByStatus": status_filter}
2991
+ # body = body_slimmer(body)
2992
+
2993
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
2994
+ f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
2995
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
2996
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
2997
+
2998
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
2999
+
3000
+ response = await self._async_make_request("POST", url, body)
3001
+ return response.json().get("elementList", "No terms found")