pyegeria 1.5.1.1.60__py3-none-any.whl → 5.2__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 (126) hide show
  1. pyegeria/__init__.py +2 -0
  2. pyegeria/_client.py +7 -2
  3. pyegeria/asset_catalog_omvs.py +34 -0
  4. pyegeria/classification_manager_omvs.py +2 -3
  5. pyegeria/collection_manager_omvs.py +92 -45
  6. pyegeria/commands/README.md +2 -1
  7. pyegeria/commands/cat/__init__.py +1 -5
  8. pyegeria/commands/cat/exp_list_glossaries.py +156 -0
  9. pyegeria/commands/cat/get_collection.py +23 -14
  10. pyegeria/commands/cat/get_tech_type_elements.py +1 -1
  11. pyegeria/commands/cat/glossary_actions.py +28 -8
  12. pyegeria/commands/cat/list_assets.py +8 -17
  13. pyegeria/commands/cat/list_cert_types.py +1 -1
  14. pyegeria/commands/cat/list_collections.py +162 -0
  15. pyegeria/commands/cat/list_deployed_catalogs.py +6 -3
  16. pyegeria/commands/cat/list_deployed_database_schemas.py +8 -13
  17. pyegeria/commands/cat/list_deployed_databases.py +3 -3
  18. pyegeria/commands/cat/list_tech_type_elements.py +190 -0
  19. pyegeria/commands/cat/list_tech_types.py +36 -24
  20. pyegeria/commands/cat/list_terms.py +7 -2
  21. pyegeria/commands/cli/egeria.py +120 -129
  22. pyegeria/commands/cli/egeria_cat.py +63 -52
  23. pyegeria/commands/cli/egeria_login_tui.py +313 -0
  24. pyegeria/commands/cli/egeria_my.py +25 -33
  25. pyegeria/commands/cli/egeria_ops.py +38 -40
  26. pyegeria/commands/cli/egeria_tech.py +55 -41
  27. pyegeria/commands/cli/ops_config.py +3 -1
  28. pyegeria/commands/cli/txt_custom_v2.tcss +19 -0
  29. pyegeria/commands/doc/README.md +145 -0
  30. pyegeria/commands/doc/Visual Command Reference/README.md +511 -0
  31. pyegeria/commands/doc/Visual Command Reference/cat/show/assets/asset-graph 2024-11-20 at 15.56.42.png +0 -0
  32. pyegeria/commands/doc/Visual Command Reference/cat/show/assets/assets-in-domain 2024-11-20 at 15.49.55@2x.png +0 -0
  33. pyegeria/commands/doc/Visual Command Reference/cat/show/assets/elements-of-type 2024-11-20 at 16.01.35.png +0 -0
  34. pyegeria/commands/doc/Visual Command Reference/cat/show/assets/tech-type-elements 2024-11-20 at 16.05.05.png +0 -0
  35. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-data-catalogs 2024-12-17 at 15.43.27@2x.png +0 -0
  36. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-data-catalogs-2024-11-20 at 16.17.43@2x.png +0 -0
  37. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-schemas 2024-11-25 at 20.14.50@2x.png +0 -0
  38. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-schemas 2024-12-17 at 15.48.38@2x.png +0 -0
  39. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-servers 2024-11-25 at 20.21.25@2x.png +0 -0
  40. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-servers 2024-12-17 at 15.52.16@2x.png +0 -0
  41. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed_databases 2024-12-16 at 16.40.31@2x.png +0 -0
  42. pyegeria/commands/doc/Visual Command Reference/cat/show/glossary/list-glossaries 2024-11-25 at 20.30.02.png +0 -0
  43. pyegeria/commands/doc/Visual Command Reference/cat/show/glossary/list-terms 2024-11-25 at 20.32.11.png +0 -0
  44. pyegeria/commands/doc/Visual Command Reference/cat/show/info/asset-types 2024-11-25 at 20.34.19@2x.png +0 -0
  45. pyegeria/commands/doc/Visual Command Reference/cat/show/info/certification-types 2024-11-25 at 20.37.07.png +0 -0
  46. pyegeria/commands/doc/Visual Command Reference/cat/show/info/collection-graph 2024-12-12 at 11.33.18@2x.png +0 -0
  47. pyegeria/commands/doc/Visual Command Reference/cat/show/info/list-collections 2024-12-10 at 14.25.51@2x.png +0 -0
  48. pyegeria/commands/doc/Visual Command Reference/cat/show/info/list-todos 2024-12-12 at 11.46.30@2x.png +0 -0
  49. pyegeria/commands/doc/Visual Command Reference/cat/show/info/list-user-ids 2024-12-12 at 11.51.09@2x.png +0 -0
  50. pyegeria/commands/doc/Visual Command Reference/cat/show/info/tech-types 2024-12-12 at 11.37.20@2x.png +0 -0
  51. pyegeria/commands/doc/Visual Command Reference/cat/show/projects/project_dependencies 2024-12-14 at 16.24.39@2x.png +0 -0
  52. pyegeria/commands/doc/Visual Command Reference/cat/show/projects/project_structure 2024-12-14 at 16.21.35@2x.png +0 -0
  53. pyegeria/commands/doc/Visual Command Reference/cat/show/projects/projects 2024-12-14 at 16.18.10@2x.png +0 -0
  54. pyegeria/commands/doc/Visual Command Reference/hey_egeria tui 2024-12-16 at 16.58.22@2x.png +0 -0
  55. pyegeria/commands/doc/Visual Command Reference/my/show/my_profile 2024-12-14 at 16.29.27@2x.png +0 -0
  56. pyegeria/commands/doc/Visual Command Reference/my/show/my_roles 2024-12-14 at 16.32.10@2x.png +0 -0
  57. pyegeria/commands/doc/Visual Command Reference/my/show/my_todos 2024-12-15 at 16.24.13@2x.png +0 -0
  58. pyegeria/commands/doc/Visual Command Reference/my/show/open_todos 2024-12-14 at 16.36.12@2x.png +0 -0
  59. pyegeria/commands/doc/Visual Command Reference/ops/show/engines/list_engine_activity compressed 2024-12-15 at 16.48.48@2x.png +0 -0
  60. pyegeria/commands/doc/Visual Command Reference/ops/show/engines/monitor_engine_activity 2024-12-15 at 16.32.55@2x.png +0 -0
  61. pyegeria/commands/doc/Visual Command Reference/ops/show/engines/monitor_engine_activity compressed 2024-12-15 at 16.38.29@2x.png +0 -0
  62. pyegeria/commands/doc/Visual Command Reference/ops/show/engines/monitor_engine_status 2024-12-15 at 16.51.26.jpeg +0 -0
  63. pyegeria/commands/doc/Visual Command Reference/ops/show/integrations/monitor_integration_daemon_status 2024-12-15 at 16.57.12@2x.png +0 -0
  64. pyegeria/commands/doc/Visual Command Reference/ops/show/integrations/monitor_integration_targets 2024-12-15 at 17.02.19@2x.png +0 -0
  65. pyegeria/commands/doc/Visual Command Reference/ops/show/platforms/monitor_platform_status 2024-12-15 at 19.53.18@2x.png +0 -0
  66. pyegeria/commands/doc/Visual Command Reference/ops/show/servers/monitor_server_status 2024-12-15 at 19.59.39@2x.png +0 -0
  67. pyegeria/commands/doc/Visual Command Reference/ops/show/servers/monitor_server_status full 2024-12-15 at 20.01.57@2x.png +0 -0
  68. pyegeria/commands/doc/Visual Command Reference/ops/show/servers/monitor_startup_servers 2024-12-15 at 19.56.07@2x.png +0 -0
  69. pyegeria/commands/doc/Visual Command Reference/tech/show/elements/get_anchored_elements 2024-12-15 at 21.25.41@2x.png +0 -0
  70. 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
  71. pyegeria/commands/doc/Visual Command Reference/tech/show/elements/info_for_guid 2024-12-16 at 11.35.29@2x.png +0 -0
  72. 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
  73. 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
  74. 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
  75. pyegeria/commands/doc/Visual Command Reference/tech/show/elements/related_elements 2024-12-16 at 14.55.01@2x.png +0 -0
  76. pyegeria/commands/doc/Visual Command Reference/tech/show/elements/show_related_specifications 2024-12-16 at 15.04.55@2x.png +0 -0
  77. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/asset_types 2024-12-16 at 15.10.16@2x.png +0 -0
  78. 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
  79. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/governance_action_processes 2024-12-16 at 15.13.01@2x.png +0 -0
  80. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/registered_services 2024-12-16 at 16.44.54@2x.png +0 -0
  81. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/relationship_types 2024-12-16 at 16.20.34@2x.png +0 -0
  82. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/relationship_types 2024-12-19 at 10.51.54@2x.png +0 -0
  83. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/valid_metadata_values 2024-12-16 at 15.31.56@2x.png +0 -0
  84. 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
  85. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-types/list_technology_types 2024-12-16 at 15.39.20@2x.png +0 -0
  86. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-types/tech_type_details 2024-12-16 at 15.37.21@2x.png +0 -0
  87. pyegeria/commands/doc/Visual Command Reference/tech/show/tech-types/tech_type_templates 2024-12-16 at 16.11.48@2x.png +0 -0
  88. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/{hey_egeria: overview.md → README.md } +9 -1
  89. pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/CleanShot 2024-11-18 at 21.32.03@2x.png +0 -0
  90. pyegeria/commands/my/monitor_my_todos.py +17 -5
  91. pyegeria/commands/my/monitor_open_todos.py +1 -1
  92. pyegeria/commands/my/todo_actions.py +7 -14
  93. pyegeria/commands/ops/monitor_asset_events.py +27 -22
  94. pyegeria/commands/ops/monitor_engine_activity_c.py +1 -1
  95. pyegeria/commands/ops/monitor_gov_eng_status.py +31 -4
  96. pyegeria/commands/ops/monitor_integ_daemon_status.py +17 -14
  97. pyegeria/commands/ops/monitor_platform_status.py +15 -3
  98. pyegeria/commands/ops/monitor_server_status.py +1 -1
  99. pyegeria/commands/ops/orig_monitor_server_status.py +36 -21
  100. pyegeria/commands/ops/refresh_integration_daemon.py +1 -1
  101. pyegeria/commands/ops/restart_integration_daemon.py +1 -1
  102. pyegeria/commands/ops/x_engine_actions.py +2 -59
  103. pyegeria/commands/tech/get_tech_details.py +79 -42
  104. pyegeria/commands/tech/get_tech_type_template.py +69 -53
  105. pyegeria/commands/tech/{list_element_graph.py → list_anchored_elements.py} +20 -17
  106. pyegeria/commands/tech/list_elements_x.py +7 -4
  107. pyegeria/commands/tech/list_registered_services.py +1 -1
  108. pyegeria/commands/tech/list_relationship_types.py +19 -21
  109. pyegeria/commands/tech/list_relationships.py +7 -3
  110. pyegeria/commands/tech/table_tech_templates.py +3 -1
  111. pyegeria/core_omag_server_config.py +36 -0
  112. pyegeria/create_tech_guid_lists.py +2 -2
  113. pyegeria/egeria_client.py +2 -0
  114. pyegeria/egeria_tech_client.py +5 -0
  115. pyegeria/glossary_manager_omvs.py +101 -7
  116. pyegeria/metadata_explorer_omvs.py +2371 -0
  117. pyegeria/server_operations.py +4 -4
  118. pyegeria/template_manager_omvs.py +1 -3
  119. pyegeria/valid_metadata_omvs.py +1 -1
  120. {pyegeria-1.5.1.1.60.dist-info → pyegeria-5.2.dist-info}/METADATA +7 -9
  121. pyegeria-5.2.dist-info/RECORD +232 -0
  122. {pyegeria-1.5.1.1.60.dist-info → pyegeria-5.2.dist-info}/entry_points.txt +4 -1
  123. pyegeria/commands/doc/command-overview.md +0 -99
  124. pyegeria-1.5.1.1.60.dist-info/RECORD +0 -167
  125. {pyegeria-1.5.1.1.60.dist-info → pyegeria-5.2.dist-info}/LICENSE +0 -0
  126. {pyegeria-1.5.1.1.60.dist-info → pyegeria-5.2.dist-info}/WHEEL +0 -0
