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