pyegeria 0.2.4__py3-none-any.whl → 5.3.0.dev3__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 (239) hide show
  1. pyegeria/README.md +35 -0
  2. pyegeria/__init__.py +345 -14
  3. pyegeria/_client.py +376 -126
  4. pyegeria/_deprecated_gov_engine.py +451 -0
  5. pyegeria/_exceptions.py +6 -6
  6. pyegeria/_globals.py +7 -1
  7. pyegeria/_validators.py +9 -6
  8. pyegeria/asset_catalog_omvs.py +807 -0
  9. pyegeria/automated_curation_omvs.py +3760 -0
  10. pyegeria/classification_manager_omvs.py +5238 -0
  11. pyegeria/collection_manager_omvs.py +2727 -0
  12. pyegeria/commands/README.md +47 -0
  13. pyegeria/commands/__init__.py +22 -0
  14. pyegeria/commands/cat/README.md +16 -0
  15. pyegeria/commands/cat/__init__.py +1 -0
  16. pyegeria/commands/cat/exp_list_glossaries.py +156 -0
  17. pyegeria/commands/cat/get_asset_graph.py +319 -0
  18. pyegeria/commands/cat/get_collection.py +148 -0
  19. pyegeria/commands/cat/get_project_dependencies.py +168 -0
  20. pyegeria/commands/cat/get_project_structure.py +168 -0
  21. pyegeria/commands/cat/get_tech_type_elements.py +174 -0
  22. pyegeria/commands/cat/glossary_actions.py +362 -0
  23. pyegeria/commands/cat/list_assets.py +176 -0
  24. pyegeria/commands/cat/list_cert_types.py +194 -0
  25. pyegeria/commands/cat/list_collections.py +162 -0
  26. pyegeria/commands/cat/list_deployed_catalogs.py +217 -0
  27. pyegeria/commands/cat/list_deployed_database_schemas.py +251 -0
  28. pyegeria/commands/cat/list_deployed_databases.py +202 -0
  29. pyegeria/commands/cat/list_glossaries.py +150 -0
  30. pyegeria/commands/cat/list_projects.py +221 -0
  31. pyegeria/commands/cat/list_servers_deployed_imp.py +158 -0
  32. pyegeria/commands/cat/list_tech_type_elements.py +190 -0
  33. pyegeria/commands/cat/list_tech_types.py +140 -0
  34. pyegeria/commands/cat/list_terms.py +242 -0
  35. pyegeria/commands/cat/list_todos.py +189 -0
  36. pyegeria/commands/cat/list_user_ids.py +145 -0
  37. pyegeria/commands/cli/__init__.py +13 -0
  38. pyegeria/commands/cli/egeria.py +1844 -0
  39. pyegeria/commands/cli/egeria_cat.py +638 -0
  40. pyegeria/commands/cli/egeria_login_tui.py +313 -0
  41. pyegeria/commands/cli/egeria_my.py +248 -0
  42. pyegeria/commands/cli/egeria_ops.py +502 -0
  43. pyegeria/commands/cli/egeria_tech.py +618 -0
  44. pyegeria/commands/cli/ops_config.py +45 -0
  45. pyegeria/commands/cli/txt_custom_v2.tcss +19 -0
  46. pyegeria/commands/doc/README.md +145 -0
  47. pyegeria/commands/doc/Visual Command Reference/README.md +511 -0
  48. pyegeria/commands/doc/Visual Command Reference/cat/show/assets/asset-graph 2024-11-20 at 15.56.42.png +0 -0
  49. pyegeria/commands/doc/Visual Command Reference/cat/show/assets/assets-in-domain 2024-11-20 at 15.49.55@2x.png +0 -0
  50. pyegeria/commands/doc/Visual Command Reference/cat/show/assets/elements-of-type 2024-11-20 at 16.01.35.png +0 -0
  51. pyegeria/commands/doc/Visual Command Reference/cat/show/assets/tech-type-elements 2024-11-20 at 16.05.05.png +0 -0
  52. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-data-catalogs 2024-12-17 at 15.43.27@2x.png +0 -0
  53. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-data-catalogs-2024-11-20 at 16.17.43@2x.png +0 -0
  54. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-schemas 2024-11-25 at 20.14.50@2x.png +0 -0
  55. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-schemas 2024-12-17 at 15.48.38@2x.png +0 -0
  56. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-servers 2024-11-25 at 20.21.25@2x.png +0 -0
  57. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-servers 2024-12-17 at 15.52.16@2x.png +0 -0
  58. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed_databases 2024-12-16 at 16.40.31@2x.png +0 -0
  59. pyegeria/commands/doc/Visual Command Reference/cat/show/glossary/list-glossaries 2024-11-25 at 20.30.02.png +0 -0
  60. pyegeria/commands/doc/Visual Command Reference/cat/show/glossary/list-terms 2024-11-25 at 20.32.11.png +0 -0
  61. pyegeria/commands/doc/Visual Command Reference/cat/show/info/asset-types 2024-11-25 at 20.34.19@2x.png +0 -0
  62. pyegeria/commands/doc/Visual Command Reference/cat/show/info/certification-types 2024-11-25 at 20.37.07.png +0 -0
  63. pyegeria/commands/doc/Visual Command Reference/cat/show/info/collection-graph 2024-12-12 at 11.33.18@2x.png +0 -0
  64. pyegeria/commands/doc/Visual Command Reference/cat/show/info/list-collections 2024-12-10 at 14.25.51@2x.png +0 -0
  65. pyegeria/commands/doc/Visual Command Reference/cat/show/info/list-todos 2024-12-12 at 11.46.30@2x.png +0 -0
  66. pyegeria/commands/doc/Visual Command Reference/cat/show/info/list-user-ids 2024-12-12 at 11.51.09@2x.png +0 -0
  67. pyegeria/commands/doc/Visual Command Reference/cat/show/info/tech-types 2024-12-12 at 11.37.20@2x.png +0 -0
  68. pyegeria/commands/doc/Visual Command Reference/cat/show/projects/project_dependencies 2024-12-14 at 16.24.39@2x.png +0 -0
  69. pyegeria/commands/doc/Visual Command Reference/cat/show/projects/project_structure 2024-12-14 at 16.21.35@2x.png +0 -0
  70. pyegeria/commands/doc/Visual Command Reference/cat/show/projects/projects 2024-12-14 at 16.18.10@2x.png +0 -0
  71. pyegeria/commands/doc/Visual Command Reference/hey_egeria tui 2024-12-16 at 16.58.22@2x.png +0 -0
  72. pyegeria/commands/doc/Visual Command Reference/my/show/my_profile 2024-12-14 at 16.29.27@2x.png +0 -0
  73. pyegeria/commands/doc/Visual Command Reference/my/show/my_roles 2024-12-14 at 16.32.10@2x.png +0 -0
  74. pyegeria/commands/doc/Visual Command Reference/my/show/my_todos 2024-12-15 at 16.24.13@2x.png +0 -0
  75. pyegeria/commands/doc/Visual Command Reference/my/show/open_todos 2024-12-14 at 16.36.12@2x.png +0 -0
  76. pyegeria/commands/doc/Visual Command Reference/ops/show/engines/list_engine_activity compressed 2024-12-15 at 16.48.48@2x.png +0 -0
  77. pyegeria/commands/doc/Visual Command Reference/ops/show/engines/monitor_engine_activity 2024-12-15 at 16.32.55@2x.png +0 -0
  78. pyegeria/commands/doc/Visual Command Reference/ops/show/engines/monitor_engine_activity compressed 2024-12-15 at 16.38.29@2x.png +0 -0
  79. pyegeria/commands/doc/Visual Command Reference/ops/show/engines/monitor_engine_status 2024-12-15 at 16.51.26.jpeg +0 -0
  80. pyegeria/commands/doc/Visual Command Reference/ops/show/integrations/monitor_integration_daemon_status 2024-12-15 at 16.57.12@2x.png +0 -0
  81. pyegeria/commands/doc/Visual Command Reference/ops/show/integrations/monitor_integration_targets 2024-12-15 at 17.02.19@2x.png +0 -0
  82. pyegeria/commands/doc/Visual Command Reference/ops/show/platforms/monitor_platform_status 2024-12-15 at 19.53.18@2x.png +0 -0
  83. pyegeria/commands/doc/Visual Command Reference/ops/show/servers/monitor_server_status 2024-12-15 at 19.59.39@2x.png +0 -0
  84. pyegeria/commands/doc/Visual Command Reference/ops/show/servers/monitor_server_status full 2024-12-15 at 20.01.57@2x.png +0 -0
  85. pyegeria/commands/doc/Visual Command Reference/ops/show/servers/monitor_startup_servers 2024-12-15 at 19.56.07@2x.png +0 -0
  86. pyegeria/commands/doc/Visual Command Reference/tech/show/elements/get_anchored_elements 2024-12-15 at 21.25.41@2x.png +0 -0
  87. pyegeria/commands/doc/Visual Command Reference/tech/show/elements/get_elements_of_om_type 2024-12-16 at 14.39.59@2x.png +0 -0
  88. pyegeria/commands/doc/Visual Command Reference/tech/show/elements/info_for_guid 2024-12-16 at 11.35.29@2x.png +0 -0
  89. pyegeria/commands/doc/Visual Command Reference/tech/show/elements/list_elements_by_om-type 2024-12-16 at 14.24.18@2x.png +0 -0
  90. pyegeria/commands/doc/Visual Command Reference/tech/show/elements/list_elements_by_om-type extended 2024-12-16 at 14.28.46@2x.png +0 -0
  91. pyegeria/commands/doc/Visual Command Reference/tech/show/elements/list_elements_of_om_type_by_classification 2024-12-16 at 14.35.26@2x.png +0 -0
  92. pyegeria/commands/doc/Visual Command Reference/tech/show/elements/related_elements 2024-12-16 at 14.55.01@2x.png +0 -0
  93. pyegeria/commands/doc/Visual Command Reference/tech/show/elements/show_related_specifications 2024-12-16 at 15.04.55@2x.png +0 -0
  94. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/asset_types 2024-12-16 at 15.10.16@2x.png +0 -0
  95. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/detailed_governance_action_processes 2024-12-16 at 15.16.26@2x.png +0 -0
  96. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/governance_action_processes 2024-12-16 at 15.13.01@2x.png +0 -0
  97. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/registered_services 2024-12-16 at 16.44.54@2x.png +0 -0
  98. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/relationship_types 2024-12-16 at 16.20.34@2x.png +0 -0
  99. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/relationship_types 2024-12-19 at 10.51.54@2x.png +0 -0
  100. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/valid_metadata_values 2024-12-16 at 15.31.56@2x.png +0 -0
  101. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-types/list_tech_type_template_specs 2024-12-16 at 16.03.22@2x.png +0 -0
  102. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-types/list_technology_types 2024-12-16 at 15.39.20@2x.png +0 -0
  103. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-types/tech_type_details 2024-12-16 at 15.37.21@2x.png +0 -0
  104. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-types/tech_type_templates 2024-12-16 at 16.11.48@2x.png +0 -0
  105. pyegeria/commands/doc/glossary/basic-glossary-tui.md +109 -0
  106. pyegeria/commands/doc/glossary/images/delete-glossary-step1 2024-11-06 at 15.47.23@2x.png +0 -0
  107. pyegeria/commands/doc/glossary/images/delete-glossary-step2 2024-11-06 at 15.51.29@2x.png +0 -0
  108. pyegeria/commands/doc/glossary/images/delete-glossary-step3 2024-11-06 at 15.53.19@2x.png +0 -0
  109. pyegeria/commands/doc/glossary/images/delete-glossary-step4 2024-11-06 at 15.55.11@2x.png +0 -0
  110. pyegeria/commands/doc/glossary/images/out-create-glossary example 2024-11-05 at 20.38.04@2x.png +0 -0
  111. pyegeria/commands/doc/glossary/images/out-create-term 2024-11-06 at 20.48.29.png +0 -0
  112. pyegeria/commands/doc/glossary/images/out-delete-term 2024-11-07 at 03.57.25.png +0 -0
  113. pyegeria/commands/doc/glossary/images/out-display-terms-for-glossary-test 2024-11-06 at 20.51.28.png +0 -0
  114. pyegeria/commands/doc/glossary/images/out-export-example 2024-11-07 at 09.54.57.png +0 -0
  115. pyegeria/commands/doc/glossary/images/out-exported-terms 2024-11-06 at 21.06.32.png +0 -0
  116. pyegeria/commands/doc/glossary/images/out-glossary-list example 2024-11-05 at 20.41.02@2x.png +0 -0
  117. pyegeria/commands/doc/glossary/images/out-import-terms 2024-11-07 at 08.15.18.png +0 -0
  118. pyegeria/commands/doc/glossary/images/out-list-all-terms 2024-11-06 at 16.22.20@2x.png +0 -0
  119. pyegeria/commands/doc/glossary/images/out-list-terms-for-example 2024-11-06 at 16.40.12.png +0 -0
  120. pyegeria/commands/doc/glossary/images/out-list-terms-second 2024-11-06 at 16.45.13.png +0 -0
  121. pyegeria/commands/doc/glossary/images/out-pipx install pyegeria 2024-11-10 at 18.12.21.png +0 -0
  122. pyegeria/commands/doc/glossary/images/out-server-status-full 2024-11-10 at 18.25.14.png +0 -0
  123. pyegeria/commands/doc/glossary/images/out-servers-status 2024-11-10 at 18.15.42.png +0 -0
  124. pyegeria/commands/doc/glossary/images/out-upsert-import 2024-11-07 at 19.37.00.png +0 -0
  125. pyegeria/commands/doc/glossary/images/tui-2024-11-10 at 18.26.29.png +0 -0
  126. pyegeria/commands/doc/glossary/images/tui-create-glossary example 2024-11-05 at 20.34.24@2x.png +0 -0
  127. pyegeria/commands/doc/glossary/images/tui-create-term 2024-11-06 at 20.46.35.png +0 -0
  128. pyegeria/commands/doc/glossary/images/tui-delete-term 2024-11-07 at 03.51.57.png +0 -0
  129. pyegeria/commands/doc/glossary/images/tui-display-terms-for-example 2024-11-06 at 20.56.49.png +0 -0
  130. pyegeria/commands/doc/glossary/images/tui-export-example 2024-11-07 at 09.52.59.png +0 -0
  131. pyegeria/commands/doc/glossary/images/tui-hey-egeria 2024-11-10 at 18.31.01.png +0 -0
  132. pyegeria/commands/doc/glossary/images/tui-import-upsert-example 2024-11-07 at 10.08.37.png +0 -0
  133. pyegeria/commands/doc/glossary/images/tui-list-terms-second 2024-11-06 at 16.46.34.png +0 -0
  134. pyegeria/commands/doc/glossary/images/tui-load-archive.png +0 -0
  135. pyegeria/commands/doc/glossary/images/tui-server-status-full 2024-11-10 at 19.14.36.png +0 -0
  136. pyegeria/commands/doc/glossary/images/tui-show-glossaries 2024-11-07 at 20.00.05.png +0 -0
  137. pyegeria/commands/doc/glossary/images/tui-show-glossary-terms 2024-11-05 at 19.37.53@2x.png +0 -0
  138. pyegeria/commands/doc/glossary/images/tui-upsert 2024-11-07 at 11.49.04.png +0 -0
  139. pyegeria/commands/doc/glossary/images/upsert-example.om-terms 2024-11-07 at 11.44.05.png +0 -0
  140. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/README.md +346 -0
  141. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/CleanShot 2024-11-18 at 21.32.03@2x.png +0 -0
  142. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/Xmind 1731421782704.png +0 -0
  143. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/Xmind 1731422134920.png +0 -0
  144. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/hey_egeria 2024-11-12 at 20.38.43.png +0 -0
  145. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/hey_egeria cat 2024-11-12 at 21.41.43.png +0 -0
  146. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/out-integ-status-list 2024-11-12 at 16.45.26.png +0 -0
  147. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/out-integ-status-live 2024-11-12 at 16.44.12@2x.png +0 -0
  148. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/out-server-status 2024-11-10 at 18.15.42@2x.png +0 -0
  149. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/out-server-status-full 2024-11-10 at 18.25.14@2x.png +0 -0
  150. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/short-cut commands 2024-11-12 at 22.22.13.png +0 -0
  151. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/tui-hey-egeria.png +0 -0
  152. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/tui-integration-status-paging.png +0 -0
  153. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/tui-load-archive 2024-11-10 at 19.19.09@2x.png +0 -0
  154. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/tui-show-server-status 2024-11-10 at 18.52.01@2x.png +0 -0
  155. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/tui-show-server-status-full 2024-11-10.png +0 -0
  156. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/tui-status-paging 2024-11-12 at 16.26.14@2x.png +0 -0
  157. pyegeria/commands/my/README.md +17 -0
  158. pyegeria/commands/my/__init__.py +0 -0
  159. pyegeria/commands/my/list_my_profile.py +163 -0
  160. pyegeria/commands/my/list_my_roles.py +151 -0
  161. pyegeria/commands/my/monitor_my_todos.py +205 -0
  162. pyegeria/commands/my/monitor_open_todos.py +175 -0
  163. pyegeria/commands/my/todo_actions.py +242 -0
  164. pyegeria/commands/ops/README.md +24 -0
  165. pyegeria/commands/ops/__init__.py +22 -0
  166. pyegeria/commands/ops/gov_server_actions.py +177 -0
  167. pyegeria/commands/ops/list_archives.py +161 -0
  168. pyegeria/commands/ops/list_catalog_targets.py +203 -0
  169. pyegeria/commands/ops/load_archive.py +75 -0
  170. pyegeria/commands/ops/monitor_asset_events.py +107 -0
  171. pyegeria/commands/ops/monitor_engine_activity.py +270 -0
  172. pyegeria/commands/ops/monitor_engine_activity_c.py +286 -0
  173. pyegeria/commands/ops/monitor_gov_eng_status.py +288 -0
  174. pyegeria/commands/ops/monitor_integ_daemon_status.py +321 -0
  175. pyegeria/commands/ops/monitor_platform_status.py +188 -0
  176. pyegeria/commands/ops/monitor_server_startup.py +117 -0
  177. pyegeria/commands/ops/monitor_server_status.py +182 -0
  178. pyegeria/commands/ops/orig_monitor_server_list.py +140 -0
  179. pyegeria/commands/ops/orig_monitor_server_status.py +124 -0
  180. pyegeria/commands/ops/refresh_integration_daemon.py +83 -0
  181. pyegeria/commands/ops/restart_integration_daemon.py +82 -0
  182. pyegeria/commands/ops/table_integ_daemon_status.py +237 -0
  183. pyegeria/commands/ops/x_engine_actions.py +76 -0
  184. pyegeria/commands/tech/README.md +24 -0
  185. pyegeria/commands/tech/__init__.py +0 -0
  186. pyegeria/commands/tech/get_element_info.py +144 -0
  187. pyegeria/commands/tech/get_guid_info.py +134 -0
  188. pyegeria/commands/tech/get_tech_details.py +173 -0
  189. pyegeria/commands/tech/get_tech_type_template.py +166 -0
  190. pyegeria/commands/tech/list_anchored_elements.py +205 -0
  191. pyegeria/commands/tech/list_asset_types.py +123 -0
  192. pyegeria/commands/tech/list_elements.py +168 -0
  193. pyegeria/commands/tech/list_elements_for_classification.py +171 -0
  194. pyegeria/commands/tech/list_elements_x.py +191 -0
  195. pyegeria/commands/tech/list_gov_action_processes.py +139 -0
  196. pyegeria/commands/tech/list_registered_services.py +180 -0
  197. pyegeria/commands/tech/list_related_elements.py +207 -0
  198. pyegeria/commands/tech/list_related_specification.py +169 -0
  199. pyegeria/commands/tech/list_relationship_types.py +164 -0
  200. pyegeria/commands/tech/list_relationships.py +179 -0
  201. pyegeria/commands/tech/list_tech_templates.py +360 -0
  202. pyegeria/commands/tech/list_valid_metadata_values.py +178 -0
  203. pyegeria/commands/tech/table_tech_templates.py +238 -0
  204. pyegeria/commands/tech/x_list_related_elements.py +165 -0
  205. pyegeria/core_omag_server_config.py +550 -313
  206. pyegeria/create_tech_guid_lists.py +105 -0
  207. pyegeria/egeria_cat_client.py +78 -0
  208. pyegeria/egeria_client.py +117 -0
  209. pyegeria/egeria_config_client.py +45 -0
  210. pyegeria/egeria_my_client.py +56 -0
  211. pyegeria/egeria_tech_client.py +93 -0
  212. pyegeria/feedback_manager_omvs.py +4573 -0
  213. pyegeria/full_omag_server_config.py +1337 -0
  214. pyegeria/glossary_browser_omvs.py +2507 -0
  215. pyegeria/glossary_manager_omvs.py +3597 -0
  216. pyegeria/mermaid_utilities.py +218 -0
  217. pyegeria/metadata_explorer_omvs.py +2371 -0
  218. pyegeria/my_profile_omvs.py +1021 -0
  219. pyegeria/platform_services.py +259 -218
  220. pyegeria/project_manager_omvs.py +1854 -0
  221. pyegeria/registered_info.py +111 -108
  222. pyegeria/runtime_manager_omvs.py +2299 -0
  223. pyegeria/server_operations.py +178 -71
  224. pyegeria/template_manager_omvs.py +1414 -0
  225. pyegeria/utils.py +75 -85
  226. pyegeria/valid_metadata_omvs.py +1911 -0
  227. pyegeria/x_action_author_omvs.py +200 -0
  228. pyegeria-5.3.0.dev3.dist-info/METADATA +70 -0
  229. pyegeria-5.3.0.dev3.dist-info/RECORD +232 -0
  230. {pyegeria-0.2.4.dist-info → pyegeria-5.3.0.dev3.dist-info}/WHEEL +1 -1
  231. pyegeria-5.3.0.dev3.dist-info/entry_points.txt +81 -0
  232. pyegeria/config.toml +0 -11
  233. pyegeria/curation_omvs.py +0 -458
  234. pyegeria/exceptions.py +0 -382
  235. pyegeria/glossary_omvs.py +0 -639
  236. pyegeria/gov_engine.py +0 -573
  237. pyegeria-0.2.4.dist-info/METADATA +0 -57
  238. pyegeria-0.2.4.dist-info/RECORD +0 -19
  239. {pyegeria-0.2.4.dist-info/licenses → pyegeria-5.3.0.dev3.dist-info}/LICENSE +0 -0
