pyegeria 0.8.4.40__tar.gz → 0.8.4.42__tar.gz

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 (99) hide show
  1. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/PKG-INFO +1 -1
  2. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cli/egeria_tech.py +61 -0
  3. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/load_archive.py +5 -1
  4. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/list_elements.py +1 -1
  5. pyegeria-0.8.4.42/commands/tech/list_elements_for_classification.py +174 -0
  6. pyegeria-0.8.4.42/commands/tech/list_related_elements.py +176 -0
  7. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyproject.toml +3 -1
  8. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/LICENSE +0 -0
  9. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/README.md +0 -0
  10. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/README.md +0 -0
  11. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/__init__.py +0 -0
  12. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/get_asset_graph.py +0 -0
  13. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/get_collection.py +0 -0
  14. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/get_project_dependencies.py +0 -0
  15. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/get_project_structure.py +0 -0
  16. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/get_tech_type_elements.py +0 -0
  17. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/get_tech_type_template.py +0 -0
  18. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/list_archives.py +0 -0
  19. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/list_assets.py +0 -0
  20. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/list_cert_types.py +0 -0
  21. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/list_glossary.py +0 -0
  22. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/list_projects.py +0 -0
  23. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/list_relationships.py +0 -0
  24. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/list_tech_types.py +0 -0
  25. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/list_todos.py +0 -0
  26. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cat/list_user_ids.py +0 -0
  27. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cli/__init__.py +0 -0
  28. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cli/egeria.py +0 -0
  29. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cli/egeria_cat.py +0 -0
  30. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cli/egeria_my.py +0 -0
  31. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cli/egeria_ops.py +0 -0
  32. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/cli/ops_config.py +0 -0
  33. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/my/README.md +0 -0
  34. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/my/__init__.py +0 -0
  35. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/my/list_my_profile.py +0 -0
  36. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/my/list_my_roles.py +0 -0
  37. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/my/monitor_my_todos.py +0 -0
  38. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/my/monitor_open_todos.py +0 -0
  39. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/my/todo_actions.py +0 -0
  40. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/README.md +0 -0
  41. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/__init__.py +0 -0
  42. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/engine_actions.py +0 -0
  43. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/gov_server_actions.py +0 -0
  44. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/list_catalog_targets.py +0 -0
  45. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/monitor_asset_events.py +0 -0
  46. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/monitor_engine_activity.py +0 -0
  47. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/monitor_engine_activity_c.py +0 -0
  48. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/monitor_gov_eng_status.py +0 -0
  49. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/monitor_integ_daemon_status.py +0 -0
  50. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/monitor_platform_status.py +0 -0
  51. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/monitor_server_status.py +0 -0
  52. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/orig_monitor_server_list.py +0 -0
  53. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/orig_monitor_server_status.py +0 -0
  54. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/refresh_integration_daemon.py +0 -0
  55. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/ops/restart_integration_daemon.py +0 -0
  56. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/README.md +0 -0
  57. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/__init__.py +0 -0
  58. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/get_element_info.py +0 -0
  59. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/get_guid_info.py +0 -0
  60. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/get_tech_details.py +0 -0
  61. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/list_asset_types.py +0 -0
  62. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/list_elements_x.py +0 -0
  63. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/list_registered_services.py +0 -0
  64. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/list_related_specification.py +0 -0
  65. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/list_relationship_types.py +0 -0
  66. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/list_tech_templates.py +0 -0
  67. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/list_valid_metadata_values.py +0 -0
  68. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/commands/tech/x_list_related_elements.py +0 -0
  69. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/__init__.py +0 -0
  70. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/_client.py +0 -0
  71. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/_deprecated_gov_engine.py +0 -0
  72. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/_exceptions.py +0 -0
  73. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/_globals.py +0 -0
  74. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/_validators.py +0 -0
  75. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/asset_catalog_omvs.py +0 -0
  76. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/automated_curation_omvs.py +0 -0
  77. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/classification_manager_omvs.py +0 -0
  78. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/collection_manager_omvs.py +0 -0
  79. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/core_omag_server_config.py +0 -0
  80. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/create_tech_guid_lists.py +0 -0
  81. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/egeria_cat_client.py +0 -0
  82. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/egeria_client.py +0 -0
  83. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/egeria_config_client.py +0 -0
  84. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/egeria_my_client.py +0 -0
  85. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/egeria_tech_client.py +0 -0
  86. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/feedback_manager_omvs.py +0 -0
  87. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/full_omag_server_config.py +0 -0
  88. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/glossary_browser_omvs.py +0 -0
  89. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/glossary_manager_omvs.py +0 -0
  90. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/mermaid_utilities.py +0 -0
  91. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/my_profile_omvs.py +0 -0
  92. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/platform_services.py +0 -0
  93. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/project_manager_omvs.py +0 -0
  94. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/registered_info.py +0 -0
  95. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/runtime_manager_omvs.py +0 -0
  96. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/server_operations.py +0 -0
  97. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/utils.py +0 -0
  98. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/valid_metadata_omvs.py +0 -0
  99. {pyegeria-0.8.4.40 → pyegeria-0.8.4.42}/pyegeria/x_action_author_omvs.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 0.8.4.40
