pyegeria 0.3.8__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. pyegeria/Xfeedback_manager_omvs.py +238 -0
  2. pyegeria/Xloaded_resources_omvs.py +91 -0
  3. pyegeria/__init__.py +15 -12
  4. pyegeria/_client.py +4 -6
  5. pyegeria/{gov_engine.py → _deprecated_gov_engine.py} +2 -59
  6. pyegeria/_exceptions.py +5 -6
  7. pyegeria/_globals.py +3 -1
  8. pyegeria/asset_catalog_omvs.py +672 -0
  9. pyegeria/automated_curation_omvs.py +627 -359
  10. pyegeria/collection_manager_omvs.py +187 -248
  11. pyegeria/core_guids.py +128 -0
  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/glossary_manager_omvs.py +3002 -0
  16. pyegeria/my_profile_omvs.py +2 -7
  17. pyegeria/platform_services.py +0 -3
  18. pyegeria/project_manager_omvs.py +9 -15
  19. pyegeria/registered_info.py +12 -52
  20. pyegeria/runtime_manager_omvs.py +967 -0
  21. pyegeria/server_operations.py +1 -5
  22. pyegeria/valid_metadata_omvs.py +204 -43
  23. pyegeria-0.4.0.data/scripts/Create_Collection_Sample.py +292 -0
  24. pyegeria-0.4.0.data/scripts/Create_Sustainability_Collection_Sample.py +115 -0
  25. pyegeria-0.4.0.data/scripts/get_guid_info.py +86 -0
  26. pyegeria-0.3.8.data/scripts/view_my_profile.py → pyegeria-0.4.0.data/scripts/get_my_profile.py +8 -34
  27. {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/get_tech_details.py +1 -37
  28. pyegeria-0.4.0.data/scripts/get_tech_type_elements.py +137 -0
  29. pyegeria-0.4.0.data/scripts/get_tech_type_template.py +137 -0
  30. {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/list_asset_types.py +3 -25
  31. pyegeria-0.4.0.data/scripts/list_assets.py +138 -0
  32. pyegeria-0.3.8.data/scripts/project_list_viewer.py → pyegeria-0.4.0.data/scripts/list_projects.py +13 -27
  33. pyegeria-0.4.0.data/scripts/list_registered_services.py +135 -0
  34. pyegeria-0.3.8.data/scripts/get_relationship_types.py → pyegeria-0.4.0.data/scripts/list_relationship_types.py +25 -43
  35. pyegeria-0.4.0.data/scripts/list_tech_templates.py +134 -0
  36. pyegeria-0.3.8.data/scripts/find_todos.py → pyegeria-0.4.0.data/scripts/list_todos.py +11 -39
  37. pyegeria-0.4.0.data/scripts/list_valid_metadata_values.py +144 -0
  38. pyegeria-0.4.0.data/scripts/view_asset_graph.py +236 -0
  39. pyegeria-0.3.8.data/scripts/multi-server_status.py → pyegeria-0.4.0.data/scripts/view_coco_status.py +17 -39
  40. pyegeria-0.3.8.data/scripts/collection_viewer.py → pyegeria-0.4.0.data/scripts/view_collection.py +12 -31
  41. pyegeria-0.3.8.data/scripts/engine_action_status.py → pyegeria-0.4.0.data/scripts/view_eng_action_status.py +17 -31
  42. pyegeria-0.3.8.data/scripts/glossary_view.py → pyegeria-0.4.0.data/scripts/view_glossary.py +2 -2
  43. pyegeria-0.3.8.data/scripts/gov_engine_status.py → pyegeria-0.4.0.data/scripts/view_gov_eng_status.py +0 -1
  44. pyegeria-0.3.8.data/scripts/integration_daemon_status.py → pyegeria-0.4.0.data/scripts/view_integ_daemon_status.py +30 -42
  45. pyegeria-0.3.8.data/scripts/my_todos.py → pyegeria-0.4.0.data/scripts/view_my_todos.py +1 -1
  46. pyegeria-0.3.8.data/scripts/open_todos.py → pyegeria-0.4.0.data/scripts/view_open_todos.py +3 -24
  47. pyegeria-0.4.0.data/scripts/view_platform_status.py +123 -0
  48. pyegeria-0.3.8.data/scripts/server_status.py → pyegeria-0.4.0.data/scripts/view_server_status.py +1 -20
  49. {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/METADATA +5 -4
  50. pyegeria-0.4.0.dist-info/RECORD +58 -0
  51. {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/WHEEL +1 -1
  52. pyegeria/glossary_omvs.py +0 -789
  53. pyegeria/loaded_resources_omvs.py +0 -159
  54. pyegeria-0.3.8.dist-info/RECORD +0 -42
  55. /pyegeria/{governance_author.py → action_author_omvs.py} +0 -0
  56. /pyegeria-0.3.8.data/scripts/get_tech_types.py → /pyegeria-0.4.0.data/scripts/list_tech_types.py +0 -0
  57. /pyegeria-0.3.8.data/scripts/server_status_widget.py → /pyegeria-0.4.0.data/scripts/view_server_list.py +0 -0
  58. {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/LICENSE +0 -0
  59. {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,2208 @@
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_browser 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
11
+
12
+ # import json
13
+ from pyegeria._client import Client
14
+ from pyegeria._validators import (validate_name, validate_guid, validate_search_string, )
15
+ from pyegeria.utils import body_slimmer
16
+
17
+
18
+ class GlossaryBrowser(Client):
19
+ """
20
+ GlossaryBrowser is a class that extends the Client class. It provides methods to search and retrieve glossaries,
21
+ terms and categories.
22
+
23
+ Attributes:
24
+
25
+ server_name: str
26
+ The name of the View Server to connect to.
27
+ platform_url : str
28
+ URL of the server platform to connect to
29
+ user_id : str
30
+ The identity of the user calling the method - this sets a default optionally used by the methods
31
+ when the user doesn't pass the user_id on a method call.
32
+ user_pwd: str
33
+ The password associated with the user_id. Defaults to None
34
+
35
+ """
36
+
37
+ def __init__(self, server_name: str, platform_url: str, token: str = None, user_id: str = None,
38
+ user_pwd: str = None, sync_mode: bool = True):
39
+ self.admin_command_root: str
40
+ Client.__init__(self, server_name, platform_url, user_id=user_id, token=token, async_mode=sync_mode)
41
+
42
+ #
43
+ # Get Valid Values for Enumerations
44
+ #
45
+
46
+ async def _async_get_glossary_term_statuses(self, server_name: str = None) -> [str]:
47
+ """ Return the list of glossary term status enum values. Async version.
48
+
49
+ Parameters
50
+ ----------
51
+ server_name : str, optional
52
+ The name of the server to query. If not provided, the server name associated with the instance is used.
53
+
54
+ Returns
55
+ -------
56
+ List[str]
57
+ A list of glossary term statuses retrieved from the server.
58
+
59
+ """
60
+ if server_name is None:
61
+ server_name = self.server_name
62
+
63
+ url = (f"{self.platform_url}/servers/{server_name}"
64
+ f"/api/open-metadata/glossary-browser/glossaries/terms/status-list")
65
+
66
+ response = await self._async_make_request("GET", url)
67
+ return response.json().get("statuses", [])
68
+
69
+ def get_glossary_term_statuses(self, server_name: str = None) -> [str]:
70
+ """ Return the list of glossary term status enum values.
71
+
72
+ Parameters
73
+ ----------
74
+ server_name : str, optional
75
+ The name of the server to query. If not provided, the server name associated with the instance is used.
76
+
77
+ Returns
78
+ -------
79
+ list of str
80
+ A list of glossary term statuses. Each status is represented as a string.
81
+
82
+ """
83
+ loop = asyncio.get_event_loop()
84
+ response = loop.run_until_complete(self._async_get_glossary_term_statuses(server_name))
85
+ return response
86
+
87
+ async def _async_get_glossary_term_rel_statuses(self, server_name: str = None) -> [str]:
88
+ """ Return the list of glossary term relationship status enum values. These values are stored in a
89
+ term-to-term, or term-to-category, relationship and are used to indicate how much the relationship should be
90
+ trusted. Async version.
91
+
92
+ Parameters
93
+ ----------
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
+ List[str]
100
+ A list of glossary term statuses retrieved from the server.
101
+
102
+ """
103
+ if server_name is None:
104
+ server_name = self.server_name
105
+
106
+ url = (f"{self.platform_url}/servers/{server_name}"
107
+ f"/api/open-metadata/glossary-browser/glossaries/terms/relationships/status-list")
108
+
109
+ response = await self._async_make_request("GET", url)
110
+ return response.json().get("statuses", [])
111
+
112
+ def get_glossary_term_rel_statuses(self, server_name: str = None) -> [str]:
113
+ """ Return the list of glossary term relationship status enum values. These values are stored in a
114
+ term-to-term, or term-to-category, relationship and are used to indicate how much the relationship should be
115
+ trusted.
116
+
117
+ Parameters
118
+ ----------
119
+ server_name : str, optional
120
+ The name of the server to query . If not provided, the server name associated with the instance is used.
121
+
122
+ Returns
123
+ -------
124
+ list of str
125
+ A list of glossary term statuses. Each status is represented as a string.
126
+
127
+ """
128
+ loop = asyncio.get_event_loop()
129
+ response = loop.run_until_complete(self._async_get_glossary_term_rel_statuses(server_name))
130
+ return response
131
+
132
+ async def _async_get_glossary_term_activity_types(self, server_name: str = None) -> [str]:
133
+ """ Return the list of glossary term activity type enum values. Async version.
134
+
135
+ Parameters
136
+ ----------
137
+ server_name : str, optional
138
+ The name of the server to query. If not provided, the server name associated with the instance is used.
139
+
140
+ Returns
141
+ -------
142
+ List[str]
143
+ A list of glossary term statuses retrieved from the server.
144
+
145
+ """
146
+ if server_name is None:
147
+ server_name = self.server_name
148
+
149
+ url = (f"{self.platform_url}/servers/{server_name}"
150
+ f"/api/open-metadata/glossary-browser/glossaries/terms/activity-types")
151
+
152
+ response = await self._async_make_request("GET", url)
153
+ return response.json().get("types", [])
154
+
155
+ def get_glossary_term_activity_types(self, server_name: str = None) -> [str]:
156
+ """ Return the list of glossary term activity type enum values.
157
+
158
+ Parameters
159
+ ----------
160
+ server_name : str, optional
161
+ The name of the server to query . If not provided, the server name associated with the instance is used.
162
+
163
+ Returns
164
+ -------
165
+ list of str
166
+ A list of glossary term statuses. Each status is represented as a string.
167
+
168
+ """
169
+ loop = asyncio.get_event_loop()
170
+ response = loop.run_until_complete(self._async_get_glossary_term_statuses(server_name))
171
+ return response
172
+
173
+ #
174
+ # Glossaries
175
+ #
176
+
177
+ async def _async_find_glossaries(self, search_string: str, effective_time: str = None, starts_with: bool = False,
178
+ ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
179
+ for_duplicate_processing: bool = False, type_name: str = None,
180
+ server_name: str = None, start_from: int = 0, page_size: int = None) -> list | str:
181
+ """ Retrieve the list of glossary metadata elements that contain the search string. Async version.
182
+ The search string is located in the request body and is interpreted as a plain string.
183
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
184
+
185
+ Parameters
186
+ ----------
187
+ search_string: str,
188
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
189
+
190
+ effective_time: str, [default=None], optional
191
+ Effective time of the query. If not specified will default to any time. Time format is
192
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
193
+ server_name : str, optional
194
+ The name of the server to configure.
195
+ If not provided, the server name associated with the instance is used.
196
+ starts_with : bool, [default=False], optional
197
+ Starts with the supplied string.
198
+ ends_with : bool, [default=False], optional
199
+ Ends with the supplied string
200
+ ignore_case : bool, [default=False], optional
201
+ Ignore case when searching
202
+ for_lineage : bool, [default=False], optional
203
+
204
+ for_duplicate_processing : bool, [default=False], optional
205
+ type_name: str, [default=None], optional
206
+ An optional parameter indicating the subtype of the glossary to filter by.
207
+ Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
208
+ start_from: int, [default=0], optional
209
+ When multiple pages of results are available, the page number to start from.
210
+ page_size: int, [default=None]
211
+ The number of items to return in a single page. If not specified, the default will be taken from
212
+ the class instance.
213
+ Returns
214
+ -------
215
+ List | str
216
+
217
+ A list of glossary definitions active in the server.
218
+
219
+ Raises
220
+ ------
221
+
222
+ InvalidParameterException
223
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
224
+ PropertyServerException
225
+ Raised by the server when an issue arises in processing a valid request
226
+ NotAuthorizedException
227
+ The principle specified by the user_id does not have authorization for the requested action
228
+
229
+ """
230
+ if server_name is None:
231
+ server_name = self.server_name
232
+ if page_size is None:
233
+ page_size = self.page_size
234
+ starts_with_s = str(starts_with).lower()
235
+ ends_with_s = str(ends_with).lower()
236
+ ignore_case_s = str(ignore_case).lower()
237
+ for_lineage_s = str(for_lineage).lower()
238
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
239
+
240
+ validate_search_string(search_string)
241
+
242
+ if search_string == '*':
243
+ search_string = None
244
+
245
+ body = {"class": "SearchStringRequestBody", "searchString": search_string, "effectiveTime": effective_time,
246
+ "typeName": type_name}
247
+ body = body_slimmer(body)
248
+ # print(f"\n\nBody is: \n{body}")
249
+
250
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
251
+ f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
252
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
253
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
254
+
255
+ response = await self._async_make_request("POST", url, body)
256
+ return response.json().get("elementList", "No Glossaries found")
257
+
258
+ def find_glossaries(self, search_string: str, effective_time: str = None, starts_with: bool = False,
259
+ ends_with: bool = False, ignore_case: bool = False, for_lineage: bool = False,
260
+ for_duplicate_processing: bool = False, type_name: str = None, server_name: str = None,
261
+ start_from: int = 0, page_size: int = None) -> list | str:
262
+ """ Retrieve the list of glossary metadata elements that contain the search string.
263
+ The search string is located in the request body and is interpreted as a plain string.
264
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
265
+
266
+ Parameters
267
+ ----------
268
+ search_string: str,
269
+ Search string to use to find matching glossaries. If the search string is '*',
270
+ then all glossaries returned.
271
+
272
+ effective_time: str, [default=None], optional
273
+ Effective time of the query. If not specified will default to any time. Time format is
274
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
275
+ server_name : str, optional
276
+ The name of the server to configure.
277
+ If not provided, the server name associated with the instance is used.
278
+ starts_with : bool, [default=False], optional
279
+ Starts with the supplied string.
280
+ ends_with : bool, [default=False], optional
281
+ Ends with the supplied string
282
+ ignore_case : bool, [default=False], optional
283
+ Ignore case when searching
284
+ for_lineage : bool, [default=False], optional
285
+ Indicates the search is for lineage.
286
+ for_duplicate_processing : bool, [default=False], optional
287
+ type_name: str, [default=None], optional
288
+ An optional parameter indicating the subtype of the glossary to filter by.
289
+ Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
290
+ start_from: int, [default=0], optional
291
+ When multiple pages of results are available, the page number to start from.
292
+ page_size: int, [default=None]
293
+ The number of items to return in a single page. If not specified, the default will be taken from
294
+ the class instance.
295
+ Returns
296
+ -------
297
+ List | str
298
+
299
+ A list of glossary definitions active in the server.
300
+
301
+ Raises
302
+ ------
303
+
304
+ InvalidParameterException
305
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
306
+ PropertyServerException
307
+ Raised by the server when an issue arises in processing a valid request
308
+ NotAuthorizedException
309
+ The principle specified by the user_id does not have authorization for the requested action
310
+
311
+ """
312
+ loop = asyncio.get_event_loop()
313
+ response = loop.run_until_complete(
314
+ self._async_find_glossaries(search_string, effective_time, starts_with, ends_with, ignore_case, for_lineage,
315
+ for_duplicate_processing, type_name, server_name, start_from, page_size))
316
+
317
+ return response
318
+
319
+ async def _async_get_glossary_by_guid(self, glossary_guid: str, server_name: str = None,
320
+ effective_time: str = None) -> dict:
321
+ """ Retrieves information about a glossary
322
+ Parameters
323
+ ----------
324
+ glossary_guid : str
325
+ Unique idetifier for the glossary
326
+ server_name : str, optional
327
+ The name of the server to get the configured access services for.
328
+ If not provided, the server name associated with the instance is used.
329
+ effective_time: str, optional
330
+ Effective time of the query. If not specified will default to any time. Time format is
331
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
332
+ Returns
333
+ -------
334
+ dict
335
+ The glossary definition associated with the glossary_guid
336
+
337
+ Raises
338
+ ------
339
+ InvalidParameterException
340
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
341
+ PropertyServerException
342
+ Raised by the server when an issue arises in processing a valid request.
343
+ NotAuthorizedException
344
+ The principle specified by the user_id does not have authorization for the requested action.
345
+ Notes
346
+ -----
347
+ """
348
+ if server_name is None:
349
+ server_name = self.server_name
350
+ validate_guid(glossary_guid)
351
+
352
+ body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
353
+
354
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
355
+ f"{glossary_guid}/retrieve")
356
+ print(url)
357
+ response = await self._async_make_request("POST", url, payload=body)
358
+ return response.json()
359
+
360
+ def get_glossary_by_guid(self, glossary_guid: str, server_name: str = None) -> dict:
361
+ """ Retrieves information about a glossary
362
+ Parameters
363
+ ----------
364
+ glossary_guid : str
365
+ Unique idetifier for the glossary
366
+ server_name : str, optional
367
+ The name of the server to get the configured access services for.
368
+ If not provided, the server name associated with the instance is used.
369
+ Returns
370
+ -------
371
+ dict
372
+ The glossary definition associated with the glossary_guid
373
+
374
+ Raises
375
+ ------
376
+ InvalidParameterException
377
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
378
+ PropertyServerException
379
+ Raised by the server when an issue arises in processing a valid request.
380
+ NotAuthorizedException
381
+ The principle specified by the user_id does not have authorization for the requested action.
382
+ Notes
383
+ -----
384
+ """
385
+ loop = asyncio.get_event_loop()
386
+ response = loop.run_until_complete(self._async_get_glossary_by_guid(glossary_guid, server_name))
387
+ return response
388
+
389
+ async def _async_get_glossaries_by_name(self, glossary_name: str, effective_time: str = None,
390
+ server_name: str = None, start_from: int = 0,
391
+ page_size: int = None) -> dict | str:
392
+ """ Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
393
+ There are no wildcards supported on this request.
394
+
395
+ Parameters
396
+ ----------
397
+ glossary_name: str,
398
+ Name of the glossary to be retrieved
399
+ effective_time: datetime, [default=None], optional
400
+ Effective time of the query. If not specified will default to any effective time. Time format is
401
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
402
+ server_name : str, optional
403
+ The name of the server to configure.
404
+ If not provided, the server name associated with the instance is used.
405
+ start_from: int, [default=0], optional
406
+ When multiple pages of results are available, the page number to start from.
407
+ page_size: int, [default=None]
408
+ The number of items to return in a single page. If not specified, the default will be taken from
409
+ the class instance.
410
+
411
+ Returns
412
+ -------
413
+ None
414
+
415
+ Raises
416
+ ------
417
+
418
+ InvalidParameterException
419
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
420
+ PropertyServerException
421
+ Raised by the server when an issue arises in processing a valid request
422
+ NotAuthorizedException
423
+ The principle specified by the user_id does not have authorization for the requested action
424
+ ConfigurationErrorException
425
+ Raised when configuration parameters passed on earlier calls turn out to be
426
+ invalid or make the new call invalid.
427
+ """
428
+ if server_name is None:
429
+ server_name = self.server_name
430
+ if page_size is None:
431
+ page_size = self.page_size
432
+ validate_name(glossary_name)
433
+
434
+ if effective_time is None:
435
+ body = {"name": glossary_name}
436
+ else:
437
+ body = {"name": glossary_name, "effectiveTime": effective_time}
438
+
439
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
440
+ f"by-name?startFrom={start_from}&pageSize={page_size}")
441
+
442
+ response = await self._async_make_request("POST", url, body)
443
+ return response.json()
444
+
445
+ def get_glossaries_by_name(self, glossary_name: str, effective_time: str = None, server_name: str = None,
446
+ start_from: int = 0, page_size: int = None) -> dict | str:
447
+ """ Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
448
+ There are no wildcards supported on this request.
449
+
450
+ Parameters
451
+ ----------
452
+ glossary_name: str,
453
+ Name of the glossary to be retrieved
454
+ effective_time: datetime, [default=None], optional
455
+ Effective time of the query. If not specified will default to any effective time.
456
+ server_name : str, optional
457
+ The name of the server to configure.
458
+ If not provided, the server name associated with the instance is used.
459
+ start_from: int, [default=0], optional
460
+ When multiple pages of results are available, the page number to start from.
461
+ page_size: int, [default=None]
462
+ The number of items to return in a single page. If not specified, the default will be taken from
463
+ he class instance.
464
+
465
+ Returns
466
+ -------
467
+ None
468
+
469
+ Raises
470
+ ------
471
+ InvalidParameterException
472
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
473
+ PropertyServerException
474
+ Raised by the server when an issue arises in processing a valid request
475
+ NotAuthorizedException
476
+ The principle specified by the user_id does not have authorization for the requested action
477
+ ConfigurationErrorException
478
+ Raised when configuration parameters passed on earlier calls turn out to be
479
+ invalid or make the new call invalid.
480
+ """
481
+ loop = asyncio.get_event_loop()
482
+ response = loop.run_until_complete(
483
+ self._async_get_glossaries_by_name(glossary_name, effective_time, server_name, start_from, page_size))
484
+ return response
485
+
486
+ #
487
+ # Glossary Categories
488
+ #
489
+
490
+ async def _async_get_glossary_for_category(self, glossary_category_guid: str, effective_time: str = None,
491
+ server_name: str = None) -> dict | str:
492
+ """ Retrieve the glossary metadata element for the requested category. The optional request body allows you to
493
+ specify that the glossary element should only be returned if it was effective at a particular time.
494
+
495
+ Parameters
496
+ ----------
497
+ glossary_category_guid: str,
498
+ Unique identifier for the glossary category.
499
+ effective_time: datetime, [default=None], optional
500
+ Effective time of the query. If not specified will default to any effective time. Time format is
501
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
502
+ server_name : str, optional
503
+ The name of the server to configure.
504
+ If not provided, the server name associated with the instance is used.
505
+
506
+ Returns
507
+ -------
508
+ A dict structure with the glossary metadata element for the requested category.
509
+
510
+ Raises
511
+ ------
512
+
513
+ InvalidParameterException
514
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
515
+ PropertyServerException
516
+ Raised by the server when an issue arises in processing a valid request
517
+ NotAuthorizedException
518
+ The principle specified by the user_id does not have authorization for the requested action
519
+ ConfigurationErrorException
520
+ Raised when configuration parameters passed on earlier calls turn out to be
521
+ invalid or make the new call invalid.
522
+ """
523
+ if server_name is None:
524
+ server_name = self.server_name
525
+
526
+ body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
527
+
528
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
529
+ f"for-category/{glossary_category_guid}/retrieve")
530
+
531
+ response = await self._async_make_request("POST", url, body)
532
+ return response.json()
533
+
534
+ def get_glossary_for_category(self, glossary_category_guid: str, effective_time: str = None,
535
+ server_name: str = None) -> dict | str:
536
+ """ Retrieve the glossary metadata element for the requested category. The optional request body allows you to
537
+ specify that the glossary element should only be returned if it was effective at a particular time.
538
+
539
+ Parameters
540
+ ----------
541
+ glossary_category_guid: str,
542
+ Unique identifier for the glossary category.
543
+ effective_time: datetime, [default=None], optional
544
+ Effective time of the query. If not specified will default to any effective time. Time format is
545
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
546
+ server_name : str, optional
547
+ The name of the server to configure.
548
+ If not provided, the server name associated with the instance is used.
549
+
550
+ Returns
551
+ -------
552
+ A dict structure with the glossary metadata element for the requested category.
553
+
554
+ Raises
555
+ ------
556
+
557
+ InvalidParameterException
558
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
559
+ PropertyServerException
560
+ Raised by the server when an issue arises in processing a valid request
561
+ NotAuthorizedException
562
+ The principle specified by the user_id does not have authorization for the requested action
563
+ ConfigurationErrorException
564
+ Raised when configuration parameters passed on earlier calls turn out to be
565
+ invalid or make the new call invalid.
566
+ """
567
+ loop = asyncio.get_event_loop()
568
+ response = loop.run_until_complete(
569
+ self._async_get_glossary_for_category(glossary_category_guid, effective_time, server_name))
570
+ return response
571
+
572
+ async def _async_find_glossary_categories(self, search_string: str, effective_time: str = None,
573
+ starts_with: bool = False, ends_with: bool = False,
574
+ ignore_case: bool = False, server_name: str = None, start_from: int = 0,
575
+ page_size: int = None) -> list | str:
576
+ """ Retrieve the list of glossary category metadata elements that contain the search string.
577
+ The search string is located in the request body and is interpreted as a plain string.
578
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
579
+ Async version.
580
+
581
+ Parameters
582
+ ----------
583
+ search_string: str,
584
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
585
+
586
+ effective_time: str, [default=None], optional
587
+ Effective time of the query. If not specified will default to any time. Time format is
588
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
589
+ server_name : str, optional
590
+ The name of the server to configure.
591
+ If not provided, the server name associated with the instance is used.
592
+ starts_with : bool, [default=False], optional
593
+ Starts with the supplied string.
594
+ ends_with : bool, [default=False], optional
595
+ Ends with the supplied string
596
+ ignore_case : bool, [default=False], optional
597
+ Ignore case when searching
598
+ start_from: int, [default=0], optional
599
+ When multiple pages of results are available, the page number to start from.
600
+ page_size: int, [default=None]
601
+ The number of items to return in a single page. If not specified, the default will be taken from
602
+ the class instance.
603
+ Returns
604
+ -------
605
+ List | str
606
+
607
+ A list of glossary definitions active in the server.
608
+
609
+ Raises
610
+ ------
611
+
612
+ InvalidParameterException
613
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
614
+ PropertyServerException
615
+ Raised by the server when an issue arises in processing a valid request
616
+ NotAuthorizedException
617
+ The principle specified by the user_id does not have authorization for the requested action
618
+
619
+ """
620
+ if server_name is None:
621
+ server_name = self.server_name
622
+ if page_size is None:
623
+ page_size = self.page_size
624
+ starts_with_s = str(starts_with).lower()
625
+ ends_with_s = str(ends_with).lower()
626
+ ignore_case_s = str(ignore_case).lower()
627
+
628
+ validate_search_string(search_string)
629
+
630
+ if search_string == '*':
631
+ search_string = None
632
+
633
+ body = {"class": "SearchStringRequestBody", "searchString": search_string, "effectiveTime": effective_time}
634
+ body = body_slimmer(body)
635
+
636
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
637
+ f"categories/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
638
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}")
639
+
640
+ response = await self._async_make_request("POST", url, body)
641
+ return response.json().get("elementList", "No Categories found")
642
+
643
+ def find_glossary_categories(self, search_string: str, effective_time: str = None, starts_with: bool = False,
644
+ ends_with: bool = False, ignore_case: bool = False, server_name: str = None,
645
+ start_from: int = 0, page_size: int = None) -> list | str:
646
+ """ Retrieve the list of glossary category metadata elements that contain the search string.
647
+ The search string is located in the request body and is interpreted as a plain string.
648
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
649
+
650
+ Parameters
651
+ ----------
652
+ search_string: str,
653
+ Search string to use to find matching glossaries. If the search string is '*' then all
654
+ glossaries returned.
655
+
656
+ effective_time: str, [default=None], optional
657
+ Effective time of the query. If not specified will default to any time. Time format is
658
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
659
+ server_name : str, optional
660
+ The name of the server to configure.
661
+ If not provided, the server name associated with the instance is used.
662
+ starts_with : bool, [default=False], optional
663
+ Starts with the supplied string.
664
+ ends_with : bool, [default=False], optional
665
+ Ends with the supplied string
666
+ ignore_case : bool, [default=False], optional
667
+ Ignore case when searching
668
+ start_from: int, [default=0], optional
669
+ When multiple pages of results are available, the page number to start from.
670
+ page_size: int, [default=None]
671
+ The number of items to return in a single page. If not specified, the default will be taken from
672
+ the class instance.
673
+ Returns
674
+ -------
675
+ List | str
676
+
677
+ A list of glossary definitions active in the server.
678
+
679
+ Raises
680
+ ------
681
+
682
+ InvalidParameterException
683
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
684
+ PropertyServerException
685
+ Raised by the server when an issue arises in processing a valid request
686
+ NotAuthorizedException
687
+ The principle specified by the user_id does not have authorization for the requested action
688
+
689
+ """
690
+ loop = asyncio.get_event_loop()
691
+ response = loop.run_until_complete(
692
+ self._async_find_glossary_categories(search_string, effective_time, starts_with, ends_with, ignore_case,
693
+ server_name, start_from, page_size))
694
+
695
+ return response
696
+
697
+ async def _async_get_categories_for_glossary(self, glossary_guid: str, server_name: str = None, start_from: int = 0,
698
+ page_size: int = None) -> list | str:
699
+ """ Return the list of categories associated with a glossary.
700
+ Async version.
701
+
702
+ Parameters
703
+ ----------
704
+ glossary_guid: str,
705
+ Unique identity of the glossary
706
+ server_name : str, optional
707
+ The name of the server to configure.
708
+ If not provided, the server name associated with the instance is used.
709
+ start_from: int, [default=0], optional
710
+ When multiple pages of results are available, the page number to start from.
711
+ page_size: int, [default=None]
712
+ The number of items to return in a single page. If not specified, the default will be taken from
713
+ the class instance.
714
+ Returns
715
+ -------
716
+ List | str
717
+
718
+ A list of categories associated with a glossary.
719
+
720
+ Raises
721
+ ------
722
+
723
+ InvalidParameterException
724
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
725
+ PropertyServerException
726
+ Raised by the server when an issue arises in processing a valid request
727
+ NotAuthorizedException
728
+ The principle specified by the user_id does not have authorization for the requested action
729
+
730
+ """
731
+ if server_name is None:
732
+ server_name = self.server_name
733
+ if page_size is None:
734
+ page_size = self.page_size
735
+
736
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
737
+ f"{glossary_guid}/categories/retrieve?startFrom={start_from}&pageSize={page_size}")
738
+
739
+ response = await self._async_make_request("POST", url)
740
+ return response.json().get("elementList", "No Categories found")
741
+
742
+ def get_categories_for_glossary(self, glossary_guid: str, server_name: str = None, start_from: int = 0,
743
+ page_size: int = None) -> list | str:
744
+ """ Return the list of categories associated with a glossary.
745
+
746
+ Parameters
747
+ ----------
748
+ glossary_guid: str,
749
+ Unique identity of the glossary
750
+ server_name : str, optional
751
+ The name of the server to configure.
752
+ If not provided, the server name associated with the instance is used.
753
+ start_from: int, [default=0], optional
754
+ When multiple pages of results are available, the page number to start from.
755
+ page_size: int, [default=None]
756
+ The number of items to return in a single page. If not specified, the default will be taken from
757
+ the class instance.
758
+ Returns
759
+ -------
760
+ List | str
761
+
762
+ A list of categories associated with a glossary.
763
+
764
+ Raises
765
+ ------
766
+
767
+ InvalidParameterException
768
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
769
+ PropertyServerException
770
+ Raised by the server when an issue arises in processing a valid request
771
+ NotAuthorizedException
772
+ The principle specified by the user_id does not have authorization for the requested action
773
+
774
+ """
775
+ loop = asyncio.get_event_loop()
776
+ response = loop.run_until_complete(
777
+ self._async_get_categories_for_glossary(glossary_guid, server_name, start_from, page_size))
778
+ return response
779
+
780
+ async def _async_get_categories_for_term(self, glossary_term_guid: str, server_name: str = None,
781
+ start_from: int = 0, page_size: int = None) -> list | str:
782
+ """ Return the list of categories associated with a glossary term.
783
+ Async version.
784
+
785
+ Parameters
786
+ ----------
787
+ glossary_term_guid: str,
788
+ Unique identity of a glossary term
789
+ server_name : str, optional
790
+ The name of the server to use.
791
+ If not provided, the server name associated with the instance is used.
792
+ start_from: int, [default=0], optional
793
+ When multiple pages of results are available, the page number to start from.
794
+ page_size: int, [default=None]
795
+ The number of items to return in a single page. If not specified, the default will be taken from
796
+ the class instance.
797
+ Returns
798
+ -------
799
+ List | str
800
+
801
+ A list of categories associated with a glossary term.
802
+
803
+ Raises
804
+ ------
805
+
806
+ InvalidParameterException
807
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
808
+ PropertyServerException
809
+ Raised by the server when an issue arises in processing a valid request
810
+ NotAuthorizedException
811
+ The principle specified by the user_id does not have authorization for the requested action
812
+
813
+ """
814
+ if server_name is None:
815
+ server_name = self.server_name
816
+ if page_size is None:
817
+ page_size = self.page_size
818
+
819
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
820
+ f"{glossary_term_guid}/categories/retrieve?startFrom={start_from}&pageSize={page_size}")
821
+
822
+ response = await self._async_make_request("POST", url)
823
+ return response.json().get("elementList", "No Categories found")
824
+
825
+ def get_categories_for_term(self, glossary_term_guid: str, server_name: str = None, start_from: int = 0,
826
+ page_size: int = None) -> list | str:
827
+ """ Return the list of categories associated with a glossary term.
828
+
829
+ Parameters
830
+ ----------
831
+ glossary_term_guid: str,
832
+ Unique identity of a glossary term
833
+ server_name : str, optional
834
+ The name of the server to use.
835
+ If not provided, the server name associated with the instance is used.
836
+ start_from: int, [default=0], optional
837
+ When multiple pages of results are available, the page number to start from.
838
+ page_size: int, [default=None]
839
+ The number of items to return in a single page. If not specified, the default will be taken from
840
+ the class instance.
841
+ Returns
842
+ -------
843
+ List | str
844
+
845
+ A list of categories associated with a glossary term.
846
+
847
+ Raises
848
+ ------
849
+
850
+ InvalidParameterException
851
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
852
+ PropertyServerException
853
+ Raised by the server when an issue arises in processing a valid request
854
+ NotAuthorizedException
855
+ The principle specified by the user_id does not have authorization for the requested action
856
+
857
+ """
858
+ loop = asyncio.get_event_loop()
859
+ response = loop.run_until_complete(
860
+ self._async_get_categories_for_term(glossary_term_guid, server_name, start_from, page_size))
861
+ return response
862
+
863
+ async def _async_get_categories_by_name(self, name: str, glossary_guid: str = None, status: [str] = ["ACTIVE"],
864
+ server_name: str = None, start_from: int = 0,
865
+ page_size: int = None) -> list | str:
866
+ """ Retrieve the list of glossary category metadata elements that either have the requested qualified name or
867
+ display name. The name to search for is located in the request body and is interpreted as a plain string.
868
+ The request body also supports the specification of a glossaryGUID to restrict the search to within a single
869
+ glossary.
870
+
871
+ Async version.
872
+
873
+ Parameters
874
+ ----------
875
+ name: str,
876
+ category name to search for.
877
+ glossary_guid: str, optional
878
+ The identity of the glossary to search. If not specified, all glossaries will be searched.
879
+ status: [str], optional
880
+ A list of statuses to optionally restrict results. Default is Active
881
+ server_name : str, optional
882
+ The name of the server to configure.
883
+ If not provided, the server name associated with the instance is used.
884
+ start_from: int, [default=0], optional
885
+ When multiple pages of results are available, the page number to start from.
886
+ page_size: int, [default=None]
887
+ The number of items to return in a single page. If not specified, the default will be taken from
888
+ the class instance.
889
+ Returns
890
+ -------
891
+ List | str
892
+
893
+ A list of categories with the corresponding display name or qualified name.
894
+
895
+ Raises
896
+ ------
897
+
898
+ InvalidParameterException
899
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
900
+ PropertyServerException
901
+ Raised by the server when an issue arises in processing a valid request
902
+ NotAuthorizedException
903
+ The principle specified by the user_id does not have authorization for the requested action
904
+
905
+ """
906
+ if server_name is None:
907
+ server_name = self.server_name
908
+ if page_size is None:
909
+ page_size = self.page_size
910
+ validate_name(name)
911
+
912
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/categories/"
913
+ f"by-name?startFrom={start_from}&pageSize={page_size}")
914
+
915
+ body = {"class": "GlossaryNameRequestBody", "name": name, "glossaryGUID": glossary_guid,
916
+ "limitResultsByStatus": status}
917
+
918
+ response = await self._async_make_request("POST", url, body)
919
+ return response.json().get("elementList", "No Categories found")
920
+
921
+ def get_categories_by_name(self, name: str, glossary_guid: str = None, status: [str] = ["ACTIVE"],
922
+ server_name: str = None, start_from: int = 0, page_size: int = None) -> list | str:
923
+ """ Retrieve the list of glossary category metadata elements that either have the requested qualified name or
924
+ display name. The name to search for is located in the request body and is interpreted as a plain string.
925
+ The request body also supports the specification of a glossaryGUID to restrict the search to within a
926
+ single glossary.
927
+
928
+ Parameters
929
+ ----------
930
+ name: str,
931
+ category name to search for.
932
+ glossary_guid: str, optional
933
+ The identity of the glossary to search. If not specified, all glossaries will be searched.
934
+ status: [str], optional
935
+ A list of statuses to optionally restrict results. Default is Active
936
+ server_name : str, optional
937
+ The name of the server to configure.
938
+ If not provided, the server name associated with the instance is used.
939
+ start_from: int, [default=0], optional
940
+ When multiple pages of results are available, the page number to start from.
941
+ page_size: int, [default=None]
942
+ The number of items to return in a single page. If not specified, the default will be taken from
943
+ the class instance.
944
+ Returns
945
+ -------
946
+ List | str
947
+
948
+ A list of categories with the corresponding display name or qualified name.
949
+
950
+ Raises
951
+ ------
952
+
953
+ InvalidParameterException
954
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
955
+ PropertyServerException
956
+ Raised by the server when an issue arises in processing a valid request
957
+ NotAuthorizedException
958
+ The principle specified by the user_id does not have authorization for the requested action
959
+
960
+ """
961
+ loop = asyncio.get_event_loop()
962
+ response = loop.run_until_complete(
963
+ self._async_get_categories_by_name(name, glossary_guid, status, server_name, start_from, page_size))
964
+ return response
965
+
966
+ async def _async_get_categories_by_guid(self, glossary_category_guid: str, effective_time: str = None,
967
+ server_name: str = None) -> list | str:
968
+ """ Retrieve the requested glossary category metadata element. The optional request body contain an effective
969
+ time for the query..
970
+
971
+ Async version.
972
+
973
+ Parameters
974
+ ----------
975
+ glossary_category_guid: str
976
+ The identity of the glossary category to search.
977
+ effective_time: str, optional
978
+ If specified, the category should only be returned if it was effective at the specified time.
979
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
980
+ server_name : str, optional
981
+ The name of the server to configure.
982
+ If not provided, the server name associated with the instance is used.
983
+
984
+ Returns
985
+ -------
986
+ List | str
987
+
988
+ Details for the category with the glossary category GUID.
989
+
990
+ Raises
991
+ ------
992
+
993
+ InvalidParameterException
994
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
995
+ PropertyServerException
996
+ Raised by the server when an issue arises in processing a valid request
997
+ NotAuthorizedException
998
+ The principle specified by the user_id does not have authorization for the requested action
999
+
1000
+ """
1001
+ if server_name is None:
1002
+ server_name = self.server_name
1003
+
1004
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/categories/"
1005
+ f"{glossary_category_guid}/retrieve")
1006
+
1007
+ body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
1008
+
1009
+ response = await self._async_make_request("POST", url, body)
1010
+ return response.json().get("element", "No Category found")
1011
+
1012
+ def get_categories_by_guid(self, glossary_category_guid: str, effective_time: str = None,
1013
+ server_name: str = None) -> list | str:
1014
+ """ Retrieve the requested glossary category metadata element. The optional request body contain an effective
1015
+ time for the query..
1016
+
1017
+ Parameters
1018
+ ----------
1019
+ glossary_category_guid: str
1020
+ The identity of the glossary category to search.
1021
+ effective_time: str, optional
1022
+ If specified, the category should only be returned if it was effective at the specified time.
1023
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1024
+ server_name : str, optional
1025
+ The name of the server to configure.
1026
+ If not provided, the server name associated with the instance is used.
1027
+
1028
+ Returns
1029
+ -------
1030
+ List | str
1031
+
1032
+ Details for the category with the glossary category GUID.
1033
+
1034
+ Raises
1035
+ ------
1036
+
1037
+ InvalidParameterException
1038
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1039
+ PropertyServerException
1040
+ Raised by the server when an issue arises in processing a valid request
1041
+ NotAuthorizedException
1042
+ The principle specified by the user_id does not have authorization for the requested action
1043
+
1044
+ """
1045
+ loop = asyncio.get_event_loop()
1046
+ response = loop.run_until_complete(
1047
+ self._async_get_categories_by_guid(glossary_category_guid, effective_time, server_name))
1048
+ return response
1049
+
1050
+ async def _async_get_category_parent(self, glossary_category_guid: str, effective_time: str = None,
1051
+ server_name: str = None) -> list | str:
1052
+ """ Glossary categories can be organized in a hierarchy. Retrieve the parent glossary category metadata
1053
+ element for the glossary category with the supplied unique identifier. If the requested category
1054
+ does not have a parent category, null is returned. The optional request body contain an effective time
1055
+ for the query.
1056
+
1057
+ Async version.
1058
+
1059
+ Parameters
1060
+ ----------
1061
+ glossary_category_guid: str
1062
+ The identity of the glossary category to search.
1063
+ effective_time: str, optional
1064
+ If specified, the category should only be returned if it was effective at the specified time.
1065
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1066
+ server_name : str, optional
1067
+ The name of the server to configure.
1068
+ If not provided, the server name associated with the instance is used.
1069
+
1070
+ Returns
1071
+ -------
1072
+ List | str
1073
+
1074
+ Details for the parent category with the glossary category GUID.
1075
+
1076
+ Raises
1077
+ ------
1078
+
1079
+ InvalidParameterException
1080
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1081
+ PropertyServerException
1082
+ Raised by the server when an issue arises in processing a valid request
1083
+ NotAuthorizedException
1084
+ The principle specified by the user_id does not have authorization for the requested action
1085
+
1086
+ """
1087
+ if server_name is None:
1088
+ server_name = self.server_name
1089
+
1090
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/categories/"
1091
+ f"{glossary_category_guid}/parent/retrieve")
1092
+
1093
+ body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
1094
+
1095
+ response = await self._async_make_request("POST", url, body)
1096
+ return response.json().get("element", "No Parent Category found")
1097
+
1098
+ def get_category_parent(self, glossary_category_guid: str, effective_time: str = None,
1099
+ server_name: str = None) -> list | str:
1100
+ """ Glossary categories can be organized in a hierarchy. Retrieve the parent glossary category metadata
1101
+ element for the glossary category with the supplied unique identifier. If the requested category
1102
+ does not have a parent category, null is returned. The optional request body contain an effective time
1103
+ for the query.
1104
+
1105
+ Parameters
1106
+ ----------
1107
+ glossary_category_guid: str
1108
+ The identity of the glossary category to search.
1109
+ effective_time: str, optional
1110
+ If specified, the category should only be returned if it was effective at the specified time.
1111
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
1112
+ server_name : str, optional
1113
+ The name of the server to configure.
1114
+ If not provided, the server name associated with the instance is used.
1115
+
1116
+ Returns
1117
+ -------
1118
+ List | str
1119
+
1120
+ Details for the parent category with the glossary category GUID.
1121
+
1122
+ Raises
1123
+ ------
1124
+
1125
+ InvalidParameterException
1126
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1127
+ PropertyServerException
1128
+ Raised by the server when an issue arises in processing a valid request
1129
+ NotAuthorizedException
1130
+ The principle specified by the user_id does not have authorization for the requested action
1131
+
1132
+ """
1133
+ loop = asyncio.get_event_loop()
1134
+ response = loop.run_until_complete(
1135
+ self._async_get_category_parent(glossary_category_guid, effective_time, server_name))
1136
+ return response
1137
+
1138
+ #
1139
+ # Terms
1140
+ #
1141
+
1142
+ async def _async_get_terms_for_category(self, glossary_category_guid: str, server_name: str = None,
1143
+ effective_time: str = None, start_from: int = 0,
1144
+ page_size: int = None) -> list | str:
1145
+ """ Retrieve ALL the glossary terms in a category.
1146
+ The request body also supports the specification of an effective time for the query.
1147
+
1148
+ Async Version.
1149
+
1150
+ Parameters
1151
+ ----------
1152
+ glossary_category_guid : str
1153
+ Unique identifier for the glossary category to retrieve terms from.
1154
+ server_name : str, optional
1155
+ The name of the server to get the configured access services for.
1156
+ If not provided, the server name associated with the instance is used.
1157
+ effective_time : str, optional
1158
+ If specified, the terms are returned if they are active at the `effective_time
1159
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1160
+ start_from: int, optional defaults to 0
1161
+ The page number to start retrieving elements from
1162
+ page_size : int, optional defaults to None
1163
+ The number of elements to retrieve
1164
+ Returns
1165
+ -------
1166
+ dict
1167
+ The glossary definition associated with the glossary_guid
1168
+
1169
+ Raises
1170
+ ------
1171
+ InvalidParameterException
1172
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1173
+ PropertyServerException
1174
+ Raised by the server when an issue arises in processing a valid request.
1175
+ NotAuthorizedException
1176
+ The principle specified by the user_id does not have authorization for the requested action.
1177
+ Notes
1178
+ -----
1179
+ """
1180
+
1181
+ if server_name is None:
1182
+ server_name = self.server_name
1183
+ validate_guid(glossary_category_guid)
1184
+
1185
+ if page_size is None:
1186
+ page_size = self.page_size
1187
+
1188
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
1189
+ f"{glossary_category_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}")
1190
+
1191
+ if effective_time is not None:
1192
+ body = {"effectiveTime": effective_time}
1193
+ response = await self._async_make_request("POST", url, body)
1194
+ else:
1195
+ response = await self._async_make_request("POST", url)
1196
+
1197
+ return response.json().get("elementList", "No terms found")
1198
+
1199
+ def get_terms_for_category(self, glossary_category_guid: str, server_name: str = None,
1200
+ effective_time: str = None, start_from: int = 0,
1201
+ page_size: int = None) -> list | str:
1202
+ """ Retrieve ALL the glossary terms in a category.
1203
+ The request body also supports the specification of an effective time for the query.
1204
+
1205
+ Async Version.
1206
+
1207
+ Parameters
1208
+ ----------
1209
+ glossary_category_guid : str
1210
+ Unique identifier for the glossary category to retrieve terms from.
1211
+ server_name : str, optional
1212
+ The name of the server to get the configured access services for.
1213
+ If not provided, the server name associated with the instance is used.
1214
+ effective_time : str, optional
1215
+ If specified, the terms are returned if they are active at the `effective_time.
1216
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)`.
1217
+ start_from: int, optional defaults to 0
1218
+ The page number to start retrieving elements from
1219
+ page_size : int, optional defaults to None
1220
+ The number of elements to retrieve
1221
+ Returns
1222
+ -------
1223
+ dict
1224
+ The glossary definition associated with the glossary_guid
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
+ loop = asyncio.get_event_loop()
1238
+ response = loop.run_until_complete(
1239
+ self._async_get_terms_for_category(glossary_category_guid, server_name, effective_time, start_from,
1240
+ page_size))
1241
+
1242
+ return response
1243
+
1244
+ async def _async_get_terms_for_glossary(self, glossary_guid: str, server_name: str = None,
1245
+ effective_time: str = None, start_from: int = 0,
1246
+ page_size: int = None) -> list | str:
1247
+ """ Retrieve the list of glossary terms associated with a glossary.
1248
+ The request body also supports the specification of an effective time for the query.
1249
+ Parameters
1250
+ ----------
1251
+ glossary_guid : str
1252
+ Unique identifier for the glossary
1253
+ server_name : str, optional
1254
+ The name of the server to get the configured access services for.
1255
+ If not provided, the server name associated with the instance is used.
1256
+ effective_time : str, optional
1257
+ If specified, terms are potentially included if they are active at the`effective_time.
1258
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)`
1259
+ start_from: int, optional defaults to 0
1260
+ The page number to start retrieving elements from
1261
+ page_size : int, optional defaults to None
1262
+ The number of elements to retrieve
1263
+ Returns
1264
+ -------
1265
+ dict
1266
+ The glossary definition associated with the glossary_guid
1267
+
1268
+ Raises
1269
+ ------
1270
+ InvalidParameterException
1271
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1272
+ PropertyServerException
1273
+ Raised by the server when an issue arises in processing a valid request.
1274
+ NotAuthorizedException
1275
+ The principle specified by the user_id does not have authorization for the requested action.
1276
+ Notes
1277
+ -----
1278
+ """
1279
+
1280
+ if server_name is None:
1281
+ server_name = self.server_name
1282
+ validate_guid(glossary_guid)
1283
+
1284
+ if page_size is None:
1285
+ page_size = self.page_size
1286
+
1287
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
1288
+ f"{glossary_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}")
1289
+
1290
+ if effective_time is not None:
1291
+ body = {"effectiveTime": effective_time}
1292
+ response = await self._async_make_request("POST", url, body)
1293
+ else:
1294
+ response = await self._async_make_request("POST", url)
1295
+
1296
+ return response.json().get("elementList", "No terms found")
1297
+
1298
+ def get_terms_for_glossary(self, glossary_guid: str, server_name: str = None, effective_time: str = None,
1299
+ start_from: int = 0, page_size: int = None) -> list | str:
1300
+ """ Retrieve the list of glossary terms associated with a glossary.
1301
+ The request body also supports the specification of an effective time for the query.
1302
+ Parameters
1303
+ ----------
1304
+ glossary_guid : str
1305
+ Unique identifier for the glossary
1306
+ server_name : str, optional
1307
+ The name of the server to get the configured access services for.
1308
+ If not provided, the server name associated with the instance is used.
1309
+ effective_time : str, optional
1310
+ If specified, terms are potentially returned if they are active at the `effective_time`
1311
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1312
+ start_from: int, optional defaults to 0
1313
+ The page number to start retrieving elements from
1314
+ page_size : int, optional defaults to None
1315
+ The number of elements to retrieve
1316
+ Returns
1317
+ -------
1318
+ dict
1319
+ The glossary definition associated with the glossary_guid
1320
+
1321
+ Raises
1322
+ ------
1323
+ InvalidParameterException
1324
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1325
+ PropertyServerException
1326
+ Raised by the server when an issue arises in processing a valid request.
1327
+ NotAuthorizedException
1328
+ The principle specified by the user_id does not have authorization for the requested action.
1329
+ Notes
1330
+ -----
1331
+ """
1332
+ loop = asyncio.get_event_loop()
1333
+ response = loop.run_until_complete(
1334
+ self._async_get_terms_for_glossary(glossary_guid, server_name, effective_time, start_from, page_size))
1335
+
1336
+ return response
1337
+
1338
+ async def _async_get_term_relationships(self, term_guid: str, server_name: str = None,
1339
+ effective_time: str = None, start_from: int = 0,
1340
+ page_size: int = None) -> list | str:
1341
+
1342
+ """ This call retrieves details of the glossary terms linked to this glossary term.
1343
+ Notice the original org 1 glossary term is linked via the "SourcedFrom" relationship..
1344
+ Parameters
1345
+ ----------
1346
+ term_guid : str
1347
+ Unique identifier for the glossary term
1348
+ server_name : str, optional
1349
+ The name of the server to get the configured access services for.
1350
+ If not provided, the server name associated with the instance is used.
1351
+ effective_time : str, optional
1352
+ If specified, term relationships are included if they are active at the `effective_time`.
1353
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1354
+ start_from: int, optional defaults to 0
1355
+ The page number to start retrieving elements from
1356
+ page_size : int, optional defaults to None
1357
+ The number of elements to retrieve
1358
+ Returns
1359
+ -------
1360
+ dict
1361
+ The glossary definition associated with the glossary_guid
1362
+
1363
+ Raises
1364
+ ------
1365
+ InvalidParameterException
1366
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1367
+ PropertyServerException
1368
+ Raised by the server when an issue arises in processing a valid request.
1369
+ NotAuthorizedException
1370
+ The principle specified by the user_id does not have authorization for the requested action.
1371
+ Notes
1372
+ -----
1373
+ """
1374
+
1375
+ if server_name is None:
1376
+ server_name = self.server_name
1377
+ validate_guid(term_guid)
1378
+
1379
+ if page_size is None:
1380
+ page_size = self.page_size
1381
+
1382
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
1383
+ f"{term_guid}/related-terms?startFrom={start_from}&pageSize={page_size}")
1384
+
1385
+ if effective_time is not None:
1386
+ body = {"effectiveTime": effective_time}
1387
+ response = await self._async_make_request("POST", url, body)
1388
+ else:
1389
+ response = await self._async_make_request("POST", url)
1390
+
1391
+ return response.json().get("elementList", "No terms found")
1392
+
1393
+ def get_term_relationships(self, term_guid: str, server_name: str = None, effective_time: str = None,
1394
+ start_from: int = 0, page_size: int = None) -> list | str:
1395
+
1396
+ """ This call retrieves details of the glossary terms linked to this glossary term.
1397
+ Notice the original org 1 glossary term is linked via the "SourcedFrom" relationship..
1398
+ Parameters
1399
+ ----------
1400
+ term_guid : str
1401
+ Unique identifier for the glossary term
1402
+ server_name : str, optional
1403
+ The name of the server to get the configured access services for.
1404
+ If not provided, the server name associated with the instance is used.
1405
+ effective_time : str, optional
1406
+ If specified, term relationships are included if they are active at the `effective_time`.
1407
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1408
+ start_from: int, optional defaults to 0
1409
+ The page number to start retrieving elements from
1410
+ page_size : int, optional defaults to None
1411
+ The number of elements to retrieve
1412
+ Returns
1413
+ -------
1414
+ dict
1415
+ The glossary definition associated with the glossary_guid
1416
+
1417
+ Raises
1418
+ ------
1419
+ InvalidParameterException
1420
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1421
+ PropertyServerException
1422
+ Raised by the server when an issue arises in processing a valid request.
1423
+ NotAuthorizedException
1424
+ The principle specified by the user_id does not have authorization for the requested action.
1425
+ Notes
1426
+ -----
1427
+ """
1428
+ loop = asyncio.get_event_loop()
1429
+ response = loop.run_until_complete(
1430
+ self._async_get_term_relationships(term_guid, server_name, effective_time, start_from, page_size))
1431
+
1432
+ return response
1433
+
1434
+ async def _async_get_glossary_for_term(self, term_guid: str, server_name: str = None,
1435
+ effective_time: str = None) -> dict | str:
1436
+ """ Retrieve the glossary metadata element for the requested term. The optional request body allows you to
1437
+ specify that the glossary element should only be returned if it was effective at a particular time.
1438
+
1439
+ Async Version.
1440
+
1441
+ Parameters
1442
+ ----------
1443
+ term_guid : str
1444
+ The unique identifier for the term.
1445
+ server_name : str, optional
1446
+ The name of the server. If not specified, the default server name will be used.
1447
+ effective_time : datetime, optional
1448
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
1449
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1450
+
1451
+ Returns
1452
+ -------
1453
+ dict
1454
+ The glossary information retrieved for the specified term.
1455
+ Raises
1456
+ ------
1457
+ InvalidParameterException
1458
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1459
+ PropertyServerException
1460
+ Raised by the server when an issue arises in processing a valid request.
1461
+ NotAuthorizedException
1462
+ The principle specified by the user_id does not have authorization for the requested action.
1463
+ Notes
1464
+ -----
1465
+ """
1466
+ if server_name is None:
1467
+ server_name = self.server_name
1468
+ validate_guid(term_guid)
1469
+
1470
+ body = {"class": "EffectiveTimeQueryRequestBody", "effectiveTime": effective_time}
1471
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
1472
+ f"for-term/{term_guid}/retrieve")
1473
+
1474
+ response = await self._async_make_request("POST", url, body)
1475
+ return response.json().get("element", "No glossary found")
1476
+
1477
+ def get_glossary_for_term(self, term_guid: str, server_name: str = None,
1478
+ effective_time: str = None) -> dict | str:
1479
+ """ Retrieve the glossary metadata element for the requested term. The optional request body allows you to
1480
+ specify that the glossary element should only be returned if it was effective at a particular time.
1481
+
1482
+ Async Version.
1483
+
1484
+ Parameters
1485
+ ----------
1486
+ term_guid : str
1487
+ The unique identifier for the term.
1488
+ server_name : str, optional
1489
+ The name of the server. If not specified, the default server name will be used.
1490
+ effective_time : datetime, optional
1491
+ TIf specified, the term information will be retrieved if it is active at the `effective_time`.
1492
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
1493
+
1494
+ Returns
1495
+ -------
1496
+ dict
1497
+ The glossary information retrieved for the specified term.
1498
+ Raises
1499
+ ------
1500
+ InvalidParameterException
1501
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1502
+ PropertyServerException
1503
+ Raised by the server when an issue arises in processing a valid request.
1504
+ NotAuthorizedException
1505
+ The principle specified by the user_id does not have authorization for the requested action.
1506
+ Notes
1507
+ -----
1508
+ """
1509
+ loop = asyncio.get_event_loop()
1510
+ response = loop.run_until_complete(self._async_get_glossary_for_term(term_guid, server_name, effective_time))
1511
+ return response
1512
+
1513
+ async def _async_get_terms_by_name(self, term: str, glossary_guid: str = None, status_filter: list = [],
1514
+ server_name: str = None, effective_time: str = None,
1515
+ for_lineage: bool = False, for_duplicate_processing: bool = False,
1516
+ start_from: int = 0, page_size: int = None) -> list:
1517
+ """ Retrieve glossary terms by display name or qualified name. Async Version.
1518
+
1519
+ Parameters
1520
+ ----------
1521
+ term : str
1522
+ The term to search for in the glossaries.
1523
+ glossary_guid : str, optional
1524
+ The GUID of the glossary to search in. If not provided, the search will be performed in all glossaries.
1525
+ status_filter : list, optional
1526
+ A list of status values to filter the search results. Default is an empty list, which means no filtering.
1527
+ server_name : str, optional
1528
+ The name of the server where the glossaries reside. If not provided, it will use the default server name.
1529
+ effective_time : datetime, optional
1530
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
1531
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1532
+ for_lineage : bool, optional
1533
+ Flag to indicate whether the search should include lineage information. Default is False.
1534
+ for_duplicate_processing : bool, optional
1535
+ Flag to indicate whether the search should include duplicate processing information. Default is False.
1536
+ start_from : int, optional
1537
+ The index of the first term to retrieve. Default is 0.
1538
+ page_size : int, optional
1539
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
1540
+
1541
+ Returns
1542
+ -------
1543
+ list
1544
+ A list of terms matching the search criteria. If no terms are found, it returns the string "No terms found".
1545
+
1546
+ Raises
1547
+ ------
1548
+ InvalidParameterException
1549
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1550
+ PropertyServerException
1551
+ Raised by the server when an issue arises in processing a valid request.
1552
+ NotAuthorizedException
1553
+ The principle specified by the user_id does not have authorization for the requested action.
1554
+ """
1555
+ if server_name is None:
1556
+ server_name = self.server_name
1557
+ if page_size is None:
1558
+ page_size = self.page_size
1559
+
1560
+ validate_name(term)
1561
+
1562
+ for_lineage_s = str(for_lineage).lower()
1563
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
1564
+
1565
+ body = {"class": "GlossaryNameRequestBody", "glossaryGUID": glossary_guid, "name": term,
1566
+ "effectiveTime": effective_time, "limitResultsByStatus": status_filter}
1567
+ # body = body_slimmer(body)
1568
+
1569
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
1570
+ f"terms/by-name?startFrom={start_from}&pageSize={page_size}&"
1571
+ f"&forLineage={for_lineage_s}&forDuplicateProcessing={for_duplicate_processing_s}")
1572
+
1573
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
1574
+
1575
+ response = await self._async_make_request("POST", url, body)
1576
+ return response.json().get("elementList", "No terms found")
1577
+
1578
+ def get_terms_by_name(self, term: str, glossary_guid: str = None, status_filter: list = [], server_name: str = None,
1579
+ effective_time: str = None, for_lineage: bool = False,
1580
+ for_duplicate_processing: bool = False, start_from: int = 0, page_size: int = None) -> list:
1581
+ """ Retrieve glossary terms by display name or qualified name.
1582
+
1583
+ Parameters
1584
+ ----------
1585
+ term : str
1586
+ The term to search for in the glossaries.
1587
+ glossary_guid : str, optional
1588
+ The GUID of the glossary to search in. If not provided, the search will be performed in all glossaries.
1589
+ status_filter : list, optional
1590
+ A list of status values to filter the search results. Default is an empty list, which means no filtering.
1591
+ server_name : str, optional
1592
+ The name of the server where the glossaries reside. If not provided, it will use the default server name.
1593
+ effective_time : datetime, optional
1594
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
1595
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1596
+ for_lineage : bool, optional
1597
+ Flag to indicate whether the search should include lineage information. Default is False.
1598
+ for_duplicate_processing : bool, optional
1599
+ Flag to indicate whether the search should include duplicate processing information. Default is False.
1600
+ start_from : int, optional
1601
+ The index of the first term to retrieve. Default is 0.
1602
+ page_size : int, optional
1603
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
1604
+
1605
+ Returns
1606
+ -------
1607
+ list
1608
+ A list of terms matching the search criteria. If no terms are found,
1609
+ it returns the string "No terms found".
1610
+
1611
+ Raises
1612
+ ------
1613
+ InvalidParameterException
1614
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1615
+ PropertyServerException
1616
+ Raised by the server when an issue arises in processing a valid request.
1617
+ NotAuthorizedException
1618
+ The principle specified by the user_id does not have authorization for the requested action.
1619
+ """
1620
+ loop = asyncio.get_event_loop()
1621
+ response = loop.run_until_complete(
1622
+ self._async_get_terms_by_name(term, glossary_guid, status_filter, server_name, effective_time, for_lineage,
1623
+ for_duplicate_processing, start_from, page_size))
1624
+ return response
1625
+
1626
+ async def _async_get_terms_by_guid(self, term_guid: str, server_name: str = None) -> dict | str:
1627
+ """ Retrieve a term using its unique id. Async version.
1628
+ Parameters
1629
+ ----------
1630
+ term_guid : str
1631
+ The GUID of the glossary term to retrieve.
1632
+ server_name : str, optional
1633
+ The name of the server to connect to. If not provided, the default server name will be used.
1634
+
1635
+ Returns
1636
+ -------
1637
+ dict | str
1638
+ A dict detailing the glossary term represented by the GUID. If no term is found, the string
1639
+ "No term found" will be returned.
1640
+
1641
+ Raises
1642
+ ------
1643
+ InvalidParameterException
1644
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1645
+ PropertyServerException
1646
+ Raised by the server when an issue arises in processing a valid request.
1647
+ NotAuthorizedException
1648
+ The principle specified by the user_id does not have authorization for the requested action.
1649
+ """
1650
+ if server_name is None:
1651
+ server_name = self.server_name
1652
+
1653
+ validate_guid(term_guid)
1654
+
1655
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
1656
+ f"{term_guid}/retrieve")
1657
+
1658
+ response = await self._async_make_request("POST", url)
1659
+ return response.json().get("element", "No term found")
1660
+
1661
+ def get_terms_by_guid(self, term_guid: str, server_name: str = None) -> dict | str:
1662
+ """ Retrieve a term using its unique id. Async version.
1663
+ Parameters
1664
+ ----------
1665
+ term_guid : str
1666
+ The GUID of the glossary term to retrieve.
1667
+ server_name : str, optional
1668
+ The name of the server to connect to. If not provided, the default server name will be used.
1669
+
1670
+ Returns
1671
+ -------
1672
+ dict | str
1673
+ A dict detailing the glossary term represented by the GUID. If no term is found, the string
1674
+ "No term found" will be returned.
1675
+
1676
+ Raises
1677
+ ------
1678
+ InvalidParameterException
1679
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1680
+ PropertyServerException
1681
+ Raised by the server when an issue arises in processing a valid request.
1682
+ NotAuthorizedException
1683
+ The principle specified by the user_id does not have authorization for the requested action.
1684
+ """
1685
+
1686
+ loop = asyncio.get_event_loop()
1687
+ response = loop.run_until_complete(self._async_get_terms_by_guid(term_guid, server_name))
1688
+
1689
+ return response
1690
+
1691
+ async def _async_get_terms_versions(self, term_guid: str, server_name: str = None, start_from: int = 0,
1692
+ page_size=None) -> dict | str:
1693
+ """ Retrieve the versions of a glossary term. Async version.
1694
+ Parameters
1695
+ ----------
1696
+ term_guid : str
1697
+ The GUID of the glossary term to retrieve.
1698
+ server_name : str, optional
1699
+ The name of the server to connect to. If not provided, the default server name will be used.
1700
+ start_from : int, optional
1701
+ The index of the first term to retrieve. Default is 0.
1702
+ page_size : int, optional
1703
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
1704
+ Returns
1705
+ -------
1706
+ dict | str
1707
+ A dict detailing the glossary term represented by the GUID. If no term is found, the string
1708
+ "No term found" will be returned.
1709
+
1710
+ Raises
1711
+ ------
1712
+ InvalidParameterException
1713
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1714
+ PropertyServerException
1715
+ Raised by the server when an issue arises in processing a valid request.
1716
+ NotAuthorizedException
1717
+ The principle specified by the user_id does not have authorization for the requested action.
1718
+ """
1719
+ if server_name is None:
1720
+ server_name = self.server_name
1721
+
1722
+ if page_size is None:
1723
+ page_size = self.page_size
1724
+
1725
+ validate_guid(term_guid)
1726
+
1727
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/terms/"
1728
+ f"{term_guid}/history?startFrom={start_from}&pageSize={page_size}")
1729
+
1730
+ response = await self._async_make_request("POST", url)
1731
+ return response.json().get("element", "No term found")
1732
+
1733
+ def get_terms_versions(self, term_guid: str, server_name: str = None, start_from: int = 0,
1734
+ page_size=None) -> dict | str:
1735
+ """ Retrieve the versions of a glossary term.
1736
+ Parameters
1737
+ ----------
1738
+ term_guid : str
1739
+ The GUID of the glossary term to retrieve.
1740
+ server_name : str, optional
1741
+ The name of the server to connect to. If not provided, the default server name will be used.
1742
+ start_from : int, optional
1743
+ The index of the first term to retrieve. Default is 0.
1744
+ page_size : int, optional
1745
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
1746
+ Returns
1747
+ -------
1748
+ dict | str
1749
+ A dict detailing the glossary term represented by the GUID. If no term is found, the string
1750
+ "No term found" will be returned.
1751
+
1752
+ Raises
1753
+ ------
1754
+ InvalidParameterException
1755
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1756
+ PropertyServerException
1757
+ Raised by the server when an issue arises in processing a valid request.
1758
+ NotAuthorizedException
1759
+ The principle specified by the user_id does not have authorization for the requested action.
1760
+ """
1761
+
1762
+ loop = asyncio.get_event_loop()
1763
+ response = loop.run_until_complete(
1764
+ self._async_get_terms_versions(term_guid, server_name, start_from, page_size))
1765
+
1766
+ return response
1767
+
1768
+ async def _async_get_term_revision_logs(self, term_guid: str, server_name: str = None, start_from: int = 0,
1769
+ page_size=None) -> dict | str:
1770
+ """ Retrieve the revision log history for a term. Async version.
1771
+ Parameters
1772
+ ----------
1773
+ term_guid : str
1774
+ The GUID of the glossary term to retrieve.
1775
+ server_name : str, optional
1776
+ The name of the server to connect to. If not provided, the default server name will be used.
1777
+ start_from : int, optional
1778
+ The index of the first term to retrieve. Default is 0.
1779
+ page_size : int, optional
1780
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
1781
+ Returns
1782
+ -------
1783
+ dict | str
1784
+ A dict detailing the glossary term revision log history. If no term is found, the string
1785
+ "No log found" will be returned.
1786
+
1787
+ Raises
1788
+ ------
1789
+ InvalidParameterException
1790
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1791
+ PropertyServerException
1792
+ Raised by the server when an issue arises in processing a valid request.
1793
+ NotAuthorizedException
1794
+ The principle specified by the user_id does not have authorization for the requested action.
1795
+ """
1796
+ if server_name is None:
1797
+ server_name = self.server_name
1798
+
1799
+ if page_size is None:
1800
+ page_size = self.page_size
1801
+
1802
+ validate_guid(term_guid)
1803
+
1804
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/elements/"
1805
+ f"{term_guid}/notes/retrieve?startFrom={start_from}&pageSize={page_size}")
1806
+
1807
+ response = await self._async_make_request("POST", url)
1808
+ return response.json().get("elementList", "No log found")
1809
+
1810
+ def get_term_revision_logs(self, term_guid: str, server_name: str = None, start_from: int = 0,
1811
+ page_size=None) -> dict | str:
1812
+ """ Retrieve the revision log history for a term.
1813
+ Parameters
1814
+ ----------
1815
+ term_guid : str
1816
+ The GUID of the glossary term to retrieve.
1817
+ server_name : str, optional
1818
+ The name of the server to connect to. If not provided, the default server name will be used.
1819
+ start_from : int, optional
1820
+ The index of the first term to retrieve. Default is 0.
1821
+ page_size : int, optional
1822
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
1823
+ Returns
1824
+ -------
1825
+ dict | str
1826
+ A dict detailing the glossary term revision log history. If no term is found, the string
1827
+ "No log found" will be returned.
1828
+
1829
+ Raises
1830
+ ------
1831
+ InvalidParameterException
1832
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1833
+ PropertyServerException
1834
+ Raised by the server when an issue arises in processing a valid request.
1835
+ NotAuthorizedException
1836
+ The principle specified by the user_id does not have authorization for the requested action.
1837
+ """
1838
+
1839
+ loop = asyncio.get_event_loop()
1840
+ response = loop.run_until_complete(
1841
+ self._async_get_term_revision_logs(term_guid, server_name, start_from, page_size))
1842
+
1843
+ return response
1844
+
1845
+ async def _async_get_term_revision_history(self, term_revision_log_guid: str, server_name: str = None,
1846
+ start_from: int = 0, page_size=None) -> dict | str:
1847
+ """ Retrieve the revision history for a glossary term. Async version.
1848
+
1849
+ Parameters
1850
+ ----------
1851
+ term_revision_log_guid : str
1852
+ The GUID of the glossary term revision log to retrieve.
1853
+ server_name : str, optional
1854
+ The name of the server to connect to. If not provided, the default server name will be used.
1855
+ start_from : int, optional
1856
+ The index of the first term to retrieve. Default is 0.
1857
+ page_size : int, optional
1858
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
1859
+ Returns
1860
+ -------
1861
+ dict | str
1862
+ A dict detailing the glossary term revision history.
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
+
1873
+
1874
+ Notes
1875
+ -----
1876
+ This revision history is created automatically. The text is supplied on the update request.
1877
+ If no text is supplied, the value "None" is show.
1878
+ """
1879
+ if server_name is None:
1880
+ server_name = self.server_name
1881
+
1882
+ if page_size is None:
1883
+ page_size = self.page_size
1884
+
1885
+ validate_guid(term_revision_log_guid)
1886
+
1887
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/note-logs/"
1888
+ f"{term_revision_log_guid}/notes/retrieve?startFrom={start_from}&pageSize={page_size}")
1889
+
1890
+ response = await self._async_make_request("POST", url)
1891
+ return response.json().get("elementList", "No logs found")
1892
+
1893
+ def get_term_revision_history(self, term_revision_log_guid: str, server_name: str = None, start_from: int = 0,
1894
+ page_size=None) -> dict | str:
1895
+ """ Retrieve the revision history for a glossary term.
1896
+
1897
+ Parameters
1898
+ ----------
1899
+ term_revision_log_guid : str
1900
+ The GUID of the glossary term revision log to retrieve.
1901
+ server_name : str, optional
1902
+ The name of the server to connect to. If not provided, the default server name will be used.
1903
+ start_from : int, optional
1904
+ The index of the first term to retrieve. Default is 0.
1905
+ page_size : int, optional
1906
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
1907
+ Returns
1908
+ -------
1909
+ dict | str
1910
+ A dict detailing the glossary term revision history.
1911
+
1912
+ Raises
1913
+ ------
1914
+ InvalidParameterException
1915
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1916
+ PropertyServerException
1917
+ Raised by the server when an issue arises in processing a valid request.
1918
+ NotAuthorizedException
1919
+ The principle specified by the user_id does not have authorization for the requested action.
1920
+
1921
+
1922
+ Notes
1923
+ -----
1924
+ This revision history is created automatically. The text is supplied on the update request.
1925
+ If no text is supplied, the value "None" is show.
1926
+ """
1927
+
1928
+ loop = asyncio.get_event_loop()
1929
+ response = loop.run_until_complete(
1930
+ self._async_get_term_revision_history(term_revision_log_guid, server_name, start_from, page_size))
1931
+
1932
+ return response
1933
+
1934
+ async def _async_find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
1935
+ effective_time: str = None, starts_with: bool = False, ends_with: bool = False,
1936
+ ignore_case: bool = False, for_lineage: bool = False,
1937
+ for_duplicate_processing: bool = False, server_name: str = None,
1938
+ start_from: int = 0, page_size: int = None) -> list | str:
1939
+
1940
+ """ Retrieve the list of glossary term metadata elements that contain the search string.
1941
+
1942
+ Parameters
1943
+ ----------
1944
+ search_string: str
1945
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
1946
+ glossary_guid str
1947
+ Identifier of the glossary to search within. If None, then all glossaries are searched.
1948
+ status_filter: list, default = [], optional
1949
+ Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
1950
+ the results will not be filtered.
1951
+ effective_time: str, [default=None], optional
1952
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
1953
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1954
+ server_name : str, optional
1955
+ The name of the server to configure.
1956
+ If not provided, the server name associated with the instance is used.
1957
+ starts_with : bool, [default=False], optional
1958
+ Starts with the supplied string.
1959
+ ends_with : bool, [default=False], optional
1960
+ Ends with the supplied string
1961
+ ignore_case : bool, [default=False], optional
1962
+ Ignore case when searching
1963
+ for_lineage : bool, [default=False], optional
1964
+
1965
+ for_duplicate_processing : bool, [default=False], optional
1966
+
1967
+ start_from: str, [default=0], optional
1968
+ Page of results to start from
1969
+ page_size : int, optional
1970
+ Number of elements to return per page - if None, then default for class will be used.
1971
+
1972
+ Returns
1973
+ -------
1974
+ List | str
1975
+
1976
+ A list of term definitions
1977
+
1978
+ Raises
1979
+ ------
1980
+ InvalidParameterException
1981
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1982
+ PropertyServerException
1983
+ Raised by the server when an issue arises in processing a valid request
1984
+ NotAuthorizedException
1985
+ The principle specified by the user_id does not have authorization for the requested action
1986
+
1987
+ Notes
1988
+ -----
1989
+ The search string is located in the request body and is interpreted as a plain string.
1990
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
1991
+ The request body also supports the specification of a glossaryGUID to restrict the search to within a single
1992
+ glossary.
1993
+ """
1994
+ if server_name is None:
1995
+ server_name = self.server_name
1996
+ if page_size is None:
1997
+ page_size = self.page_size
1998
+ if effective_time is None:
1999
+ effective_time = datetime.now().isoformat()
2000
+ starts_with_s = str(starts_with).lower()
2001
+ ends_with_s = str(ends_with).lower()
2002
+ ignore_case_s = str(ignore_case).lower()
2003
+ for_lineage_s = str(for_lineage).lower()
2004
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
2005
+ if search_string == '*':
2006
+ search_string = None
2007
+
2008
+ # validate_search_string(search_string)
2009
+
2010
+ body = {"class": "GlossarySearchStringRequestBody", "glossaryGUID": glossary_guid,
2011
+ "searchString": search_string, "effectiveTime": effective_time, "limitResultsByStatus": status_filter}
2012
+ # body = body_slimmer(body)
2013
+
2014
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
2015
+ f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
2016
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
2017
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
2018
+
2019
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
2020
+
2021
+ response = await self._async_make_request("POST", url, body)
2022
+ return response.json().get("elementList", "No terms found") # return response.text
2023
+
2024
+ def find_glossary_terms(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
2025
+ effective_time: str = None, starts_with: bool = False, ends_with: bool = False,
2026
+ ignore_case: bool = False, for_lineage: bool = False,
2027
+ for_duplicate_processing: bool = False, server_name: str = None, start_from: int = 0,
2028
+ page_size: int = None) -> list | str:
2029
+ """ Retrieve the list of glossary term metadata elements that contain the search string.
2030
+
2031
+ Parameters
2032
+ ----------
2033
+ search_string: str
2034
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries
2035
+ returned.
2036
+ glossary_guid str
2037
+ Identifier of the glossary to search within. If None, then all glossaries are searched.
2038
+ status_filter: list, default = [], optional
2039
+ Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
2040
+ the results will not be filtered.
2041
+ effective_time: str, [default=None], optional
2042
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
2043
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2044
+ server_name : str, optional
2045
+ The name of the server to configure.
2046
+ If not provided, the server name associated with the instance is used.
2047
+ starts_with : bool, [default=False], optional
2048
+ Starts with the supplied string.
2049
+ ends_with : bool, [default=False], optional
2050
+ Ends with the supplied string
2051
+ ignore_case : bool, [default=False], optional
2052
+ Ignore case when searching
2053
+ for_lineage : bool, [default=False], optional
2054
+
2055
+ for_duplicate_processing : bool, [default=False], optional
2056
+
2057
+ start_from: str, [default=0], optional
2058
+ Page of results to start from
2059
+ page_size : int, optional
2060
+ Number of elements to return per page - if None, then default for class will be used.
2061
+
2062
+ Returns
2063
+ -------
2064
+ List | str
2065
+
2066
+ A list of term definitions
2067
+
2068
+ Raises
2069
+ ------
2070
+ InvalidParameterException
2071
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2072
+ PropertyServerException
2073
+ Raised by the server when an issue arises in processing a valid request
2074
+ NotAuthorizedException
2075
+ The principle specified by the user_id does not have authorization for the requested action
2076
+
2077
+ Notes
2078
+ -----
2079
+ The search string is located in the request body and is interpreted as a plain string.
2080
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
2081
+ The request body also supports the specification of a glossaryGUID to restrict the search to within a
2082
+ single glossary.
2083
+ """
2084
+
2085
+ loop = asyncio.get_event_loop()
2086
+ response = loop.run_until_complete(
2087
+ self._async_find_glossary_terms(search_string, glossary_guid, status_filter, effective_time, starts_with,
2088
+ ends_with, ignore_case, for_lineage, for_duplicate_processing, server_name,
2089
+ start_from, page_size))
2090
+
2091
+ return response
2092
+
2093
+ #
2094
+ # Feedback
2095
+ #
2096
+ async def _async_get_comment(self, commemt_guid: str, effective_time: str, server_name: str = None,
2097
+ for_lineage: bool = False, for_duplicate_processing: bool = False) -> dict | list:
2098
+ """ Retrieve the comment specified by the comment GUID """
2099
+ if server_name is None:
2100
+ server_name = self.server_name
2101
+
2102
+ validate_guid(commemt_guid)
2103
+
2104
+ if effective_time is None:
2105
+ effective_time = datetime.now().isoformat()
2106
+
2107
+ for_lineage_s = str(for_lineage).lower()
2108
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
2109
+
2110
+ body = {"effective_time": effective_time}
2111
+
2112
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
2113
+ f"{commemt_guid}?forLineage={for_lineage_s}&"
2114
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
2115
+
2116
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
2117
+
2118
+ response = await self._async_make_request("POST", url, body)
2119
+ return response.json()
2120
+
2121
+ async def _async_add_comment_reply(self, comment_guid: str, is_public: bool, comment_type: str, comment_text: str,
2122
+ server_name: str = None, for_lineage: bool = False,
2123
+ for_duplicate_processing: bool = False) -> str:
2124
+ """ Reply to a comment """
2125
+
2126
+ if server_name is None:
2127
+ server_name = self.server_name
2128
+
2129
+ validate_guid(comment_guid)
2130
+ validate_name(comment_type)
2131
+
2132
+ is_public_s = str(is_public).lower()
2133
+ for_lineage_s = str(for_lineage).lower()
2134
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
2135
+
2136
+ body = {"class": "CommentRequestBody", "commentType": comment_type, "commentText": comment_text,
2137
+ "isPublic": is_public}
2138
+
2139
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
2140
+ f"{comment_guid}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
2141
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
2142
+
2143
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
2144
+
2145
+ response = await self._async_make_request("POST", url, body)
2146
+ return response
2147
+
2148
+ async def _async_update_comment(self, comment_guid: str, is_public: bool, comment_type: str, comment_text: str,
2149
+ server_name: str = None, is_merge_update: bool = False, for_lineage: bool = False,
2150
+ for_duplicate_processing: bool = False) -> str:
2151
+ """ Update the specified comment"""
2152
+ if server_name is None:
2153
+ server_name = self.server_name
2154
+
2155
+ validate_guid(comment_guid)
2156
+ validate_name(comment_type)
2157
+
2158
+ is_public_s = str(is_public).lower()
2159
+ for_lineage_s = str(for_lineage).lower()
2160
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
2161
+
2162
+ body = {"class": "CommentRequestBody", "commentType": comment_type, "commentText": comment_text,
2163
+ "isPublic": is_public}
2164
+
2165
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/comments/"
2166
+ f"{comment_guid}/replies?isPublic={is_public_s}&forLineage={for_lineage_s}&"
2167
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
2168
+
2169
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
2170
+
2171
+ response = await self._async_make_request("POST", url, body)
2172
+ return response
2173
+
2174
+ async def _async_find_comment(self, search_string: str, glossary_guid: str = None, status_filter: list = [],
2175
+ effective_time: str = None, starts_with: bool = False, ends_with: bool = False,
2176
+ ignore_case: bool = False, for_lineage: bool = False,
2177
+ for_duplicate_processing: bool = False, server_name: str = None, start_from: int = 0,
2178
+ page_size: int = None):
2179
+ """Find comments by search string"""
2180
+ if server_name is None:
2181
+ server_name = self.server_name
2182
+ if page_size is None:
2183
+ page_size = self.page_size
2184
+ if effective_time is None:
2185
+ effective_time = datetime.now().isoformat()
2186
+ starts_with_s = str(starts_with).lower()
2187
+ ends_with_s = str(ends_with).lower()
2188
+ ignore_case_s = str(ignore_case).lower()
2189
+ for_lineage_s = str(for_lineage).lower()
2190
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
2191
+ if search_string == '*':
2192
+ search_string = None
2193
+
2194
+ # validate_search_string(search_string)
2195
+
2196
+ body = {"class": "GlossarySearchStringRequestBody", "glossaryGUID": glossary_guid,
2197
+ "searchString": search_string, "effectiveTime": effective_time, "limitResultsByStatus": status_filter}
2198
+ # body = body_slimmer(body)
2199
+
2200
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/glossary-browser/glossaries/"
2201
+ f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
2202
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
2203
+ f"forDuplicateProcessing={for_duplicate_processing_s}")
2204
+
2205
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
2206
+
2207
+ response = await self._async_make_request("POST", url, body)
2208
+ return response.json().get("elementList", "No terms found")