@@ -0,0 +1,3597 @@
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_manager 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
+ import os
11
+ import time
12
+ import csv
13
+ from datetime import datetime
14
+ from typing import List
15
+
16
+ from pyegeria import InvalidParameterException
17
+
18
+ # import json
19
+ from pyegeria._client import Client
20
+ from pyegeria._validators import (
21
+ validate_name,
22
+ validate_guid,
23
+ validate_search_string,
24
+ )
25
+ from pyegeria.glossary_browser_omvs import GlossaryBrowser
26
+ from pyegeria.utils import body_slimmer
27
+
28
+
29
+ class GlossaryManager(GlossaryBrowser):
30
+ """
31
+ GlossaryManager is a class that extends the Client class. It provides methods to create and manage glossaries,
32
+ terms and categories.
33
+
34
+ Attributes:
35
+
36
+ view_server: str
37
+ The name of the View Server to connect to.
38
+ platform_url : str
39
+ URL of the server platform to connect to
40
+ user_id : str
41
+ The identity of the user calling the method - this sets a default optionally used by the methods
42
+ when the user doesn't pass the user_id on a method call.
43
+ user_pwd: str
44
+ The password associated with the user_id. Defaults to None
45
+
46
+
47
+ """
48
+
49
+ def __init__(
50
+ self,
51
+ view_server: str,
52
+ platform_url: str,
53
+ user_id: str,
54
+ user_pwd: str = None,
55
+ token: str = None,
56
+ ):
57
+ self.gl_mgr_command_root: str
58
+ self.view_server = view_server
59
+ self.platform_url = platform_url
60
+ self.user_id = user_id
61
+ self.user_pwd = user_pwd
62
+
63
+ Client.__init__(self, view_server, platform_url, user_id, user_pwd, token)
64
+
65
+ #
66
+ # Get Valid Values for Enumerations
67
+ #
68
+
69
+ def __validate_term_status__(self, status: str) -> bool:
70
+ """Return True if the status is a legal glossary term status"""
71
+ recognized_term_status = self.get_glossary_term_statuses()
72
+ return status in recognized_term_status
73
+
74
+ async def _async_create_glossary(
75
+ self,
76
+ display_name: str,
77
+ description: str,
78
+ language: str = "English",
79
+ usage: str = None,
80
+ ) -> str:
81
+ """Create a new glossary. Async version.
82
+
83
+ Parameters
84
+ ----------
85
+ display_name: str
86
+ The name of the new glossary. This will be used to produce a unique qualified name for the glossary.
87
+ description: str
88
+ A description of the glossary.
89
+ language: str, optional, default = "English"
90
+ The language the used for the glossary
91
+ usage: str, optional, default = None
92
+ How the glossary is intended to be used
93
+
94
+
95
+ Returns
96
+ -------
97
+ str
98
+ The GUID of the created glossary.
99
+
100
+ """
101
+
102
+ url = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries"
103
+ body = {
104
+ "class": "ReferenceableRequestBody",
105
+ "elementProperties": {
106
+ "class": "GlossaryProperties",
107
+ "qualifiedName": f"Glossary:{display_name}",
108
+ "displayName": display_name,
109
+ "description": description,
110
+ "language": language,
111
+ "usage": usage,
112
+ },
113
+ }
114
+ response = await self._async_make_request("POST", url, body_slimmer(body))
115
+ return response.json().get("guid", None)
116
+
117
+ def create_glossary(
118
+ self,
119
+ display_name: str,
120
+ description: str,
121
+ language: str = "English",
122
+ usage: str = None,
123
+ ) -> str:
124
+ """Create a new glossary.
125
+
126
+ Parameters
127
+ ----------
128
+ display_name: str
129
+ The name of the new glossary. This will be used to produce a unique qualified name for the glossary.
130
+ description: str
131
+ A description of the glossary.
132
+ language: str, optional, default = "English"
133
+ The language the used for the glossary
134
+ usage: str, optional, default = None
135
+ How the glossary is intended to be used
136
+
137
+
138
+ Returns
139
+ -------
140
+ str
141
+ The GUID of the created glossary.
142
+
143
+ """
144
+ loop = asyncio.get_event_loop()
145
+ response = loop.run_until_complete(
146
+ self._async_create_glossary(display_name, description, language, usage)
147
+ )
148
+ return response
149
+
150
+ async def _async_delete_glossary(self, glossary_guid: str) -> None:
151
+ """Delete glossary. Async version.
152
+
153
+ Parameters
154
+ ----------
155
+ glossary_guid: str
156
+ The ID of the glossary to delete.
157
+
158
+
159
+ Returns
160
+ -------
161
+ None
162
+
163
+ """
164
+
165
+ url = (
166
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
167
+ f"{glossary_guid}/remove"
168
+ )
169
+
170
+ await self._async_make_request("POST", url)
171
+ return
172
+
173
+ def delete_glossary(self, glossary_guid: str) -> None:
174
+ """Create a new glossary.
175
+
176
+ Parameters
177
+ ----------
178
+ glossary_guid: str
179
+ The ID of the glossary to delete.
180
+
181
+
182
+ Returns
183
+ -------
184
+ None
185
+
186
+ """
187
+ loop = asyncio.get_event_loop()
188
+ response = loop.run_until_complete(self._async_delete_glossary(glossary_guid))
189
+ return response
190
+
191
+ async def _async_update_glossary(
192
+ self,
193
+ glossary_guid: str,
194
+ body: dict,
195
+ is_merge_update: bool = True,
196
+ for_lineage: bool = False,
197
+ for_duplicate_processing: bool = False,
198
+ ) -> None:
199
+ """Update Glossary.
200
+
201
+ Async version.
202
+
203
+ Parameters
204
+ ----------
205
+ glossary_guid: str
206
+ The ID of the glossary to update.
207
+ body: dict
208
+ A dict containing the properties to update.
209
+ is_merge_update: bool, optional, default = True
210
+ If true, then only those properties specified in the body will be updated. If false, then all the
211
+ properties of the glossary will be replaced with those of the body.
212
+ for_lineage: bool, optional, default = False
213
+ Normally false. Used when we want to retrieve elements that have been delete but have a Memento entry.
214
+ for_duplicate_processing: bool, optional, default = False
215
+ Normally false. Set true when Egeria is told to skip deduplication because another system will do it.
216
+
217
+
218
+ Returns
219
+ -------
220
+ None
221
+
222
+ Notes
223
+ -----
224
+
225
+ Sample body:
226
+
227
+ {
228
+ "class" : "ReferenceableRequestBody",
229
+ "elementProperties" :
230
+ {
231
+ "class" : "GlossaryProperties",
232
+ "qualifiedName" : "MyGlossary",
233
+ "displayName" : "My Glossary",
234
+ "description" : "This is an example glossary"
235
+ }
236
+ }
237
+ """
238
+
239
+ url = (
240
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
241
+ f"{glossary_guid}/update?isMergeUpdate={is_merge_update}&forLineage={for_lineage}&"
242
+ f"forDuplicateProcessing={for_duplicate_processing}"
243
+ )
244
+
245
+ await self._async_make_request("POST", url, body_slimmer(body))
246
+ return
247
+
248
+ def update_glossary(
249
+ self,
250
+ glossary_guid: str,
251
+ body: dict,
252
+ is_merge_update: bool = True,
253
+ for_lineage: bool = False,
254
+ for_duplicate_processing: bool = False,
255
+ ) -> None:
256
+ """Update Glossary.
257
+
258
+ Parameters
259
+ ----------
260
+ glossary_guid: str
261
+ The ID of the glossary to update.
262
+ body: dict
263
+ A dict containing the properties to update.
264
+ is_merge_update: bool, optional, default = True
265
+ If true, then only those properties specified in the body will be updated. If false, then all the
266
+ properties of the glossary will be replaced with those of the body.
267
+ for_lineage: bool, optional, default = False
268
+ Normally false. Used when we want to retrieve elements that have been delete but have a Memento entry.
269
+ for_duplicate_processing: bool, optional, default = False
270
+ Normally false. Set true when Egeria is told to skip deduplication because another system will do it.
271
+
272
+
273
+ Returns
274
+ -------
275
+ None
276
+
277
+ Notes
278
+ -----
279
+
280
+ Sample body:
281
+
282
+ {
283
+ "class" : "ReferenceableRequestBody",
284
+ "elementProperties" :
285
+ {
286
+ "class" : "GlossaryProperties",
287
+ "qualifiedName" : "MyGlossary",
288
+ "displayName" : "My Glossary",
289
+ "description" : "This is an example glossary"
290
+ }
291
+ }
292
+ """
293
+ loop = asyncio.get_event_loop()
294
+ loop.run_until_complete(
295
+ self._async_update_glossary(
296
+ glossary_guid,
297
+ body,
298
+ is_merge_update,
299
+ for_lineage,
300
+ for_duplicate_processing,
301
+ )
302
+ )
303
+ return
304
+
305
+ #
306
+ # Glossaries
307
+ #
308
+
309
+ async def _async_find_glossaries(
310
+ self,
311
+ search_string: str,
312
+ effective_time: str = None,
313
+ starts_with: bool = False,
314
+ ends_with: bool = False,
315
+ ignore_case: bool = False,
316
+ for_lineage: bool = False,
317
+ for_duplicate_processing: bool = False,
318
+ type_name: str = None,
319
+ start_from: int = 0,
320
+ page_size: int = None,
321
+ ) -> list | str:
322
+ """Retrieve the list of glossary metadata elements that contain the search string. Async version.
323
+ The search string is located in the request body and is interpreted as a plain string.
324
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
325
+
326
+ Parameters
327
+ ----------
328
+ search_string: str,
329
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
330
+
331
+ effective_time: str, [default=None], optional
332
+ Effective time of the query. If not specified will default to any time. Time format is
333
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
334
+
335
+ starts_with : bool, [default=False], optional
336
+ Starts with the supplied string.
337
+ ends_with : bool, [default=False], optional
338
+ Ends with the supplied string
339
+ ignore_case : bool, [default=False], optional
340
+ Ignore case when searching
341
+ for_lineage : bool, [default=False], optional
342
+
343
+ for_duplicate_processing : bool, [default=False], optional
344
+ type_name: str, [default=None], optional
345
+ An optional parameter indicating the subtype of the glossary to filter by.
346
+ Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
347
+ start_from: int, [default=0], optional
348
+ When multiple pages of results are available, the page number to start from.
349
+ page_size: int, [default=None]
350
+ The number of items to return in a single page. If not specified, the default will be taken from
351
+ the class instance.
352
+ Returns
353
+ -------
354
+ List | str
355
+
356
+ A list of glossary definitions active in the server.
357
+
358
+ Raises
359
+ ------
360
+
361
+ InvalidParameterException
362
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
363
+ PropertyServerException
364
+ Raised by the server when an issue arises in processing a valid request
365
+ NotAuthorizedException
366
+ The principle specified by the user_id does not have authorization for the requested action
367
+
368
+ """
369
+
370
+ if page_size is None:
371
+ page_size = self.page_size
372
+ starts_with_s = str(starts_with).lower()
373
+ ends_with_s = str(ends_with).lower()
374
+ ignore_case_s = str(ignore_case).lower()
375
+ for_lineage_s = str(for_lineage).lower()
376
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
377
+
378
+ validate_search_string(search_string)
379
+
380
+ if search_string == "*":
381
+ search_string = None
382
+
383
+ body = {
384
+ "class": "SearchStringRequestBody",
385
+ "searchString": search_string,
386
+ "effectiveTime": effective_time,
387
+ "typeName": type_name,
388
+ }
389
+ body = body_slimmer(body)
390
+ # print(f"\n\nBody is: \n{body}")
391
+
392
+ url = (
393
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
394
+ f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
395
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
396
+ f"forDuplicateProcessing={for_duplicate_processing_s}"
397
+ )
398
+
399
+ response = await self._async_make_request("POST", url, body)
400
+ return response.json().get("elementList", "No Glossaries found")
401
+
402
+ def find_glossaries(
403
+ self,
404
+ search_string: str,
405
+ effective_time: str = None,
406
+ starts_with: bool = False,
407
+ ends_with: bool = False,
408
+ ignore_case: bool = False,
409
+ for_lineage: bool = False,
410
+ for_duplicate_processing: bool = False,
411
+ type_name: str = None,
412
+ start_from: int = 0,
413
+ page_size: int = None,
414
+ ) -> list | str:
415
+ """Retrieve the list of glossary metadata elements that contain the search string.
416
+ The search string is located in the request body and is interpreted as a plain string.
417
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
418
+
419
+ Parameters
420
+ ----------
421
+ search_string: str,
422
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
423
+
424
+ effective_time: str, [default=None], optional
425
+ Effective time of the query. If not specified will default to any time. Time format is
426
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
427
+
428
+ starts_with : bool, [default=False], optional
429
+ Starts with the supplied string.
430
+ ends_with : bool, [default=False], optional
431
+ Ends with the supplied string
432
+ ignore_case : bool, [default=False], optional
433
+ Ignore case when searching
434
+ for_lineage : bool, [default=False], optional
435
+ Indicates the search is for lineage.
436
+ for_duplicate_processing : bool, [default=False], optional
437
+ type_name: str, [default=None], optional
438
+ An optional parameter indicating the subtype of the glossary to filter by.
439
+ Values include 'ControlledGlossary', 'EditingGlossary', and 'StagingGlossary'
440
+ start_from: int, [default=0], optional
441
+ When multiple pages of results are available, the page number to start from.
442
+ page_size: int, [default=None]
443
+ The number of items to return in a single page. If not specified, the default will be taken from
444
+ the class instance.
445
+ Returns
446
+ -------
447
+ List | str
448
+
449
+ A list of glossary definitions active in the server.
450
+
451
+ Raises
452
+ ------
453
+
454
+ InvalidParameterException
455
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
456
+ PropertyServerException
457
+ Raised by the server when an issue arises in processing a valid request
458
+ NotAuthorizedException
459
+ The principle specified by the user_id does not have authorization for the requested action
460
+
461
+ """
462
+ loop = asyncio.get_event_loop()
463
+ response = loop.run_until_complete(
464
+ self._async_find_glossaries(
465
+ search_string,
466
+ effective_time,
467
+ starts_with,
468
+ ends_with,
469
+ ignore_case,
470
+ for_lineage,
471
+ for_duplicate_processing,
472
+ type_name,
473
+ start_from,
474
+ page_size,
475
+ )
476
+ )
477
+
478
+ return response
479
+
480
+ async def _async_get_glossaries_by_name(
481
+ self,
482
+ glossary_name: str,
483
+ effective_time: str = None,
484
+ start_from: int = 0,
485
+ page_size: int = None,
486
+ ) -> dict | str:
487
+ """Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
488
+ There are no wildcards supported on this request.
489
+
490
+ Parameters
491
+ ----------
492
+ glossary_name: str,
493
+ Name of the glossary to be retrieved
494
+ effective_time: datetime, [default=None], optional
495
+ Effective time of the query. If not specified will default to any effective time. Time format is
496
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
497
+
498
+ start_from: int, [default=0], optional
499
+ When multiple pages of results are available, the page number to start from.
500
+ page_size: int, [default=None]
501
+ The number of items to return in a single page. If not specified, the default will be taken from
502
+ the class instance.
503
+
504
+ Returns
505
+ -------
506
+ None
507
+
508
+ Raises
509
+ ------
510
+
511
+ InvalidParameterException
512
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
513
+ PropertyServerException
514
+ Raised by the server when an issue arises in processing a valid request
515
+ NotAuthorizedException
516
+ The principle specified by the user_id does not have authorization for the requested action
517
+ ConfigurationErrorException
518
+ Raised when configuration parameters passed on earlier calls turn out to be
519
+ invalid or make the new call invalid.
520
+ """
521
+
522
+ if page_size is None:
523
+ page_size = self.page_size
524
+ validate_name(glossary_name)
525
+
526
+ if effective_time is None:
527
+ body = {"name": glossary_name}
528
+ else:
529
+ body = {"name": glossary_name, "effectiveTime": effective_time}
530
+
531
+ url = (
532
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
533
+ f"by-name?startFrom={start_from}&pageSize={page_size}"
534
+ )
535
+
536
+ response = await self._async_make_request("POST", url, body)
537
+ return response.json().get("elementList", "No glossaries found")
538
+
539
+ def get_glossaries_by_name(
540
+ self,
541
+ glossary_name: str,
542
+ effective_time: str = None,
543
+ start_from: int = 0,
544
+ page_size: int = None,
545
+ ) -> dict | str:
546
+ """Retrieve the list of glossary metadata elements with an exactly matching qualified or display name.
547
+ There are no wildcards supported on this request.
548
+
549
+ Parameters
550
+ ----------
551
+ glossary_name: str,
552
+ Name of the glossary to be retrieved
553
+ effective_time: datetime, [default=None], optional
554
+ Effective time of the query. If not specified will default to any effective time.
555
+
556
+ start_from: int, [default=0], optional
557
+ When multiple pages of results are available, the page number to start from.
558
+ page_size: int, [default=None]
559
+ The number of items to return in a single page. If not specified, the default will be taken from
560
+ he class instance.
561
+
562
+ Returns
563
+ -------
564
+ None
565
+
566
+ Raises
567
+ ------
568
+ InvalidParameterException
569
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
570
+ PropertyServerException
571
+ Raised by the server when an issue arises in processing a valid request
572
+ NotAuthorizedException
573
+ The principle specified by the user_id does not have authorization for the requested action
574
+ ConfigurationErrorException
575
+ Raised when configuration parameters passed on earlier calls turn out to be
576
+ invalid or make the new call invalid.
577
+ """
578
+ loop = asyncio.get_event_loop()
579
+ response = loop.run_until_complete(
580
+ self._async_get_glossaries_by_name(
581
+ glossary_name, effective_time, start_from, page_size
582
+ )
583
+ )
584
+ return response
585
+
586
+ #
587
+ # Glossary Categories
588
+ #
589
+ async def _async_create_category(
590
+ self,
591
+ glossary_guid: str,
592
+ display_name: str,
593
+ description: str,
594
+ ) -> str:
595
+ """Create a new category within the specified glossary. Async Version.
596
+
597
+ Parameters
598
+ ----------
599
+ glossary_guid: str,
600
+ Unique identifier for the glossary.
601
+ display_name: str,
602
+ Display name for the glossary category. Will be used as the base for a constructed unique qualified name.
603
+ description: str,
604
+ Description for the category.
605
+
606
+
607
+ Returns
608
+ -------
609
+ A string with the GUID of the new category..
610
+
611
+ Raises
612
+ ------
613
+
614
+ InvalidParameterException
615
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
616
+ PropertyServerException
617
+ Raised by the server when an issue arises in processing a valid request
618
+ NotAuthorizedException
619
+ The principle specified by the user_id does not have authorization for the requested action
620
+ ConfigurationErrorException
621
+ Raised when configuration parameters passed on earlier calls turn out to be
622
+ invalid or make the new call invalid.
623
+ """
624
+
625
+ url = (
626
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
627
+ f"{glossary_guid}/categories"
628
+ )
629
+ body = {
630
+ "class": "ReferenceableRequestBody",
631
+ "elementProperties": {
632
+ "class": "GlossaryCategoryProperties",
633
+ "qualifiedName": f"GlossaryCategory-{display_name}-{time.asctime()}",
634
+ "displayName": display_name,
635
+ "description": description,
636
+ },
637
+ }
638
+ response = await self._async_make_request("POST", url, body)
639
+ return response.json().get("guid", None)
640
+
641
+ def create_category(
642
+ self,
643
+ glossary_guid: str,
644
+ display_name: str,
645
+ description: str,
646
+ ) -> str:
647
+ """Create a new category within the specified glossary.
648
+
649
+ Parameters
650
+ ----------
651
+ glossary_guid: str,
652
+ Unique identifier for the glossary.
653
+ display_name: str,
654
+ Display name for the glossary category. Will be used as the base for a constructed unique qualified name.
655
+ description: str,
656
+ Description for the category.
657
+
658
+
659
+ Returns
660
+ -------
661
+ A string with the GUID of the new category..
662
+
663
+ Raises
664
+ ------
665
+
666
+ InvalidParameterException
667
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
668
+ PropertyServerException
669
+ Raised by the server when an issue arises in processing a valid request
670
+ NotAuthorizedException
671
+ The principle specified by the user_id does not have authorization for the requested action
672
+ ConfigurationErrorException
673
+ Raised when configuration parameters passed on earlier calls turn out to be
674
+ invalid or make the new call invalid.
675
+ """
676
+ loop = asyncio.get_event_loop()
677
+ response = loop.run_until_complete(
678
+ self._async_create_category(glossary_guid, display_name, description)
679
+ )
680
+ return response
681
+
682
+ async def _async_get_glossary_for_category(
683
+ self,
684
+ glossary_category_guid: str,
685
+ effective_time: str = None,
686
+ ) -> dict | str:
687
+ """Retrieve the glossary metadata element for the requested category. The optional request body allows you to
688
+ specify that the glossary element should only be returned if it was effective at a particular time.
689
+
690
+ Parameters
691
+ ----------
692
+ glossary_category_guid: str,
693
+ Unique identifier for the glossary category.
694
+ effective_time: datetime, [default=None], optional
695
+ Effective time of the query. If not specified will default to any effective time. Time format is
696
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
697
+
698
+
699
+ Returns
700
+ -------
701
+ A dict structure with the glossary metadata element for the requested category.
702
+
703
+ Raises
704
+ ------
705
+
706
+ InvalidParameterException
707
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
708
+ PropertyServerException
709
+ Raised by the server when an issue arises in processing a valid request
710
+ NotAuthorizedException
711
+ The principle specified by the user_id does not have authorization for the requested action
712
+ ConfigurationErrorException
713
+ Raised when configuration parameters passed on earlier calls turn out to be
714
+ invalid or make the new call invalid.
715
+ """
716
+
717
+ body = {
718
+ "class": "EffectiveTimeQueryRequestBody",
719
+ "effectiveTime": effective_time,
720
+ }
721
+
722
+ url = (
723
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
724
+ f"for-category/{glossary_category_guid}/retrieve"
725
+ )
726
+
727
+ response = await self._async_make_request("POST", url, body)
728
+ return response.json()
729
+
730
+ def get_glossary_for_category(
731
+ self,
732
+ glossary_category_guid: str,
733
+ effective_time: str = None,
734
+ ) -> dict | str:
735
+ """Retrieve the glossary metadata element for the requested category. The optional request body allows you to
736
+ specify that the glossary element should only be returned if it was effective at a particular time.
737
+
738
+ Parameters
739
+ ----------
740
+ glossary_category_guid: str,
741
+ Unique identifier for the glossary category.
742
+ effective_time: datetime, [default=None], optional
743
+ Effective time of the query. If not specified will default to any effective time. Time format is
744
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
745
+
746
+
747
+ Returns
748
+ -------
749
+ A dict structure with the glossary metadata element for the requested category.
750
+
751
+ Raises
752
+ ------
753
+
754
+ InvalidParameterException
755
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
756
+ PropertyServerException
757
+ Raised by the server when an issue arises in processing a valid request
758
+ NotAuthorizedException
759
+ The principle specified by the user_id does not have authorization for the requested action
760
+ ConfigurationErrorException
761
+ Raised when configuration parameters passed on earlier calls turn out to be
762
+ invalid or make the new call invalid.
763
+ """
764
+ loop = asyncio.get_event_loop()
765
+ response = loop.run_until_complete(
766
+ self._async_get_glossary_for_category(
767
+ glossary_category_guid, effective_time
768
+ )
769
+ )
770
+ return response
771
+
772
+ async def _async_find_glossary_categories(
773
+ self,
774
+ search_string: str,
775
+ effective_time: str = None,
776
+ starts_with: bool = False,
777
+ ends_with: bool = False,
778
+ ignore_case: bool = False,
779
+ start_from: int = 0,
780
+ page_size: int = None,
781
+ ) -> list | str:
782
+ """Retrieve the list of glossary category metadata elements that contain the search string.
783
+ The search string is located in the request body and is interpreted as a plain string.
784
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
785
+ Async version.
786
+
787
+ Parameters
788
+ ----------
789
+ search_string: str,
790
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
791
+
792
+ effective_time: str, [default=None], optional
793
+ Effective time of the query. If not specified will default to any time. Time format is
794
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
795
+
796
+ starts_with : bool, [default=False], optional
797
+ Starts with the supplied string.
798
+ ends_with : bool, [default=False], optional
799
+ Ends with the supplied string
800
+ ignore_case : bool, [default=False], optional
801
+ Ignore case when searching
802
+ start_from: int, [default=0], optional
803
+ When multiple pages of results are available, the page number to start from.
804
+ page_size: int, [default=None]
805
+ The number of items to return in a single page. If not specified, the default will be taken from
806
+ the class instance.
807
+ Returns
808
+ -------
809
+ List | str
810
+
811
+ A list of glossary definitions active in the server.
812
+
813
+ Raises
814
+ ------
815
+
816
+ InvalidParameterException
817
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
818
+ PropertyServerException
819
+ Raised by the server when an issue arises in processing a valid request
820
+ NotAuthorizedException
821
+ The principle specified by the user_id does not have authorization for the requested action
822
+
823
+ """
824
+
825
+ if page_size is None:
826
+ page_size = self.page_size
827
+ starts_with_s = str(starts_with).lower()
828
+ ends_with_s = str(ends_with).lower()
829
+ ignore_case_s = str(ignore_case).lower()
830
+
831
+ validate_search_string(search_string)
832
+
833
+ if search_string == "*":
834
+ search_string = None
835
+
836
+ body = {
837
+ "class": "SearchStringRequestBody",
838
+ "searchString": search_string,
839
+ "effectiveTime": effective_time,
840
+ }
841
+ body = body_slimmer(body)
842
+
843
+ url = (
844
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
845
+ f"categories/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
846
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}"
847
+ )
848
+
849
+ response = await self._async_make_request("POST", url, body)
850
+ return response.json().get("elementList", "No Categories found")
851
+
852
+ def find_glossary_categories(
853
+ self,
854
+ search_string: str,
855
+ effective_time: str = None,
856
+ starts_with: bool = False,
857
+ ends_with: bool = False,
858
+ ignore_case: bool = False,
859
+ start_from: int = 0,
860
+ page_size: int = None,
861
+ ) -> list | str:
862
+ """Retrieve the list of glossary category metadata elements that contain the search string.
863
+ The search string is located in the request body and is interpreted as a plain string.
864
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
865
+
866
+ Parameters
867
+ ----------
868
+ search_string: str,
869
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
870
+
871
+ effective_time: str, [default=None], optional
872
+ Effective time of the query. If not specified will default to any time. Time format is
873
+ "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
874
+
875
+ starts_with : bool, [default=False], optional
876
+ Starts with the supplied string.
877
+ ends_with : bool, [default=False], optional
878
+ Ends with the supplied string
879
+ ignore_case : bool, [default=False], optional
880
+ Ignore case when searching
881
+ start_from: int, [default=0], optional
882
+ When multiple pages of results are available, the page number to start from.
883
+ page_size: int, [default=None]
884
+ The number of items to return in a single page. If not specified, the default will be taken from
885
+ the class instance.
886
+ Returns
887
+ -------
888
+ List | str
889
+
890
+ A list of glossary definitions active in the server.
891
+
892
+ Raises
893
+ ------
894
+
895
+ InvalidParameterException
896
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
897
+ PropertyServerException
898
+ Raised by the server when an issue arises in processing a valid request
899
+ NotAuthorizedException
900
+ The principle specified by the user_id does not have authorization for the requested action
901
+
902
+ """
903
+ loop = asyncio.get_event_loop()
904
+ response = loop.run_until_complete(
905
+ self._async_find_glossary_categories(
906
+ search_string,
907
+ effective_time,
908
+ starts_with,
909
+ ends_with,
910
+ ignore_case,
911
+ start_from,
912
+ page_size,
913
+ )
914
+ )
915
+
916
+ return response
917
+
918
+ async def _async_get_categories_for_glossary(
919
+ self,
920
+ glossary_guid: str,
921
+ start_from: int = 0,
922
+ page_size: int = None,
923
+ ) -> list | str:
924
+ """Return the list of categories associated with a glossary.
925
+ Async version.
926
+
927
+ Parameters
928
+ ----------
929
+ glossary_guid: str,
930
+ Unique identity of the glossary
931
+
932
+ start_from: int, [default=0], optional
933
+ When multiple pages of results are available, the page number to start from.
934
+ page_size: int, [default=None]
935
+ The number of items to return in a single page. If not specified, the default will be taken from
936
+ the class instance.
937
+ Returns
938
+ -------
939
+ List | str
940
+
941
+ A list of categories associated with a glossary.
942
+
943
+ Raises
944
+ ------
945
+
946
+ InvalidParameterException
947
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
948
+ PropertyServerException
949
+ Raised by the server when an issue arises in processing a valid request
950
+ NotAuthorizedException
951
+ The principle specified by the user_id does not have authorization for the requested action
952
+
953
+ """
954
+
955
+ if page_size is None:
956
+ page_size = self.page_size
957
+
958
+ url = (
959
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
960
+ f"{glossary_guid}/categories/retrieve?startFrom={start_from}&pageSize={page_size}"
961
+ )
962
+
963
+ response = await self._async_make_request("POST", url)
964
+ return response.json().get("elementList", "No Categories found")
965
+
966
+ def get_categories_for_glossary(
967
+ self,
968
+ glossary_guid: str,
969
+ start_from: int = 0,
970
+ page_size: int = None,
971
+ ) -> list | str:
972
+ """Return the list of categories associated with a glossary.
973
+
974
+ Parameters
975
+ ----------
976
+ glossary_guid: str,
977
+ Unique identity of the glossary
978
+
979
+ start_from: int, [default=0], optional
980
+ When multiple pages of results are available, the page number to start from.
981
+ page_size: int, [default=None]
982
+ The number of items to return in a single page. If not specified, the default will be taken from
983
+ the class instance.
984
+ Returns
985
+ -------
986
+ List | str
987
+
988
+ A list of categories associated with a glossary.
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
+ loop = asyncio.get_event_loop()
1002
+ response = loop.run_until_complete(
1003
+ self._async_get_categories_for_glossary(
1004
+ glossary_guid, start_from, page_size
1005
+ )
1006
+ )
1007
+ return response
1008
+
1009
+ async def _async_get_categories_for_term(
1010
+ self,
1011
+ glossary_term_guid: str,
1012
+ start_from: int = 0,
1013
+ page_size: int = None,
1014
+ ) -> list | str:
1015
+ """Return the list of categories associated with a glossary term.
1016
+ Async version.
1017
+
1018
+ Parameters
1019
+ ----------
1020
+ glossary_term_guid: str,
1021
+ Unique identity of a glossary term
1022
+
1023
+ start_from: int, [default=0], optional
1024
+ When multiple pages of results are available, the page number to start from.
1025
+ page_size: int, [default=None]
1026
+ The number of items to return in a single page. If not specified, the default will be taken from
1027
+ the class instance.
1028
+ Returns
1029
+ -------
1030
+ List | str
1031
+
1032
+ A list of categories associated with a glossary term.
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
+
1046
+ if page_size is None:
1047
+ page_size = self.page_size
1048
+
1049
+ url = (
1050
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/terms/"
1051
+ f"{glossary_term_guid}/categories/retrieve?startFrom={start_from}&pageSize={page_size}"
1052
+ )
1053
+
1054
+ response = await self._async_make_request("POST", url)
1055
+ return response.json().get("elementList", "No Categories found")
1056
+
1057
+ def get_categories_for_term(
1058
+ self,
1059
+ glossary_term_guid: str,
1060
+ start_from: int = 0,
1061
+ page_size: int = None,
1062
+ ) -> list | str:
1063
+ """Return the list of categories associated with a glossary term.
1064
+
1065
+ Parameters
1066
+ ----------
1067
+ glossary_term_guid: str,
1068
+ Unique identity of a glossary term
1069
+
1070
+ start_from: int, [default=0], optional
1071
+ When multiple pages of results are available, the page number to start from.
1072
+ page_size: int, [default=None]
1073
+ The number of items to return in a single page. If not specified, the default will be taken from
1074
+ the class instance.
1075
+ Returns
1076
+ -------
1077
+ List | str
1078
+
1079
+ A list of categories associated with a glossary term.
1080
+
1081
+ Raises
1082
+ ------
1083
+
1084
+ InvalidParameterException
1085
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1086
+ PropertyServerException
1087
+ Raised by the server when an issue arises in processing a valid request
1088
+ NotAuthorizedException
1089
+ The principle specified by the user_id does not have authorization for the requested action
1090
+
1091
+ """
1092
+ loop = asyncio.get_event_loop()
1093
+ response = loop.run_until_complete(
1094
+ self._async_get_categories_for_term(
1095
+ glossary_term_guid, start_from, page_size
1096
+ )
1097
+ )
1098
+ return response
1099
+
1100
+ async def _async_get_categories_by_name(
1101
+ self,
1102
+ name: str,
1103
+ glossary_guid: str = None,
1104
+ status: [str] = ["ACTIVE"],
1105
+ start_from: int = 0,
1106
+ page_size: int = None,
1107
+ ) -> list | str:
1108
+ """Retrieve the list of glossary category metadata elements that either have the requested qualified name or display name.
1109
+ The name to search for is located in the request body and is interpreted as a plain string.
1110
+ The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
1111
+
1112
+ Async version.
1113
+
1114
+ Parameters
1115
+ ----------
1116
+ name: str,
1117
+ category name to search for.
1118
+ glossary_guid: str, optional
1119
+ The identity of the glossary to search. If not specified, all glossaries will be searched.
1120
+ status: [str], optional
1121
+ A list of statuses to optionally restrict results. Default is Active
1122
+
1123
+ start_from: int, [default=0], optional
1124
+ When multiple pages of results are available, the page number to start from.
1125
+ page_size: int, [default=None]
1126
+ The number of items to return in a single page. If not specified, the default will be taken from
1127
+ the class instance.
1128
+ Returns
1129
+ -------
1130
+ List | str
1131
+
1132
+ A list of categories with the corresponding display name or qualified name.
1133
+
1134
+ Raises
1135
+ ------
1136
+
1137
+ InvalidParameterException
1138
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1139
+ PropertyServerException
1140
+ Raised by the server when an issue arises in processing a valid request
1141
+ NotAuthorizedException
1142
+ The principle specified by the user_id does not have authorization for the requested action
1143
+
1144
+ """
1145
+
1146
+ if page_size is None:
1147
+ page_size = self.page_size
1148
+ validate_name(name)
1149
+
1150
+ url = (
1151
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/categories/"
1152
+ f"by-name?startFrom={start_from}&pageSize={page_size}"
1153
+ )
1154
+
1155
+ body = {
1156
+ "class": "GlossaryNameRequestBody",
1157
+ "name": name,
1158
+ "glossaryGUID": glossary_guid,
1159
+ "limitResultsByStatus": status,
1160
+ }
1161
+
1162
+ response = await self._async_make_request("POST", url)
1163
+ return response.json().get("elementList", "No Categories found")
1164
+
1165
+ def get_categories_by_name(
1166
+ self,
1167
+ name: str,
1168
+ glossary_guid: str = None,
1169
+ status: [str] = ["ACTIVE"],
1170
+ start_from: int = 0,
1171
+ page_size: int = None,
1172
+ ) -> list | str:
1173
+ """Retrieve the list of glossary category metadata elements that either have the requested qualified name or display name.
1174
+ The name to search for is located in the request body and is interpreted as a plain string.
1175
+ The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
1176
+
1177
+ Parameters
1178
+ ----------
1179
+ name: str,
1180
+ category name to search for.
1181
+ glossary_guid: str, optional
1182
+ The identity of the glossary to search. If not specified, all glossaries will be searched.
1183
+ status: [str], optional
1184
+ A list of statuses to optionally restrict results. Default is Active
1185
+
1186
+ start_from: int, [default=0], optional
1187
+ When multiple pages of results are available, the page number to start from.
1188
+ page_size: int, [default=None]
1189
+ The number of items to return in a single page. If not specified, the default will be taken from
1190
+ the class instance.
1191
+ Returns
1192
+ -------
1193
+ List | str
1194
+
1195
+ A list of categories with the corresponding display name or qualified name.
1196
+
1197
+ Raises
1198
+ ------
1199
+
1200
+ InvalidParameterException
1201
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1202
+ PropertyServerException
1203
+ Raised by the server when an issue arises in processing a valid request
1204
+ NotAuthorizedException
1205
+ The principle specified by the user_id does not have authorization for the requested action
1206
+
1207
+ """
1208
+ loop = asyncio.get_event_loop()
1209
+ response = loop.run_until_complete(
1210
+ self._async_get_categories_by_name(
1211
+ name, glossary_guid, status, start_from, page_size
1212
+ )
1213
+ )
1214
+ return response
1215
+
1216
+ async def _async_get_categories_by_guid(
1217
+ self,
1218
+ glossary_category_guid: str,
1219
+ effective_time: str = None,
1220
+ ) -> list | str:
1221
+ """Retrieve the requested glossary category metadata element. The optional request body contain an effective
1222
+ time for the query..
1223
+
1224
+ Async version.
1225
+
1226
+ Parameters
1227
+ ----------
1228
+ glossary_category_guid: str
1229
+ The identity of the glossary category to search.
1230
+ effective_time: str, optional
1231
+ If specified, the category should only be returned if it was effective at the specified time.
1232
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1233
+
1234
+
1235
+ Returns
1236
+ -------
1237
+ List | str
1238
+
1239
+ Details for the category with the glossary category GUID.
1240
+
1241
+ Raises
1242
+ ------
1243
+
1244
+ InvalidParameterException
1245
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1246
+ PropertyServerException
1247
+ Raised by the server when an issue arises in processing a valid request
1248
+ NotAuthorizedException
1249
+ The principle specified by the user_id does not have authorization for the requested action
1250
+
1251
+ """
1252
+
1253
+ url = (
1254
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/categories/"
1255
+ f"{glossary_category_guid}/retrieve"
1256
+ )
1257
+
1258
+ body = {
1259
+ "class": "EffectiveTimeQueryRequestBody",
1260
+ "effectiveTime": effective_time,
1261
+ }
1262
+
1263
+ response = await self._async_make_request("POST", url, body)
1264
+ return response.json().get("element", "No Category found")
1265
+
1266
+ def get_categories_by_guid(
1267
+ self,
1268
+ glossary_category_guid: str,
1269
+ effective_time: str = None,
1270
+ ) -> list | str:
1271
+ """Retrieve the requested glossary category metadata element. The optional request body contain an effective
1272
+ time for the query..
1273
+
1274
+ Parameters
1275
+ ----------
1276
+ glossary_category_guid: str
1277
+ The identity of the glossary category to search.
1278
+ effective_time, datetime, optional
1279
+ If specified, the category should only be returned if it was effective at the specified time.
1280
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1281
+
1282
+
1283
+ Returns
1284
+ -------
1285
+ List | str
1286
+
1287
+ Details for the category with the glossary category GUID.
1288
+
1289
+ Raises
1290
+ ------
1291
+
1292
+ InvalidParameterException
1293
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1294
+ PropertyServerException
1295
+ Raised by the server when an issue arises in processing a valid request
1296
+ NotAuthorizedException
1297
+ The principle specified by the user_id does not have authorization for the requested action
1298
+
1299
+ """
1300
+ loop = asyncio.get_event_loop()
1301
+ response = loop.run_until_complete(
1302
+ self._async_get_categories_by_guid(glossary_category_guid, effective_time)
1303
+ )
1304
+ return response
1305
+
1306
+ async def _async_get_category_parent(
1307
+ self,
1308
+ glossary_category_guid: str,
1309
+ effective_time: str = None,
1310
+ ) -> list | str:
1311
+ """Glossary categories can be organized in a hierarchy. Retrieve the parent glossary category metadata
1312
+ element for the glossary category with the supplied unique identifier. If the requested category
1313
+ does not have a parent category, null is returned. The optional request body contain an effective time
1314
+ for the query.
1315
+
1316
+ Async version.
1317
+
1318
+ Parameters
1319
+ ----------
1320
+ glossary_category_guid: str
1321
+ The identity of the glossary category to search.
1322
+ effective_time, datetime, optional
1323
+ If specified, the category should only be returned if it was effective at the specified time.
1324
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1325
+
1326
+
1327
+ Returns
1328
+ -------
1329
+ List | str
1330
+
1331
+ Details for the parent category with the glossary category GUID.
1332
+
1333
+ Raises
1334
+ ------
1335
+
1336
+ InvalidParameterException
1337
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1338
+ PropertyServerException
1339
+ Raised by the server when an issue arises in processing a valid request
1340
+ NotAuthorizedException
1341
+ The principle specified by the user_id does not have authorization for the requested action
1342
+
1343
+ """
1344
+
1345
+ url = (
1346
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/categories/"
1347
+ f"{glossary_category_guid}/parent/retrieve"
1348
+ )
1349
+
1350
+ body = {
1351
+ "class": "EffectiveTimeQueryRequestBody",
1352
+ "effectiveTime": effective_time,
1353
+ }
1354
+
1355
+ response = await self._async_make_request("POST", url, body)
1356
+ return response.json().get("element", "No Parent Category found")
1357
+
1358
+ def get_category_parent(
1359
+ self,
1360
+ glossary_category_guid: str,
1361
+ effective_time: str = None,
1362
+ ) -> list | str:
1363
+ """Glossary categories can be organized in a hierarchy. Retrieve the parent glossary category metadata
1364
+ element for the glossary category with the supplied unique identifier. If the requested category
1365
+ does not have a parent category, null is returned. The optional request body contain an effective time
1366
+ for the query.
1367
+
1368
+ Parameters
1369
+ ----------
1370
+ glossary_category_guid: str
1371
+ The identity of the glossary category to search.
1372
+ effective_time, datetime, optional
1373
+ If specified, the category should only be returned if it was effective at the specified time.
1374
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
1375
+
1376
+
1377
+ Returns
1378
+ -------
1379
+ List | str
1380
+
1381
+ Details for the parent category with the glossary category GUID.
1382
+
1383
+ Raises
1384
+ ------
1385
+
1386
+ InvalidParameterException
1387
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1388
+ PropertyServerException
1389
+ Raised by the server when an issue arises in processing a valid request
1390
+ NotAuthorizedException
1391
+ The principle specified by the user_id does not have authorization for the requested action
1392
+
1393
+ """
1394
+ loop = asyncio.get_event_loop()
1395
+ response = loop.run_until_complete(
1396
+ self._async_get_category_parent(glossary_category_guid, effective_time)
1397
+ )
1398
+ return response
1399
+
1400
+ #
1401
+ # Terms
1402
+ #
1403
+ async def _async_create_controlled_glossary_term(
1404
+ self, glossary_guid: str, body: dict
1405
+ ) -> str:
1406
+ """Create a term for a controlled glossary.
1407
+ See also: https://egeria-project.org/types/3/0385-Controlled-Glossary-Development/?h=controlled
1408
+ The request body also supports the specification of an effective time for the query.
1409
+
1410
+ Async Version.
1411
+
1412
+ Parameters
1413
+ ----------
1414
+ glossary_guid : str
1415
+ Unique identifier for the glossary category to retrieve terms from.
1416
+ body: dict
1417
+ The dictionary to create te controlled glossary term for. Example below.
1418
+
1419
+
1420
+ Returns
1421
+ -------
1422
+ str:
1423
+ The unique guid for the created term.
1424
+
1425
+ Raises
1426
+ ------
1427
+ InvalidParameterException
1428
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1429
+ PropertyServerException
1430
+ Raised by the server when an issue arises in processing a valid request.
1431
+ NotAuthorizedException
1432
+ The principle specified by the user_id does not have authorization for the requested action.
1433
+ Notes
1434
+ -----
1435
+
1436
+ Sample body like:
1437
+ {
1438
+ "class" : "ReferenceableRequestBody",
1439
+ "elementProperties" :
1440
+ {
1441
+ "class" : "GlossaryTermProperties",
1442
+ "qualifiedName" : "GlossaryTerm: term name : {$isoTimestamp}",
1443
+ "displayName" : "term name",
1444
+ "summary" : "This is the short description.",
1445
+ "description" : "This is the long description of the term.",
1446
+ "abbreviation" : "GT",
1447
+ "examples" : "Add examples and descriptions here.",
1448
+ "usage" : "This is how the concept described by the glossary term is used.",
1449
+ "publishVersionIdentifier" : "V1.0",
1450
+ "additionalProperties" :
1451
+ {
1452
+ "propertyName1" : "xxxx",
1453
+ "propertyName2" : "xxxx"
1454
+ }
1455
+ },
1456
+ "initialStatus" : "DRAFT"
1457
+ }
1458
+
1459
+ """
1460
+
1461
+ validate_guid(glossary_guid)
1462
+ if self.__validate_term_status__(body["initialStatus"]) is False:
1463
+ raise InvalidParameterException("Bad status value")
1464
+
1465
+ url = (
1466
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
1467
+ f"{glossary_guid}/terms/new-controlled"
1468
+ )
1469
+
1470
+ response = await self._async_make_request("POST", url, body)
1471
+
1472
+ return response.json().get("guid", "Term not created")
1473
+
1474
+ def create_controlled_glossary_term(self, glossary_guid: str, body: dict) -> str:
1475
+ """Create a term for a controlled glossary.
1476
+ See also: https://egeria-project.org/types/3/0385-Controlled-Glossary-Development/?h=controlled
1477
+ The request body also supports the specification of an effective time for the query.
1478
+
1479
+ Parameters
1480
+ ----------
1481
+ glossary_guid : str
1482
+ Unique identifier for the glossary category to retrieve terms from.
1483
+ body: dict
1484
+ The dictionary to create te controlled glossary term for. Example below.
1485
+
1486
+
1487
+ Returns
1488
+ -------
1489
+ str:
1490
+ The unique guid for the created term.
1491
+
1492
+ Raises
1493
+ ------
1494
+ InvalidParameterException
1495
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1496
+ PropertyServerException
1497
+ Raised by the server when an issue arises in processing a valid request.
1498
+ NotAuthorizedException
1499
+ The principle specified by the user_id does not have authorization for the requested action.
1500
+ Notes
1501
+ -----
1502
+
1503
+ Sample body like:
1504
+ {
1505
+ "class" : "ReferenceableRequestBody",
1506
+ "elementProperties" :
1507
+ {
1508
+ "class" : "GlossaryTermProperties",
1509
+ "qualifiedName" : "GlossaryTerm: term name : {$isoTimestamp}",
1510
+ "displayName" : "term name",
1511
+ "summary" : "This is the short description.",
1512
+ "description" : "This is the long description of the term.",
1513
+ "abbreviation" : "GT",
1514
+ "examples" : "Add examples and descriptions here.",
1515
+ "usage" : "This is how the concept described by the glossary term is used.",
1516
+ "publishVersionIdentifier" : "V1.0",
1517
+ "additionalProperties" :
1518
+ {
1519
+ "propertyName1" : "xxxx",
1520
+ "propertyName2" : "xxxx"
1521
+ }
1522
+ },
1523
+ "initialStatus" : "DRAFT"
1524
+ }
1525
+
1526
+ """
1527
+ loop = asyncio.get_event_loop()
1528
+ response = loop.run_until_complete(
1529
+ self._async_create_controlled_glossary_term(glossary_guid, body)
1530
+ )
1531
+
1532
+ return response
1533
+
1534
+ def load_terms_from_file(
1535
+ self,
1536
+ glossary_name: str,
1537
+ filename: str,
1538
+ file_path: str = os.environ.get("EGERIA_GLOSSARY_PATH", None),
1539
+ upsert: bool = True,
1540
+ verbose: bool = True,
1541
+ ) -> List[dict] | None:
1542
+ """This method loads glossary terms into the specified glossary from the indicated file.
1543
+
1544
+ Parameters
1545
+ ----------
1546
+ glossary_name : str
1547
+ Name of the glossary to import terms into.
1548
+ file_path: str, default is EGERIA_GLOSSARY_PATH if specified or None
1549
+ If EGERIA_GLOSSARY_PATH environment variable is set, then it will be used in forming the
1550
+ prepended to the filename parameter to form the full path to the file.
1551
+ filename: str
1552
+ Path to the file to import terms from. File is assumed to be in CSV format. The path
1553
+ is relative to where the python method is being called from.
1554
+ upsert: bool, default = True
1555
+ If true, terms from the file are inserted into the glossary if no qualified name is specified;
1556
+ if a qualified name is specified in the file, then the file values for this term will over-ride the
1557
+ values in the glossary. If false, the row in the file will be appended to the glossary, possibly
1558
+ resulting in duplicate term names - which is legal (since the qualified names will be unique).
1559
+
1560
+ verbose: bool, default = True
1561
+ If true, a JSON structure will be returned indicating the import status of each row.
1562
+
1563
+
1564
+ Returns
1565
+ -------
1566
+ [dict]:
1567
+ If verbose is True, import status for each row
1568
+ None:
1569
+ If verbose is False
1570
+
1571
+ Raises
1572
+ ------
1573
+ InvalidParameterException
1574
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1575
+ PropertyServerException
1576
+ Raised by the server when an issue arises in processing a valid request.
1577
+ NotAuthorizedException
1578
+ The principle specified by the user_id does not have authorization for the requested action.
1579
+ Notes
1580
+ -----
1581
+ Keep in mind that the file path is relative to where the python method is being called from -
1582
+ not relative to the Egeria platform.
1583
+
1584
+ """
1585
+
1586
+ # Check that glossary exists and get guid
1587
+ glossaries = self.get_glossaries_by_name(glossary_name)
1588
+ if type(glossaries) is not list:
1589
+ return "Unknown glossary"
1590
+ if len(glossaries) > 1:
1591
+ glossary_error = (
1592
+ "Multiple glossaries found - please use a qualified name from below\n"
1593
+ )
1594
+ for g in glossaries:
1595
+ glossary_error += (
1596
+ f"Display Name: {g['glossaryProperties']['displayName']}\tQualified Name:"
1597
+ f" {g['glossaryProperties']['qualifiedName']}\n"
1598
+ )
1599
+ raise Exception(glossary_error)
1600
+ sys.exit(1)
1601
+
1602
+ # Now we know we have a single glossary so we can get the guid
1603
+ glossary_guid = glossaries[0]["elementHeader"]["guid"]
1604
+
1605
+ term_properties = {
1606
+ "Term Name",
1607
+ "Qualified Name",
1608
+ "Abbreviation",
1609
+ "Summary",
1610
+ "Description",
1611
+ "Examples",
1612
+ "Usage",
1613
+ "Version Identifier",
1614
+ "Status",
1615
+ }
1616
+
1617
+ if file_path:
1618
+ full_file_path = os.path.join(file_path, filename)
1619
+ else:
1620
+ full_file_path = filename
1621
+
1622
+ if not os.path.isfile(full_file_path):
1623
+ raise FileNotFoundError(
1624
+ f"Did not find file with path {file_path} and name {filename}"
1625
+ )
1626
+ # process file
1627
+ with open(full_file_path, mode="r") as file:
1628
+ # Create a CSV reader object
1629
+ csv_reader = csv.DictReader(file)
1630
+ headers = csv_reader.fieldnames
1631
+ term_info = []
1632
+ # check that the column headers are known
1633
+ if all(header in term_properties for header in headers) is False:
1634
+ raise InvalidParameterException("Invalid headers in CSV File")
1635
+
1636
+ # process each row and validate values
1637
+ for row in csv_reader:
1638
+ # Parse the file. When the value '---' is encountered, make the value None.git+https:
1639
+ term_name = row.get("Term Name", " ")
1640
+ if len(term_name) < 2:
1641
+ term_info.append(
1642
+ {
1643
+ "term_name": "---",
1644
+ "qualified_name": "---",
1645
+ "term_guid": "---",
1646
+ "error": "missing or invalid term names - skipping",
1647
+ }
1648
+ )
1649
+ continue
1650
+ qualified_name = row.get("Qualified Name", None)
1651
+ abbrev_in = row.get("Abbreviation", None)
1652
+ abbrev = None if abbrev_in == "---" else abbrev_in
1653
+
1654
+ summary_in = row.get("Summary", None)
1655
+ summary = None if summary_in == "---" else summary_in
1656
+
1657
+ description_in = row.get("Description", None)
1658
+ description = None if description_in == "---" else description_in
1659
+
1660
+ examples_in = row.get("Examples", None)
1661
+ examples = None if examples_in == "---" else examples_in
1662
+
1663
+ usage_in = row.get("Usage", None)
1664
+ usage = None if usage_in == "---" else usage_in
1665
+
1666
+ version = row.get("Version Identifier", "1.0")
1667
+ status = row.get("Status", "DRAFT").upper()
1668
+ if self.__validate_term_status__(status) is False:
1669
+ term_info.append(
1670
+ {
1671
+ "term_name": "---",
1672
+ "qualified_name": "---",
1673
+ "term_guid": "---",
1674
+ "error": "invalid term status",
1675
+ }
1676
+ )
1677
+ continue
1678
+
1679
+ if upsert:
1680
+ # If upsert is set we need to see if it can be done (there must be a valid qualified name) and then
1681
+ # do the update for the row - if there is no qualified name we will treat the row as an insert.
1682
+ if qualified_name:
1683
+ term_stuff = self.get_terms_by_name(
1684
+ qualified_name, glossary_guid
1685
+ )
1686
+ if type(term_stuff) is str:
1687
+ # An existing term was not found with that qualified name
1688
+ term_info.append(
1689
+ {
1690
+ "term_name": term_name,
1691
+ "qualified_name": qualified_name,
1692
+ "error": "Matching term not found - skipping",
1693
+ }
1694
+ )
1695
+ continue
1696
+ elif len(term_stuff) > 1:
1697
+ term_info.append(
1698
+ {
1699
+ "term_name": term_name,
1700
+ "qualified_name": qualified_name,
1701
+ "error": "Multiple matching terms - skipping",
1702
+ }
1703
+ )
1704
+ continue
1705
+ else:
1706
+ # An existing term was found - so update it! Get the existing values and overlay
1707
+ # values from file when present
1708
+
1709
+ body = {
1710
+ "class": "ReferenceableRequestBody",
1711
+ "elementProperties": {
1712
+ "class": "GlossaryTermProperties",
1713
+ "qualifiedName": qualified_name,
1714
+ "displayName": term_name,
1715
+ "summary": summary,
1716
+ "description": description,
1717
+ "abbreviation": abbrev,
1718
+ "examples": examples,
1719
+ "usage": usage,
1720
+ "publishVersionIdentifier": version,
1721
+ },
1722
+ "updateDescription": "Update from file import via upsert",
1723
+ }
1724
+ term_guid = term_stuff[0]["elementHeader"]["guid"]
1725
+ self.update_term(
1726
+ term_guid, body_slimmer(body), is_merge_update=True
1727
+ )
1728
+ term_info.append(
1729
+ {
1730
+ "term_name": term_name,
1731
+ "qualified_name": qualified_name,
1732
+ "term_guid": term_guid,
1733
+ "updated": "the term was updated",
1734
+ }
1735
+ )
1736
+ continue
1737
+
1738
+ # Add the term
1739
+ term_qualified_name = (
1740
+ f"GlossaryTerm: {term_name} - {datetime.now().isoformat()}"
1741
+ )
1742
+ body = {
1743
+ "class": "ReferenceableRequestBody",
1744
+ "elementProperties": {
1745
+ "class": "GlossaryTermProperties",
1746
+ "qualifiedName": term_qualified_name,
1747
+ "displayName": term_name,
1748
+ "summary": summary,
1749
+ "description": description,
1750
+ "abbreviation": abbrev,
1751
+ "examples": examples,
1752
+ "usage": usage,
1753
+ "publishVersionIdentifier": version,
1754
+ },
1755
+ "initialStatus": status,
1756
+ }
1757
+
1758
+ # Add the term
1759
+ term_guid = self.create_controlled_glossary_term(
1760
+ glossary_guid, body_slimmer(body)
1761
+ )
1762
+ term_info.append(
1763
+ {
1764
+ "term_name": term_name,
1765
+ "qualified_name": term_qualified_name,
1766
+ "term_guid": term_guid,
1767
+ }
1768
+ )
1769
+ if verbose:
1770
+ return term_info
1771
+ else:
1772
+ return
1773
+
1774
+ async def _async_export_glossary_to_csv(
1775
+ self,
1776
+ glossary_guid: str,
1777
+ target_file: str,
1778
+ file_path: str = os.environ.get("EGERIA_GLOSSARY_PATH", None),
1779
+ ) -> int:
1780
+ """Export all the terms in a glossary to a CSV file. Async version
1781
+
1782
+ Parameters:
1783
+ -----------
1784
+ glossary_guid: str
1785
+ Identity of the glossary to export.
1786
+ target_file: str
1787
+ Complete file name with path and extension to export to.
1788
+ file_path: str, default is EGERIA_GLOSSARY_PATH if specified or None
1789
+ If EGERIA_GLOSSARY_PATH environment variable is set, then it will be used in forming the
1790
+ prepended to the filename parameter to form the full path to the file.
1791
+
1792
+ Returns:
1793
+ int: Number of rows exported.
1794
+ """
1795
+
1796
+ term_list = await self._async_get_terms_for_glossary(glossary_guid)
1797
+
1798
+ header = [
1799
+ "Term Name",
1800
+ "Qualified Name",
1801
+ "Abbreviation",
1802
+ "Summary",
1803
+ "Description",
1804
+ "Examples",
1805
+ "Usage",
1806
+ "Version Identifier",
1807
+ "Status",
1808
+ ]
1809
+ if file_path:
1810
+ full_file_path = os.path.join(file_path, target_file)
1811
+ else:
1812
+ full_file_path = target_file
1813
+
1814
+ with open(full_file_path, mode="w") as file:
1815
+ csv_writer = csv.DictWriter(file, fieldnames=header)
1816
+ csv_writer.writeheader()
1817
+ count = 0
1818
+ for term in term_list:
1819
+ term_name = term["glossaryTermProperties"]["displayName"]
1820
+ qualified_name = term["glossaryTermProperties"]["qualifiedName"]
1821
+ abbrev = term["glossaryTermProperties"].get("abbreviation", "---")
1822
+ summary = term["glossaryTermProperties"].get("summary", "---")
1823
+ description = term["glossaryTermProperties"].get("description", "---")
1824
+ examples = term["glossaryTermProperties"].get("examples", "---")
1825
+ usage = term["glossaryTermProperties"].get("usage", "---")
1826
+ version = term["glossaryTermProperties"].get(
1827
+ "publishVersionIdentifier", "---"
1828
+ )
1829
+ status = term["elementHeader"]["status"]
1830
+
1831
+ csv_writer.writerow(
1832
+ {
1833
+ "Term Name": term_name,
1834
+ "Qualified Name": qualified_name,
1835
+ "Abbreviation": abbrev,
1836
+ "Summary": summary,
1837
+ "Description": description,
1838
+ "Examples": examples,
1839
+ "Usage": usage,
1840
+ "Version Identifier": version,
1841
+ "Status": status,
1842
+ }
1843
+ )
1844
+
1845
+ count += 1
1846
+ return count
1847
+
1848
+ def export_glossary_to_csv(
1849
+ self,
1850
+ glossary_guid: str,
1851
+ target_file: str,
1852
+ file_path: str = os.environ.get("EGERIA_GLOSSARY_PATH", None),
1853
+ ) -> int:
1854
+ """Export all the terms in a glossary to a CSV file.
1855
+
1856
+ Parameters:
1857
+ -----------
1858
+ glossary_guid: str
1859
+ Identity of the glossary to export.
1860
+ target_file: str
1861
+ Complete file name with path and extension to export to.
1862
+ file_path: str, default is EGERIA_GLOSSARY_PATH if specified or None
1863
+ If EGERIA_GLOSSARY_PATH environment variable is set, then it will be used in forming the
1864
+ prepended to the filename parameter to form the full path to the file.
1865
+
1866
+ Returns:
1867
+ int: Number of rows exported.
1868
+ """
1869
+
1870
+ loop = asyncio.get_event_loop()
1871
+ response = loop.run_until_complete(
1872
+ self._async_export_glossary_to_csv(glossary_guid, target_file, file_path)
1873
+ )
1874
+
1875
+ return response
1876
+
1877
+ async def _async_create_term_copy(
1878
+ self,
1879
+ glossary_guid: str,
1880
+ glossary_term_guid: str,
1881
+ new_display_name: str,
1882
+ version_id: str,
1883
+ term_status: str = "PROPOSED",
1884
+ ) -> str:
1885
+ """Create a new term from an existing term.
1886
+
1887
+ Async Version.
1888
+
1889
+ Parameters
1890
+ ----------
1891
+ glossary_guid : str
1892
+ Unique identifier for the glossary category to retrieve terms from.
1893
+ glossary_term_guid: str
1894
+ Unique identifier for the source glossary term.
1895
+ new_display_named: str
1896
+ The display name of the new term.
1897
+ version_id: str
1898
+ The version identifier of the new term.
1899
+ term_status: str, optional, default = "PROPOSED"
1900
+ The status of the term
1901
+
1902
+
1903
+ Returns
1904
+ -------
1905
+ str:
1906
+ The unique guid for the created term.
1907
+
1908
+ Raises
1909
+ ------
1910
+ InvalidParameterException
1911
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1912
+ PropertyServerException
1913
+ Raised by the server when an issue arises in processing a valid request.
1914
+ NotAuthorizedException
1915
+ The principle specified by the user_id does not have authorization for the requested action.
1916
+ Notes
1917
+ -----
1918
+
1919
+ """
1920
+
1921
+ validate_guid(glossary_guid)
1922
+ validate_guid(glossary_term_guid)
1923
+
1924
+ url = (
1925
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
1926
+ f"{glossary_guid}/terms/from-template/{glossary_term_guid}"
1927
+ )
1928
+
1929
+ body = {
1930
+ "class": "GlossaryTemplateRequestBody",
1931
+ "elementProperties": {
1932
+ "class": "TemplateProperties",
1933
+ "qualifiedName": f"Term-{new_display_name}-{time.asctime()}",
1934
+ "displayName": new_display_name,
1935
+ "versionIdentifier": version_id,
1936
+ },
1937
+ "glossaryTermStatus": term_status,
1938
+ }
1939
+
1940
+ response = await self._async_make_request("POST", url, body)
1941
+
1942
+ return response.json().get("guid", "Term not created")
1943
+
1944
+ def create_term_copy(
1945
+ self,
1946
+ glossary_guid: str,
1947
+ glossary_term_guid: str,
1948
+ new_display_name: str,
1949
+ version_id: str,
1950
+ term_status: str = "PROPOSED",
1951
+ ) -> str:
1952
+ """Create a new term from an existing term.
1953
+
1954
+ Parameters
1955
+ ----------
1956
+ glossary_guid : str
1957
+ Unique identifier for the glossary category to retrieve terms from.
1958
+ glossary_term_guid: str
1959
+ Unique identifier for the source glossary term.
1960
+ new_display_named: str
1961
+ The display name of the new term.
1962
+ version_id: str
1963
+ The version identifier of the new term.
1964
+ term_status: str, optional, default = "PROPOSED"
1965
+ The status of the term
1966
+
1967
+
1968
+ Returns
1969
+ -------
1970
+ str:
1971
+ The unique guid for the created term.
1972
+
1973
+ Raises
1974
+ ------
1975
+ InvalidParameterException
1976
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
1977
+ PropertyServerException
1978
+ Raised by the server when an issue arises in processing a valid request.
1979
+ NotAuthorizedException
1980
+ The principle specified by the user_id does not have authorization for the requested action.
1981
+ Notes
1982
+ -----
1983
+
1984
+ """
1985
+ loop = asyncio.get_event_loop()
1986
+ response = loop.run_until_complete(
1987
+ self._async_create_term_copy(
1988
+ glossary_guid,
1989
+ glossary_term_guid,
1990
+ new_display_name,
1991
+ version_id,
1992
+ term_status,
1993
+ )
1994
+ )
1995
+
1996
+ return response
1997
+
1998
+ async def _async_add_data_field_to_term(
1999
+ self, glossary_term_guid: str, body: dict
2000
+ ) -> None:
2001
+ """Add the data field values classification to a glossary term
2002
+
2003
+ Async Version.
2004
+
2005
+ Parameters
2006
+ ----------
2007
+ glossary_guid : str
2008
+ Unique identifier for the glossary category to retrieve terms from.
2009
+ glossary_term_guid: str
2010
+ Unique identifier for the source glossary term.
2011
+ body: dict
2012
+ Body containing information about the data field to add
2013
+
2014
+
2015
+ Returns
2016
+ -------
2017
+ None
2018
+
2019
+ Raises
2020
+ ------
2021
+ InvalidParameterException
2022
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2023
+ PropertyServerException
2024
+ Raised by the server when an issue arises in processing a valid request.
2025
+ NotAuthorizedException
2026
+ The principle specified by the user_id does not have authorization for the requested action.
2027
+ Notes
2028
+ -----
2029
+ Body is of the structure:
2030
+
2031
+ {
2032
+ "class" : "ClassificationRequestBody",
2033
+ "properties" :
2034
+ {
2035
+ "class" : "DataFieldValuesProperties",
2036
+ "defaultValue" : "Add default value here",
2037
+ "sampleValues" : [ "Sample Value 1", "Sample Value 2"],
2038
+ "dataPattern" : ["add data pattern here"],
2039
+ "namePattern" : ["add column pattern here"]
2040
+ }
2041
+ }
2042
+ """
2043
+
2044
+ validate_guid(glossary_term_guid)
2045
+
2046
+ url = (
2047
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
2048
+ f"terms/{glossary_term_guid}/is-data-field"
2049
+ )
2050
+
2051
+ await self._async_make_request("POST", url, body)
2052
+ return
2053
+
2054
+ def add_data_field_to_term(self, glossary_term_guid: str, body: dict) -> None:
2055
+ """Add the data field values classification to a glossary term
2056
+
2057
+ Parameters
2058
+ ----------
2059
+ glossary_term_guid: str
2060
+ Unique identifier for the source glossary term.
2061
+ body: dict
2062
+ Body containing information about the data field to add
2063
+
2064
+
2065
+ Returns
2066
+ -------
2067
+ None
2068
+
2069
+ Raises
2070
+ ------
2071
+ InvalidParameterException
2072
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2073
+ PropertyServerException
2074
+ Raised by the server when an issue arises in processing a valid request.
2075
+ NotAuthorizedException
2076
+ The principle specified by the user_id does not have authorization for the requested action.
2077
+ Notes
2078
+ -----
2079
+ Body is of the structure:
2080
+
2081
+ {
2082
+ "class" : "ClassificationRequestBody",
2083
+ "properties" :
2084
+ {
2085
+ "class" : "DataFieldValuesProperties",
2086
+ "defaultValue" : "Add default value here",
2087
+ "sampleValues" : [ "Sample Value 1", "Sample Value 2"],
2088
+ "dataPattern" : ["add data pattern here"],
2089
+ "namePattern" : ["add column pattern here"]
2090
+ }
2091
+ }
2092
+ """
2093
+ loop = asyncio.get_event_loop()
2094
+ loop.run_until_complete(
2095
+ self._async_add_data_field_to_term(glossary_term_guid, body)
2096
+ )
2097
+
2098
+ return
2099
+
2100
+ async def _async_add_confidentiality_to_term(
2101
+ self,
2102
+ glossary_term_guid: str,
2103
+ confidentiality_level: int,
2104
+ ) -> None:
2105
+ """Add the confidentiality classification to a glossary term
2106
+
2107
+ Async Version.
2108
+
2109
+ Parameters
2110
+ ----------
2111
+ glossary_term_guid: str
2112
+ Unique identifier for the source glossary term.
2113
+ confidentiality_level: int
2114
+ The level of confidentiality to classify the term with.
2115
+
2116
+
2117
+ Returns
2118
+ -------
2119
+ None
2120
+
2121
+ Raises
2122
+ ------
2123
+ InvalidParameterException
2124
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2125
+ PropertyServerException
2126
+ Raised by the server when an issue arises in processing a valid request.
2127
+ NotAuthorizedException
2128
+ The principle specified by the user_id does not have authorization for the requested action.
2129
+ Notes
2130
+ -----
2131
+ See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
2132
+ for a list of default confidentiality levels.
2133
+
2134
+ """
2135
+
2136
+ validate_guid(glossary_term_guid)
2137
+
2138
+ url = (
2139
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/elements/"
2140
+ f"{glossary_term_guid}/confidentiality"
2141
+ )
2142
+
2143
+ body = {
2144
+ "class": "ClassificationRequestBody",
2145
+ "properties": {
2146
+ "class": "GovernanceClassificationProperties",
2147
+ "levelIdentifier": confidentiality_level,
2148
+ },
2149
+ }
2150
+
2151
+ await self._async_make_request("POST", url, body)
2152
+ return
2153
+
2154
+ def add_confidentiality_to_term(
2155
+ self,
2156
+ glossary_term_guid: str,
2157
+ confidentiality_level: int,
2158
+ ) -> str:
2159
+ """Add the confidentiality classification to a glossary term
2160
+
2161
+ Parameters
2162
+ ----------
2163
+ glossary_term_guid: str
2164
+ Unique identifier for the source glossary term.
2165
+ confidentiality_level: int
2166
+ The level of confidentiality to classify the term with.
2167
+
2168
+
2169
+ Returns
2170
+ -------
2171
+ None
2172
+
2173
+ Raises
2174
+ ------
2175
+ InvalidParameterException
2176
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2177
+ PropertyServerException
2178
+ Raised by the server when an issue arises in processing a valid request.
2179
+ NotAuthorizedException
2180
+ The principle specified by the user_id does not have authorization for the requested action.
2181
+ Notes
2182
+ -----
2183
+ See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
2184
+ for a list of default confidentiality levels.
2185
+
2186
+ """
2187
+ loop = asyncio.get_event_loop()
2188
+ response = loop.run_until_complete(
2189
+ self._async_add_confidentiality_to_term(
2190
+ glossary_term_guid, confidentiality_level
2191
+ )
2192
+ )
2193
+
2194
+ return
2195
+
2196
+ async def _async_add_subject_area_to_term(
2197
+ self, glossary_term_guid: str, subject_area: str
2198
+ ) -> None:
2199
+ """Add the confidentiality classification to a glossary term
2200
+
2201
+ Async Version.
2202
+
2203
+ Parameters
2204
+ ----------
2205
+ glossary_term_guid: str
2206
+ Unique identifier for the source glossary term.
2207
+ subject_area: str
2208
+ The subject area to classify the term with.
2209
+
2210
+
2211
+ Returns
2212
+ -------
2213
+ None
2214
+
2215
+ Raises
2216
+ ------
2217
+ InvalidParameterException
2218
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2219
+ PropertyServerException
2220
+ Raised by the server when an issue arises in processing a valid request.
2221
+ NotAuthorizedException
2222
+ The principle specified by the user_id does not have authorization for the requested action.
2223
+ Notes
2224
+ -----
2225
+ See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
2226
+ for a list of default confidentiality levels.
2227
+
2228
+ """
2229
+
2230
+ validate_guid(glossary_term_guid)
2231
+
2232
+ url = (
2233
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/elements/"
2234
+ f"{glossary_term_guid}/subject-area-member"
2235
+ )
2236
+
2237
+ body = {
2238
+ "class": "ClassificationRequestBody",
2239
+ "properties": {
2240
+ "class": "SubjectAreaMemberProperties",
2241
+ "subjectAreaName": subject_area,
2242
+ },
2243
+ }
2244
+
2245
+ await self._async_make_request("POST", url, body)
2246
+ return
2247
+
2248
+ def add_subject_area_to_term(
2249
+ self, glossary_term_guid: str, subject_area: str
2250
+ ) -> None:
2251
+ """Add the confidentiality classification to a glossary term
2252
+
2253
+ Parameters
2254
+ ----------
2255
+ glossary_term_guid: str
2256
+ Unique identifier for the source glossary term.
2257
+ subject_area: str
2258
+ The subject area to classify the term with.
2259
+
2260
+
2261
+ Returns
2262
+ -------
2263
+ None
2264
+
2265
+ Raises
2266
+ ------
2267
+ InvalidParameterException
2268
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2269
+ PropertyServerException
2270
+ Raised by the server when an issue arises in processing a valid request.
2271
+ NotAuthorizedException
2272
+ The principle specified by the user_id does not have authorization for the requested action.
2273
+ Notes
2274
+ -----
2275
+ See https://egeria-project.org/types/4/0421-Governance-Classification-Levels/?h=confidential#governance-classification-levels
2276
+ for a list of default confidentiality levels.
2277
+
2278
+ """
2279
+ loop = asyncio.get_event_loop()
2280
+ response = loop.run_until_complete(
2281
+ self._async_add_subject_area_to_term(glossary_term_guid, subject_area)
2282
+ )
2283
+
2284
+ return
2285
+
2286
+ async def _async_update_term(
2287
+ self,
2288
+ glossary_term_guid: str,
2289
+ body: dict,
2290
+ is_merge_update: bool = True,
2291
+ for_lineage: bool = False,
2292
+ for_duplicate_processig: bool = False,
2293
+ ) -> None:
2294
+ """Add the data field values classification to a glossary term
2295
+
2296
+ Async Version.
2297
+
2298
+ Parameters
2299
+ ----------
2300
+ glossary_term_guid: str
2301
+ Unique identifier for the source glossary term.
2302
+ body: dict
2303
+ Body containing information about the data field to add
2304
+ is_merge_update: bool, optional, default = True
2305
+ Whether the data field values should be merged with existing definition or replace it.
2306
+
2307
+
2308
+ Returns
2309
+ -------
2310
+ None
2311
+
2312
+ Raises
2313
+ ------
2314
+ InvalidParameterException
2315
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2316
+ PropertyServerException
2317
+ Raised by the server when an issue arises in processing a valid request.
2318
+ NotAuthorizedException
2319
+ The principle specified by the user_id does not have authorization for the requested action.
2320
+ Notes
2321
+ -----
2322
+ An example body is:
2323
+
2324
+ {
2325
+ "class" : "ReferenceableRequestBody",
2326
+ "elementProperties" :
2327
+ {
2328
+ "class" : "GlossaryTermProperties",
2329
+ "description" : "This is the long description of the term. And this is some more text."
2330
+ },
2331
+ "updateDescription" : "Final updates based on in-house review comments."
2332
+ }
2333
+
2334
+ """
2335
+
2336
+ validate_guid(glossary_term_guid)
2337
+ is_merge_update_s = str(is_merge_update).lower()
2338
+ for_lineage_s = str(for_lineage).lower()
2339
+ for_duplicate_processing_s = str(for_duplicate_processig).lower()
2340
+
2341
+ url = (
2342
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/terms/{glossary_term_guid}/"
2343
+ f"update?isMergeUpdate={is_merge_update_s}&forLineage={for_lineage_s}&forDuplicateProcessing={for_duplicate_processing_s}"
2344
+ )
2345
+
2346
+ await self._async_make_request("POST", url, body)
2347
+ return
2348
+
2349
+ def update_term(
2350
+ self,
2351
+ glossary_term_guid: str,
2352
+ body: dict,
2353
+ is_merge_update: bool = True,
2354
+ for_lineage: bool = False,
2355
+ for_duplicate_processig: bool = False,
2356
+ ) -> None:
2357
+ """Add the data field values classification to a glossary term
2358
+
2359
+ Async Version.
2360
+
2361
+ Parameters
2362
+ ----------
2363
+ glossary_term_guid: str
2364
+ Unique identifier for the source glossary term.
2365
+ body: dict
2366
+ Body containing information about the data field to add
2367
+ is_merge_update: bool, optional, default = True
2368
+ Whether the data field values should be merged with existing definition or replace it.
2369
+
2370
+
2371
+ Returns
2372
+ -------
2373
+ None
2374
+
2375
+ Raises
2376
+ ------
2377
+ InvalidParameterException
2378
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2379
+ PropertyServerException
2380
+ Raised by the server when an issue arises in processing a valid request.
2381
+ NotAuthorizedException
2382
+ The principle specified by the user_id does not have authorization for the requested action.
2383
+ Notes
2384
+ -----
2385
+ An example body is:
2386
+
2387
+ {
2388
+ "class" : "ReferenceableRequestBody",
2389
+ "elementProperties" :
2390
+ {
2391
+ "class" : "GlossaryTermProperties",
2392
+ "description" : "This is the long description of the term. And this is some more text."
2393
+ },
2394
+ "updateDescription" : "Final updates based on in-house review comments."
2395
+ }
2396
+
2397
+ """
2398
+ loop = asyncio.get_event_loop()
2399
+ loop.run_until_complete(
2400
+ self._async_update_term(
2401
+ glossary_term_guid,
2402
+ body,
2403
+ is_merge_update,
2404
+ for_lineage,
2405
+ for_duplicate_processig,
2406
+ )
2407
+ )
2408
+
2409
+ return
2410
+
2411
+ async def _async_update_term_version_id(
2412
+ self,
2413
+ glossary_term_guid: str,
2414
+ new_version_identifier: str,
2415
+ ) -> None:
2416
+ """Update a glossary term's version identifier
2417
+
2418
+ Async Version.
2419
+
2420
+ Parameters
2421
+ ----------
2422
+ glossary_term_guid: str
2423
+ Unique identifier for the source glossary term.
2424
+ new_version_identifier: str
2425
+ The new version identifier to update the term with.
2426
+
2427
+
2428
+ Returns
2429
+ -------
2430
+ None
2431
+
2432
+ Raises
2433
+ ------
2434
+ InvalidParameterException
2435
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2436
+ PropertyServerException
2437
+ Raised by the server when an issue arises in processing a valid request.
2438
+ NotAuthorizedException
2439
+ The principle specified by the user_id does not have authorization for the requested action.
2440
+ Notes
2441
+ -----
2442
+ This is a useful example of a term update, specifying a new version identifier.
2443
+
2444
+ """
2445
+
2446
+ validate_guid(glossary_term_guid)
2447
+
2448
+ url = (
2449
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/terms/{glossary_term_guid}/"
2450
+ f"update?isMergeUpdate=true"
2451
+ )
2452
+
2453
+ body = {
2454
+ "class": "ReferenceableRequestBody",
2455
+ "elementProperties": {
2456
+ "class": "GlossaryTermProperties",
2457
+ "publishVersionIdentifier": new_version_identifier,
2458
+ },
2459
+ }
2460
+ await self._async_make_request("POST", url, body)
2461
+ return
2462
+
2463
+ def update_term_version_id(
2464
+ self,
2465
+ glossary_term_guid: str,
2466
+ new_version_identifier: str,
2467
+ ) -> None:
2468
+ """Update a glossary term's version identifier
2469
+
2470
+ Async Version.
2471
+
2472
+ Parameters
2473
+ ----------
2474
+ glossary_term_guid: str
2475
+ Unique identifier for the source glossary term.
2476
+ new_version_identifier: str
2477
+ The new version identifier to update the term with.
2478
+
2479
+
2480
+ Returns
2481
+ -------
2482
+ None
2483
+
2484
+ Raises
2485
+ ------
2486
+ InvalidParameterException
2487
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2488
+ PropertyServerException
2489
+ Raised by the server when an issue arises in processing a valid request.
2490
+ NotAuthorizedException
2491
+ The principle specified by the user_id does not have authorization for the requested action.
2492
+ Notes
2493
+ -----
2494
+ This is a useful example of a term update, specifying a new version identifier.
2495
+
2496
+ """
2497
+ loop = asyncio.get_event_loop()
2498
+ loop.run_until_complete(
2499
+ self._async_update_term_version_id(
2500
+ glossary_term_guid, new_version_identifier
2501
+ )
2502
+ )
2503
+
2504
+ async def _async_undo_term_update(self, glossary_term_guid: str) -> None:
2505
+ """Undo an update to a glossary term
2506
+
2507
+ Async Version.
2508
+
2509
+ Parameters
2510
+ ----------
2511
+ glossary_term_guid: str
2512
+ Unique identifier for the source glossary term.
2513
+
2514
+ Returns
2515
+ -------
2516
+ None
2517
+
2518
+ Raises
2519
+ ------
2520
+ InvalidParameterException
2521
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2522
+ PropertyServerException
2523
+ Raised by the server when an issue arises in processing a valid request.
2524
+ NotAuthorizedException
2525
+ The principle specified by the user_id does not have authorization for the requested action.
2526
+ Notes
2527
+ -----
2528
+ This creates a new version with the state of the term before the last update.
2529
+
2530
+ """
2531
+
2532
+ validate_guid(glossary_term_guid)
2533
+
2534
+ url = (
2535
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/terms/"
2536
+ f"{glossary_term_guid}/undo"
2537
+ )
2538
+
2539
+ await self._async_make_request("POST", url)
2540
+
2541
+ def undo_term_update(self, glossary_term_guid: str) -> None:
2542
+ """Undo an update to a glossary term
2543
+
2544
+ Parameters
2545
+ ----------
2546
+ glossary_term_guid: str
2547
+ Unique identifier for the source glossary term.
2548
+
2549
+ Returns
2550
+ -------
2551
+ None
2552
+
2553
+ Raises
2554
+ ------
2555
+ InvalidParameterException
2556
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2557
+ PropertyServerException
2558
+ Raised by the server when an issue arises in processing a valid request.
2559
+ NotAuthorizedException
2560
+ The principle specified by the user_id does not have authorization for the requested action.
2561
+ Notes
2562
+ -----
2563
+ This creates a new version with the state of the term before the last update.
2564
+
2565
+ """
2566
+ loop = asyncio.get_event_loop()
2567
+ loop.run_until_complete(self._async_undo_term_update(glossary_term_guid))
2568
+
2569
+ async def _async_get_terms_for_category(
2570
+ self,
2571
+ glossary_category_guid: str,
2572
+ effective_time: str = None,
2573
+ start_from: int = 0,
2574
+ page_size: int = None,
2575
+ ) -> list | str:
2576
+ """Retrieve ALL the glossary terms in a category.
2577
+ The request body also supports the specification of an effective time for the query.
2578
+
2579
+ Async Version.
2580
+
2581
+ Parameters
2582
+ ----------
2583
+ glossary_category_guid : str
2584
+ Unique identifier for the glossary category to retrieve terms from.
2585
+ effective_time : str, optional
2586
+ If specified, the terms are returned if they are active at the `effective_time
2587
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2588
+ start_from: int, optional defaults to 0
2589
+ The page number to start retrieving elements from
2590
+ page_size : int, optional defaults to None
2591
+ The number of elements to retrieve
2592
+ Returns
2593
+ -------
2594
+ dict
2595
+ The glossary definition associated with the glossary_guid
2596
+
2597
+ Raises
2598
+ ------
2599
+ InvalidParameterException
2600
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2601
+ PropertyServerException
2602
+ Raised by the server when an issue arises in processing a valid request.
2603
+ NotAuthorizedException
2604
+ The principle specified by the user_id does not have authorization for the requested action.
2605
+ Notes
2606
+ -----
2607
+ """
2608
+
2609
+ validate_guid(glossary_category_guid)
2610
+
2611
+ if page_size is None:
2612
+ page_size = self.page_size
2613
+
2614
+ url = (
2615
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
2616
+ f"{glossary_category_guid}/terms/retrieve?startFrom={start_from}&pageSize={page_size}"
2617
+ )
2618
+
2619
+ if effective_time is not None:
2620
+ body = {"effectiveTime": effective_time}
2621
+ response = await self._async_make_request("POST", url, body)
2622
+ else:
2623
+ response = await self._async_make_request("POST", url)
2624
+
2625
+ return response.json().get("elementList", "No terms found")
2626
+
2627
+ def get_terms_for_category(
2628
+ self,
2629
+ glossary_category_guid: str,
2630
+ effective_time: str = None,
2631
+ start_from: int = 0,
2632
+ page_size: int = None,
2633
+ ) -> list | str:
2634
+ """Retrieve ALL the glossary terms in a category.
2635
+ The request body also supports the specification of an effective time for the query.
2636
+
2637
+ Async Version.
2638
+
2639
+ Parameters
2640
+ ----------
2641
+ glossary_category_guid : str
2642
+ Unique identifier for the glossary category to retrieve terms from.
2643
+ effective_time : str, optional
2644
+ If specified, the terms are returned if they are active at the `effective_time.
2645
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)`.
2646
+ start_from: int, optional defaults to 0
2647
+ The page number to start retrieving elements from
2648
+ page_size : int, optional defaults to None
2649
+ The number of elements to retrieve
2650
+ Returns
2651
+ -------
2652
+ dict
2653
+ The glossary definition associated with the glossary_guid
2654
+
2655
+ Raises
2656
+ ------
2657
+ InvalidParameterException
2658
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2659
+ PropertyServerException
2660
+ Raised by the server when an issue arises in processing a valid request.
2661
+ NotAuthorizedException
2662
+ The principle specified by the user_id does not have authorization for the requested action.
2663
+ Notes
2664
+ -----
2665
+ """
2666
+ loop = asyncio.get_event_loop()
2667
+ response = loop.run_until_complete(
2668
+ self._async_get_terms_for_category(
2669
+ glossary_category_guid,
2670
+ effective_time,
2671
+ start_from,
2672
+ page_size,
2673
+ )
2674
+ )
2675
+
2676
+ return response
2677
+
2678
+ async def _async_delete_term(
2679
+ self,
2680
+ term_guid: str,
2681
+ for_lineage: bool = False,
2682
+ for_duplicate_processing: bool = False,
2683
+ ) -> list | str:
2684
+ """Delete the glossary terms associated with the specified glossary. Async version.
2685
+
2686
+ Parameters
2687
+ ----------
2688
+ term_guid : str,
2689
+ The unique identifier for the term to delete.
2690
+ for_lineage: bool, opt, default = False
2691
+ Set true for lineage processing - generally false.
2692
+ for_duplicate_processing: bool, opt, default = False
2693
+ Set true if duplicate processing handled externally - generally set False.
2694
+
2695
+ Returns
2696
+ -------
2697
+ None
2698
+
2699
+ Raises
2700
+ ------
2701
+ InvalidParameterException
2702
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2703
+ PropertyServerException
2704
+ Raised by the server when an issue arises in processing a valid request.
2705
+ NotAuthorizedException
2706
+ The principle specified by the user_id does not have authorization for the requested action.
2707
+ Notes
2708
+ -----
2709
+ """
2710
+
2711
+ validate_guid(term_guid)
2712
+
2713
+ url = (
2714
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-manager/glossaries/"
2715
+ f"terms/{term_guid}/remove?forLineage={for_lineage}&forDuplicateProcessing={for_duplicate_processing}"
2716
+ )
2717
+
2718
+ await self._async_make_request("POST", url)
2719
+ return
2720
+
2721
+ def delete_term(
2722
+ self,
2723
+ term_guid: str,
2724
+ for_lineage: bool = False,
2725
+ for_duplicate_processing: bool = False,
2726
+ ) -> list | str:
2727
+ """Delete the glossary terms associated with the specified glossary.
2728
+
2729
+ Parameters
2730
+ ----------
2731
+ term_guid : str,
2732
+ The unique identifier for the term to delete.
2733
+ for_lineage: bool, opt, default = False
2734
+ Set true for lineage processing - generally false.
2735
+ for_duplicate_processing: bool, opt, default = False
2736
+ Set true if duplicate processing handled externally - generally set False.
2737
+
2738
+ Returns
2739
+ -------
2740
+ None
2741
+
2742
+ Raises
2743
+ ------
2744
+ InvalidParameterException
2745
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2746
+ PropertyServerException
2747
+ Raised by the server when an issue arises in processing a valid request.
2748
+ NotAuthorizedException
2749
+ The principle specified by the user_id does not have authorization for the requested action.
2750
+ Notes
2751
+ -----
2752
+ """
2753
+ loop = asyncio.get_event_loop()
2754
+ loop.run_until_complete(
2755
+ self._async_delete_term(term_guid, for_lineage, for_duplicate_processing)
2756
+ )
2757
+
2758
+ return
2759
+
2760
+ async def _async_get_term_relationships(
2761
+ self,
2762
+ term_guid: str,
2763
+ effective_time: str = None,
2764
+ start_from: int = 0,
2765
+ page_size: int = None,
2766
+ ) -> list | str:
2767
+ """This call retrieves details of the glossary terms linked to this glossary term.
2768
+ Notice the original org 1 glossary term is linked via the "SourcedFrom" relationship..
2769
+ Parameters
2770
+ ----------
2771
+ term_guid : str
2772
+ Unique identifier for the glossary term
2773
+ effective_time : str, optional
2774
+ If specified, term relationships are included if they are active at the `effective_time`.
2775
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2776
+ start_from: int, optional defaults to 0
2777
+ The page number to start retrieving elements from
2778
+ page_size : int, optional defaults to None
2779
+ The number of elements to retrieve
2780
+ Returns
2781
+ -------
2782
+ dict
2783
+ The glossary definition associated with the glossary_guid
2784
+
2785
+ Raises
2786
+ ------
2787
+ InvalidParameterException
2788
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2789
+ PropertyServerException
2790
+ Raised by the server when an issue arises in processing a valid request.
2791
+ NotAuthorizedException
2792
+ The principle specified by the user_id does not have authorization for the requested action.
2793
+ Notes
2794
+ -----
2795
+ """
2796
+
2797
+ validate_guid(term_guid)
2798
+
2799
+ if page_size is None:
2800
+ page_size = self.page_size
2801
+
2802
+ url = (
2803
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
2804
+ f"{term_guid}/related-terms?startFrom={start_from}&pageSize={page_size}"
2805
+ )
2806
+
2807
+ if effective_time is not None:
2808
+ body = {"effectiveTime": effective_time}
2809
+ response = await self._async_make_request("POST", url, body)
2810
+ else:
2811
+ response = await self._async_make_request("POST", url)
2812
+
2813
+ return response.json().get("elementList", "No terms found")
2814
+
2815
+ def get_term_relationships(
2816
+ self,
2817
+ term_guid: str,
2818
+ effective_time: str = None,
2819
+ start_from: int = 0,
2820
+ page_size: int = None,
2821
+ ) -> list | str:
2822
+ """This call retrieves details of the glossary terms linked to this glossary term.
2823
+ Notice the original org 1 glossary term is linked via the "SourcedFrom" relationship..
2824
+ Parameters
2825
+ ----------
2826
+ term_guid : str
2827
+ Unique identifier for the glossary term
2828
+ effective_time : str, optional
2829
+ If specified, term relationships are included if they are active at the `effective_time`.
2830
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2831
+ start_from: int, optional defaults to 0
2832
+ The page number to start retrieving elements from
2833
+ page_size : int, optional defaults to None
2834
+ The number of elements to retrieve
2835
+ Returns
2836
+ -------
2837
+ dict
2838
+ The glossary definition associated with the glossary_guid
2839
+
2840
+ Raises
2841
+ ------
2842
+ InvalidParameterException
2843
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2844
+ PropertyServerException
2845
+ Raised by the server when an issue arises in processing a valid request.
2846
+ NotAuthorizedException
2847
+ The principle specified by the user_id does not have authorization for the requested action.
2848
+ Notes
2849
+ -----
2850
+ """
2851
+ loop = asyncio.get_event_loop()
2852
+ response = loop.run_until_complete(
2853
+ self._async_get_term_relationships(
2854
+ term_guid, effective_time, start_from, page_size
2855
+ )
2856
+ )
2857
+
2858
+ return response
2859
+
2860
+ async def _async_get_glossary_for_term(
2861
+ self, term_guid: str, effective_time: str = None
2862
+ ) -> dict | str:
2863
+ """Retrieve the glossary metadata element for the requested term. The optional request body allows you to specify
2864
+ that the glossary element should only be returned if it was effective at a particular time.
2865
+
2866
+ Async Version.
2867
+
2868
+ Parameters
2869
+ ----------
2870
+ term_guid : str
2871
+ The unique identifier for the term.
2872
+
2873
+ effective_time : datetime, optional
2874
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
2875
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2876
+
2877
+ Returns
2878
+ -------
2879
+ dict
2880
+ The glossary information retrieved for the specified term.
2881
+ Raises
2882
+ ------
2883
+ InvalidParameterException
2884
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2885
+ PropertyServerException
2886
+ Raised by the server when an issue arises in processing a valid request.
2887
+ NotAuthorizedException
2888
+ The principle specified by the user_id does not have authorization for the requested action.
2889
+ Notes
2890
+ -----
2891
+ """
2892
+
2893
+ validate_guid(term_guid)
2894
+
2895
+ body = {
2896
+ "class": "EffectiveTimeQueryRequestBody",
2897
+ "effectiveTime": effective_time,
2898
+ }
2899
+ url = (
2900
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
2901
+ f"for-term/{term_guid}/retrieve"
2902
+ )
2903
+
2904
+ response = await self._async_make_request("POST", url, body)
2905
+ return response.json().get("element", "No glossary found")
2906
+
2907
+ def get_glossary_for_term(
2908
+ self, term_guid: str, effective_time: str = None
2909
+ ) -> dict | str:
2910
+ """Retrieve the glossary metadata element for the requested term. The optional request body allows you to specify
2911
+ that the glossary element should only be returned if it was effective at a particular time.
2912
+
2913
+ Async Version.
2914
+
2915
+ Parameters
2916
+ ----------
2917
+ term_guid : str
2918
+ The unique identifier for the term.
2919
+
2920
+ effective_time : datetime, optional
2921
+ TIf specified, the term information will be retrieved if it is active at the `effective_time`.
2922
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601).
2923
+
2924
+ Returns
2925
+ -------
2926
+ dict
2927
+ The glossary information retrieved for the specified term.
2928
+ Raises
2929
+ ------
2930
+ InvalidParameterException
2931
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2932
+ PropertyServerException
2933
+ Raised by the server when an issue arises in processing a valid request.
2934
+ NotAuthorizedException
2935
+ The principle specified by the user_id does not have authorization for the requested action.
2936
+ Notes
2937
+ -----
2938
+ """
2939
+ loop = asyncio.get_event_loop()
2940
+ response = loop.run_until_complete(
2941
+ self._async_get_glossary_for_term(term_guid, effective_time)
2942
+ )
2943
+ return response
2944
+
2945
+ async def _async_get_terms_by_name(
2946
+ self,
2947
+ term: str,
2948
+ glossary_guid: str = None,
2949
+ status_filter: list = [],
2950
+ effective_time: str = None,
2951
+ for_lineage: bool = False,
2952
+ for_duplicate_processing: bool = False,
2953
+ start_from: int = 0,
2954
+ page_size: int = None,
2955
+ ) -> list:
2956
+ """Retrieve glossary terms by display name or qualified name. Async Version.
2957
+
2958
+ Parameters
2959
+ ----------
2960
+ term : str
2961
+ The term to search for in the glossaries.
2962
+ glossary_guid : str, optional
2963
+ The GUID of the glossary to search in. If not provided, the search will be performed in all glossaries.
2964
+ status_filter : list, optional
2965
+ A list of status values to filter the search results. Default is an empty list, which means no filtering.
2966
+
2967
+ effective_time : datetime, optional
2968
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
2969
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2970
+ for_lineage : bool, optional
2971
+ Flag to indicate whether the search should include lineage information. Default is False.
2972
+ for_duplicate_processing : bool, optional
2973
+ Flag to indicate whether the search should include duplicate processing information. Default is False.
2974
+ start_from : int, optional
2975
+ The index of the first term to retrieve. Default is 0.
2976
+ page_size : int, optional
2977
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
2978
+
2979
+ Returns
2980
+ -------
2981
+ list
2982
+ A list of terms matching the search criteria. If no terms are found, it returns the string "No terms found".
2983
+
2984
+ Raises
2985
+ ------
2986
+ InvalidParameterException
2987
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
2988
+ PropertyServerException
2989
+ Raised by the server when an issue arises in processing a valid request.
2990
+ NotAuthorizedException
2991
+ The principle specified by the user_id does not have authorization for the requested action.
2992
+ """
2993
+
2994
+ if page_size is None:
2995
+ page_size = self.page_size
2996
+
2997
+ validate_name(term)
2998
+
2999
+ for_lineage_s = str(for_lineage).lower()
3000
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
3001
+
3002
+ body = {
3003
+ "class": "GlossaryNameRequestBody",
3004
+ "glossaryGUID": glossary_guid,
3005
+ "name": term,
3006
+ "effectiveTime": effective_time,
3007
+ "limitResultsByStatus": status_filter,
3008
+ }
3009
+ # body = body_slimmer(body)
3010
+
3011
+ url = (
3012
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
3013
+ f"terms/by-name?startFrom={start_from}&pageSize={page_size}&"
3014
+ f"&forLineage={for_lineage_s}&forDuplicateProcessing={for_duplicate_processing_s}"
3015
+ )
3016
+
3017
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
3018
+
3019
+ response = await self._async_make_request("POST", url, body)
3020
+ return response.json().get("elementList", "No terms found")
3021
+
3022
+ def get_terms_by_name(
3023
+ self,
3024
+ term: str,
3025
+ glossary_guid: str = None,
3026
+ status_filter: list = [],
3027
+ effective_time: str = None,
3028
+ for_lineage: bool = False,
3029
+ for_duplicate_processing: bool = False,
3030
+ start_from: int = 0,
3031
+ page_size: int = None,
3032
+ ) -> list:
3033
+ """Retrieve glossary terms by display name or qualified name.
3034
+
3035
+ Parameters
3036
+ ----------
3037
+ term : str
3038
+ The term to search for in the glossaries.
3039
+ glossary_guid : str, optional
3040
+ The GUID of the glossary to search in. If not provided, the search will be performed in all glossaries.
3041
+ status_filter : list, optional
3042
+ A list of status values to filter the search results. Default is an empty list, which means no filtering.
3043
+
3044
+ effective_time : datetime, optional
3045
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
3046
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
3047
+ for_lineage : bool, optional
3048
+ Flag to indicate whether the search should include lineage information. Default is False.
3049
+ for_duplicate_processing : bool, optional
3050
+ Flag to indicate whether the search should include duplicate processing information. Default is False.
3051
+ start_from : int, optional
3052
+ The index of the first term to retrieve. Default is 0.
3053
+ page_size : int, optional
3054
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
3055
+
3056
+ Returns
3057
+ -------
3058
+ list
3059
+ A list of terms matching the search criteria. If no terms are found,
3060
+ it returns the string "No terms found".
3061
+
3062
+ Raises
3063
+ ------
3064
+ InvalidParameterException
3065
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
3066
+ PropertyServerException
3067
+ Raised by the server when an issue arises in processing a valid request.
3068
+ NotAuthorizedException
3069
+ The principle specified by the user_id does not have authorization for the requested action.
3070
+ """
3071
+ loop = asyncio.get_event_loop()
3072
+ response = loop.run_until_complete(
3073
+ self._async_get_terms_by_name(
3074
+ term,
3075
+ glossary_guid,
3076
+ status_filter,
3077
+ effective_time,
3078
+ for_lineage,
3079
+ for_duplicate_processing,
3080
+ start_from,
3081
+ page_size,
3082
+ )
3083
+ )
3084
+ return response
3085
+
3086
+ async def _async_get_terms_by_guid(self, term_guid: str) -> dict | str:
3087
+ """Retrieve a term using its unique id. Async version.
3088
+ Parameters
3089
+ ----------
3090
+ term_guid : str
3091
+ The GUID of the glossary term to retrieve.
3092
+
3093
+ Returns
3094
+ -------
3095
+ dict | str
3096
+ A dict detailing the glossary term represented by the GUID. If no term is found, the string
3097
+ "No term found" will be returned.
3098
+
3099
+ Raises
3100
+ ------
3101
+ InvalidParameterException
3102
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
3103
+ PropertyServerException
3104
+ Raised by the server when an issue arises in processing a valid request.
3105
+ NotAuthorizedException
3106
+ The principle specified by the user_id does not have authorization for the requested action.
3107
+ """
3108
+
3109
+ validate_guid(term_guid)
3110
+
3111
+ url = (
3112
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
3113
+ f"{term_guid}/retrieve"
3114
+ )
3115
+
3116
+ response = await self._async_make_request("POST", url)
3117
+ return response.json().get("element", "No term found")
3118
+
3119
+ def get_terms_by_guid(self, term_guid: str) -> dict | str:
3120
+ """Retrieve a term using its unique id. Async version.
3121
+ Parameters
3122
+ ----------
3123
+ term_guid : str
3124
+ The GUID of the glossary term to retrieve.
3125
+
3126
+ Returns
3127
+ -------
3128
+ dict | str
3129
+ A dict detailing the glossary term represented by the GUID. If no term is found, the string
3130
+ "No term found" will be returned.
3131
+
3132
+ Raises
3133
+ ------
3134
+ InvalidParameterException
3135
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
3136
+ PropertyServerException
3137
+ Raised by the server when an issue arises in processing a valid request.
3138
+ NotAuthorizedException
3139
+ The principle specified by the user_id does not have authorization for the requested action.
3140
+ """
3141
+
3142
+ loop = asyncio.get_event_loop()
3143
+ response = loop.run_until_complete(self._async_get_terms_by_guid(term_guid))
3144
+
3145
+ return response
3146
+
3147
+ async def _async_get_terms_versions(
3148
+ self,
3149
+ term_guid: str,
3150
+ start_from: int = 0,
3151
+ page_size=None,
3152
+ ) -> dict | str:
3153
+ """Retrieve the versions of a glossary term. Async version.
3154
+ Parameters
3155
+ ----------
3156
+ term_guid : str
3157
+ The GUID of the glossary term to retrieve.
3158
+ start_from : int, optional
3159
+ The index of the first term to retrieve. Default is 0.
3160
+ page_size : int, optional
3161
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
3162
+ Returns
3163
+ -------
3164
+ dict | str
3165
+ A dict detailing the glossary term represented by the GUID. If no term is found, the string
3166
+ "No term found" will be returned.
3167
+
3168
+ Raises
3169
+ ------
3170
+ InvalidParameterException
3171
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
3172
+ PropertyServerException
3173
+ Raised by the server when an issue arises in processing a valid request.
3174
+ NotAuthorizedException
3175
+ The principle specified by the user_id does not have authorization for the requested action.
3176
+ """
3177
+
3178
+ if page_size is None:
3179
+ page_size = self.page_size
3180
+
3181
+ validate_guid(term_guid)
3182
+
3183
+ url = (
3184
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/terms/"
3185
+ f"{term_guid}/history?startFrom={start_from}&pageSize={page_size}"
3186
+ )
3187
+
3188
+ response = await self._async_make_request("POST", url)
3189
+ return response.json().get("element", "No term found")
3190
+
3191
+ def get_terms_versions(
3192
+ self,
3193
+ term_guid: str,
3194
+ start_from: int = 0,
3195
+ page_size=None,
3196
+ ) -> dict | str:
3197
+ """Retrieve the versions of a glossary term.
3198
+ Parameters
3199
+ ----------
3200
+ term_guid : str
3201
+ The GUID of the glossary term to retrieve.
3202
+ start_from : int, optional
3203
+ The index of the first term to retrieve. Default is 0.
3204
+ page_size : int, optional
3205
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
3206
+ Returns
3207
+ -------
3208
+ dict | str
3209
+ A dict detailing the glossary term represented by the GUID. If no term is found, the string
3210
+ "No term found" will be returned.
3211
+
3212
+ Raises
3213
+ ------
3214
+ InvalidParameterException
3215
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
3216
+ PropertyServerException
3217
+ Raised by the server when an issue arises in processing a valid request.
3218
+ NotAuthorizedException
3219
+ The principle specified by the user_id does not have authorization for the requested action.
3220
+ """
3221
+
3222
+ loop = asyncio.get_event_loop()
3223
+ response = loop.run_until_complete(
3224
+ self._async_get_terms_versions(term_guid, start_from, page_size)
3225
+ )
3226
+
3227
+ return response
3228
+
3229
+ async def _async_get_term_revision_logs(
3230
+ self,
3231
+ term_guid: str,
3232
+ start_from: int = 0,
3233
+ page_size=None,
3234
+ ) -> dict | str:
3235
+ """Retrieve the revision log history for a term. Async version.
3236
+ Parameters
3237
+ ----------
3238
+ term_guid : str
3239
+ The GUID of the glossary term to retrieve.
3240
+ start_from : int, optional
3241
+ The index of the first term to retrieve. Default is 0.
3242
+ page_size : int, optional
3243
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
3244
+ Returns
3245
+ -------
3246
+ dict | str
3247
+ A dict detailing the glossary term revision log history. If no term is found, the string
3248
+ "No log found" will be returned.
3249
+
3250
+ Raises
3251
+ ------
3252
+ InvalidParameterException
3253
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
3254
+ PropertyServerException
3255
+ Raised by the server when an issue arises in processing a valid request.
3256
+ NotAuthorizedException
3257
+ The principle specified by the user_id does not have authorization for the requested action.
3258
+ """
3259
+
3260
+ if page_size is None:
3261
+ page_size = self.page_size
3262
+
3263
+ validate_guid(term_guid)
3264
+
3265
+ url = (
3266
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/elements/"
3267
+ f"{term_guid}/notes/retrieve?startFrom={start_from}&pageSize={page_size}"
3268
+ )
3269
+
3270
+ response = await self._async_make_request("POST", url)
3271
+ return response.json().get("elementList", "No log found")
3272
+
3273
+ def get_term_revision_logs(
3274
+ self,
3275
+ term_guid: str,
3276
+ start_from: int = 0,
3277
+ page_size=None,
3278
+ ) -> dict | str:
3279
+ """Retrieve the revision log history for a term.
3280
+ Parameters
3281
+ ----------
3282
+ term_guid : str
3283
+ The GUID of the glossary term to retrieve.
3284
+ start_from : int, optional
3285
+ The index of the first term to retrieve. Default is 0.
3286
+ page_size : int, optional
3287
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
3288
+ Returns
3289
+ -------
3290
+ dict | str
3291
+ A dict detailing the glossary term revision log history. If no term is found, the string
3292
+ "No log found" will be returned.
3293
+
3294
+ Raises
3295
+ ------
3296
+ InvalidParameterException
3297
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
3298
+ PropertyServerException
3299
+ Raised by the server when an issue arises in processing a valid request.
3300
+ NotAuthorizedException
3301
+ The principle specified by the user_id does not have authorization for the requested action.
3302
+ """
3303
+
3304
+ loop = asyncio.get_event_loop()
3305
+ response = loop.run_until_complete(
3306
+ self._async_get_term_revision_logs(term_guid, start_from, page_size)
3307
+ )
3308
+
3309
+ return response
3310
+
3311
+ async def _async_get_term_revision_history(
3312
+ self,
3313
+ term_revision_log_guid: str,
3314
+ start_from: int = 0,
3315
+ page_size=None,
3316
+ ) -> dict | str:
3317
+ """Retrieve the revision history for a glossary term. Async version.
3318
+
3319
+ Parameters
3320
+ ----------
3321
+ term_revision_log_guid : str
3322
+ The GUID of the glossary term revision log to retrieve.
3323
+ start_from : int, optional
3324
+ The index of the first term to retrieve. Default is 0.
3325
+ page_size : int, optional
3326
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
3327
+ Returns
3328
+ -------
3329
+ dict | str
3330
+ A dict detailing the glossary term revision history.
3331
+
3332
+ Raises
3333
+ ------
3334
+ InvalidParameterException
3335
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
3336
+ PropertyServerException
3337
+ Raised by the server when an issue arises in processing a valid request.
3338
+ NotAuthorizedException
3339
+ The principle specified by the user_id does not have authorization for the requested action.
3340
+
3341
+
3342
+ Notes
3343
+ -----
3344
+ This revision history is created automatically. The text is supplied on the update request.
3345
+ If no text is supplied, the value "None" is show.
3346
+ """
3347
+
3348
+ if page_size is None:
3349
+ page_size = self.page_size
3350
+
3351
+ validate_guid(term_revision_log_guid)
3352
+
3353
+ url = (
3354
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/note-logs/"
3355
+ f"{term_revision_log_guid}/notes/retrieve?startFrom={start_from}&pageSize={page_size}"
3356
+ )
3357
+
3358
+ response = await self._async_make_request("POST", url)
3359
+ return response.json().get("elementList", "No logs found")
3360
+
3361
+ def get_term_revision_history(
3362
+ self,
3363
+ term_revision_log_guid: str,
3364
+ start_from: int = 0,
3365
+ page_size=None,
3366
+ ) -> dict | str:
3367
+ """Retrieve the revision history for a glossary term.
3368
+
3369
+ Parameters
3370
+ ----------
3371
+ term_revision_log_guid : str
3372
+ The GUID of the glossary term revision log to retrieve.
3373
+ start_from : int, optional
3374
+ The index of the first term to retrieve. Default is 0.
3375
+ page_size : int, optional
3376
+ The number of terms to retrieve per page. If not provided, it will use the default page size.
3377
+ Returns
3378
+ -------
3379
+ dict | str
3380
+ A dict detailing the glossary term revision history.
3381
+
3382
+ Raises
3383
+ ------
3384
+ InvalidParameterException
3385
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
3386
+ PropertyServerException
3387
+ Raised by the server when an issue arises in processing a valid request.
3388
+ NotAuthorizedException
3389
+ The principle specified by the user_id does not have authorization for the requested action.
3390
+
3391
+
3392
+ Notes
3393
+ -----
3394
+ This revision history is created automatically. The text is supplied on the update request.
3395
+ If no text is supplied, the value "None" is show.
3396
+ """
3397
+
3398
+ loop = asyncio.get_event_loop()
3399
+ response = loop.run_until_complete(
3400
+ self._async_get_term_revision_history(
3401
+ term_revision_log_guid, start_from, page_size
3402
+ )
3403
+ )
3404
+
3405
+ return response
3406
+
3407
+ async def _async_find_glossary_terms(
3408
+ self,
3409
+ search_string: str,
3410
+ glossary_guid: str = None,
3411
+ status_filter: list = [],
3412
+ effective_time: str = None,
3413
+ starts_with: bool = False,
3414
+ ends_with: bool = False,
3415
+ ignore_case: bool = True,
3416
+ for_lineage: bool = False,
3417
+ for_duplicate_processing: bool = False,
3418
+ start_from: int = 0,
3419
+ page_size: int = None,
3420
+ ) -> list | str:
3421
+ """Retrieve the list of glossary term metadata elements that contain the search string.
3422
+
3423
+ Parameters
3424
+ ----------
3425
+ search_string: str
3426
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
3427
+ glossary_guid str
3428
+ Identifier of the glossary to search within. If None, then all glossaries are searched.
3429
+ status_filter: list, default = [], optional
3430
+ Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
3431
+ the results will not be filtered.
3432
+ effective_time: str, [default=None], optional
3433
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
3434
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
3435
+
3436
+ starts_with : bool, [default=False], optional
3437
+ Starts with the supplied string.
3438
+ ends_with : bool, [default=False], optional
3439
+ Ends with the supplied string
3440
+ ignore_case : bool, [default=False], optional
3441
+ Ignore case when searching
3442
+ for_lineage : bool, [default=False], optional
3443
+
3444
+ for_duplicate_processing : bool, [default=False], optional
3445
+
3446
+ start_from: str, [default=0], optional
3447
+ Page of results to start from
3448
+ page_size : int, optional
3449
+ Number of elements to return per page - if None, then default for class will be used.
3450
+
3451
+ Returns
3452
+ -------
3453
+ List | str
3454
+
3455
+ A list of term definitions
3456
+
3457
+ Raises
3458
+ ------
3459
+ InvalidParameterException
3460
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
3461
+ PropertyServerException
3462
+ Raised by the server when an issue arises in processing a valid request
3463
+ NotAuthorizedException
3464
+ The principle specified by the user_id does not have authorization for the requested action
3465
+
3466
+ Notes
3467
+ -----
3468
+ The search string is located in the request body and is interpreted as a plain string.
3469
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
3470
+ The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
3471
+ """
3472
+
3473
+ if page_size is None:
3474
+ page_size = self.page_size
3475
+ if effective_time is None:
3476
+ effective_time = datetime.now().isoformat()
3477
+ starts_with_s = str(starts_with).lower()
3478
+ ends_with_s = str(ends_with).lower()
3479
+ ignore_case_s = str(ignore_case).lower()
3480
+ for_lineage_s = str(for_lineage).lower()
3481
+ for_duplicate_processing_s = str(for_duplicate_processing).lower()
3482
+ if search_string == "*":
3483
+ search_string = None
3484
+
3485
+ # validate_search_string(search_string)
3486
+
3487
+ body = {
3488
+ "class": "GlossarySearchStringRequestBody",
3489
+ "glossaryGUID": glossary_guid,
3490
+ "searchString": search_string,
3491
+ "effectiveTime": effective_time,
3492
+ "limitResultsByStatus": status_filter,
3493
+ }
3494
+ # body = body_slimmer(body)
3495
+
3496
+ url = (
3497
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/glossary-browser/glossaries/"
3498
+ f"terms/by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
3499
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}&forLineage={for_lineage_s}&"
3500
+ f"forDuplicateProcessing={for_duplicate_processing_s}"
3501
+ )
3502
+
3503
+ # print(f"\n\nURL is: \n {url}\n\nBody is: \n{body}")
3504
+
3505
+ response = await self._async_make_request("POST", url, body)
3506
+ return response.json().get(
3507
+ "elementList", "No terms found"
3508
+ ) # return response.text
3509
+
3510
+ def find_glossary_terms(
3511
+ self,
3512
+ search_string: str,
3513
+ glossary_guid: str = None,
3514
+ status_filter: list = [],
3515
+ effective_time: str = None,
3516
+ starts_with: bool = False,
3517
+ ends_with: bool = False,
3518
+ ignore_case: bool = False,
3519
+ for_lineage: bool = False,
3520
+ for_duplicate_processing: bool = False,
3521
+ start_from: int = 0,
3522
+ page_size: int = None,
3523
+ ) -> list | str:
3524
+ """Retrieve the list of glossary term metadata elements that contain the search string.
3525
+
3526
+ Parameters
3527
+ ----------
3528
+ search_string: str
3529
+ Search string to use to find matching glossaries. If the search string is '*' then all glossaries returned.
3530
+ glossary_guid str
3531
+ Identifier of the glossary to search within. If None, then all glossaries are searched.
3532
+ status_filter: list, default = [], optional
3533
+ Filters the results by the included Term statuses (such as 'ACTIVE', 'DRAFT'). If not specified,
3534
+ the results will not be filtered.
3535
+ effective_time: str, [default=None], optional
3536
+ If specified, the term information will be retrieved if it is active at the `effective_time`.
3537
+ Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
3538
+
3539
+ starts_with : bool, [default=False], optional
3540
+ Starts with the supplied string.
3541
+ ends_with : bool, [default=False], optional
3542
+ Ends with the supplied string
3543
+ ignore_case : bool, [default=False], optional
3544
+ Ignore case when searching
3545
+ for_lineage : bool, [default=False], optional
3546
+
3547
+ for_duplicate_processing : bool, [default=False], optional
3548
+
3549
+ start_from: str, [default=0], optional
3550
+ Page of results to start from
3551
+ page_size : int, optional
3552
+ Number of elements to return per page - if None, then default for class will be used.
3553
+
3554
+ Returns
3555
+ -------
3556
+ List | str
3557
+
3558
+ A list of term definitions
3559
+
3560
+ Raises
3561
+ ------
3562
+ InvalidParameterException
3563
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
3564
+ PropertyServerException
3565
+ Raised by the server when an issue arises in processing a valid request
3566
+ NotAuthorizedException
3567
+ The principle specified by the user_id does not have authorization for the requested action
3568
+
3569
+ Notes
3570
+ -----
3571
+ The search string is located in the request body and is interpreted as a plain string.
3572
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
3573
+ The request body also supports the specification of a glossaryGUID to restrict the search to within a single glossary.
3574
+ """
3575
+
3576
+ loop = asyncio.get_event_loop()
3577
+ response = loop.run_until_complete(
3578
+ self._async_find_glossary_terms(
3579
+ search_string,
3580
+ glossary_guid,
3581
+ status_filter,
3582
+ effective_time,
3583
+ starts_with,
3584
+ ends_with,
3585
+ ignore_case,
3586
+ for_lineage,
3587
+ for_duplicate_processing,
3588
+ start_from,
3589
+ page_size,
3590
+ )
3591
+ )
3592
+
3593
+ return response
3594
+
3595
+
3596
+ if __name__ == "__main__":
3597
+ print("Main-Glossary Manager")