3
+ Version: 0.8.4.42
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://github.com/odpi/egeria-python
6
6
  License: Apache 2.0
@@ -27,6 +27,8 @@ from commands.tech.get_element_info import display_elements
27
27
  from commands.tech.list_related_specification import (
28
28
  display_related_specification,
29
29
  )
30
+ from commands.tech.list_related_elements import list_related_elements
31
+ from commands.tech.list_elements_for_classification import list_classified_elements
30
32
 
31
33
 
32
34
  # from pyegeria import ServerOps
@@ -330,6 +332,65 @@ def show_relationship_types(ctx, rel_type):
330
332
  )
331
333
 
332
334
 
335
+ @show.command("elements-by-classification")
336
+ @click.option(
337
+ "--om-type",
338
+ default="Project",
339
+ help="Open Metadata type to filter by",
340
+ )
341
+ @click.option(
342
+ "--classification",
343
+ default="GovernanceProject",
344
+ help="Classification to filter byt",
345
+ )
346
+ @click.pass_context
347
+ def show_elements_by_classification(ctx, om_type, classification):
348
+ """Show information about the specified relationship type"""
349
+ c = ctx.obj
350
+ list_classified_elements(
351
+ om_type,
352
+ classification,
353
+ c.view_server,
354
+ c.view_server_url,
355
+ c.userid,
356
+ c.password,
357
+ c.jupyter,
358
+ c.width,
359
+ )
360
+
361
+
362
+ @show.command("related-elements")
363
+ @click.option(
364
+ "--element-guid",
365
+ help="GUID of the Element to navigate from.",
366
+ )
367
+ @click.option(
368
+ "--om-type",
369
+ default="Project",
370
+ help="Open metadata type to filter by.",
371
+ )
372
+ @click.option(
373
+ "--rel-type",
374
+ default="Certification",
375
+ help="Relationship type to follow.",
376
+ )
377
+ @click.pass_context
378
+ def show_relationship_types(ctx, element_guid, om_type, rel_type):
379
+ """Show information about the specified relationship type"""
380
+ c = ctx.obj
381
+ list_related_elements(
382
+ element_guid,
383
+ om_type,
384
+ rel_type,
385
+ c.view_server,
386
+ c.view_server_url,
387
+ c.userid,
388
+ c.password,
389
+ c.jupyter,
390
+ c.width,
391
+ )
392
+
393
+
333
394
  @show.command("tech-templates")
334
395
  @click.pass_context
335
396
  @click.option(
@@ -50,7 +50,7 @@ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
50
50
  )
51
51
  @click.option("--userid", default=EGERIA_USER, help="Egeria admin user")
52
52
  @click.option("--password", default=EGERIA_USER_PASSWORD, help="Egeria admin password")
53
- @click.option("--timeout", default=60, help="Number of seconds to wait")
53
+ @click.option("--timeout", default=120, help="Number of seconds to wait")
54
54
  def load_archive(file, server, view_server, url, userid, password, timeout):
55
55
  """Load an Open Metadata Archive"""
56
56
 
@@ -65,6 +65,10 @@ def load_archive(file, server, view_server, url, userid, password, timeout):
65
65
  click.echo(f"Loaded archive: {file}")
66
66
 
67
67
  except (InvalidParameterException, PropertyServerException) as e:
68
+ print(
69
+ f"Perhaps there was a timeout? If so, the command will complete despite the exception\n"
70
+ f"===> You can check by rerunning the command in a few minutes"
71
+ )
68
72
  print_exception_response(e)
