pyegeria 0.5.8.20__py3-none-any.whl → 0.5.8.22__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 (26) hide show
  1. examples/widgets/catalog_user/get_asset_graph.py +3 -5
  2. examples/widgets/catalog_user/list_assets.py +17 -9
  3. examples/widgets/{personal_organizer → catalog_user}/list_projects.py +18 -16
  4. examples/widgets/{personal_organizer → catalog_user}/list_todos.py +6 -5
  5. examples/widgets/cli/egeria_cat.py +46 -11
  6. examples/widgets/cli/egeria_ops.py +19 -3
  7. examples/widgets/cli/egeria_tech.py +201 -0
  8. examples/widgets/operational/engine_actions.py +13 -46
  9. examples/widgets/operational/integration_daemon_actions.py +2 -2
  10. examples/widgets/operational/list_catalog_targets.py +12 -10
  11. examples/widgets/operational/load_archive.py +6 -4
  12. examples/widgets/{developer → tech}/get_guid_info.py +20 -13
  13. examples/widgets/{developer → tech}/get_tech_details.py +36 -31
  14. examples/widgets/{developer → tech}/list_asset_types.py +8 -4
  15. examples/widgets/{developer → tech}/list_registered_services.py +14 -7
  16. examples/widgets/{developer → tech}/list_relationship_types.py +16 -10
  17. examples/widgets/{developer → tech}/list_tech_templates.py +11 -6
  18. examples/widgets/{developer → tech}/list_valid_metadata_values.py +12 -7
  19. pyegeria/asset_catalog_omvs.py +2 -2
  20. {pyegeria-0.5.8.20.dist-info → pyegeria-0.5.8.22.dist-info}/METADATA +1 -1
  21. {pyegeria-0.5.8.20.dist-info → pyegeria-0.5.8.22.dist-info}/RECORD +26 -25
  22. {pyegeria-0.5.8.20.dist-info → pyegeria-0.5.8.22.dist-info}/entry_points.txt +9 -9
  23. /examples/widgets/{developer → tech}/README.md +0 -0
  24. /examples/widgets/{developer → tech}/__init__.py +0 -0
  25. {pyegeria-0.5.8.20.dist-info → pyegeria-0.5.8.22.dist-info}/LICENSE +0 -0
  26. {pyegeria-0.5.8.20.dist-info → pyegeria-0.5.8.22.dist-info}/WHEEL +0 -0
@@ -15,7 +15,7 @@ from rich.console import Console
15
15
  import time
16
16
  import click
17
17
  # from ops_config import Config, pass_config
