pyegeria 0.7.15__tar.gz → 0.7.17__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.
- {pyegeria-0.7.15 → pyegeria-0.7.17}/PKG-INFO +1 -1
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cli/egeria.py +14 -1
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cli/egeria_tech.py +9 -1
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/engine_actions.py +1 -7
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/list_catalog_targets.py +1 -1
- pyegeria-0.7.17/examples/widgets/tech/list_related_specification.py +144 -0
- pyegeria-0.7.17/examples/widgets/tech/x_list_related_elements.py +145 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyproject.toml +2 -1
- {pyegeria-0.7.15 → pyegeria-0.7.17}/LICENSE +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/README.md +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/doc_samples/Create_Collection_Sample.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/doc_samples/Create_Sustainability_Collection_Sample.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/README.md +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/__init__.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/get_asset_graph.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/get_collection.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/get_project_structure.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/get_tech_type_elements.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/get_tech_type_template.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/list_assets.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/list_cert_types.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/list_glossary.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/list_projects.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/list_relationships.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/list_tech_types.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cat/list_todos.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cli/__init__.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cli/egeria_cat.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cli/egeria_my.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cli/egeria_ops.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/cli/ops_config.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/my/README.md +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/my/__init__.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/my/list_my_profile.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/my/list_my_roles.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/my/monitor_my_todos.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/my/monitor_open_todos.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/my/my_profile_actions.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/README.md +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/__init__.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/integration_daemon_actions.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/load_archive.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/monitor_asset_events.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/monitor_coco_status.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/monitor_engine_activity.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/monitor_gov_eng_status.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/monitor_integ_daemon_status.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/monitor_platform_status.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/monitor_server_list.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/monitor_server_status.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/refresh_integration_daemon.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/ops/restart_integration_daemon.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/tech/README.md +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/tech/__init__.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/tech/get_guid_info.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/tech/get_tech_details.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/tech/list_asset_types.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/tech/list_elements.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/tech/list_registered_services.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/tech/list_relationship_types.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/tech/list_tech_templates.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/examples/widgets/tech/list_valid_metadata_values.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/Xloaded_resources_omvs.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/__init__.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/_client.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/_deprecated_gov_engine.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/_exceptions.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/_globals.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/_validators.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/action_author_omvs.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/asset_catalog_omvs.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/automated_curation_omvs.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/classification_manager_omvs.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/collection_manager_omvs.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/core_omag_server_config.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/create_tech_guid_lists.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/feedback_manager_omvs.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/full_omag_server_config.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/glossary_browser_omvs.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/glossary_manager_omvs.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/my_profile_omvs.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/platform_services.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/project_manager_omvs.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/registered_info.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/runtime_manager_omvs.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/server_operations.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/utils.py +0 -0
- {pyegeria-0.7.15 → pyegeria-0.7.17}/pyegeria/valid_metadata_omvs.py +0 -0
@@ -24,6 +24,7 @@ from examples.widgets.cat.list_projects import display_project_list
|
|
24
24
|
from examples.widgets.cat.list_tech_types import display_tech_types
|
25
25
|
from examples.widgets.cat.list_todos import display_to_dos
|
26
26
|
from examples.widgets.cli.ops_config import Config
|
27
|
+
from examples.widgets.cat.list_relationships import list_relationships
|
27
28
|
|
28
29
|
from examples.widgets.ops.engine_actions import start_server as start_engine_host, \
|
29
30
|
stop_server as stop_engine_host
|
@@ -51,7 +52,8 @@ from examples.widgets.tech.list_relationship_types import display_relationship_t
|
|
51
52
|
from examples.widgets.tech.list_tech_templates import display_templates_spec
|
52
53
|
from examples.widgets.tech.list_valid_metadata_values import display_metadata_values
|
53
54
|
from examples.widgets.tech.list_elements import list_elements
|
54
|
-
from examples.widgets.
|
55
|
+
from examples.widgets.tech.list_related_specification import display_related_specification
|
56
|
+
|
55
57
|
|
56
58
|
@tui()
|
57
59
|
# @tui('menu', 'menu', 'A textual command line interface')
|
@@ -275,6 +277,17 @@ def show_registered_services(ctx, services):
|
|
275
277
|
display_registered_svcs(services, c.view_server, c.view_server_url,
|
276
278
|
c.userid, c.password, c.jupyter, c.width)
|
277
279
|
|
280
|
+
@show.command('related-specifications')
|
281
|
+
@click.pass_context
|
282
|
+
@click.argument('element-guid')
|
283
|
+
def show_related_specifications(ctx, element_guid):
|
284
|
+
"""List specifications related to the given Element"""
|
285
|
+
c = ctx.obj
|
286
|
+
display_related_specification(element_guid, c.view_server, c.view_server_url,
|
287
|
+
c.userid, c.password, c.jupyter, c.width)
|
288
|
+
|
289
|
+
|
290
|
+
|
278
291
|
|
279
292
|
@show.command('relationship-types')
|
280
293
|
@click.option('--rel-type', default='AssetOwner', help='Relationship type to get information about')
|
@@ -23,6 +23,7 @@ from examples.widgets.tech.list_tech_templates import display_templates_spec
|
|
23
23
|
from examples.widgets.tech.list_valid_metadata_values import display_metadata_values
|
24
24
|
from examples.widgets.cat.get_tech_type_template import template_viewer
|
25
25
|
from examples.widgets.tech.list_elements import list_elements
|
26
|
+
from examples.widgets.tech.list_related_specification import display_related_specification
|
26
27
|
|
27
28
|
|
28
29
|
|
@@ -216,7 +217,14 @@ def get_element_info(ctx, om_type):
|
|
216
217
|
list_elements(om_type, c.view_server, c.view_server_url,
|
217
218
|
c.userid, c.password, c.jupyter, c.width)
|
218
219
|
|
219
|
-
|
220
|
+
@show.command('related-specifications')
|
221
|
+
@click.pass_context
|
222
|
+
@click.argument('element-guid')
|
223
|
+
def show_related_specifications(ctx, element_guid):
|
224
|
+
"""List specifications related to the given Element"""
|
225
|
+
c = ctx.obj
|
226
|
+
display_related_specification(element_guid,c.view_server, c.view_server_url,
|
227
|
+
c.userid, c.password, c.jupyter, c.width)
|
220
228
|
|
221
229
|
#
|
222
230
|
# Tell
|
@@ -4,15 +4,9 @@ Copyright Contributors to the ODPi Egeria project.
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
|
7
|
+
Execute engine actions.
|
8
8
|
|
9
9
|
"""
|
10
|
-
|
11
|
-
import os
|
12
|
-
from rich import print, print_json
|
13
|
-
from rich.console import Console
|
14
|
-
|
15
|
-
import time
|
16
10
|
import click
|
17
11
|
# from ops_config import Config, pass_config
|
18
12
|
from pyegeria import ServerOps, AutomatedCuration, INTEGRATION_GUIDS, Platform
|
@@ -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 elements related to given element guid by the specified relationship type. Optionally filter by a specified
|
7
|
+
open metadata type.
|
8
|
+
|
9
|
+
"""
|
10
|
+
import argparse
|
11
|
+
import os
|
12
|
+
import sys
|
13
|
+
import time
|
14
|
+
|
15
|
+
from rich import box
|
16
|
+
from rich.console import Console
|
17
|
+
from rich.markdown import Markdown
|
18
|
+
from rich.prompt import Prompt
|
19
|
+
from rich.table import Table
|
20
|
+
|
21
|
+
from pyegeria import (InvalidParameterException, PropertyServerException, UserNotAuthorizedException,
|
22
|
+
print_exception_response, ClassificationManager)
|
23
|
+
|
24
|
+
console = Console()
|
25
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
26
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
|
27
|
+
EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
|
28
|
+
EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
|
29
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
|
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 display_related_specification(element_guid: str, server: str, url: str, username: str, password: str,
|
40
|
+
jupyter: bool = EGERIA_JUPYTER, width: int = EGERIA_WIDTH):
|
41
|
+
c_client = ClassificationManager(server, url, user_id=username, user_pwd=password)
|
42
|
+
token = c_client.create_egeria_bearer_token()
|
43
|
+
rel_el = c_client.get_related_elements(element_guid, 'SpecificationPropertyAssignment', None)
|
44
|
+
|
45
|
+
if type(rel_el) is str:
|
46
|
+
print(f"\n\nWas not able list related specifications for {element_guid}\n\n")
|
47
|
+
sys.exit(0)
|
48
|
+
|
49
|
+
related_elements: dict = {}
|
50
|
+
|
51
|
+
def generate_table() -> Table:
|
52
|
+
"""Make a new table."""
|
53
|
+
table = Table(title=f"Specifications related to: {element_guid} @ {time.asctime()}",
|
54
|
+
style="bold bright_white on black", row_styles=["bold bright_white on black"],
|
55
|
+
header_style="white on dark_blue", title_style="bold bright_white on black", caption_style="white on black",
|
56
|
+
show_lines=True, box=box.ROUNDED, caption=f"Elements from Server '{server}' @ Platform - {url}",
|
57
|
+
expand=True, # width=500
|
58
|
+
)
|
59
|
+
|
60
|
+
table.add_column("Name", justify='center', style="bold bright_white")
|
61
|
+
table.add_column("Specification", justify='center', style="bold bright_white")
|
62
|
+
|
63
|
+
for element in rel_el:
|
64
|
+
relationship_props = element["relationshipProperties"]['propertyType']
|
65
|
+
related_elements[relationship_props] = []
|
66
|
+
|
67
|
+
for element in rel_el:
|
68
|
+
relationship_props = element["relationshipProperties"]['propertyType']
|
69
|
+
|
70
|
+
rel_element = element['relatedElement']
|
71
|
+
el = rel_element["properties"]
|
72
|
+
re: dict = {}
|
73
|
+
|
74
|
+
re['case'] = el.get("isCaseSensitive", '---')
|
75
|
+
re['name'] = el.get("preferredValue", '---')
|
76
|
+
re['description'] = el.get("description", '---')
|
77
|
+
add = el.get("additionalProperties", '---')
|
78
|
+
if type(add) is str:
|
79
|
+
re['additional'] = add
|
80
|
+
else:
|
81
|
+
add_md = ""
|
82
|
+
for k in add.keys():
|
83
|
+
add_md += f"* {k}: {add[k]}\n"
|
84
|
+
re['additional'] = Markdown(add_md)
|
85
|
+
|
86
|
+
related_elements[relationship_props].append(re)
|
87
|
+
|
88
|
+
for kind in related_elements.keys():
|
89
|
+
|
90
|
+
spec_table = Table(expand=False, show_lines=True)
|
91
|
+
spec_table.add_column('Name')
|
92
|
+
spec_table.add_column('Case Sensitive?')
|
93
|
+
spec_table.add_column('Description')
|
94
|
+
spec_table.add_column('Additional Properties')
|
95
|
+
|
96
|
+
for spec_row in related_elements[kind]:
|
97
|
+
name = spec_row['name']
|
98
|
+
case = spec_row['case']
|
99
|
+
desc = spec_row['description']
|
100
|
+
additional_props = spec_row['additional']
|
101
|
+
spec_table.add_row(name, case, desc, additional_props)
|
102
|
+
|
103
|
+
table.add_row(kind, spec_table)
|
104
|
+
|
105
|
+
return table
|
106
|
+
|
107
|
+
try:
|
108
|
+
console = Console(width=width, force_terminal=not jupyter)
|
109
|
+
|
110
|
+
with console.pager(styles=True):
|
111
|
+
console.print(generate_table())
|
112
|
+
|
113
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
114
|
+
print_exception_response(e)
|
115
|
+
assert e.related_http_code != "200", "Invalid parameters"
|
116
|
+
finally:
|
117
|
+
c_client.close_session()
|
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="Password")
|
126
|
+
|
127
|
+
args = parser.parse_args()
|
128
|
+
|
129
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
130
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
131
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
132
|
+
password = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
133
|
+
guid = None
|
134
|
+
|
135
|
+
try:
|
136
|
+
element_guid = Prompt.ask("Enter an Element GUID find relationships for")
|
137
|
+
|
138
|
+
display_related_specification(element_guid, server, url, userid, password)
|
139
|
+
except(KeyboardInterrupt):
|
140
|
+
pass
|
141
|
+
|
142
|
+
|
143
|
+
if __name__ == "__main__":
|
144
|
+
main()
|
@@ -0,0 +1,145 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
List elements related to given element guid by the specified relationship type. Optionally filter by a specified
|
7
|
+
open metadata type.
|
8
|
+
|
9
|
+
"""
|
10
|
+
import argparse
|
11
|
+
import os
|
12
|
+
import sys
|
13
|
+
import time
|
14
|
+
|
15
|
+
from rich import box
|
16
|
+
from rich.console import Console
|
17
|
+
from rich.markdown import Markdown
|
18
|
+
from rich.prompt import Prompt
|
19
|
+
from rich.table import Table
|
20
|
+
|
21
|
+
from pyegeria import (
|
22
|
+
InvalidParameterException,
|
23
|
+
PropertyServerException,
|
24
|
+
UserNotAuthorizedException,
|
25
|
+
print_exception_response,
|
26
|
+
ClassificationManager
|
27
|
+
)
|
28
|
+
|
29
|
+
console = Console()
|
30
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
31
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
|
32
|
+
EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
|
33
|
+
EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
|
34
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
|
35
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
|
36
|
+
EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
|
37
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
|
38
|
+
EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
|
39
|
+
EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
|
40
|
+
EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
|
41
|
+
EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
|
42
|
+
|
43
|
+
|
44
|
+
def display_related_elements(element_guid: str, relationship: str, om_type: str, server: str,
|
45
|
+
url: str, username: str, password: str, jupyter: bool = EGERIA_JUPYTER,
|
46
|
+
width: int = EGERIA_WIDTH
|
47
|
+
):
|
48
|
+
c_client = ClassificationManager(server, url, user_id=username, user_pwd=password)
|
49
|
+
token = c_client.create_egeria_bearer_token()
|
50
|
+
rel_el = c_client.get_related_elements(element_guid, relationship, om_type)
|
51
|
+
|
52
|
+
if type(rel_el) is str:
|
53
|
+
print(f"\n\nWas not able find related elements for {element_guid} with relationship {relationship}\n\n")
|
54
|
+
sys.exit(0)
|
55
|
+
|
56
|
+
def generate_table() -> Table:
|
57
|
+
"""Make a new table."""
|
58
|
+
table = Table(
|
59
|
+
title=f"Elements Related to guid: {element_guid} by relationship: {relationship} @ {time.asctime()}",
|
60
|
+
style="bold bright_white on black",
|
61
|
+
row_styles=["bold bright_white on black"],
|
62
|
+
header_style="white on dark_blue",
|
63
|
+
title_style="bold bright_white on black",
|
64
|
+
caption_style="white on black",
|
65
|
+
show_lines=True,
|
66
|
+
box=box.ROUNDED,
|
67
|
+
caption=f"Elements from Server '{server}' @ Platform - {url}",
|
68
|
+
expand=True,
|
69
|
+
# width=500
|
70
|
+
)
|
71
|
+
|
72
|
+
table.add_column("Relationship Properties")
|
73
|
+
table.add_column("Preferred Value")
|
74
|
+
table.add_column("Case Sensitive")
|
75
|
+
table.add_column("Description")
|
76
|
+
table.add_column("Additional Properties")
|
77
|
+
|
78
|
+
for related_element in rel_el:
|
79
|
+
relationship_props = related_element["relationshipProperties"]
|
80
|
+
|
81
|
+
rel_prop_md = ''
|
82
|
+
for key in relationship_props.keys():
|
83
|
+
rel_prop_md += f"{key}: {relationship_props[key]}\n"
|
84
|
+
# rel_prop_out = Markdown(rel_prop_md)
|
85
|
+
|
86
|
+
rel_element = related_element['relatedElement']
|
87
|
+
el = rel_element["properties"]
|
88
|
+
for prop in el:
|
89
|
+
el_case = el.get("isCaseSensitive", '---')
|
90
|
+
el_pref = el.get("preferredValue", '---')
|
91
|
+
el_desc = el.get("description", '---')
|
92
|
+
el_add = el.get("additionalProperties", '---')
|
93
|
+
|
94
|
+
el_add_md = ''
|
95
|
+
el_add_f = el_add.replace('\u003d',':')
|
96
|
+
s = el_add.strip('{}').strip()
|
97
|
+
pairs = [i.split('=') for i in s.split(', ')]
|
98
|
+
# d_add_prop = dict(pairs)
|
99
|
+
# for key in d_add_prop.keys():
|
100
|
+
# el_add_md += f"{key}: {d_add_prop[key]}\n"
|
101
|
+
# el_add_out = Markdown(el_add_md)
|
102
|
+
|
103
|
+
table.add_row(rel_prop_md, el_pref, el_case, el_desc, s)
|
104
|
+
|
105
|
+
return table
|
106
|
+
|
107
|
+
try:
|
108
|
+
console = Console(width=width, force_terminal=not jupyter)
|
109
|
+
|
110
|
+
with console.pager(styles=True):
|
111
|
+
console.print(generate_table())
|
112
|
+
|
113
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
114
|
+
print_exception_response(e)
|
115
|
+
assert e.related_http_code != "200", "Invalid parameters"
|
116
|
+
finally:
|
117
|
+
c_client.close_session()
|
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="Password")
|
126
|
+
|
127
|
+
args = parser.parse_args()
|
128
|
+
|
129
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
130
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
131
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
132
|
+
password = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
133
|
+
guid = None
|
134
|
+
|
135
|
+
try:
|
136
|
+
element_guid = Prompt.ask("Enter an Element GUID find relationships for")
|
137
|
+
relationship = Prompt.ask("Enter the relationship to search", default="SpecificationPropertyAssignment")
|
138
|
+
om_type = Prompt.ask("Enter an optional Open Metadata Type", default=None)
|
139
|
+
display_related_elements(element_guid, relationship, om_type, server, url, userid, password)
|
140
|
+
except(KeyboardInterrupt):
|
141
|
+
pass
|
142
|
+
|
143
|
+
|
144
|
+
if __name__ == "__main__":
|
145
|
+
main()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "pyegeria"
|
3
|
-
version = "0.7.
|
3
|
+
version = "0.7.17"
|
4
4
|
license = 'Apache 2.0'
|
5
5
|
authors = ["Dan Wolfson <dan.wolfson@pdr-associates.com>"]
|
6
6
|
readme = "README.md"
|
@@ -100,5 +100,6 @@ pytest = "^8.2.2"
|
|
100
100
|
list_tech_templates = "examples.widgets.tech.list_tech_templates:main"
|
101
101
|
get_element_info = "examples.widgets.tech.get_element_info:main"
|
102
102
|
list_elements = "examples.widgets.tech.list_elements:main"
|
103
|
+
list_related_specification = "examples.widgets.tech.list_related_specification:main"
|
103
104
|
|
104
105
|
list_valid_metadata_values = "examples.widgets.tech.list_valid_metadata_values:main"
|
File without changes
|
File without changes
|
File without changes
|
{pyegeria-0.7.15 → pyegeria-0.7.17}/examples/doc_samples/Create_Sustainability_Collection_Sample.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|