pyegeria 0.7.11__py3-none-any.whl → 0.7.12__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.
- examples/widgets/cat/list_relationships.py +143 -0
- examples/widgets/cli/egeria.py +10 -0
- examples/widgets/cli/egeria_cat.py +11 -0
- examples/widgets/tech/get_tech_details.py +1 -1
- {pyegeria-0.7.11.dist-info → pyegeria-0.7.12.dist-info}/METADATA +1 -1
- {pyegeria-0.7.11.dist-info → pyegeria-0.7.12.dist-info}/RECORD +9 -8
- {pyegeria-0.7.11.dist-info → pyegeria-0.7.12.dist-info}/entry_points.txt +1 -0
- {pyegeria-0.7.11.dist-info → pyegeria-0.7.12.dist-info}/LICENSE +0 -0
- {pyegeria-0.7.11.dist-info → pyegeria-0.7.12.dist-info}/WHEEL +0 -0
@@ -0,0 +1,143 @@
|
|
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
|
+
console = Console(width=width, force_terminal=not jupyter, soft_wrap=True)
|
48
|
+
if (search_string is None) or ((len(search_string) < 3)) and (search_string != '*'):
|
49
|
+
raise ValueError("Invalid Search String - must be greater than four characters long")
|
50
|
+
g_client = ClassificationManager(server, url, user_id=username,user_pwd=user_password)
|
51
|
+
token = g_client.create_egeria_bearer_token(username, user_password)
|
52
|
+
|
53
|
+
|
54
|
+
def generate_table(search_string:str = None) -> Table:
|
55
|
+
"""Make a new table."""
|
56
|
+
table = Table(
|
57
|
+
title=f"Relationship List for {search_string} @ {time.asctime()}",
|
58
|
+
header_style="white on dark_blue",
|
59
|
+
style="bold white on black",
|
60
|
+
row_styles=["bold white on black"],
|
61
|
+
title_style="bold white on black",
|
62
|
+
caption_style="white on black",
|
63
|
+
show_lines=True,
|
64
|
+
box=box.ROUNDED,
|
65
|
+
caption=f"View Server '{server}' @ Platform - {url}",
|
66
|
+
expand=True
|
67
|
+
)
|
68
|
+
table.add_column('End 1 Name')
|
69
|
+
table.add_column("End 1 GUID", no_wrap=True)
|
70
|
+
table.add_column('End 1 Type')
|
71
|
+
table.add_column('End 2 Name')
|
72
|
+
table.add_column("End 2 GUID", no_wrap=True)
|
73
|
+
table.add_column("End 2 Type")
|
74
|
+
table.add_column("Properties", min_width=40)
|
75
|
+
|
76
|
+
rel_list = g_client.get_relationships(search_string, page_size=100, time_out=time_out)
|
77
|
+
if type(rel_list) is str:
|
78
|
+
return table
|
79
|
+
|
80
|
+
for rel in rel_list:
|
81
|
+
end1_name = rel['end1'].get('uniqueName','---')
|
82
|
+
end1_guid = rel['end1']['guid']
|
83
|
+
end1_type = rel['end1']['type']['typeName']
|
84
|
+
end2_name = rel['end2'].get('uniqueName', '---')
|
85
|
+
end2_guid = rel['end2']['guid']
|
86
|
+
end2_type = rel['end2']['type']['typeName']
|
87
|
+
|
88
|
+
rel_md = ''
|
89
|
+
for key in rel['properties'].keys():
|
90
|
+
rel_md += f"* {key}: {rel['properties'][key]}\n"
|
91
|
+
|
92
|
+
rel_out = Markdown(rel_md)
|
93
|
+
|
94
|
+
table.add_row(
|
95
|
+
end1_name, end1_guid, end1_type, end1_name, end2_guid, end2_type, rel_out)
|
96
|
+
|
97
|
+
g_client.close_session()
|
98
|
+
|
99
|
+
return table
|
100
|
+
|
101
|
+
try:
|
102
|
+
# with Live(generate_table(), refresh_per_second=4, screen=True) as live:
|
103
|
+
# while True:
|
104
|
+
# time.sleep(2)
|
105
|
+
# live.update(generate_table())
|
106
|
+
|
107
|
+
with console.pager(styles=True):
|
108
|
+
console.print(generate_table(search_string), soft_wrap=True)
|
109
|
+
|
110
|
+
|
111
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
112
|
+
console.print_exception()
|
113
|
+
sys.exit(1)
|
114
|
+
|
115
|
+
except ValueError as e:
|
116
|
+
console.print(f"\n\n====> Invalid Search String - must be greater than four characters long")
|
117
|
+
sys.exit(1)
|
118
|
+
|
119
|
+
|
120
|
+
def main():
|
121
|
+
parser = argparse.ArgumentParser()
|
122
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
123
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
124
|
+
parser.add_argument("--userid", help="User Id")
|
125
|
+
parser.add_argument("--password", help="User Password")
|
126
|
+
parser.add_argument("--time_out", help="Time Out")
|
127
|
+
|
128
|
+
args = parser.parse_args()
|
129
|
+
|
130
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
131
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
132
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
133
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
134
|
+
time_out = args.time_out if args.time_out is not None else 60
|
135
|
+
try:
|
136
|
+
# search_string = Prompt.ask("Enter an asset search string:", default="*")
|
137
|
+
search_string = 'Certification'
|
138
|
+
list_relationships(search_string, server, url, userid, user_pass, time_out)
|
139
|
+
except(KeyboardInterrupt):
|
140
|
+
pass
|
141
|
+
|
142
|
+
if __name__ == "__main__":
|
143
|
+
main()
|
examples/widgets/cli/egeria.py
CHANGED
@@ -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(
|
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:
|
@@ -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=DvgxfojP75h6hSkuFrDdJoq1zKNwLRwmOD_sCSxYnkg,5480
|
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=
|
18
|
-
examples/widgets/cli/egeria_cat.py,sha256=
|
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=
|
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.
|
83
|
-
pyegeria-0.7.
|
84
|
-
pyegeria-0.7.
|
85
|
-
pyegeria-0.7.
|
86
|
-
pyegeria-0.7.
|
83
|
+
pyegeria-0.7.12.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
84
|
+
pyegeria-0.7.12.dist-info/METADATA,sha256=qsrbbvfP81Z654NRKT_kgGzRRrUevIxW6YKK-NbTymY,2775
|
85
|
+
pyegeria-0.7.12.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
86
|
+
pyegeria-0.7.12.dist-info/entry_points.txt,sha256=AIgB6gxgFnBzAz_m79P_ES_TeP3hoZVxgJDROxo9q6c,2927
|
87
|
+
pyegeria-0.7.12.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.get_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
|
File without changes
|
File without changes
|