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