@@ -47,6 +47,8 @@ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
47
47
  EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
48
48
  EGERIA_WIDTH = os.environ.get("EGERIA_WIDTH", 200)
49
49
  EGERIA_JUPYTER = os.environ.get("EGERIA_JUPYTER", False)
50
+ EGERIA_HOME_GLOSSARY_GUID = os.environ.get("EGERIA_HOME_GLOSSARY_GUID", None)
51
+ EGERIA_GLOSSARY_PATH = os.environ.get("EGERIA_GLOSSARY_PATH", None)
50
52
 
51
53
 
52
54
  @click.command("create-glossary")
@@ -125,7 +127,7 @@ def create_glossary(
125
127
  @click.option("--userid", default=EGERIA_USER, help="Egeria user")
126
128
  @click.option("--password", default=EGERIA_USER_PASSWORD, help="Egeria user password")
127
129
  @click.option("--timeout", default=60, help="Number of seconds to wait")
128
- @click.argument("glossary-guid")
130
+ @click.argument("glossary-guid", default=EGERIA_HOME_GLOSSARY_GUID)
129
131
  def delete_glossary(server, url, userid, password, timeout, glossary_guid):
130
132
  """Delete the glossary specified"""
131
133
  m_client = EgeriaTech(server, url, user_id=userid, user_pwd=password)
@@ -264,8 +266,11 @@ def delete_term(server, url, userid, password, timeout, term_guid):
264
266
 
265
267
 
266
268
  @click.command("import-terms")
267
- @click.option("--glossary-name", help="Name of Glossary", required=True)
268
- @click.option("--file-name", help="Path of CSV file", required=True)
269
+ @click.option("--glossary_name", help="Name of Glossary", required=True)
270
+ @click.option("--file_name", help="Path of CSV file", required=True)
271
+ @click.option(
272
+ "--file_path", help="Path of CSV file", default=EGERIA_GLOSSARY_PATH, required=False
273
+ )
269
274
  @click.option(
270
275
  "--verbose",
271
276
  is_flag=True,
@@ -287,6 +292,7 @@ def delete_term(server, url, userid, password, timeout, term_guid):
287
292
  @click.option("--timeout", default=60, help="Number of seconds to wait")
288
293
  def import_terms(
289
294
  glossary_name: str,
295
+ file_path: str,
290
296
  file_name: str,
291
297
  verbose: bool,
292
298
  upsert: bool,
@@ -301,7 +307,11 @@ def import_terms(
301
307
  token = m_client.create_egeria_bearer_token()
302
308
  try:
303
309
  result = m_client.load_terms_from_file(
304
- glossary_name, file_name, upsert=upsert, verbose=verbose
310
+ glossary_name,
311
+ file_name,
312
+ file_path=file_path,
313
+ upsert=upsert,
314
+ verbose=verbose,
305
315
  )
306
316
 
307
317
  click.echo(
@@ -317,8 +327,16 @@ def import_terms(
317
327
 
318
328
 
319
329
  @click.command("export-terms")
320
- @click.option("--glossary-guid", help="GUID of Glossary to export", required=True)
321
- @click.option("--file-name", help="Path of CSV file", required=True)
330
+ @click.option(
331
+ "--glossary_guid",
332
+ default=EGERIA_HOME_GLOSSARY_GUID,
333
+ help="GUID of Glossary to export",
334
+ required=True,
335
+ )
336
+ @click.option("--file_name", help="Path of CSV file", required=True)
337
+ @click.option(
338
+ "--file_path", help="Path of CSV file", default=EGERIA_GLOSSARY_PATH, required=False
339
+ )
322
340
  @click.option("--server", default=EGERIA_VIEW_SERVER, help="Egeria view server to use")
323
341
  @click.option(
324
342
  "--url", default=EGERIA_VIEW_SERVER_URL, help="URL of Egeria platform to connect to"
@@ -326,12 +344,14 @@ def import_terms(
326
344
  @click.option("--userid", default=EGERIA_USER, help="Egeria user")
327
345
  @click.option("--password", default=EGERIA_USER_PASSWORD, help="Egeria user password")
328
346
  @click.option("--timeout", default=60, help="Number of seconds to wait")
329
- def export_terms(glossary_guid: str, file_name, server, url, userid, password, timeout):
347
+ def export_terms(
348
+ glossary_guid: str, file_name, file_path, server, url, userid, password, timeout
349
+ ):
330
350
  """Export the glossary specified"""
331
351
  m_client = EgeriaTech(server, url, user_id=userid, user_pwd=password)
332
352
  token = m_client.create_egeria_bearer_token()
333
353
  try:
334
- result = m_client.export_glossary_to_csv(glossary_guid, file_name)
354
+ result = m_client.export_glossary_to_csv(glossary_guid, file_name, file_path)
335
355
 
336
356
  click.echo(
337
357
  f"Exported {result} terms from glossary: {glossary_guid} into {file_name}"
@@ -3,10 +3,8 @@
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  Copyright Contributors to the ODPi Egeria project.
5
5
 
6
- Unit tests for the Utils helper functions using the Pytest framework.
6
+ List assets
7
7
 
8
-
9
- A simple display for glossary terms
10
8
  """
11
9
  import argparse
12
10
  import os
@@ -18,6 +16,7 @@ from rich.console import Console
18
16
  from rich.prompt import Prompt
19
17
  from rich.markdown import Markdown
20
18
  from rich.table import Table
19
+ from rich.text import Text
21
20
 
22
21
  from pyegeria import (
23
22
  InvalidParameterException,
@@ -78,9 +77,8 @@ def display_assets(
78
77
  caption=f"View Server '{server}' @ Platform - {url}",
79
78
  expand=True,
80
79
  )
81
- table.add_column("Display Name", max_width=15)
80
+ table.add_column("Display Name / Qualified Name / GUID", width=36)
82
81
  table.add_column("Type Name")
83
- table.add_column("GUID", no_wrap=True)
84
82
  table.add_column("Technology Type")
85
83
  # table.add_column("Qualified Name",max_width=15)
86
84
  table.add_column("Matching Elements")
@@ -100,23 +98,16 @@ def display_assets(
100
98
  properties = element["properties"]
101
99
  header = element["elementHeader"]
102
100
  nested = element.get("matchingElements", "---")
101
+ qualified_name = properties["qualifiedName"]
102
+ display_name = Text(f"{properties.get("displayName", "---")}\n\n{qualified_name}\n\n"
103
+ f"{header['guid']}", justify="center")
103
104
 
104
- display_name = properties.get("displayName", "---")
105
- # qualified_name = properties["qualifiedName"] # we decided that qualified name wasn't useful
106
105
  type_name = header["type"]["typeName"]
107
106
  tech_type = properties.get("deployedImplementationType", "---")
108
- guid = header["guid"]
109
- #### We decided that path wasn't useful
110
- # path_name = element.get("extendedProperties", None)
111
- # if path_name:
112
- # path = path_name.get("pathName"," ")
113
- # else:
114
- # path = " "
115
- match_md = ""
116
107
 
117
108
  match_tab = Table(expand=True)
118
109
  match_tab.add_column("Type Name")
119
- match_tab.add_column("GUID", no_wrap=True, width=36)
110
+ match_tab.add_column("GUID", width=36)
120
111
  match_tab.add_column("Properties")
121
112
 
122
113
  for match_t in nested:
@@ -130,7 +121,7 @@ def display_assets(
130
121
  match_details_out = Markdown(match_details_md)
131
122
  match_tab.add_row(match_type_name, matching_guid, match_details_out)
132
123
 
133
- table.add_row(display_name, type_name, guid, tech_type, match_tab)
124
+ table.add_row(display_name, type_name, tech_type, match_tab)
134
125
 
135
126
  g_client.close_session()
136
127
  return table
@@ -107,7 +107,7 @@ def display_certifications(
107
107
  title = properties.get("title", "---")
108
108
  cert_guid = element["elementHeader"]["guid"]
109
109
 
110
- related = g_client.get_all_related_elements(cert_guid)
110
+ related = g_client.get_related_elements(cert_guid)
111
111
  if (len(related) > 0) and (type(related) is list):
112
112
  rel_md = ""
113
113
  for rel in related:
@@ -0,0 +1,162 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ SPDX-License-Identifier: Apache-2.0
4
+ Copyright Contributors to the ODPi Egeria project.
5
+
6
+ A simple display for collections
7
+ """
8
+ import argparse
9
+ import os
10
+ import time
11
+
12
+ from rich import box
13
+ from rich.console import Console
14
+ from rich.prompt import Prompt
15
+ from rich.table import Table
16
+ from rich.text import Text
17
+
18
+ from pyegeria import (
19
+ InvalidParameterException,
20
+ PropertyServerException,
21
+ UserNotAuthorizedException,
22
+ EgeriaTech,
23
+ print_exception_response,
24
+ )
25
+
26
+ disable_ssl_warnings = True
27
+
28
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
29
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
30
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
31
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
32
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
33
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
34
+ )
35
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
36
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
37
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
38
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
39
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
40
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
41
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
42
+
43
+
44
+ def display_collections(
45
+ search_string: str = "*",
46
+ view_server: str = EGERIA_VIEW_SERVER,
47
+ view_url: str = EGERIA_VIEW_SERVER_URL,
48
+ user: str = EGERIA_USER,
49
+ user_pass: str = EGERIA_USER_PASSWORD,
50
+ jupyter: bool = EGERIA_JUPYTER,
51
+ width: int = EGERIA_WIDTH,
52
+ ):
53
+ """Display either a specified glossary or all collections if the search_string is '*'.
54
+ Parameters
55
+ ----------
56
+ search_string : str, default is '*'
57
+ The string used to search for collections.
58
+ view_server : str
59
+ The view server name or address where the Egeria services are hosted.
60
+ view_url : str
61
+ The URL of the platform the view server is on.
62
+ user : str
63
+ The user ID for authentication with the Egeria server.
64
+ user_pass : str
65
+ The password for authentication with the Egeria server.
66
+ jupyter : bool, optional
67
+ A boolean indicating whether the output is intended for a Jupyter notebook (default is EGERIA_JUPYTER).
68
+ width : int, optional
69
+ The width of the console output (default is EGERIA_WIDTH).
70
+ """
71
+ m_client = EgeriaTech(view_server, view_url, user_id=user, user_pwd=user_pass)
72
+ token = m_client.create_egeria_bearer_token()
73
+ try:
74
+ table = Table(
75
+ title=f"Collection List @ {time.asctime()}",
76
+ style="bright_white on black",
77
+ header_style="bright_white on dark_blue",
78
+ title_style="bold white on black",
79
+ caption_style="white on black",
80
+ show_lines=True,
81
+ box=box.ROUNDED,
82
+ caption=f"View Server '{view_server}' @ Platform - {view_url}",
83
+ expand=True,
84
+ )
85
+ table.add_column("Collection Name")
86
+ table.add_column(
87
+ "Qualified Name & GUID", width=38, no_wrap=True, justify="center"
88
+ )
89
+ table.add_column("Home Metadata Collection")
90
+ table.add_column("Description")
91
+ table.add_column("Collection Type")
92
+
93
+ collections = m_client.find_collections(
94
+ search_string.strip(), None, False, ends_with=False, ignore_case=True
95
+ )
96
+ if type(collections) is list:
97
+ sorted_collection_list = sorted(
98
+ collections, key=lambda k: k["properties"]["name"]
99
+ )
100
+ for collection in sorted_collection_list:
101
+ display_name = collection["properties"]["name"]
102
+ qualified_name = collection["properties"]["qualifiedName"]
103
+ home_metadata_collection = collection["elementHeader"]["origin"][
104
+ "homeMetadataCollectionName"
105
+ ]
106
+ guid = collection["elementHeader"]["guid"]
107
+ q_name = Text(f"{qualified_name}\n&\n{guid}", justify="center")
108
+ description = collection["properties"]["description"]
109
+ collection_type = collection["properties"].get("collectionType", "---")
110
+ table.add_row(
111
+ display_name,
112
+ q_name,
113
+ home_metadata_collection,
114
+ description,
115
+ collection_type,
116
+ )
117
+ console = Console(
118
+ style="bold bright_white on black",
119
+ width=width,
120
+ force_terminal=not jupyter,
121
+ )
122
+ console.print(table)
123
+ else:
124
+ print("==> No collections with that name found")
125
+
126
+ except (
127
+ InvalidParameterException,
128
+ UserNotAuthorizedException,
129
+ PropertyServerException,
130
+ ) as e:
131
+ print_exception_response(e)
132
+ finally:
133
+ m_client.close_session()
134
+
135
+
136
+ def main():
137
+ parser = argparse.ArgumentParser()
138
+ parser.add_argument("--server", help="Name of the server to display status for")
139
+ parser.add_argument("--url", help="URL Platform to connect to")
140
+ parser.add_argument("--userid", help="User Id")
141
+ parser.add_argument("--password", help="User Password")
142
+
143
+ args = parser.parse_args()
144
+
145
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
146
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
147
+ userid = args.userid if args.userid is not None else EGERIA_USER
148
+ user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
149
+
150
+ try:
151
+ search_string = Prompt.ask(
152
+ "Enter the collection you are searching for or '*' for all:", default="*"
153
+ ).strip()
154
+
155
+ display_collections(search_string, server, url, userid, user_pass)
156
+
157
+ except KeyboardInterrupt:
158
+ pass
159
+
160
+
161
+ if __name__ == "__main__":
162
+ main()
@@ -81,7 +81,8 @@ def list_deployed_catalogs(
81
81
  def generate_table() -> Table:
82
82
  """Make a new table."""
83
83
  table = Table(
84
- caption=f"Databases found: {view_url} - {view_server} @ {time.asctime()}",
84
+ title=f"Catalog List @ {time.asctime()}",
85
+ caption=f"Catalogs found: {view_url} - {view_server} @ {time.asctime()}",
85
86
  style="bold bright_white on black",
86
87
  row_styles=["bold bright_white on black"],
87
88
  header_style="white on dark_blue",
@@ -100,11 +101,13 @@ def list_deployed_catalogs(
100
101
  table.add_column("Catalog Schemas")
101
102
 
102
103
  if catalog_server in [None, "*"]:
103
- cats = c_client.get_elements_by_classification("Anchors", "Catalog")
104
+ cats = c_client.get_elements_by_classification(
105
+ "Anchors", "DataAccessManager"
106
+ )
104
107
  else:
105
108
  server_guid = c_client.get_guid_for_name(catalog_server)
106
109
  cats = c_client.get_elements_by_classification_with_property_value(
107
- "Anchors", server_guid, ["anchorGUID"], "Catalog"
110
+ "Anchors", server_guid, ["anchorGUID"], "DataAccessManager"
108
111
  )
109
112
  if type(cats) is list:
110
113
  for cat in cats:
@@ -87,6 +87,7 @@ def list_deployed_database_schemas(
87
87
  def generate_table() -> Table:
88
88
  """Make a new table."""
89
89
  table = Table(
90
+ title=f"Catalog Schema List @ {time.asctime()}",
90
91
  caption=f"Databases found: {view_url} - {view_server} @ {time.asctime()}",
91
92
  style="bold bright_white on black",
92
93
  row_styles=["bold bright_white on black"],
@@ -95,17 +96,12 @@ def list_deployed_database_schemas(
95
96
  caption_style="white on black",
96
97
  show_lines=True,
97
98
  box=box.ROUNDED,
98
- # title=f"Elements for Open Metadata Type: '{om_type}' ",
99
99
  expand=True,
100
100
  # width=500
101
101
  )
102
102
 
103
103
  table.add_column("Schema in Catalog")
104
104
  table.add_column("Schema Properties")
105
-
106
- # table.add_column("Home Store")
107
- # table.add_column("GUID", width=38, no_wrap=True)
108
- # table.add_column("Properties")
109
105
  table.add_column("Cataloged Resource")
110
106
 
111
107
  om_type = "DeployedDatabaseSchema"
@@ -138,18 +134,21 @@ def list_deployed_database_schemas(
138
134
  # get the information about the catalog we are part of
139
135
  el_classification = header["classifications"]
140
136
  for c in el_classification:
137
+ el_cat_guid = "---"
141
138
  if c["type"]["typeName"] == "Anchors":
142
139
  el_anchor_guid = c["classificationProperties"]["anchorGUID"]
143
140
  el_anchor_type_name = c["classificationProperties"][
144
141
  "anchorTypeName"
145
142
  ]
146
- if el_anchor_type_name == "Catalog":
143
+ el_anchor_domain_name = c["classificationProperties"][
144
+ "anchorDomainName"
145
+ ]
146
+ el_cat_name = "---"
147
+ if el_anchor_domain_name == "SoftwareCapability":
147
148
  el_cat = c_client.get_element_by_guid(el_anchor_guid)
148
149
  el_cat_name = el_cat["properties"].get("name", None)
149
150
  if el_cat_name is None:
150
- el_cat_name = el_cat["properties"].get(
151
- "qualifiedName", "---"
152
- )
151
+ el_cat_name = el_cat["properties"].get("qualifiedName", "")
153
152
  el_cat_guid = el_cat["elementHeader"]["guid"]
154
153
  el_schema_id = (
155
154
  f"{el_name}\n{el_guid}\n\n\t\tin\n\n{el_cat_name}\n{el_cat_guid}"
@@ -202,10 +201,6 @@ def list_deployed_database_schemas(
202
201
 
203
202
  table.add_row(
204
203
  el_schema_id,
205
- # el_type,
206
- # el_created_out,
207
- # el_home,
208
- # el_guid,
209
204
  el_props_out,
210
205
  rel_el_out,
211
206
  )
@@ -76,6 +76,7 @@ def list_deployed_databases(
76
76
  def generate_table() -> Table:
77
77
  """Make a new table."""
78
78
  table = Table(
79
+ title=f"Database List @ {time.asctime()}",
79
80
  caption=f"Databases found: {view_url} - {view_server} @ {time.asctime()}",
80
81
  style="bold bright_white on black",
81
82
  row_styles=["bold bright_white on black"],
@@ -92,7 +93,6 @@ def list_deployed_databases(
92
93
  table.add_column("Qualified Name")
93
94
  table.add_column("Type")
94
95
  table.add_column("Created", width=23)
95
- table.add_column("Home Store")
96
96
  table.add_column("GUID", width=38, no_wrap=True)
97
97
  table.add_column("Properties")
98
98
  table.add_column("Schemas")
@@ -113,7 +113,8 @@ def list_deployed_databases(
113
113
  el_created_by = header["versions"]["createdBy"]
114
114
  el_created_md = (
115
115
  f"* **Created By**: {el_created_by}\n"
116
- f"* **Created Time**: {el_create_time}"
116
+ f"* **Created Time**: {el_create_time}\n"
117
+ f"* **Home Store**: {el_home}"
117
118
  )
118
119
  el_created_out = Markdown(el_created_md)
119
120
 
@@ -150,7 +151,6 @@ def list_deployed_databases(
150
151
  el_q_name,
151
152
  el_type,
152
153
  el_created_out,
153
- el_home,
154
154
  el_guid,
155
155
  el_props_out,
156
156
  rel_el_out,
@@ -0,0 +1,190 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ SPDX-License-Identifier: Apache-2.0
4
+ Copyright Contributors to the ODPi Egeria project.
5
+
6
+ Display the status of cataloged platforms and servers.
7
+ """
8
+ import argparse
9
+ import os
10
+ import sys
11
+ import time
12
+
13
+ import rich.box as box
14
+ from rich import print
15
+ from rich.console import Console
16
+ from rich.markdown import Markdown
17
+ from rich.panel import Panel
18
+ from rich.prompt import Prompt
19
+ from rich.table import Table
20
+
21
+ from pyegeria import (
22
+ InvalidParameterException,
23
+ PropertyServerException,
24
+ UserNotAuthorizedException,
25
+ print_exception_response,
26
+ AutomatedCuration,
27
+ )
28
+
29
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
30
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
31
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
32
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
33
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
34
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
35
+ )
36
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
37
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
38
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
39
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
40
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
41
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
42
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
43
+
44
+
45
+ disable_ssl_warnings = True
46
+ console = Console(width=200)
47
+
48
+ guid_list = []
49
+
50
+
51
+ def list_tech_elements(
52
+ tech_name: str,
53
+ server_name: str,
54
+ platform_url: str,
55
+ user: str,
56
+ user_pass: str,
57
+ jupyter: bool = EGERIA_JUPYTER,
58
+ width: int = EGERIA_WIDTH,
59
+ ):
60
+ console = Console(width=width, force_terminal=not jupyter)
61
+
62
+ a_client = AutomatedCuration(server_name, platform_url, user_id=user)
63
+ token = a_client.create_egeria_bearer_token(user, user_pass)
64
+
65
+ def build_classifications(classification: dict) -> Markdown:
66
+ class_md = "\n"
67
+ for c in classification:
68
+ c_type = c["classificationName"]
69
+ if c_type == "Anchors":
70
+ continue
71
+ class_md += f"* Classification: {c_type}\n"
72
+ class_props = c.get("classificationProperties", None)
73
+ if class_props is None:
74
+ continue
75
+ for prop in class_props.keys():
76
+ class_md += f"\t* {prop}: {class_props[prop]}\n"
77
+ if class_md == "-":
78
+ output = None
79
+ else:
80
+ output = class_md
81
+ return output
82
+
83
+ def generate_table() -> Table:
84
+ """Make a new table."""
85
+ table = Table(
86
+ title=f"Tech Type Elements for {tech_name} @ {time.asctime()}",
87
+ caption=f"{platform_url} - {server_name} @ {time.asctime()}",
88
+ style="bold bright_white on black",
89
+ row_styles=["bold bright_white on black"],
90
+ header_style="white on dark_blue",
91
+ title_style="bold bright_white on black",
92
+ caption_style="white on black",
93
+ show_lines=True,
94
+ box=box.ROUNDED,
95
+ expand=True,
96
+ )
97
+
98
+ table.add_column("Qualified Name/GUID", width=38, no_wrap=True)
99
+ table.add_column("Properties", width=40)
100
+ table.add_column("Classifications", width=50)
101
+
102
+ tech_elements = a_client.get_technology_type_elements(
103
+ tech_name, get_templates=False
104
+ )
105
+ if type(tech_elements) is str:
106
+ console.print(f"No elements found for {tech_name}")
107
+ sys.exit(1)
108
+
109
+ note: str = " "
110
+ for element in tech_elements:
111
+ header = element["elementHeader"]
112
+ tech_type = header["type"]["typeName"]
113
+ tech_collection = header["origin"]["homeMetadataCollectionName"]
114
+ tech_created_by = header["versions"]["createdBy"]
115
+ tech_created_at = header["versions"]["createTime"]
116
+ tech_guid = header["guid"]
117
+ tech_classifications = header["classifications"]
118
+ class_md = build_classifications(tech_classifications)
119
+
120
+ referenceables = element["referenceableProperties"]
121
+ tech_qualified_name = referenceables["qualifiedName"]
122
+ extended = referenceables["extendedProperties"]
123
+ ex_md: str = ""
124
+ for key, value in extended.items():
125
+ ex_md += f"* {key}: {value}\n"
126
+
127
+ note = (
128
+ f"{ex_md}\n"
129
+ f"* Created by: {tech_created_by}\n"
130
+ f"* Created at: {tech_created_at}\n"
131
+ f"* Home Collection: {tech_collection}\n"
132
+ )
133
+
134
+ interfaces = extended.get("connectorInterfaces", None)
135
+ if interfaces is not None:
136
+ interface_type_name = interfaces["typeName"]
137
+ interface_array_cnt = interfaces["arrayCount"]
138
+ note += f"* Interface Type: {interface_type_name}\n"
139
+ for i in range(0, int(interface_array_cnt)):
140
+ note += (
141
+ f"\t* Type: {interfaces['arrayValues']['propertyValueMap'][str(i)]['typeName']}"
142
+ f"\tName: {interfaces['arrayValues']['propertiesAsStrings'][str(i)]}\n"
143
+ )
144
+ note_md = Markdown(note)
145
+ qn = Markdown(f"\n{tech_qualified_name}\n \n--- \n\n\n{tech_guid}")
146
+ cm = Markdown(class_md)
147
+ table.add_row(qn, note_md, cm)
148
+ return table
149
+
150
+ try:
151
+ console = Console(width=width, force_terminal=not jupyter)
152
+
153
+ with console.pager(styles=True):
154
+ console.print(generate_table())
155
+
156
+ except (
157
+ InvalidParameterException,
158
+ PropertyServerException,
159
+ UserNotAuthorizedException,
160
+ ) as e:
161
+ print_exception_response(e)
162
+ print("\n\nPerhaps the type name isn't known")
163
+ finally:
164
+ a_client.close_session()
165
+
166
+
167
+ def main():
168
+ parser = argparse.ArgumentParser()
169
+
170
+ parser.add_argument("--server", help="Name of the server to display status for")
171
+ parser.add_argument("--url", help="URL Platform to connect to")
172
+ parser.add_argument("--userid", help="User Id")
173
+ parser.add_argument("--password", help="User Password")
174
+ args = parser.parse_args()
175
+
176
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
177
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
178
+ userid = args.userid if args.userid is not None else EGERIA_USER
179
+ user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
180
+ try:
181
+ tech_name = Prompt.ask(
182
+ "Enter the tech type to view:", default="PostgreSQL Server"
183
+ )
184
+ list_tech_elements(tech_name, server, url, userid, user_pass)
185
+ except KeyboardInterrupt:
186
+ pass
187
+
188
+
189
+ if __name__ == "__main__":
190
+ main()