pyegeria 0.7.11__py3-none-any.whl → 0.7.13__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.
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ SPDX-License-Identifier: Apache-2.0
4
+ Copyright Contributors to the ODPi Egeria project.
5
+
6
+ List certification types
7
+
8
+
9
+ A simple display for certification types
10
+ """
11
+ import argparse
12
+ import os
13
+ import sys
14
+ import time
15
+
16
+ from rich import box
17
+ from rich.console import Console
18
+ from rich.markdown import Markdown
19
+ from rich.table import Table
20
+
21
+ from pyegeria import (
22
+ InvalidParameterException,
23
+ PropertyServerException,
24
+ UserNotAuthorizedException,
25
+ ClassificationManager
26
+ )
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('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
33
+ EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
34
+ EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
35
+ EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
36
+ EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
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'))
40
+
41
+
42
+ disable_ssl_warnings = True
43
+
44
+
45
+ def list_relationships(search_string: str, server: str, url: str, username: str, user_password: str, time_out: int = 60,
46
+ jupyter: bool = EGERIA_JUPYTER, width: int = EGERIA_WIDTH):
47
+
48
+ console = Console(width=width, force_terminal=not jupyter, soft_wrap=True)
49
+ if (search_string is None) or ((len(search_string) < 3)) and (search_string != '*'):
50
+ raise ValueError("Invalid Search String - must be greater than four characters long")
51
+ g_client = ClassificationManager(server, url, user_id=username,user_pwd=user_password)
52
+ token = g_client.create_egeria_bearer_token(username, user_password)
53
+
54
+
55
+ def generate_table(search_string:str = None) -> Table:
56
+ """Make a new table."""
57
+ table = Table(
58
+ title=f"Relationship List for {search_string} @ {time.asctime()}",
59
+ header_style="white on dark_blue",
60
+ style="bold white on black",
61
+ row_styles=["bold white on black"],
62
+ title_style="bold white on black",
63
+ caption_style="white on black",
64
+ show_lines=True,
65
+ box=box.ROUNDED,
66
+ caption=f"View Server '{server}' @ Platform - {url}",
67
+ expand=True
68
+ )
69
+ table.add_column('End 1 Name')
70
+ table.add_column("End 1 GUID", no_wrap=True)
71
+ table.add_column('End 1 Type')
72
+ table.add_column('End 2 Name')
73
+ table.add_column("End 2 GUID", no_wrap=True)
74
+ table.add_column("End 2 Type")
75
+ table.add_column("Properties", min_width=40)
76
+
77
+ rel_list = g_client.get_relationships(search_string, page_size=100, time_out=time_out)
78
+ if type(rel_list) is str:
79
+ return table
80
+
81
+ for rel in rel_list:
82
+ end1_name = rel['end1'].get('uniqueName','---')
83
+ end1_guid = rel['end1']['guid']
84
+ end1_type = rel['end1']['type']['typeName']
85
+ end2_name = rel['end2'].get('uniqueName', '---')
86
+ end2_guid = rel['end2']['guid']
87
+ end2_type = rel['end2']['type']['typeName']
88
+
89
+ rel_md = ''
90
+ for key in rel['properties'].keys():
91
+ rel_md += f"* {key}: {rel['properties'][key]}\n"
92
+
93
+ rel_out = Markdown(rel_md)
94
+
95
+ table.add_row(
96
+ end1_name, end1_guid, end1_type, end1_name, end2_guid, end2_type, rel_out)
97
+
98
+ g_client.close_session()
99
+
100
+ return table
101
+
102
+ try:
103
+ # with Live(generate_table(), refresh_per_second=4, screen=True) as live:
104
+ # while True:
105
+ # time.sleep(2)
106
+ # live.update(generate_table())
107
+
108
+ with console.pager(styles=True):
109
+ console.print(generate_table(search_string), soft_wrap=True)
110
+
111
+
112
+ except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
113
+ console.print_exception()
114
+ sys.exit(1)
115
+
116
+ except ValueError as e:
117
+ console.print(f"\n\n====> Invalid Search String - must be greater than four characters long")
118
+ sys.exit(1)
119
+
120
+
121
+ def main():
122
+ parser = argparse.ArgumentParser()
123
+ parser.add_argument("--server", help="Name of the server to display status for")
124
+ parser.add_argument("--url", help="URL Platform to connect to")
125
+ parser.add_argument("--userid", help="User Id")
126
+ parser.add_argument("--password", help="User Password")
127
+ parser.add_argument("--time_out", help="Time Out")
128
+
129
+ args = parser.parse_args()
130
+
131
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
132
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
133
+ userid = args.userid if args.userid is not None else EGERIA_USER
134
+ user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
135
+ time_out = args.time_out if args.time_out is not None else 60
136
+ try:
137
+ # search_string = Prompt.ask("Enter an asset search string:", default="*")
138
+ search_string = 'Certification'
139
+ list_relationships(search_string, server, url, userid, user_pass, time_out)
140
+ except(KeyboardInterrupt):
141
+ pass
142
+
143
+ if __name__ == "__main__":
144
+ main()
@@ -51,6 +51,7 @@ from examples.widgets.tech.list_relationship_types import display_relationship_t
51
51
  from examples.widgets.tech.list_tech_templates import display_templates_spec
52
52
  from examples.widgets.tech.list_valid_metadata_values import display_metadata_values
53
53
  from examples.widgets.tech.list_elements import list_elements
54
+ from examples.widgets.cat.list_relationships import list_relationships
54
55
 
55
56
  @tui()
56
57
  # @tui('menu', 'menu', 'A textual command line interface')
@@ -396,6 +397,15 @@ def show_project_structure(ctx, project):
396
397
  project_structure_viewer(project, c.view_server, c.view_server_url, c.userid,
397
398
  c.password, c.jupyter, c.width, c.timeout)
398
399
 
400
+ @show.command('relationships')
401
+ @click.option('--relationship', default = 'Certification',
402
+ help="Relationship type name to search for.")
403
+ @click.pass_context
404
+ def show_relationships(ctx, relationship):
405
+ """Show the structure of the project starting from a root project"""
406
+ c = ctx.obj
407
+ list_relationships(relationship, c.view_server, c.view_server_url, c.userid,
408
+ c.password, c.jupyter, c.width, c.timeout)
399
409
 
400
410
 
401
411
 
@@ -23,6 +23,7 @@ from examples.widgets.cat.list_projects import display_project_list
23
23
  from examples.widgets.cat.list_todos import display_to_dos
24
24
  from examples.widgets.cat.get_project_structure import project_structure_viewer
25
25
  from examples.widgets.cat.list_cert_types import display_certifications
26
+ from examples.widgets.cat.list_relationships import list_relationships
26
27
 
27
28
  # from pyegeria import ServerOps
28
29
  from examples.widgets.cli.ops_config import Config
@@ -211,6 +212,16 @@ def show_project_structure(ctx, project):
211
212
  project_structure_viewer(project, c.view_server, c.view_server_url, c.userid,
212
213
  c.password, c.jupyter, c.width, c.timeout)
213
214
 
215
+ @show.command('relationships')
216
+ @click.option('--relationship', default = 'Certification',
217
+ help="Relationship type name to search for.")
218
+ @click.pass_context
219
+ def show_relationships(ctx, relationship):
220
+ """Show the structure of the project starting from a root project"""
221
+ c = ctx.obj
222
+ list_relationships(relationship, c.view_server, c.view_server_url, c.userid,
223
+ c.password, c.jupyter, c.width, c.timeout)
224
+
214
225
 
215
226
 
216
227
  @show.command('to-dos')
@@ -70,7 +70,7 @@ def tech_details_viewer(tech: str, server_name: str, platform_url: str, user: st
70
70
  if ext_ref is not None:
71
71
  uri = ext_ref[0]["properties"].get("uri", "---")
72
72
  # console.print(f" {type(ext_ref)}, {len(ext_ref)}")
73
- l2 = tree.add(Panel(Text(f'* URI: {uri}', style)))
73
+ l2 = tree.add(Panel(Markdown(f'* URI: {uri}', style)))
74
74
 
75
75
  resource_list = tech_details.get('resourceList', None)
76
76
  if resource_list:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 0.7.11
3
+ Version: 0.7.13
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://github.com/odpi/egeria-python
6
6
  License: Apache 2.0
@@ -11,11 +11,12 @@ examples/widgets/cat/list_assets.py,sha256=bNwSaBDz661hfnc2Rn4j4HPHAugKvz0XwN9L1
11
11
  examples/widgets/cat/list_cert_types.py,sha256=-FEftRK36pOAXYr8OprvL6T_FcRyVtgfqzSKX74XC5o,7004
12
12
  examples/widgets/cat/list_glossary.py,sha256=zljSzVKYysFZVmVhHJt0fYFDmAG9azIphOs4MOIfA7g,5395
13
13
  examples/widgets/cat/list_projects.py,sha256=jP6HoVqGi-w4R1itgdAW1zamPLsgkvjvh8reRj0v10Q,7432
14
+ examples/widgets/cat/list_relationships.py,sha256=MztqAIVczfDNnjYj9Xh95K5IBI6m76N0GFcdmEZtC7w,5481
14
15
  examples/widgets/cat/list_tech_types.py,sha256=20T4v6L5qeebSsaL1nGkFMDAIsy2W3A3SMm1RcgFoh0,4609
15
16
  examples/widgets/cat/list_todos.py,sha256=wD9HevGcc4G_bxV25VUz1rRssdZHE33mF5zmJ6Lprt8,5522
16
17
  examples/widgets/cli/__init__.py,sha256=6d_R0KZBNnJy9EBz9J2xvGFlx-3j_ZPqPCxKgdvYeDQ,291
17
- examples/widgets/cli/egeria.py,sha256=WTGHf1tJHq3IPiGada2QH1mMWggNrEIlXPFxjDR6Lew,23450
18
- examples/widgets/cli/egeria_cat.py,sha256=f9KxOPAEFbeEtSAdk_czcBDLqCKsHkrpdiBuDDo-iUw,10301
18
+ examples/widgets/cli/egeria.py,sha256=eF26fnPGcbt4ZHO5Og1xOIRUNsJ1QLVVHZmoctbsiZQ,23974
19
+ examples/widgets/cli/egeria_cat.py,sha256=B-a30wOx0RkZYLQStcSZmcE7utyd8ieguAlSjBN2RqQ,10826
19
20
  examples/widgets/cli/egeria_my.py,sha256=xi2j1hzNnjDruJeR1qa8K9JPDgzaL_COsMkcieT4Vo8,5653
20
21
  examples/widgets/cli/egeria_ops.py,sha256=Y2fNDFnaaMjt8vjOeUXneh4_WEyxp0ucMvIfdLn8Bik,10139
21
22
  examples/widgets/cli/egeria_tech.py,sha256=EgerEUaaFOzIixYRhI79IKfVMEVQZ37RjX62aVbNPXc,9352
@@ -46,7 +47,7 @@ examples/widgets/ops/restart_integration_daemon.py,sha256=fID7qGFL5RD6rfn9PgXf5k
46
47
  examples/widgets/tech/README.md,sha256=nxDnfr3BCiGgW5G1VxWxiwUWJXIe5wreNuUeRyIt_hY,1343
47
48
  examples/widgets/tech/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
49
  examples/widgets/tech/get_guid_info.py,sha256=p-peTX1Mahi8fNmcNVHOVI3OjqjlJwZjv7gRdBI4l0Q,4137
49
- examples/widgets/tech/get_tech_details.py,sha256=vis_WedhYySa02nxDPJV1z814hB5_n97p8dm9jU57tQ,6019
50
+ examples/widgets/tech/get_tech_details.py,sha256=p5OgSKep3VOuuZmQXE2OSYhE-kvnI18TBcQ-PU5kEAw,6023
50
51
  examples/widgets/tech/list_asset_types.py,sha256=PHPtCXqCHhIw0K59hUvoKdybp6IKPt_9Wc0AJVDtdrg,4181
51
52
  examples/widgets/tech/list_elements.py,sha256=xQg-PGS2oORed2ATVNPZvGVCGLEUHO5rOeXvgS6pkrg,4726
52
53
  examples/widgets/tech/list_registered_services.py,sha256=TqZbT54vMGvHUAX_bovCce3A3eV_RbjSEtPP6u6ZJV0,6388
@@ -79,8 +80,8 @@ pyegeria/runtime_manager_omvs.py,sha256=oSVFeG_yBGXIvQR0EClLZqTZ6C5z5ReZzwm8cce8
79
80
  pyegeria/server_operations.py,sha256=1z2wZLdrNZG6HlswY_Eh8qI1mlcjsQ59zO-AMy9XbUU,16605
80
81
  pyegeria/utils.py,sha256=pkVmS3RrbjaS9yz7FtOCwaOfV5FMqz-__Rt5koCnd9c,5374
81
82
  pyegeria/valid_metadata_omvs.py,sha256=aisdRodIwJSkyArAzfm_sEnBELh69xE8k4Nea-vHu8M,36745
82
- pyegeria-0.7.11.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
83
- pyegeria-0.7.11.dist-info/METADATA,sha256=FDy_0lN6YamcOBl2vjk5axYpN4w0vGSqJ769lxEfA2E,2775
84
- pyegeria-0.7.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
85
- pyegeria-0.7.11.dist-info/entry_points.txt,sha256=UJ9j8ILCKryCUhbEIktWwLvJf0Isbuvpxv4TExaHJiA,2859
86
- pyegeria-0.7.11.dist-info/RECORD,,
83
+ pyegeria-0.7.13.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
84
+ pyegeria-0.7.13.dist-info/METADATA,sha256=h5LXogrSee7flmmlJlYKd3iNfwGB5foHMVJPnyVSb4c,2775
85
+ pyegeria-0.7.13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
86
+ pyegeria-0.7.13.dist-info/entry_points.txt,sha256=ySsq3_OAG14o6fIIuLHnZgQfYf5LPayXDdUcN8Gv-rk,2923
87
+ pyegeria-0.7.13.dist-info/RECORD,,
@@ -25,6 +25,7 @@ list_my_profile=examples.widgets.my.list_my_profile:main
25
25
  list_projects=examples.widgets.cat.list_projects:main
26
26
  list_registered_services=examples.widgets.tech.list_registered_services:main
27
27
  list_relationship_types=examples.widgets.tech.list_relationship_types:main
28
+ list_relationships=examples.widgets.cat.list_relationships:main
28
29
  list_tech_templates=examples.widgets.tech.list_tech_templates:main
29
30
  list_tech_types=examples.widgets.cat.list_tech_types:main
30
31
  list_todos=examples.widgets.cat.list_todos:main