18
- from pyegeria import ServerOps, AutomatedCuration, INTEGRATION_GUIDS
18
+ from pyegeria import ServerOps, AutomatedCuration, INTEGRATION_GUIDS, Platform
19
19
  from pyegeria._exceptions import (
20
20
  InvalidParameterException,
21
21
  PropertyServerException,
@@ -24,67 +24,34 @@ from pyegeria._exceptions import (
24
24
  )
25
25
 
26
26
 
27
- @click.command('add-target')
28
- @click.argument('integration-connector')
29
- @click.argument('metadata-element')
30
- @click.argument('catalog-target-name')
31
- @click.pass_context
32
- def add_catalog_target(ctx, integration_connector: str, metadata_element_guid:str, catalog_target_name:str)-> str:
33
- """Add catalog targets to the specified integration connector"""
34
- try:
35
- if integration_connector not in INTEGRATION_GUIDS.keys():
36
- click.echo('Integration connector is not known')
37
-
38
- c = ctx.obj
39
- a_client = AutomatedCuration(c.view_server, c.view_server_url, c.userid, c.password)
40
- token = a_client.create_egeria_bearer_token()
41
-
42
- guid = a_client.add_catalog_target(INTEGRATION_GUIDS[integration_connector], metadata_element_guid,
43
- catalog_target_name)
44
-
45
- click.echo(f"Added catalog target to {integration_connector} with a return guid of {guid}")
46
-
47
-
48
- except (InvalidParameterException, PropertyServerException) as e:
49
- print_exception_response(e)
50
-
51
27
 
52
28
 
53
- @click.command('remove-target')
54
- @click.argument('relationship-guid')
29
+ @click.command('stop')
55
30
  @click.pass_context
56
- def remove_catalog_target(ctx, relationship_guid: str):
57
- """Remove the catalog target specified by the relationship guidr"""
31
+ def stop_server(ctx):
32
+ """Stop an engine-host daemon"""
58
33
  try:
59
34
  c = ctx.obj
60
- a_client = AutomatedCuration(c.view_server, c.view_server_url, c.userid, c.password)
61
- token = a_client.create_egeria_bearer_token()
62
-
63
- a_client.remove_catalog_target(relationship_guid)
64
-
65
- click.echo(f"Removed catalog target with relationship guid of {relationship_guid}")
35
+ p_client = Platform(c.engine_host, c.engine_host_url, c.admin_user, c.admin_user_password)
66
36
 
37
+ p_client.shutdown_server()
67
38
 
39
+ click.echo(f"Stopped server {c.engine_host}")
68
40
  except (InvalidParameterException, PropertyServerException) as e:
69
41
  print_exception_response(e)
70
42
 
71
43
 
72
- @click.command('update-target')
73
- @click.argument('relationship-guid')
74
- @click.argument('catalog-target-name')
44
+ @click.command('start')
75
45
  @click.pass_context
76
- def update_catalog_target(ctx, relationship_guid: str, catalog_target_name:str):
77
- """Update the catalog target specified by the relationship guid """
46
+ def start_server(ctx):
47
+ """Start or restart an engine-host from its known configuration """
78
48
  try:
79
49
  c = ctx.obj
80
- a_client = AutomatedCuration(c.view_server, c.view_server_url, c.userid, c.password)
81
- token = a_client.create_egeria_bearer_token()
82
-
83
- guid = a_client.update_catalog_target(relationship_guid, catalog_target_name)
50
+ p_client = Platform(c.engine_host, c.engine_host_url, c.admin_user, c.admin_user_password)
84
51
 
85
- click.echo(f"Update catalog target with relationship guid of {relationship_guid} to a catalog target name of "
86
- f"{catalog_target_name} with a return guid of {guid}")
52
+ p_client.activate_server_stored_config()
87
53
 
54
+ click.echo(f"Started server {c.engine_host}")
88
55
 
89
56
  except (InvalidParameterException, PropertyServerException) as e:
90
57
  print_exception_response(e)
@@ -91,7 +91,7 @@ def update_catalog_target(ctx, relationship_guid: str, catalog_target_name:str):
91
91
  @click.command('stop')
92
92
  @click.pass_context
93
93
  def stop_server(ctx):
94
- """Stop the integration daemon"""
94
+ """Stop an integration daemon"""
95
95
  try:
96
96
  c = ctx.obj
97
97
  p_client = Platform(c.integration_daemon, c.integration_daemon_url, c.userid, c.password)
@@ -106,7 +106,7 @@ def stop_server(ctx):
106
106
  @click.command('start')
107
107
  @click.pass_context
108
108
  def start_server(ctx):
109
- """Start the integration daemon from its known configuration """
109
+ """Start or restart an integration daemon from its known configuration """
110
110
  try:
111
111
  c = ctx.obj
112
112
  p_client = Platform(c.integration_daemon, c.integration_daemon_url, c.userid, c.password)
@@ -54,16 +54,15 @@ def display_catalog_targets(connector: str, server: str, url: str, username: str
54
54
  show_lines=True,
55
55
  box=box.ROUNDED,
56
56
  caption=f"Catalog Targets for '{server}' @ Platform - {url}",
57
- expand=True,
58
- # width = 200
57
+ expand=True
59
58
  )
60
- table.add_column("Name of Target", max_width=15)
61
- table.add_column("Catalog Target Name", max_width=15)
62
- table.add_column('Metadata Source Qualified Name')
63
- table.add_column("Relationship GUID", no_wrap=True)
59
+ table.add_column("Name of Target")
60
+ table.add_column("Catalog Target")
61
+
62
+ # table.add_column("Relationship GUID", no_wrap=True)
64
63
  table.add_column('Configuration Properties')
65
64
  table.add_column('Template Properties')
66
- table.add_column("Operational Instructions", max_width=15)
65
+ table.add_column("Operational Instructions", max_width=20)
67
66
  # table.add_column("Delete Method")
68
67
 
69
68
  if type(cat_targets) is list:
@@ -78,6 +77,9 @@ def display_catalog_targets(connector: str, server: str, url: str, username: str
78
77
  # target_guid = target['catalogTargetElement']['guid']
79
78
  connector_unique = target['catalogTargetElement']['uniqueName']
80
79
 
80
+ cat_target_out = Markdown(f"* Target Name: {target_name}\n* Target Source: {target_source}\n"
81
+ f"* Relationship Guid: {target_rel}")
82
+
81
83
  config_props = target.get('configurationProperties', '---')
82
84
  if type(config_props) is dict:
83
85
  config_props_md = ''
@@ -97,7 +99,7 @@ def display_catalog_targets(connector: str, server: str, url: str, username: str
97
99
  template_props_out = '---'
98
100
 
99
101
  table.add_row(
100
- connector_unique, target_name, target_source, target_rel,
102
+ connector_unique, cat_target_out,
101
103
  config_props_out, template_props_out, op_instruct_out)
102
104
 
103
105
  return table
@@ -110,9 +112,9 @@ def display_catalog_targets(connector: str, server: str, url: str, username: str
110
112
 
111
113
  connector_guid = INTEGRATION_GUIDS[connector]
112
114
  cat_targets = a_client.get_catalog_targets(connector_guid)
113
- console = Console(force_terminal=not jupyter, width=width)
115
+ console = Console(force_terminal=not jupyter, width=width, soft_wrap=True)
114
116
  with console.pager(styles=True):
115
- console.print(generate_table())
117
+ console.print(generate_table(), soft_wrap=True)
116
118
 
117
119
  except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
118
120
  print_exception_response(e)
@@ -32,16 +32,18 @@ EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
32
32
  EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
33
33
  EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
34
34
 
35
- @tui()
36
- @click.command()
37
- @click.option('--file', prompt= "Path to the archive file to load", help='Full path to the archive file to load')
35
+
36
+ @click.command('load-archive')
37
+ @click.option('--file', prompt= "Path on the Metadata Server of the archive file to load",
38
+ default='content-packs/CocoComboArchive.omarchive',
39
+ help='Full path on the Metadata Server to the archive file to load')
38
40
  @click.option('--server', default = EGERIA_METADATA_STORE, help='Egeria metadata store to load')
39
41
  @click.option('--url', default = EGERIA_PLATFORM_URL, help='URL of Egeria platform to connect to')
40
42
  @click.option('--userid', default = EGERIA_ADMIN_USER, help='Egeria admin user')
41
43
  @click.option('--password', default = EGERIA_ADMIN_PASSWORD, help='Egeria admin password')
42
44
  @click.option('--timeout', default = 60, help = 'Number of seconds to wait')
43
-
44
45
  def load_archive(file, server, url, userid, password, timeout):
46
+ """Load an Open Metadata Archive"""
45
47
 
46
48
  try:
47
49
 
@@ -9,24 +9,25 @@ Unit tests for the Utils helper functions using the Pytest framework.
9
9
 
10
10
  A simple display for glossary terms
11
11
  """
12
- import os
13
12
  import argparse
14
13
  import json
14
+ import os
15
15
 
16
16
  from rich import print
17
17
  from rich.console import Console
18
+ from rich.panel import Panel
18
19
  from rich.prompt import Prompt
19
20
  from rich.text import Text
20
21
  from rich.tree import Tree
21
- from rich.panel import Panel
22
22
 
23
23
  from pyegeria import (
24
24
  InvalidParameterException,
25
25
  PropertyServerException,
26
26
  UserNotAuthorizedException,
27
- print_exception_response,
28
27
  Client
29
28
  )
29
+
30
+
30
31
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
31
32
  EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
32
33
  EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
@@ -37,17 +38,19 @@ EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
37
38
  EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
38
39
  EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
39
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'))
40
43
 
41
44
 
42
- def display_guid(guid: str, server: str, url: str, username: str, user_password: str):
43
-
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
+ ):
44
48
  c = Client(server, url, user_id=username)
45
49
  url = (f"{url}/servers/{server}/open-metadata/repository-services/users/{username}/"
46
50
  f"instances/entity/{guid}")
47
51
 
48
-
49
52
  try:
50
- console = Console(width = 160, style="bold white on black")
53
+ console = Console(width=width, force_terminal=not jupyter, style="bold white on black")
51
54
  r = c.make_request("GET", url)
52
55
  if r.status_code == 200:
53
56
  pass
@@ -59,24 +62,26 @@ def display_guid(guid: str, server: str, url: str, username: str, user_password:
59
62
  created = Text(f"Created at: {e['createTime']}")
60
63
  details = Text(f"Details: {json.dumps(p, indent=2)}")
61
64
 
62
- tree = Tree(f"{guid}", style = "bold bright_white on black", guide_style="bold bright_blue")
65
+ tree = Tree(f"{guid}", style="bold bright_white on black", guide_style="bold bright_blue")
63
66
 
64
67
  tree = tree.add(type_name)
65
68
  tree.add(metadataCollection)
66
69
  tree.add(created)
67
- tree.add(Panel(details,title="Element Details", expand=False))
70
+ tree.add(Panel(details, title="Element Details", expand=False))
68
71
  print(tree)
69
72
 
70
73
  c.close_session()
71
74
 
72
75
  except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ValueError) as e:
73
76
  if type(e) is str:
74
- console.print_exception()
77
+ console.print_exception()
75
78
  else:
76
- console.print(f"\n Looks like the GUID isn't known...\n")
79
+ # console.print_exception(show_locals=True)
80
+ console.print(f"\n ===> Looks like the GUID isn't known...\n")
81
+
77
82
 
78
- def main():
79
83
 
84
+ def main():
80
85
  parser = argparse.ArgumentParser()
81
86
  parser.add_argument("--server", help="Name of the server to display status for")
82
87
  parser.add_argument("--url", help="URL Platform to connect to")
@@ -96,5 +101,7 @@ def main():
96
101
  display_guid(guid, server, url, userid, user_pass)
97
102
  except (KeyboardInterrupt):
98
103
  pass
104
+
105
+
99
106
  if __name__ == "__main__":
100
- main()
107
+ main()
@@ -6,22 +6,22 @@ Copyright Contributors to the ODPi Egeria project.
6
6
  A simple viewer for collections - provide the root and we display the hierarchy
7
7
 
8
8
  """
9
- import os
10
9
  import argparse
11
- import asyncio
12
- import nest_asyncio
10
+ import os
13
11
 
14
12
  from rich import print
13
+ from rich.console import Console
15
14
  from rich.panel import Panel
16
15
  from rich.prompt import Prompt
17
16
  from rich.text import Text
18
17
  from rich.tree import Tree
19
- from rich.console import Console
18
+
20
19
  from pyegeria import (UserNotAuthorizedException, PropertyServerException,
21
20
  InvalidParameterException, AutomatedCuration)
22
21
  from pyegeria._exceptions import (
23
22
  print_exception_response,
24
23
  )
24
+
25
25
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
26
26
  EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
27
27
  EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
@@ -32,46 +32,51 @@ EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
32
32
  EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
33
33
  EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
34
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
+ # nest_asyncio.apply()
35
39
 
36
- nest_asyncio.apply()
37
- console = Console()
38
40
  disable_ssl_warnings = True
39
41
 
40
- def tech_viewer(tech: str, server_name:str, platform_url:str, user:str, user_password:str):
42
+
43
+ def tech_details_viewer(tech: str, server_name: str, platform_url: str, user: str, user_password: str,
44
+ jupyter: bool = EGERIA_JUPYTER, width: int = EGERIA_WIDTH):
45
+ console = Console(width=width, force_terminal=not jupyter)
41
46
 
42
47
  def view_tech_details(a_client: AutomatedCuration, root_collection_name: str, tree: Tree) -> Tree:
43
48
  l2: Tree = None
44
49
  tech_details = a_client.get_technology_type_detail(tech)
45
- if (type(tech_details) is dict) and (len(tech_details)>0):
46
- name = tech_details.get('name','---')
47
- qualified_name = tech_details.get('qualifiedName',"---")
48
- category = tech_details.get('category','---')
49
- description = tech_details.get('description','---')
50
+ if (type(tech_details) is dict) and (len(tech_details) > 0):
51
+ name = tech_details.get('name', '---')
52
+ qualified_name = tech_details.get('qualifiedName', "---")
53
+ category = tech_details.get('category', '---')
54
+ description = tech_details.get('description', '---')
50
55
 
51
- style = ""
56
+ style = "bold bright_white on black"
52
57
  l2 = tree.add(Text(f"Name: {name}", "bold red"))
53
- l2 = tree.add(Text(f"* QualifiedName: {qualified_name}","bold white"))
54
- l2 = tree.add(Text(f"* Category: {category}", "bold white"))
55
- l2 = tree.add(Text(f"* Technology Description: {description}", "bold white"))
58
+ l2 = tree.add(Text(f"* QualifiedName: {qualified_name}", style))
59
+ l2 = tree.add(Text(f"* Category: {category}", style))
60
+ l2 = tree.add(Text(f"* Technology Description: {description}", style))
56
61
  ext_ref = tech_details.get('externalReferences', None)
57
62
 
58
63
  if ext_ref is not None:
59
64
  uri = ext_ref[0]["properties"].get("uri", "---")
60
65
  # console.print(f" {type(ext_ref)}, {len(ext_ref)}")
61
- l2 = tree.add(Text(f'* URI: {uri}', "bold white"))
66
+ l2 = tree.add(Text(f'* URI: {uri}', style))
62
67
 
63
- resource_list = tech_details.get('resourceList',None)
68
+ resource_list = tech_details.get('resourceList', None)
64
69
  if resource_list:
65
70
  t_r = tree.add("Resource List[bold red]")
66
71
  for resource in resource_list:
67
- resource_use = Text(f"[bold white]{resource.get('resourceUse','---')}", "")
68
- resource_use_description = Text(f"[bold white]{resource.get('resourceUseDescription','---')}", "")
69
- type_name = Text(f"[bold white]{resource['relatedElement']['type'].get('typeName','---')}", "")
70
- unique_name = Text(f"[bold white]{resource['relatedElement'].get('uniqueName','---')}", "")
71
- related_guid = Text(f"[bold white]{resource['relatedElement'].get('guid','---')}", "")
72
+ resource_use = Text(f"[bold bright_white]{resource.get('resourceUse', '---')}")
73
+ resource_use_description = Text(f"[bold bright_white]{resource.get('resourceUseDescription', '---')}")
74
+ type_name = Text(f"[bold bright_white]{resource['relatedElement']['type'].get('typeName', '---')}")
75
+ unique_name = Text(f"[bold bright_white]{resource['relatedElement'].get('uniqueName', '---')}")
76
+ related_guid = Text(f"[bold bright_white]{resource['relatedElement'].get('guid', '---')}")
72
77
  resource_text = (f"[bold red]Resource\n"
73
78
  f"[white]Resource use: {resource_use}[white]\nDescription: "
74
- f"{resource_use_description}\nType Name: {type_name}\n"
79
+ f"{resource_use_description}\n[white]Type Name: {type_name}\n"
75
80
  f"[white]Unique Name: {unique_name}\n[white]Related GUID: {related_guid}\n")
76
81
  p = Panel.fit(resource_text)
77
82
  tt = t_r.add(p, style=style)
@@ -82,18 +87,18 @@ def tech_viewer(tech: str, server_name:str, platform_url:str, user:str, user_pas
82
87
  return tt
83
88
 
84
89
  try:
85
- tree = Tree(f"{tech}", style = "bold bright_white on black", guide_style="bold bright_blue")
90
+ tree = Tree(f"{tech}", style="bold bright_white on black", guide_style="bold bright_blue")
86
91
  a_client = AutomatedCuration(server_name, platform_url,
87
92
  user_id=user)
88
93
 
89
94
  token = a_client.create_egeria_bearer_token(user, user_password)
90
- view_tech_details(a_client,tech,tree)
95
+ view_tech_details(a_client, tech, tree)
91
96
  print(tree)
92
97
 
93
98
  except (
94
- InvalidParameterException,
95
- PropertyServerException,
96
- UserNotAuthorizedException
99
+ InvalidParameterException,
100
+ PropertyServerException,
101
+ UserNotAuthorizedException
97
102
  ) as e:
98
103
  print_exception_response(e)
99
104
 
@@ -113,10 +118,10 @@ def main():
113
118
  user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
114
119
  try:
115
120
  tech = Prompt.ask("Enter the Technology to start from:", default="PostgreSQL Server")
116
- tech_viewer(tech,server, url, userid, user_pass)
121
+ tech_details_viewer(tech, server, url, userid, user_pass)
117
122
  except(KeyboardInterrupt):
118
123
  pass
119
124
 
120
125
 
121
126
  if __name__ == "__main__":
122
- main()
127
+ main()
@@ -34,9 +34,13 @@ EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
34
34
  EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
35
35
  EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
36
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'))
37
39
 
38
40
 
39
- def display_asset_types(server: str, url: str, username: str, user_password: str):
41
+ def display_asset_types(server: str, url: str, username: str, user_password: str,
42
+ jupyter: bool = EGERIA_JUPYTER, width: int = EGERIA_WIDTH
43
+ ):
40
44
  r_client = RegisteredInfo(server, url, username)
41
45
  token = r_client.create_egeria_bearer_token(username, user_password)
42
46
  asset_types = r_client.list_asset_types()
@@ -45,8 +49,8 @@ def display_asset_types(server: str, url: str, username: str, user_password: str
45
49
  """Make a new table."""
46
50
  table = Table(
47
51
  title=f"Asset Types for: {url} @ {time.asctime()}",
48
- style="bold white on black",
49
- row_styles=["bold white on black"],
52
+ style="bold bright_white on black",
53
+ row_styles=["bold bright_white on black"],
50
54
  header_style="white on dark_blue",
51
55
  title_style="bold white on black",
52
56
  show_lines=True,
@@ -76,7 +80,7 @@ def display_asset_types(server: str, url: str, username: str, user_password: str
76
80
  return table
77
81
 
78
82
  try:
79
- console = Console()
83
+ console = Console(width=width, force_terminal=not jupyter)
80
84
  with console.pager(styles=True):
81
85
  console.print(generate_table())
82
86
 
@@ -8,9 +8,10 @@ A simple widget to retrieve the registered services.
8
8
  """
9
9
 
10
10
  import argparse
11
+ import os
11
12
  import sys
12
13
  import time
13
- import os
14
+
14
15
  from rich import box
15
16
  from rich.console import Console
16
17
  from rich.prompt import Prompt
@@ -22,6 +23,7 @@ from pyegeria import (
22
23
  UserNotAuthorizedException,
23
24
  RegisteredInfo,
24
25
  )
26
+
25
27
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
26
28
  EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
27
29
  EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
@@ -32,9 +34,13 @@ EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
32
34
  EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
33
35
  EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
34
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
+
35
40
 
36
- def display_registered_svcs(service: str, server: str , url: str,
37
- username: str, password: str ):
41
+ def display_registered_svcs(service: str, server: str, url: str,
42
+ username: str, password: str, jupyter: bool = EGERIA_JUPYTER, width: int = EGERIA_WIDTH
43
+ ):
38
44
  """ Display the registered services list
39
45
  Parameters
40
46
  ----------
@@ -53,12 +59,13 @@ def display_registered_svcs(service: str, server: str , url: str,
53
59
  password : str, optional
54
60
  The password for authentication. Default is `default_password`.
55
61
  """
62
+
56
63
  def generate_table(svc_list) -> Table:
57
64
  """Make a new table."""
58
65
  table = Table(
59
66
  title=f"Technology Types for: {url} @ {time.asctime()}",
60
- style="bold white on black",
61
- row_styles=["bold white on black"],
67
+ style="bold bright_white on black",
68
+ row_styles=["bold bright_white on black"],
62
69
  header_style="white on dark_blue",
63
70
  title_style="bold white on black",
64
71
  caption_style="white on black",
@@ -113,7 +120,7 @@ def display_registered_svcs(service: str, server: str , url: str,
113
120
  print("Unknown service type")
114
121
  sys.exit(1)
115
122
 
116
- console = Console()
123
+ console = Console(width=width, force_terminal=not jupyter)
117
124
  try:
118
125
  a_client = RegisteredInfo(server, url, username)
119
126
  # token = a_client.create_egeria_bearer_token(username, password)
@@ -150,4 +157,4 @@ def main():
150
157
 
151
158
 
152
159
  if __name__ == "__main__":
153
- main()
160
+ main()
@@ -7,8 +7,8 @@ Copyright Contributors to the ODPi Egeria project.
7
7
 
8
8
  Get valid relationship types.
9
9
  """
10
- import os
11
10
  import argparse
11
+ import os
12
12
  import time
13
13
 
14
14
  from rich import box
@@ -24,6 +24,7 @@ from pyegeria import (
24
24
  print_exception_response,
25
25
  )
26
26
  from pyegeria import ValidMetadataManager
27
+
27
28
  EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
28
29
  EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
29
30
  EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
@@ -34,11 +35,14 @@ EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
34
35
  EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
35
36
  EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
36
37
  EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
38
+ EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
39
+ EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
37
40
 
38
41
 
39
- def display_list(type_name:str, server: str, url: str ,
40
- username: str, user_pass:str, save_output: bool = False):
41
-
42
+ def display_relationship_types(type_name: str, server: str, url: str,
43
+ username: str, user_pass: str, save_output: bool = False, jupyter: bool = EGERIA_JUPYTER,
44
+ width: int = EGERIA_WIDTH
45
+ ):
42
46
  p_client = ValidMetadataManager(server, url, user_id=username)
43
47
  token = p_client.create_egeria_bearer_token(username, user_pass)
44
48
 
@@ -86,7 +90,7 @@ def display_list(type_name:str, server: str, url: str ,
86
90
  # guid = types['guid']
87
91
  status = types['initialStatus']
88
92
  description = types['description']
89
- description_wiki = types.get("descriptionWiki"," ")
93
+ description_wiki = types.get("descriptionWiki", " ")
90
94
  attribute_defs = types.get("attributeDefinitions")
91
95
  if attribute_defs:
92
96
  for attr in attribute_defs:
@@ -95,18 +99,18 @@ def display_list(type_name:str, server: str, url: str ,
95
99
  attr_status = attr['attributeStatus']
96
100
  attr_type = attr['attributeType']["name"]
97
101
  table.add_row(
98
- status, name, description, attr_name, attr_status, attr_type, attr_desc,
102
+ status, name, description, attr_name, attr_status, attr_type, attr_desc,
99
103
  description_wiki
100
104
  )
101
105
  else:
102
- table.add_row(status,name,description,description_wiki," ", " ", " "," " )
106
+ table.add_row(status, name, description, description_wiki, " ", " ", " ", " ")
103
107
 
104
108
  p_client.close_session()
105
109
  return table
106
110
 
107
111
  try:
108
112
 
109
- console = Console(record=True)
113
+ console = Console(width=width, force_terminal=not jupyter, record=True)
110
114
  with console.pager(styles=True):
111
115
  console.print(generate_table(type_name))
112
116
  if save_output:
@@ -118,6 +122,7 @@ def display_list(type_name:str, server: str, url: str ,
118
122
  else:
119
123
  print_exception_response(e)
120
124
 
125
+
121
126
  def main():
122
127
  parser = argparse.ArgumentParser()
123
128
  parser.add_argument("--server", help="Name of the server to display status for")
@@ -135,7 +140,8 @@ def main():
135
140
  save_output = args.save_output if args.save_output is not None else False
136
141
  type_name = Prompt.ask("Enter the Type Name to retrieve:", default="AssetOwner")
137
142
 
138
- display_list(type_name, server, url, userid, user_pass,save_output)
143
+ display_relationship_types(type_name, server, url, userid, user_pass, save_output)
144
+
139
145
 
140
146
  if __name__ == "__main__":
141
- main()
147
+ main()
@@ -31,10 +31,14 @@ EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
31
31
  EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
32
32
  EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
33
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'))
34
36
 
35
37
 
36
- def display_tech_types(search_string:str, server: str,
37
- url: str, username: str, password: str):
38
+
39
+ def display_tech_templates(search_string:str, server: str,
40
+ url: str, username: str, password: str, jupyter:bool=EGERIA_JUPYTER, width:int = EGERIA_WIDTH
41
+ ):
38
42
 
39
43
  a_client = AutomatedCuration(server, url, username)
40
44
  token = a_client.create_egeria_bearer_token(username, password)
@@ -44,8 +48,8 @@ def display_tech_types(search_string:str, server: str,
44
48
  """Make a new table."""
45
49
  table = Table(
46
50
  title=f"Technology Templates for: {url} @ {time.asctime()}",
47
- style="bold white on black",
48
- row_styles=["bold white on black"],
51
+ style="bold bright_white on black",
52
+ row_styles=["bold bright_white on black"],
49
53
  header_style="white on dark_blue",
50
54
  title_style="bold white on black",
51
55
  caption_style="white on black",
@@ -108,7 +112,8 @@ def display_tech_types(search_string:str, server: str,
108
112
  sys.exit(1)
109
113
 
110
114
  try:
111
- console = Console()
115
+ console = Console(width=width, force_terminal=not jupyter)
116
+
112
117
  with console.pager(styles=True):
113
118
  console.print(generate_table())
114
119
 
@@ -136,7 +141,7 @@ def main():
136
141
 
137
142
  try:
138
143
  search_string = Prompt.ask("Enter the technology you are searching for:", default="*")
139
- display_tech_types(search_string, server, url, userid, password)
144
+ display_tech_templates(search_string, server, url, userid, password)
140
145
  except(KeyboardInterrupt):
141
146
  pass
142
147