69
73
 
70
74
 
@@ -106,7 +106,7 @@ def list_elements(
106
106
  )
107
107
  if type(class_props) is dict:
108
108
  for prop in class_props.keys():
109
- c_md += f"* **{prop}**: {class_props[prop]}\n"
109
+ c_md += f" * **{prop}**: {class_props[prop]}\n"
110
110
  c_md_out = Markdown(c_md)
111
111
 
112
112
  table.add_row(
@@ -0,0 +1,174 @@
1
+ """This creates a templates guid file from the core metadata archive"""
2
+ from jedi import Project
3
+ from rich.markdown import Markdown
4
+ from rich.prompt import Prompt
5
+ import os
6
+ import argparse
7
+ import time
8
+ import sys
9
+ from rich import box
10
+ from rich.console import Console
11
+ from rich.table import Table
12
+
13
+ from pyegeria import (
14
+ InvalidParameterException,
15
+ PropertyServerException,
16
+ UserNotAuthorizedException,
17
+ print_exception_response,
18
+ EgeriaTech,
19
+ )
20
+ from tests.test_classification_manager_omvs import element_guid
21
+
22
+ console = Console()
23
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
24
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
25
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
26
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
27
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
28
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
29
+ )
30
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
31
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
32
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
33
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
34
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
35
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
36
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
37
+
38
+
39
+ def list_classified_elements(
40
+ om_type: str,
41
+ classification: str,
42
+ server: str,
43
+ url: str,
44
+ username: str,
45
+ password: str,
46
+ jupyter: bool = EGERIA_JUPYTER,
47
+ width: int = EGERIA_WIDTH,
48
+ ):
49
+ c_client = EgeriaTech(server, url, user_id=username, user_pwd=password)
50
+ token = c_client.create_egeria_bearer_token()
51
+
52
+ om_typedef = c_client.get_typedef_by_name(om_type)
53
+ if type(om_typedef) is str:
54
+ print(
55
+ f"The type name '{om_type}' is not known to the Egeria platform at {url} - {server}"
56
+ )
57
+ sys.exit(1)
58
+
59
+ elements = c_client.get_elements_by_classification(classification, om_type)
60
+
61
+ def generate_table() -> Table:
62
+ """Make a new table."""
63
+ table = Table(
64
+ caption=f"Metadata Elements for: {url} - {server} @ {time.asctime()}",
65
+ style="bold bright_white on black",
66
+ row_styles=["bold bright_white on black"],
67
+ header_style="white on dark_blue",
68
+ title_style="bold bright_white on black",
69
+ caption_style="white on black",
70
+ show_lines=True,
71
+ box=box.ROUNDED,
72
+ title=f"Elements for Open Metadata Type: '{om_type}' ",
73
+ expand=True,
74
+ # width=500
75
+ )
76
+
77
+ table.add_column("Qualified Name")
78
+ table.add_column("Type")
79
+ table.add_column("Created")
80
+ table.add_column("Home Store")
81
+ table.add_column("GUID", width=38, no_wrap=True)
82
+ table.add_column("Properties")
83
+ table.add_column("Classifications")
84
+
85
+ if type(elements) is list:
86
+ for element in elements:
87
+ header = element["elementHeader"]
88
+ el_q_name = element["properties"].get("qualifiedName", "---")
89
+ el_type = header["type"]["typeName"]
90
+ el_home = header["origin"]["homeMetadataCollectionName"]
91
+ el_create_time = header["versions"]["createTime"][:-10]
92
+ el_guid = header["guid"]
93
+ el_class = header.get("classifications", "---")
94
+
95
+ el_props_md = ""
96
+ for prop in element["properties"].keys():
97
+ el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
98
+ el_props_out = Markdown(el_props_md)
99
+
100
+ c_md = ""
101
+ if type(el_class) is list:
102
+ for classification in el_class:
103
+ classification_name = classification.get(
104
+ "classificationName", "---"
105
+ )
106
+ c_md = f"* **{classification_name}**\n"
107
+ class_props = classification.get(
108
+ "classificationProperties", "---"
109
+ )
110
+ if type(class_props) is dict:
111
+ for prop in class_props.keys():
112
+ c_md += f" * **{prop}**: {class_props[prop]}\n"
113
+ c_md_out = Markdown(c_md)
114
+
115
+ table.add_row(
116
+ el_q_name,
117
+ el_type,
118
+ el_create_time,
119
+ el_home,
120
+ el_guid,
121
+ el_props_out,
122
+ c_md_out,
123
+ )
124
+
125
+ return table
126
+ else:
127
+ print("No instances found")
128
+ sys.exit(1)
129
+
130
+ try:
131
+ console = Console(width=width, force_terminal=not jupyter)
132
+
133
+ with console.pager(styles=True):
134
+ console.print(generate_table())
135
+
136
+ except (
137
+ InvalidParameterException,
138
+ PropertyServerException,
139
+ UserNotAuthorizedException,
140
+ ) as e:
141
+ print_exception_response(e)
142
+ print("\n\nPerhaps the type name isn't known")
143
+ finally:
144
+ c_client.close_session()
145
+
146
+
147
+ def main():
148
+ parser = argparse.ArgumentParser()
149
+ parser.add_argument("--server", help="Name of the server to display status for")
150
+ parser.add_argument("--url", help="URL Platform to connect to")
151
+ parser.add_argument("--userid", help="User Id")
152
+ parser.add_argument("--password", help="Password")
153
+
154
+ args = parser.parse_args()
155
+
156
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
157
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
158
+ userid = args.userid if args.userid is not None else EGERIA_USER
159
+ password = args.password if args.password is not None else EGERIA_USER_PASSWORD
160
+
161
+ try:
162
+ om_type = Prompt.ask(
163
+ "Enter the Open Metadata Type to find elements of:", default="Project"
164
+ )
165
+ classification = Prompt.ask("Enter the classification to filter by: ")
166
+ list_classifiedd_elements(
167
+ om_type, classification, server, url, userid, password
168
+ )
169
+ except KeyboardInterrupt:
170
+ pass
171
+
172
+
173
+ if __name__ == "__main__":
174
+ main()
@@ -0,0 +1,176 @@
1
+ """This creates a templates guid file from the core metadata archive"""
2
+ from jedi import Project
3
+ from rich.markdown import Markdown
4
+ from rich.prompt import Prompt
5
+ import os
6
+ import argparse
7
+ import time
8
+ import sys
9
+ from rich import box
10
+ from rich.console import Console
11
+ from rich.table import Table
12
+
13
+ from pyegeria import (
14
+ InvalidParameterException,
15
+ PropertyServerException,
16
+ UserNotAuthorizedException,
17
+ print_exception_response,
18
+ EgeriaTech,
19
+ )
20
+ from tests.test_classification_manager_omvs import element_guid
21
+
22
+ console = Console()
23
+ EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
24
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
25
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
26
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
27
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
28
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
29
+ )
30
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
31
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
32
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
33
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
34
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
35
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
36
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
37
+
38
+
39
+ def list_related_elements(
40
+ element_guid: str,
41
+ om_type: str,
42
+ relationship_type: str,
43
+ server: str,
44
+ url: str,
45
+ username: str,
46
+ password: str,
47
+ jupyter: bool = EGERIA_JUPYTER,
48
+ width: int = EGERIA_WIDTH,
49
+ ):
50
+ c_client = EgeriaTech(server, url, user_id=username, user_pwd=password)
51
+ token = c_client.create_egeria_bearer_token()
52
+
53
+ om_typedef = c_client.get_typedef_by_name(om_type)
54
+ if type(om_typedef) is str:
55
+ print(
56
+ f"The type name '{om_type}' is not known to the Egeria platform at {url} - {server}"
57
+ )
58
+ sys.exit(1)
59
+
60
+ elements = c_client.get_related_elements(element_guid, relationship_type, om_type)
61
+
62
+ def generate_table() -> Table:
63
+ """Make a new table."""
64
+ table = Table(
65
+ caption=f"Metadata Elements for: {url} - {server} @ {time.asctime()}",
66
+ style="bold bright_white on black",
67
+ row_styles=["bold bright_white on black"],
68
+ header_style="white on dark_blue",
69
+ title_style="bold bright_white on black",
70
+ caption_style="white on black",
71
+ show_lines=True,
72
+ box=box.ROUNDED,
73
+ title=f"Elements for Open Metadata Type: '{om_type}' ",
74
+ expand=True,
75
+ # width=500
76
+ )
77
+
78
+ table.add_column("Qualified Name")
79
+ table.add_column("Type")
80
+ table.add_column("Created")
81
+ table.add_column("Home Store")
82
+ table.add_column("GUID", width=38, no_wrap=True)
83
+ table.add_column("Properties")
84
+ table.add_column("Classifications")
85
+
86
+ if type(elements) is list:
87
+ for element in elements:
88
+ header = element["elementHeader"]
89
+ el_q_name = element["properties"].get("qualifiedName", "---")
90
+ el_type = header["type"]["typeName"]
91
+ el_home = header["origin"]["homeMetadataCollectionName"]
92
+ el_create_time = header["versions"]["createTime"][:-10]
93
+ el_guid = header["guid"]
94
+ el_class = header.get("classifications", "---")
95
+
96
+ el_props_md = ""
97
+ for prop in element["properties"].keys():
98
+ el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
99
+ el_props_out = Markdown(el_props_md)
100
+
101
+ c_md = ""
102
+ if type(el_class) is list:
103
+ for classification in el_class:
104
+ classification_name = classification.get(
105
+ "classificationName", "---"
106
+ )
107
+ c_md = f"* **{classification_name}**\n"
108
+ class_props = classification.get(
109
+ "classificationProperties", "---"
110
+ )
111
+ if type(class_props) is dict:
112
+ for prop in class_props.keys():
113
+ c_md += f" * **{prop}**: {class_props[prop]}\n"
114
+ c_md_out = Markdown(c_md)
115
+
116
+ table.add_row(
117
+ el_q_name,
118
+ el_type,
119
+ el_create_time,
120
+ el_home,
121
+ el_guid,
122
+ el_props_out,
123
+ c_md_out,
124
+ )
125
+
126
+ return table
127
+ else:
128
+ print("No instances found")
129
+ sys.exit(1)
130
+
131
+ try:
132
+ console = Console(width=width, force_terminal=not jupyter)
133
+
134
+ with console.pager(styles=True):
135
+ console.print(generate_table())
136
+
137
+ except (
138
+ InvalidParameterException,
139
+ PropertyServerException,
140
+ UserNotAuthorizedException,
141
+ ) as e:
142
+ print_exception_response(e)
143
+ print("\n\nPerhaps the type name isn't known")
144
+ finally:
145
+ c_client.close_session()
146
+
147
+
148
+ def main():
149
+ parser = argparse.ArgumentParser()
150
+ parser.add_argument("--server", help="Name of the server to display status for")
151
+ parser.add_argument("--url", help="URL Platform to connect to")
152
+ parser.add_argument("--userid", help="User Id")
153
+ parser.add_argument("--password", help="Password")
154
+
155
+ args = parser.parse_args()
156
+
157
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
158
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
159
+ userid = args.userid if args.userid is not None else EGERIA_USER
160
+ password = args.password if args.password is not None else EGERIA_USER_PASSWORD
161
+
162
+ try:
163
+ element_guid = Prompt.ask("Guid of base element")
164
+ om_type = Prompt.ask(
165
+ "Enter the Open Metadata Type to find elements of:", default="Project"
166
+ )
167
+ relationship_type = Prompt.ask("Enter the relationship type to follow: ")
168
+ list_related_elements(
169
+ element_guid, om_type, relationship_type, server, url, userid, password
170
+ )
171
+ except KeyboardInterrupt:
172
+ pass
173
+
174
+
175
+ if __name__ == "__main__":
176
+ main()
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pyegeria"
3
- version = "0.8.4.40"
3
+ version = "0.8.4.42"
4
4
  license = 'Apache 2.0'
5
5
  authors = ["Dan Wolfson <dan.wolfson@pdr-associates.com>"]
6
6
  readme = "README.md"
@@ -115,5 +115,7 @@ pytest = "^8.2.2"
115
115
  get_element_info = "commands.tech.get_element_info:main"
116
116
  list_elements = "commands.tech.list_elements:main"
117
117
  list_related_specification = "commands.tech.list_related_specification:main"
118
+ list_elements_by_classification = "commands.tech.list_elements_by_classification:main"
119
+ list_related_elements = "commands.tech.list_related_elements:main"
118
120
 
119
121
  list_valid_metadata_values = "commands.tech.list_valid_metadata_values:main"
File without changes
File without changes