pyegeria 0.7.45.1__py3-none-any.whl → 0.8.0__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 (47) hide show
  1. examples/widgets/cat/list_cert_types.py +61 -43
  2. examples/widgets/cat/list_projects.py +1 -1
  3. examples/widgets/my/my_profile_actions.py +51 -32
  4. examples/widgets/ops/engine_actions.py +35 -23
  5. examples/widgets/ops/integration_daemon_actions.py +51 -32
  6. examples/widgets/tech/get_element_info.py +63 -38
  7. examples/widgets/tech/get_guid_info.py +50 -27
  8. examples/widgets/tech/list_asset_types.py +33 -23
  9. examples/widgets/tech/list_elements.py +44 -34
  10. examples/widgets/tech/list_elements_x.py +69 -49
  11. examples/widgets/tech/list_registered_services.py +44 -24
  12. examples/widgets/tech/list_related_specification.py +70 -45
  13. examples/widgets/tech/list_relationship_types.py +50 -31
  14. examples/widgets/tech/list_valid_metadata_values.py +57 -28
  15. examples/widgets/tech/x_list_related_elements.py +54 -34
  16. pyegeria/Xloaded_resources_omvs.py +43 -41
  17. pyegeria/__init__.py +5 -1
  18. pyegeria/_client.py +142 -102
  19. pyegeria/_deprecated_gov_engine.py +218 -167
  20. pyegeria/action_author_omvs.py +107 -88
  21. pyegeria/asset_catalog_omvs.py +467 -395
  22. pyegeria/automated_curation_omvs.py +2 -2
  23. pyegeria/classification_manager_omvs.py +3 -9
  24. pyegeria/collection_manager_omvs.py +1957 -1519
  25. pyegeria/core_omag_server_config.py +310 -192
  26. pyegeria/egeria_cat_client.py +88 -0
  27. pyegeria/egeria_config_client.py +37 -0
  28. pyegeria/egeria_my_client.py +47 -0
  29. pyegeria/egeria_ops_client.py +67 -0
  30. pyegeria/egeria_tech_client.py +77 -0
  31. pyegeria/feedback_manager_omvs.py +633 -631
  32. pyegeria/full_omag_server_config.py +330 -158
  33. pyegeria/glossary_browser_omvs.py +927 -474
  34. pyegeria/glossary_manager_omvs.py +1033 -543
  35. pyegeria/my_profile_omvs.py +714 -574
  36. pyegeria/platform_services.py +228 -176
  37. pyegeria/project_manager_omvs.py +1158 -903
  38. pyegeria/registered_info.py +76 -74
  39. pyegeria/runtime_manager_omvs.py +749 -670
  40. pyegeria/server_operations.py +123 -85
  41. pyegeria/valid_metadata_omvs.py +268 -168
  42. {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/METADATA +1 -1
  43. {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/RECORD +46 -42
  44. pyegeria/tech_guids_31-08-2024 14:33.py +0 -79
  45. {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/LICENSE +0 -0
  46. {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/WHEEL +0 -0
  47. {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/entry_points.txt +0 -0
@@ -25,66 +25,90 @@ from pyegeria import (
25
25
  InvalidParameterException,
26
26
  PropertyServerException,
27
27
  UserNotAuthorizedException,
28
- Client, ClassificationManager
28
+ Client,
29
+ ClassificationManager,
29
30
  )
30
31
 
31
32
 
32
33
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
33
- EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
34
- EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
35
- EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
36
- EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
37
- EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
38
- EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
39
- EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
40
- EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
41
- EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
42
- EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
43
- EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
44
-
45
-
46
- def display_elements(om_type: str, server: str, url: str, username: str, user_password: str,
47
- jupyter: bool = EGERIA_JUPYTER, width: int = EGERIA_WIDTH
48
- ):
34
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
35
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
36
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
37
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
38
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
39
+ )
40
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
41
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
42
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
43
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
44
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
45
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
46
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
47
+
48
+
49
+ def display_elements(
50
+ om_type: str,
51
+ server: str,
52
+ url: str,
53
+ username: str,
54
+ user_password: str,
55
+ jupyter: bool = EGERIA_JUPYTER,
56
+ width: int = EGERIA_WIDTH,
57
+ ):
49
58
  c = ClassificationManager(server, url, user_id=username, user_pwd=user_password)
50
59
 
51
60
  bearer_token = c.create_egeria_bearer_token(username, user_password)
52
61
 
53
62
  try:
54
- console = Console(width=width, force_terminal=not jupyter, style="bold white on black")
63
+ console = Console(
64
+ width=width, force_terminal=not jupyter, style="bold white on black"
65
+ )
55
66
  r = c.get_elements(om_type)
56
67
  if type(r) is not list:
57
68
  print(f"\n\n\tno elements found: {r}")
58
69
  sys.exit(1)
59
70
 
60
- tree = Tree(f"Elements for Open Metadata Type:{om_type}\n* There are {len(r)} elements", style="bold bright_white on black",
61
- guide_style="bold bright_blue")
71
+ tree = Tree(
72
+ f"Elements for Open Metadata Type:{om_type}\n* There are {len(r)} elements",
73
+ style="bold bright_white on black",
74
+ guide_style="bold bright_blue",
75
+ )
62
76
  t = tree.add(f"Elements for {om_type}", style="bold bright_white on black")
63
77
  for element in r:
64
- header = element['elementHeader']
65
- el_type = header["type"]['typeName']
66
- el_home = header['origin']['homeMetadataCollectionName']
67
- el_create_time = header['versions']['createTime']
68
- el_guid = header['guid']
69
-
70
- el_md = (f"#### Element Basics\n"
71
- f"* **Type**: {el_type}\n"
72
- f"* **Home**: {el_home}\n"
73
- f"* **Created**: {el_create_time}\n"
74
- f"* **GUID**: {el_guid}\n ---\n")
75
- for prop in element['properties'].keys():
78
+ header = element["elementHeader"]
79
+ el_type = header["type"]["typeName"]
80
+ el_home = header["origin"]["homeMetadataCollectionName"]
81
+ el_create_time = header["versions"]["createTime"]
82
+ el_guid = header["guid"]
83
+
84
+ el_md = (
85
+ f"#### Element Basics\n"
86
+ f"* **Type**: {el_type}\n"
87
+ f"* **Home**: {el_home}\n"
88
+ f"* **Created**: {el_create_time}\n"
89
+ f"* **GUID**: {el_guid}\n ---\n"
90
+ )
91
+ for prop in element["properties"].keys():
76
92
  el_md += f"* **{prop}**: {element['properties'][prop]}\n"
77
93
 
78
94
  el_out = Markdown(el_md)
79
- p = Panel.fit(el_out, title=element['properties']['qualifiedName'],
80
- style = "bold white on black")
95
+ p = Panel.fit(
96
+ el_out,
97
+ title=element["properties"]["qualifiedName"],
98
+ style="bold white on black",
99
+ )
81
100
  t = tree.add(p)
82
101
 
83
102
  print(tree)
84
103
 
85
104
  c.close_session()
86
105
 
87
- except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ValueError) as e:
106
+ except (
107
+ InvalidParameterException,
108
+ PropertyServerException,
109
+ UserNotAuthorizedException,
110
+ ValueError,
111
+ ) as e:
88
112
  if type(e) is str:
89
113
  console.print_exception()
90
114
  else:
@@ -92,7 +116,6 @@ def display_elements(om_type: str, server: str, url: str, username: str, user_pa
92
116
  console.print(f"\n ===> Looks like the type {om_type} isn't known...\n")
93
117
 
94
118
 
95
-
96
119
  def main():
97
120
  parser = argparse.ArgumentParser()
98
121
  parser.add_argument("--server", help="Name of the server to display status for")
@@ -109,9 +132,11 @@ def main():
109
132
  user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
110
133
 
111
134
  try:
112
- om_type = Prompt.ask("Enter the Open Metadata Type to find Elements for", default=None)
135
+ om_type = Prompt.ask(
136
+ "Enter the Open Metadata Type to find Elements for", default=None
137
+ )
113
138
  display_elements(om_type, server, url, userid, user_pass)
114
- except (KeyboardInterrupt):
139
+ except KeyboardInterrupt:
115
140
  pass
116
141
 
117
142
 
@@ -24,49 +24,68 @@ from pyegeria import (
24
24
  InvalidParameterException,
25
25
  PropertyServerException,
26
26
  UserNotAuthorizedException,
27
- Client, ClassificationManager
27
+ Client,
28
+ ClassificationManager,
28
29
  )
29
30
 
30
31
 
31
32
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
32
- EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
33
- EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
34
- EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
35
- EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
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
- def display_guid(guid: str, server: str, url: str, username: str, user_password: str,
46
- jupyter: bool = EGERIA_JUPYTER, width: int = EGERIA_WIDTH
47
- ):
33
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
34
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
35
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
36
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
37
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
38
+ )
39
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
40
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
41
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
42
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
43
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
44
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
45
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
46
+
47
+
48
+ def display_guid(
49
+ guid: str,
50
+ server: str,
51
+ url: str,
52
+ username: str,
53
+ user_password: str,
54
+ jupyter: bool = EGERIA_JUPYTER,
55
+ width: int = EGERIA_WIDTH,
56
+ ):
48
57
  c = Client(server, url, user_id=username)
49
- url = (f"{url}/servers/{server}/open-metadata/repository-services/users/{username}/"
50
- f"instances/entity/{guid}")
58
+ url = (
59
+ f"{url}/servers/{server}/open-metadata/repository-services/users/{username}/"
60
+ f"instances/entity/{guid}"
61
+ )
51
62
  # c = ClassificationManager(server, url)
52
63
 
53
64
  bearer_token = c.create_egeria_bearer_token(username, user_password)
54
65
 
55
66
  try:
56
- console = Console(width=width, force_terminal=not jupyter, style="bold white on black")
67
+ console = Console(
68
+ width=width, force_terminal=not jupyter, style="bold white on black"
69
+ )
57
70
  r = c.make_request("GET", url)
58
71
  if r.status_code == 200:
59
72
  pass
60
73
  # r = c.retrieve_instance_for_guid(guid)
61
- e = r.json()['entity']
62
- p = e['properties']['instanceProperties']
74
+ e = r.json()["entity"]
75
+ p = e["properties"]["instanceProperties"]
63
76
 
64
77
  type_name = Text(f"Type is: {e['type']['typeDefName']}")
65
- metadataCollection = Text(f"Metadadata Collection: {e['metadataCollectionName']}")
78
+ metadataCollection = Text(
79
+ f"Metadadata Collection: {e['metadataCollectionName']}"
80
+ )
66
81
  created = Text(f"Created at: {e['createTime']}")
67
82
  details = Text(f"Details: {json.dumps(p, indent=2)}")
68
83
 
69
- tree = Tree(f"{guid}", style="bold bright_white on black", guide_style="bold bright_blue")
84
+ tree = Tree(
85
+ f"{guid}",
86
+ style="bold bright_white on black",
87
+ guide_style="bold bright_blue",
88
+ )
70
89
 
71
90
  tree = tree.add(type_name)
72
91
  tree.add(metadataCollection)
@@ -76,7 +95,12 @@ def display_guid(guid: str, server: str, url: str, username: str, user_password:
76
95
 
77
96
  c.close_session()
78
97
 
79
- except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ValueError) as e:
98
+ except (
99
+ InvalidParameterException,
100
+ PropertyServerException,
101
+ UserNotAuthorizedException,
102
+ ValueError,
103
+ ) as e:
80
104
  if type(e) is str:
81
105
  console.print_exception()
82
106
  else:
@@ -84,7 +108,6 @@ def display_guid(guid: str, server: str, url: str, username: str, user_password:
84
108
  console.print(f"\n ===> Looks like the GUID isn't known...\n")
85
109
 
86
110
 
87
-
88
111
  def main():
89
112
  parser = argparse.ArgumentParser()
90
113
  parser.add_argument("--server", help="Name of the server to display status for")
@@ -103,7 +126,7 @@ def main():
103
126
  try:
104
127
  guid = Prompt.ask("Enter the GUID to retrieve", default=None)
105
128
  display_guid(guid, server, url, userid, user_pass)
106
- except (KeyboardInterrupt):
129
+ except KeyboardInterrupt:
107
130
  pass
108
131
 
109
132
 
@@ -21,26 +21,33 @@ from pyegeria import (
21
21
  PropertyServerException,
22
22
  UserNotAuthorizedException,
23
23
  print_exception_response,
24
- RegisteredInfo
24
+ RegisteredInfo,
25
25
  )
26
26
 
27
27
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
28
- EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
29
- EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
30
- EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
31
- EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
32
- EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
33
- EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
34
- EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
35
- EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
36
- EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
37
- EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
38
- EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
39
-
40
-
41
- def display_asset_types(server: str, url: str, username: str, user_password: str,
42
- jupyter: bool = EGERIA_JUPYTER, width: int = EGERIA_WIDTH
43
- ):
28
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
29
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
30
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
31
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
32
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
33
+ )
34
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
35
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
36
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
37
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
38
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
39
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
40
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
41
+
42
+
43
+ def display_asset_types(
44
+ server: str,
45
+ url: str,
46
+ username: str,
47
+ user_password: str,
48
+ jupyter: bool = EGERIA_JUPYTER,
49
+ width: int = EGERIA_WIDTH,
50
+ ):
44
51
  r_client = RegisteredInfo(server, url, username)
45
52
  token = r_client.create_egeria_bearer_token(username, user_password)
46
53
  asset_types = r_client.list_asset_types()
@@ -56,7 +63,7 @@ def display_asset_types(server: str, url: str, username: str, user_password: str
56
63
  show_lines=True,
57
64
  box=box.ROUNDED,
58
65
  caption=f"Asset Types from Server '{server}' @ Platform - {url}",
59
- expand=True
66
+ expand=True,
60
67
  )
61
68
 
62
69
  table.add_column("Name")
@@ -74,9 +81,7 @@ def display_asset_types(server: str, url: str, username: str, user_password: str
74
81
  description = a_type.get("description", "none")
75
82
  version = a_type.get("version", " ")
76
83
  super_type = a_type.get("superType", "none")
77
- table.add_row(
78
- name, description, super_type, str(version)
79
- )
84
+ table.add_row(name, description, super_type, str(version))
80
85
  return table
81
86
 
82
87
  try:
@@ -84,7 +89,11 @@ def display_asset_types(server: str, url: str, username: str, user_password: str
84
89
  with console.pager(styles=True):
85
90
  console.print(generate_table())
86
91
 
87
- except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
92
+ except (
93
+ InvalidParameterException,
94
+ PropertyServerException,
95
+ UserNotAuthorizedException,
96
+ ) as e:
88
97
  print_exception_response(e)
89
98
  assert e.related_http_code != "200", "Invalid parameters"
90
99
  finally:
@@ -109,5 +118,6 @@ def main():
109
118
 
110
119
  display_asset_types(server, url, userid, user_pass)
111
120
 
121
+
112
122
  if __name__ == "__main__":
113
- main()
123
+ main()
@@ -14,30 +14,36 @@ from pyegeria import (
14
14
  PropertyServerException,
15
15
  UserNotAuthorizedException,
16
16
  print_exception_response,
17
- ClassificationManager
17
+ ClassificationManager,
18
18
  )
19
19
 
20
20
 
21
21
  console = Console()
22
22
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
23
- EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
24
- EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
25
- EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
26
- EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
27
- EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
28
- EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
29
- EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
30
- EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
31
- EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
32
- EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
33
- EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
34
-
35
-
36
-
37
- def list_elements(om_type:str, server: str,
38
- url: str, username: str, password: str, jupyter:bool=EGERIA_JUPYTER, width:int = EGERIA_WIDTH
23
+ EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
24
+ EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
25
+ EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
26
+ EGERIA_VIEW_SERVER_URL = os.environ.get(
27
+ "EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
28
+ )
29
+ EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
30
+ EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
31
+ EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
32
+ EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
33
+ EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
34
+ EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
35
+ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
36
+
37
+
38
+ def list_elements(
39
+ om_type: str,
40
+ server: str,
41
+ url: str,
42
+ username: str,
43
+ password: str,
44
+ jupyter: bool = EGERIA_JUPYTER,
45
+ width: int = EGERIA_WIDTH,
39
46
  ):
40
-
41
47
  c_client = ClassificationManager(server, url, user_id=username, user_pwd=password)
42
48
  token = c_client.create_egeria_bearer_token()
43
49
  elements = c_client.get_elements(om_type)
@@ -62,25 +68,26 @@ def list_elements(om_type:str, server: str,
62
68
  table.add_column("Type")
63
69
  table.add_column("Created")
64
70
  table.add_column("Home Store")
65
- table.add_column("GUID", width = 38,no_wrap=True)
71
+ table.add_column("GUID", width=38, no_wrap=True)
66
72
  table.add_column("Properties")
67
73
 
68
-
69
74
  if type(elements) is list:
70
75
  for element in elements:
71
- header = element['elementHeader']
72
- el_q_name = element['properties'].get('qualifiedName',"---")
73
- el_type = header["type"]['typeName']
74
- el_home = header['origin']['homeMetadataCollectionName']
75
- el_create_time = header['versions']['createTime'][:-10]
76
- el_guid = header['guid']
76
+ header = element["elementHeader"]
77
+ el_q_name = element["properties"].get("qualifiedName", "---")
78
+ el_type = header["type"]["typeName"]
79
+ el_home = header["origin"]["homeMetadataCollectionName"]
80
+ el_create_time = header["versions"]["createTime"][:-10]
81
+ el_guid = header["guid"]
77
82
 
78
83
  el_props_md = ""
79
- for prop in element['properties'].keys():
84
+ for prop in element["properties"].keys():
80
85
  el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
81
86
 
82
87
  el_props_out = Markdown(el_props_md)
83
- table.add_row(el_q_name, el_type, el_create_time, el_home, el_guid, el_props_out)
88
+ table.add_row(
89
+ el_q_name, el_type, el_create_time, el_home, el_guid, el_props_out
90
+ )
84
91
 
85
92
  return table
86
93
  else:
@@ -93,7 +100,11 @@ def list_elements(om_type:str, server: str,
93
100
  with console.pager(styles=True):
94
101
  console.print(generate_table())
95
102
 
96
- except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
103
+ except (
104
+ InvalidParameterException,
105
+ PropertyServerException,
106
+ UserNotAuthorizedException,
107
+ ) as e:
97
108
  print_exception_response(e)
98
109
  print("\n\nPerhaps the type name isn't known")
99
110
  finally:
@@ -115,14 +126,13 @@ def main():
115
126
  password = args.password if args.password is not None else EGERIA_USER_PASSWORD
116
127
 
117
128
  try:
118
- om_type = Prompt.ask("Enter the Open Metadata Type to find elements of:", default="GlossaryTerm")
129
+ om_type = Prompt.ask(
130
+ "Enter the Open Metadata Type to find elements of:", default="GlossaryTerm"
131
+ )
119
132
  list_elements(om_type, server, url, userid, password)
120
- except(KeyboardInterrupt):
133
+ except KeyboardInterrupt:
121
134
  pass
122
135
 
123
136
 
124
137
  if __name__ == "__main__":
125
138
  main()
126
-
127
-
128
-