pyegeria 0.8.3__tar.gz → 0.8.4.1__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.8.3 → pyegeria-0.8.4.1}/PKG-INFO +1 -1
- pyegeria-0.8.4.1/examples/widgets/cat/get_project_dependencies.py +168 -0
- pyegeria-0.8.4.1/examples/widgets/cat/get_project_structure.py +168 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/__init__.py +1 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/egeria_cat_client.py +2 -12
- pyegeria-0.8.4.1/pyegeria/egeria_client.py +114 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/glossary_browser_omvs.py +2 -3
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/glossary_manager_omvs.py +1 -3
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/project_manager_omvs.py +1 -2
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyproject.toml +1 -1
- pyegeria-0.8.3/examples/widgets/cat/get_project_dependencies.py +0 -135
- pyegeria-0.8.3/examples/widgets/cat/get_project_structure.py +0 -135
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/LICENSE +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/README.md +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/doc_samples/Create_Collection_Sample.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/doc_samples/Create_Sustainability_Collection_Sample.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/README.md +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/__init__.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/get_asset_graph.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/get_collection.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/get_tech_type_elements.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/get_tech_type_template.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/list_archives.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/list_assets.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/list_cert_types.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/list_glossary.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/list_projects.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/list_relationships.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/list_tech_types.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/list_todos.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cat/list_user_ids.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cli/__init__.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cli/egeria.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cli/egeria_cat.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cli/egeria_my.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cli/egeria_ops.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cli/egeria_tech.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/cli/ops_config.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/my/README.md +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/my/__init__.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/my/list_my_profile.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/my/list_my_roles.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/my/monitor_my_todos.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/my/monitor_open_todos.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/my/my_profile_actions.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/my/todo_actions.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/README.md +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/__init__.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/engine_actions.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/integration_daemon_actions.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/list_catalog_targets.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/load_archive.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/monitor_asset_events.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/monitor_coco_status.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/monitor_engine_activity.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/monitor_engine_activity_c.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/monitor_gov_eng_status.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/monitor_integ_daemon_status.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/monitor_platform_status.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/monitor_server_list.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/monitor_server_status.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/refresh_integration_daemon.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/ops/restart_integration_daemon.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/README.md +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/__init__.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/get_element_info.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/get_guid_info.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/get_tech_details.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/list_asset_types.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/list_elements.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/list_elements_x.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/list_registered_services.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/list_related_specification.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/list_relationship_types.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/list_tech_templates.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/list_valid_metadata_values.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/examples/widgets/tech/x_list_related_elements.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/Xloaded_resources_omvs.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/_client.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/_deprecated_gov_engine.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/_exceptions.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/_globals.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/_validators.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/action_author_omvs.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/asset_catalog_omvs.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/automated_curation_omvs.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/classification_manager_omvs.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/collection_manager_omvs.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/core_omag_server_config.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/create_tech_guid_lists.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/egeria_config_client.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/egeria_my_client.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/egeria_ops_client.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/egeria_tech_client.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/feedback_manager_omvs.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/full_omag_server_config.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/mermaid_utilities.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/my_profile_omvs.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/platform_services.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/registered_info.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/runtime_manager_omvs.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/server_operations.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/utils.py +0 -0
- {pyegeria-0.8.3 → pyegeria-0.8.4.1}/pyegeria/valid_metadata_omvs.py +0 -0
@@ -0,0 +1,168 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
A simple viewer for project dependencies - provide the root and we display the dependency tree
|
7
|
+
|
8
|
+
"""
|
9
|
+
|
10
|
+
import argparse
|
11
|
+
import os
|
12
|
+
|
13
|
+
from rich import print
|
14
|
+
from rich.console import Console
|
15
|
+
from rich.markdown import Markdown
|
16
|
+
from rich.panel import Panel
|
17
|
+
from rich.prompt import Prompt
|
18
|
+
from rich.tree import Tree
|
19
|
+
|
20
|
+
from pyegeria import (
|
21
|
+
ProjectManager,
|
22
|
+
UserNotAuthorizedException,
|
23
|
+
PropertyServerException,
|
24
|
+
InvalidParameterException,
|
25
|
+
)
|
26
|
+
from pyegeria._exceptions import (
|
27
|
+
print_exception_response,
|
28
|
+
)
|
29
|
+
|
30
|
+
disable_ssl_warnings = True
|
31
|
+
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(
|
36
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
37
|
+
)
|
38
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
39
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
40
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
41
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
42
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
43
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
44
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
45
|
+
|
46
|
+
|
47
|
+
def project_dependency_viewer(
|
48
|
+
root: str,
|
49
|
+
server_name: str,
|
50
|
+
platform_url: str,
|
51
|
+
user: str,
|
52
|
+
user_password: str,
|
53
|
+
jupyter: bool = EGERIA_JUPYTER,
|
54
|
+
width: int = EGERIA_WIDTH,
|
55
|
+
timeout: int = 30,
|
56
|
+
):
|
57
|
+
"""A simple collection viewer"""
|
58
|
+
|
59
|
+
def walk_project_hierarchy(
|
60
|
+
project_client: ProjectManager,
|
61
|
+
project_name: str,
|
62
|
+
tree: Tree,
|
63
|
+
root: bool = False,
|
64
|
+
) -> None:
|
65
|
+
"""Recursively build a Tree with collection contents."""
|
66
|
+
t = None
|
67
|
+
style = "bright_white on black"
|
68
|
+
|
69
|
+
project = project_client.get_projects_by_name(project_name)
|
70
|
+
if type(project) is list:
|
71
|
+
proj_guid = project[0]["elementHeader"]["guid"]
|
72
|
+
proj_props = project[0]["properties"]
|
73
|
+
|
74
|
+
proj_type = proj_props.get("typeName", "---")
|
75
|
+
proj_unique = proj_props.get("qualifiedName", "---")
|
76
|
+
proj_identifier = proj_props.get("identifier", "---")
|
77
|
+
proj_name = proj_props.get("name", "---")
|
78
|
+
proj_desc = proj_props.get("description", "---")
|
79
|
+
proj_status = proj_props.get("projectStatus", "---")
|
80
|
+
proj_priority = proj_props.get("priority", "---")
|
81
|
+
proj_start = proj_props.get("startDate", "---")[:-10]
|
82
|
+
proj_props_md = (
|
83
|
+
f"* Name: {proj_name}\n"
|
84
|
+
f"* Identifier: {proj_identifier}\n"
|
85
|
+
f"* Type: {proj_type}\n"
|
86
|
+
f"* Status: {proj_status}\n"
|
87
|
+
f"* priority: {proj_priority}\n"
|
88
|
+
f"* Start: {proj_start}\n"
|
89
|
+
f"* Description: {proj_desc}\n"
|
90
|
+
f"* GUID: {proj_guid}"
|
91
|
+
)
|
92
|
+
else:
|
93
|
+
return
|
94
|
+
|
95
|
+
team = project_client.get_project_team(proj_guid)
|
96
|
+
member_md = ""
|
97
|
+
if type(team) is list:
|
98
|
+
for member in team:
|
99
|
+
member_guid = member["member"]["guid"]
|
100
|
+
member_unique = member["member"]["uniqueName"]
|
101
|
+
member_md += f"* Member Unique Name: {member_unique}\n* Member GUID: {member_guid}"
|
102
|
+
proj_props_md += f"\n### Team Members\n {member_md}"
|
103
|
+
|
104
|
+
proj_props_out = Markdown(proj_props_md)
|
105
|
+
p = Panel.fit(proj_props_out, style=style, title=project_name)
|
106
|
+
t = tree.add(p)
|
107
|
+
|
108
|
+
linked_projects = project_client.get_linked_projects(proj_guid)
|
109
|
+
if type(linked_projects) is list:
|
110
|
+
for proj in linked_projects:
|
111
|
+
child_md = ""
|
112
|
+
child_guid = proj["elementHeader"]["guid"]
|
113
|
+
child_name = proj["properties"]["name"]
|
114
|
+
relationship = proj["relatedElement"]["relationshipHeader"]["type"][
|
115
|
+
"typeName"
|
116
|
+
]
|
117
|
+
if relationship != "ProjectDependency":
|
118
|
+
continue
|
119
|
+
walk_project_hierarchy(project_client, child_name, t)
|
120
|
+
|
121
|
+
else:
|
122
|
+
return t
|
123
|
+
|
124
|
+
try:
|
125
|
+
console = Console(width=width, force_terminal=not jupyter)
|
126
|
+
tree = Tree(
|
127
|
+
f"[bold bright green on black]{root}", guide_style="bold bright_blue"
|
128
|
+
)
|
129
|
+
p_client = ProjectManager(server_name, platform_url, user_id=user)
|
130
|
+
|
131
|
+
token1 = p_client.create_egeria_bearer_token(user, user_password)
|
132
|
+
|
133
|
+
walk_project_hierarchy(p_client, root, tree, root=True)
|
134
|
+
print(tree)
|
135
|
+
|
136
|
+
except (
|
137
|
+
InvalidParameterException,
|
138
|
+
PropertyServerException,
|
139
|
+
UserNotAuthorizedException,
|
140
|
+
) as e:
|
141
|
+
print_exception_response(e)
|
142
|
+
|
143
|
+
|
144
|
+
def main():
|
145
|
+
parser = argparse.ArgumentParser()
|
146
|
+
|
147
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
148
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
149
|
+
parser.add_argument("--userid", help="User Id")
|
150
|
+
parser.add_argument("--password", help="User Password")
|
151
|
+
args = parser.parse_args()
|
152
|
+
|
153
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
154
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
155
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
156
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
157
|
+
|
158
|
+
try:
|
159
|
+
root_project = Prompt.ask(
|
160
|
+
"Enter the Root Project to start from:", default="Sustainability Campaign"
|
161
|
+
)
|
162
|
+
project_dependency_viewer(root_project, server, url, userid, user_pass)
|
163
|
+
except KeyboardInterrupt:
|
164
|
+
pass
|
165
|
+
|
166
|
+
|
167
|
+
if __name__ == "__main__":
|
168
|
+
main()
|
@@ -0,0 +1,168 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
A simple viewer for project structure - provide the root and we display the hierarchy
|
7
|
+
|
8
|
+
"""
|
9
|
+
|
10
|
+
import argparse
|
11
|
+
import os
|
12
|
+
|
13
|
+
from rich import print
|
14
|
+
from rich.console import Console
|
15
|
+
from rich.markdown import Markdown
|
16
|
+
from rich.panel import Panel
|
17
|
+
from rich.prompt import Prompt
|
18
|
+
from rich.tree import Tree
|
19
|
+
|
20
|
+
from pyegeria import (
|
21
|
+
ProjectManager,
|
22
|
+
UserNotAuthorizedException,
|
23
|
+
PropertyServerException,
|
24
|
+
InvalidParameterException,
|
25
|
+
)
|
26
|
+
from pyegeria._exceptions import (
|
27
|
+
print_exception_response,
|
28
|
+
)
|
29
|
+
|
30
|
+
disable_ssl_warnings = True
|
31
|
+
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(
|
36
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
37
|
+
)
|
38
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
39
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
40
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
41
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
42
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
43
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
44
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
45
|
+
|
46
|
+
|
47
|
+
def project_structure_viewer(
|
48
|
+
root: str,
|
49
|
+
server_name: str,
|
50
|
+
platform_url: str,
|
51
|
+
user: str,
|
52
|
+
user_password: str,
|
53
|
+
jupyter: bool = EGERIA_JUPYTER,
|
54
|
+
width: int = EGERIA_WIDTH,
|
55
|
+
timeout: int = 30,
|
56
|
+
):
|
57
|
+
"""A simple collection viewer"""
|
58
|
+
|
59
|
+
def walk_project_hierarchy(
|
60
|
+
project_client: ProjectManager,
|
61
|
+
project_name: str,
|
62
|
+
tree: Tree,
|
63
|
+
root: bool = False,
|
64
|
+
) -> None:
|
65
|
+
"""Recursively build a Tree with collection contents."""
|
66
|
+
t = None
|
67
|
+
style = "bright_white on black"
|
68
|
+
|
69
|
+
project = project_client.get_projects_by_name(project_name)
|
70
|
+
if type(project) is list:
|
71
|
+
proj_guid = project[0]["elementHeader"]["guid"]
|
72
|
+
proj_props = project[0]["properties"]
|
73
|
+
|
74
|
+
proj_type = proj_props.get("typeName", "---")
|
75
|
+
proj_unique = proj_props.get("qualifiedName", "---")
|
76
|
+
proj_identifier = proj_props.get("identifier", "---")
|
77
|
+
proj_name = proj_props.get("name", "---")
|
78
|
+
proj_desc = proj_props.get("description", "---")
|
79
|
+
proj_status = proj_props.get("projectStatus", "---")
|
80
|
+
proj_priority = proj_props.get("priority", "---")
|
81
|
+
proj_start = proj_props.get("startDate", "---")[:-10]
|
82
|
+
proj_props_md = (
|
83
|
+
f"* Name: {proj_name}\n"
|
84
|
+
f"* Identifier: {proj_identifier}\n"
|
85
|
+
f"* Type: {proj_type}\n"
|
86
|
+
f"* Status: {proj_status}\n"
|
87
|
+
f"* priority: {proj_priority}\n"
|
88
|
+
f"* Start: {proj_start}\n"
|
89
|
+
f"* Description: {proj_desc}\n"
|
90
|
+
f"* GUID: {proj_guid}"
|
91
|
+
)
|
92
|
+
else:
|
93
|
+
return
|
94
|
+
|
95
|
+
team = project_client.get_project_team(proj_guid)
|
96
|
+
member_md = ""
|
97
|
+
if type(team) is list:
|
98
|
+
for member in team:
|
99
|
+
member_guid = member["member"]["guid"]
|
100
|
+
member_unique = member["member"]["uniqueName"]
|
101
|
+
member_md += f"* Member Unique Name: {member_unique}\n* Member GUID: {member_guid}"
|
102
|
+
proj_props_md += f"\n### Team Members\n {member_md}"
|
103
|
+
|
104
|
+
proj_props_out = Markdown(proj_props_md)
|
105
|
+
p = Panel.fit(proj_props_out, style=style, title=project_name)
|
106
|
+
t = tree.add(p)
|
107
|
+
|
108
|
+
linked_projects = project_client.get_linked_projects(proj_guid)
|
109
|
+
if type(linked_projects) is list:
|
110
|
+
for proj in linked_projects:
|
111
|
+
child_md = ""
|
112
|
+
child_guid = proj["elementHeader"]["guid"]
|
113
|
+
child_name = proj["properties"]["name"]
|
114
|
+
relationship = proj["relatedElement"]["relationshipHeader"]["type"][
|
115
|
+
"typeName"
|
116
|
+
]
|
117
|
+
if relationship != "ProjectHierarchy":
|
118
|
+
continue
|
119
|
+
walk_project_hierarchy(project_client, child_name, t)
|
120
|
+
|
121
|
+
else:
|
122
|
+
return t
|
123
|
+
|
124
|
+
try:
|
125
|
+
console = Console(width=width, force_terminal=not jupyter)
|
126
|
+
tree = Tree(
|
127
|
+
f"[bold bright green on black]{root}", guide_style="bold bright_blue"
|
128
|
+
)
|
129
|
+
p_client = ProjectManager(server_name, platform_url, user_id=user)
|
130
|
+
|
131
|
+
token1 = p_client.create_egeria_bearer_token(user, user_password)
|
132
|
+
|
133
|
+
walk_project_hierarchy(p_client, root, tree, root=True)
|
134
|
+
print(tree)
|
135
|
+
|
136
|
+
except (
|
137
|
+
InvalidParameterException,
|
138
|
+
PropertyServerException,
|
139
|
+
UserNotAuthorizedException,
|
140
|
+
) as e:
|
141
|
+
print_exception_response(e)
|
142
|
+
|
143
|
+
|
144
|
+
def main():
|
145
|
+
parser = argparse.ArgumentParser()
|
146
|
+
|
147
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
148
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
149
|
+
parser.add_argument("--userid", help="User Id")
|
150
|
+
parser.add_argument("--password", help="User Password")
|
151
|
+
args = parser.parse_args()
|
152
|
+
|
153
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
154
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
155
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
156
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
157
|
+
|
158
|
+
try:
|
159
|
+
root_project = Prompt.ask(
|
160
|
+
"Enter the Root Project to start from:", default="Sustainability Campaign"
|
161
|
+
)
|
162
|
+
project_structure_viewer(root_project, server, url, userid, user_pass)
|
163
|
+
except KeyboardInterrupt:
|
164
|
+
pass
|
165
|
+
|
166
|
+
|
167
|
+
if __name__ == "__main__":
|
168
|
+
main()
|
@@ -75,6 +75,7 @@ from .egeria_cat_client import EgeriaCat
|
|
75
75
|
from .egeria_tech_client import EgeriaTech
|
76
76
|
from .egeria_config_client import EgeriaConfig
|
77
77
|
from .egeria_ops_client import EgeriaOps
|
78
|
+
from .egeria_client import Egeria
|
78
79
|
|
79
80
|
#
|
80
81
|
# The following assignments were generated by the `create_tech_guid_lists.py` utility that uses the pyegeria functions
|
@@ -65,19 +65,9 @@ class EgeriaCat(
|
|
65
65
|
)
|
66
66
|
|
67
67
|
GlossaryManager.__init__(
|
68
|
-
self,
|
69
|
-
server_name,
|
70
|
-
platform_url,
|
71
|
-
token,
|
72
|
-
user_id,
|
73
|
-
user_pwd,
|
68
|
+
self, server_name, platform_url, user_id, user_pwd, token=token
|
74
69
|
)
|
75
70
|
|
76
71
|
ProjectManager.__init__(
|
77
|
-
self,
|
78
|
-
server_name,
|
79
|
-
platform_url,
|
80
|
-
token,
|
81
|
-
user_id,
|
82
|
-
user_pwd,
|
72
|
+
self, server_name, platform_url, user_id, user_pwd, token
|
83
73
|
)
|
@@ -0,0 +1,114 @@
|
|
1
|
+
"""
|
2
|
+
SPDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
This class is the overall Egeria Client covering all of the functional pyegeria classes. May not be appropriate
|
6
|
+
for all use cases..using the more role based clients is often appropriate:
|
7
|
+
* EgeriaCat - for catalog users
|
8
|
+
* EgeriaConfig - for configuring the Egeria platform and servers
|
9
|
+
* EgeriaMy - for personal actions
|
10
|
+
* EgeriaOps - for operations and administration
|
11
|
+
* EgeriaTech - for technical users such as data scientists and engineers
|
12
|
+
|
13
|
+
"""
|
14
|
+
|
15
|
+
from pyegeria import (
|
16
|
+
AssetCatalog,
|
17
|
+
CollectionManager,
|
18
|
+
EgeriaCat,
|
19
|
+
EgeriaMy,
|
20
|
+
GlossaryManager,
|
21
|
+
ProjectManager,
|
22
|
+
RuntimeManager,
|
23
|
+
ServerOps,
|
24
|
+
ActionAuthor,
|
25
|
+
AutomatedCuration,
|
26
|
+
ClassificationManager,
|
27
|
+
RegisteredInfo,
|
28
|
+
ValidMetadataManager,
|
29
|
+
FullServerConfig,
|
30
|
+
EgeriaConfig,
|
31
|
+
)
|
32
|
+
|
33
|
+
|
34
|
+
class Egeria(
|
35
|
+
AssetCatalog,
|
36
|
+
CollectionManager,
|
37
|
+
EgeriaMy,
|
38
|
+
GlossaryManager,
|
39
|
+
# GovernanceAuthor,
|
40
|
+
# PeopleOrganizer,
|
41
|
+
ProjectManager,
|
42
|
+
RuntimeManager,
|
43
|
+
ServerOps,
|
44
|
+
FullServerConfig,
|
45
|
+
ActionAuthor,
|
46
|
+
AutomatedCuration,
|
47
|
+
ClassificationManager,
|
48
|
+
RegisteredInfo,
|
49
|
+
# TemplateManager,
|
50
|
+
ValidMetadataManager,
|
51
|
+
):
|
52
|
+
"""
|
53
|
+
Client to issue Runtime status requests.
|
54
|
+
|
55
|
+
Attributes:
|
56
|
+
|
57
|
+
server_name: str
|
58
|
+
Name of the server to use.
|
59
|
+
platform_url : str
|
60
|
+
URL of the server platform to connect to
|
61
|
+
user_id : str
|
62
|
+
The identity of the user calling the method - this sets a default optionally used by the methods
|
63
|
+
when the user doesn't pass the user_id on a method call.
|
64
|
+
user_pwd: str
|
65
|
+
The password associated with the user_id. Defaults to None
|
66
|
+
token: str
|
67
|
+
An optional bearer token
|
68
|
+
|
69
|
+
Methods:
|
70
|
+
|
71
|
+
"""
|
72
|
+
|
73
|
+
def __init__(
|
74
|
+
self,
|
75
|
+
server_name: str,
|
76
|
+
platform_url: str,
|
77
|
+
user_id: str,
|
78
|
+
user_pwd: str = None,
|
79
|
+
token: str = None,
|
80
|
+
):
|
81
|
+
AssetCatalog.__init__(self, server_name, platform_url, user_id, user_pwd, token)
|
82
|
+
CollectionManager.__init__(
|
83
|
+
self, server_name, platform_url, user_id, user_pwd, token
|
84
|
+
)
|
85
|
+
EgeriaMy.__init__(self, server_name, platform_url, user_id, user_pwd, token)
|
86
|
+
|
87
|
+
GlossaryManager.__init__(
|
88
|
+
self, server_name, platform_url, user_id, user_pwd, token
|
89
|
+
)
|
90
|
+
|
91
|
+
ProjectManager.__init__(
|
92
|
+
self, server_name, platform_url, user_id, user_pwd, token
|
93
|
+
)
|
94
|
+
|
95
|
+
RuntimeManager.__init__(
|
96
|
+
self, server_name, platform_url, user_id, user_pwd, token=token
|
97
|
+
)
|
98
|
+
ServerOps.__init__(self, server_name, platform_url, user_id, user_pwd)
|
99
|
+
|
100
|
+
EgeriaConfig.__init__(self, server_name, platform_url, user_id, user_pwd)
|
101
|
+
|
102
|
+
ActionAuthor.__init__(self, server_name, platform_url, user_id, user_pwd, token)
|
103
|
+
AutomatedCuration.__init__(
|
104
|
+
self, server_name, platform_url, user_id, user_pwd, token
|
105
|
+
)
|
106
|
+
ClassificationManager.__init__(
|
107
|
+
self, server_name, platform_url, user_id, user_pwd, token
|
108
|
+
)
|
109
|
+
RegisteredInfo.__init__(
|
110
|
+
self, server_name, platform_url, user_id, user_pwd, token
|
111
|
+
)
|
112
|
+
ValidMetadataManager.__init__(
|
113
|
+
self, server_name, platform_url, user_id, user_pwd, token
|
114
|
+
)
|
@@ -42,13 +42,12 @@ class GlossaryBrowser(Client):
|
|
42
42
|
self,
|
43
43
|
server_name: str,
|
44
44
|
platform_url: str,
|
45
|
-
token: str = None,
|
46
45
|
user_id: str = None,
|
47
46
|
user_pwd: str = None,
|
48
|
-
|
47
|
+
token: str = None,
|
49
48
|
):
|
50
49
|
self.admin_command_root: str
|
51
|
-
Client.__init__(self, server_name, platform_url, user_id
|
50
|
+
Client.__init__(self, server_name, platform_url, user_id, user_pwd, token=token)
|
52
51
|
|
53
52
|
#
|
54
53
|
# Get Valid Values for Enumerations
|
@@ -48,11 +48,9 @@ class GlossaryManager(GlossaryBrowser):
|
|
48
48
|
self,
|
49
49
|
server_name: str,
|
50
50
|
platform_url: str,
|
51
|
-
token: str = None,
|
52
51
|
user_id: str = None,
|
53
52
|
user_pwd: str = None,
|
54
|
-
|
55
|
-
sync_mode: bool = True,
|
53
|
+
token: str = None,
|
56
54
|
):
|
57
55
|
self.admin_command_root: str
|
58
56
|
Client.__init__(self, server_name, platform_url, user_id=user_id, token=token)
|
@@ -40,10 +40,9 @@ class ProjectManager(Client):
|
|
40
40
|
self,
|
41
41
|
server_name: str,
|
42
42
|
platform_url: str,
|
43
|
-
token: str = None,
|
44
43
|
user_id: str = None,
|
45
44
|
user_pwd: str = None,
|
46
|
-
|
45
|
+
token: str = None,
|
47
46
|
):
|
48
47
|
self.command_base: str = f"/api/open-metadata/project-manager/metadata-elements"
|
49
48
|
Client.__init__(self, server_name, platform_url, user_id=user_id, token=token)
|
@@ -1,135 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
"""
|
3
|
-
SPDX-License-Identifier: Apache-2.0
|
4
|
-
Copyright Contributors to the ODPi Egeria project.
|
5
|
-
|
6
|
-
A simple viewer for project dependencies - provide the root and we display the dependency tree
|
7
|
-
|
8
|
-
"""
|
9
|
-
|
10
|
-
import argparse
|
11
|
-
import os
|
12
|
-
|
13
|
-
from rich import print
|
14
|
-
from rich.console import Console
|
15
|
-
from rich.markdown import Markdown
|
16
|
-
from rich.panel import Panel
|
17
|
-
from rich.prompt import Prompt
|
18
|
-
from rich.tree import Tree
|
19
|
-
|
20
|
-
from pyegeria import (ProjectManager, UserNotAuthorizedException, PropertyServerException, InvalidParameterException)
|
21
|
-
from pyegeria._exceptions import (print_exception_response, )
|
22
|
-
|
23
|
-
disable_ssl_warnings = True
|
24
|
-
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
25
|
-
EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
|
26
|
-
EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
|
27
|
-
EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
|
28
|
-
EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
|
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 project_dependency_viewer(root: str, server_name: str, platform_url: str, user: str, user_password: str,
|
39
|
-
jupyter: bool = EGERIA_JUPYTER, width: int = EGERIA_WIDTH, timeout: int = 30):
|
40
|
-
""" A simple collection viewer"""
|
41
|
-
|
42
|
-
def walk_project_hierarchy(project_client: ProjectManager, project_name: str, tree: Tree,
|
43
|
-
root: bool = False) -> None:
|
44
|
-
"""Recursively build a Tree with collection contents."""
|
45
|
-
t = None
|
46
|
-
style = "bright_white on black"
|
47
|
-
|
48
|
-
project = project_client.get_projects_by_name(project_name)
|
49
|
-
if type(project) is list:
|
50
|
-
proj_guid = project[0]['elementHeader']['guid']
|
51
|
-
proj_props = project[0]['properties']
|
52
|
-
|
53
|
-
proj_type = proj_props.get('typeName', '---')
|
54
|
-
proj_unique = proj_props.get('qualifiedName', '---')
|
55
|
-
proj_identifier = proj_props.get('identifier', '---')
|
56
|
-
proj_name = proj_props.get('name', '---')
|
57
|
-
proj_desc = proj_props.get('description', '---')
|
58
|
-
proj_status = proj_props.get('projectStatus', '---')
|
59
|
-
proj_priority = proj_props.get('priority', '---')
|
60
|
-
proj_start = proj_props.get('startDate', '---')[:-10]
|
61
|
-
proj_props_md = (f"* Name: {proj_name}\n"
|
62
|
-
f"* Identifier: {proj_identifier}\n"
|
63
|
-
f"* Type: {proj_type}\n"
|
64
|
-
f"* Status: {proj_status}\n"
|
65
|
-
f"* priority: {proj_priority}\n"
|
66
|
-
f"* Start: {proj_start}\n"
|
67
|
-
f"* Description: {proj_desc}\n"
|
68
|
-
f"* GUID: {proj_guid}")
|
69
|
-
else:
|
70
|
-
return
|
71
|
-
|
72
|
-
team = project_client.get_project_team(proj_guid)
|
73
|
-
member_md = ""
|
74
|
-
if type(team) is list:
|
75
|
-
for member in team:
|
76
|
-
member_guid = member['member']['guid']
|
77
|
-
member_unique = member['member']['uniqueName']
|
78
|
-
member_md += f"* Member Unique Name: {member_unique}\n* Member GUID: {member_guid}"
|
79
|
-
proj_props_md += f"\n### Team Members\n {member_md}"
|
80
|
-
|
81
|
-
proj_props_out = Markdown(proj_props_md)
|
82
|
-
p = Panel.fit(proj_props_out, style=style, title=project_name)
|
83
|
-
t = tree.add(p)
|
84
|
-
|
85
|
-
linked_projects = project_client.get_linked_projects(proj_guid)
|
86
|
-
if type(linked_projects) is list:
|
87
|
-
for proj in linked_projects:
|
88
|
-
child_md = ""
|
89
|
-
child_guid = proj['elementHeader']['guid']
|
90
|
-
child_name = proj['properties']['name']
|
91
|
-
relationship = proj['relatedElement']['relationshipHeader']['type']['typeName']
|
92
|
-
if relationship != 'ProjectDependency':
|
93
|
-
continue
|
94
|
-
walk_project_hierarchy(project_client, child_name, t)
|
95
|
-
|
96
|
-
else:
|
97
|
-
return t
|
98
|
-
|
99
|
-
try:
|
100
|
-
console = Console(width=width, force_terminal=not jupyter)
|
101
|
-
tree = Tree(f"[bold bright green on black]{root}", guide_style="bold bright_blue")
|
102
|
-
p_client = ProjectManager(server_name, platform_url, user_id=user)
|
103
|
-
|
104
|
-
token1 = p_client.create_egeria_bearer_token(user, user_password)
|
105
|
-
|
106
|
-
walk_project_hierarchy(p_client, root, tree, root=True)
|
107
|
-
print(tree)
|
108
|
-
|
109
|
-
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
110
|
-
print_exception_response(e)
|
111
|
-
|
112
|
-
|
113
|
-
def main():
|
114
|
-
parser = argparse.ArgumentParser()
|
115
|
-
|
116
|
-
parser.add_argument("--server", help="Name of the server to display status for")
|
117
|
-
parser.add_argument("--url", help="URL Platform to connect to")
|
118
|
-
parser.add_argument("--userid", help="User Id")
|
119
|
-
parser.add_argument("--password", help="User Password")
|
120
|
-
args = parser.parse_args()
|
121
|
-
|
122
|
-
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
123
|
-
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
124
|
-
userid = args.userid if args.userid is not None else EGERIA_USER
|
125
|
-
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
126
|
-
|
127
|
-
try:
|
128
|
-
root_project = Prompt.ask("Enter the Root Project to start from:", default="Sustainability Campaign")
|
129
|
-
project_dependency_viewer(root_project, server, url, userid, user_pass)
|
130
|
-
except (KeyboardInterrupt):
|
131
|
-
pass
|
132
|
-
|
133
|
-
|
134
|
-
if __name__ == "__main__":
|
135
|
-
main()
|
@@ -1,135 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
"""
|
3
|
-
SPDX-License-Identifier: Apache-2.0
|
4
|
-
Copyright Contributors to the ODPi Egeria project.
|
5
|
-
|
6
|
-
A simple viewer for project structure - provide the root and we display the hierarchy
|
7
|
-
|
8
|
-
"""
|
9
|
-
|
10
|
-
import argparse
|
11
|
-
import os
|
12
|
-
|
13
|
-
from rich import print
|
14
|
-
from rich.console import Console
|
15
|
-
from rich.markdown import Markdown
|
16
|
-
from rich.panel import Panel
|
17
|
-
from rich.prompt import Prompt
|
18
|
-
from rich.tree import Tree
|
19
|
-
|
20
|
-
from pyegeria import (ProjectManager, UserNotAuthorizedException, PropertyServerException, InvalidParameterException)
|
21
|
-
from pyegeria._exceptions import (print_exception_response, )
|
22
|
-
|
23
|
-
disable_ssl_warnings = True
|
24
|
-
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
25
|
-
EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
|
26
|
-
EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
|
27
|
-
EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
|
28
|
-
EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
|
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 project_structure_viewer(root: str, server_name: str, platform_url: str, user: str, user_password: str,
|
39
|
-
jupyter: bool = EGERIA_JUPYTER, width: int = EGERIA_WIDTH, timeout: int = 30):
|
40
|
-
""" A simple collection viewer"""
|
41
|
-
|
42
|
-
def walk_project_hierarchy(project_client: ProjectManager, project_name: str, tree: Tree,
|
43
|
-
root: bool = False) -> None:
|
44
|
-
"""Recursively build a Tree with collection contents."""
|
45
|
-
t = None
|
46
|
-
style = "bright_white on black"
|
47
|
-
|
48
|
-
project = project_client.get_projects_by_name(project_name)
|
49
|
-
if type(project) is list:
|
50
|
-
proj_guid = project[0]['elementHeader']['guid']
|
51
|
-
proj_props = project[0]['properties']
|
52
|
-
|
53
|
-
proj_type = proj_props.get('typeName', '---')
|
54
|
-
proj_unique = proj_props.get('qualifiedName', '---')
|
55
|
-
proj_identifier = proj_props.get('identifier', '---')
|
56
|
-
proj_name = proj_props.get('name', '---')
|
57
|
-
proj_desc = proj_props.get('description', '---')
|
58
|
-
proj_status = proj_props.get('projectStatus', '---')
|
59
|
-
proj_priority = proj_props.get('priority', '---')
|
60
|
-
proj_start = proj_props.get('startDate', '---')[:-10]
|
61
|
-
proj_props_md = (f"* Name: {proj_name}\n"
|
62
|
-
f"* Identifier: {proj_identifier}\n"
|
63
|
-
f"* Type: {proj_type}\n"
|
64
|
-
f"* Status: {proj_status}\n"
|
65
|
-
f"* priority: {proj_priority}\n"
|
66
|
-
f"* Start: {proj_start}\n"
|
67
|
-
f"* Description: {proj_desc}\n"
|
68
|
-
f"* GUID: {proj_guid}")
|
69
|
-
else:
|
70
|
-
return
|
71
|
-
|
72
|
-
team = project_client.get_project_team(proj_guid)
|
73
|
-
member_md = ""
|
74
|
-
if type(team) is list:
|
75
|
-
for member in team:
|
76
|
-
member_guid = member['member']['guid']
|
77
|
-
member_unique = member['member']['uniqueName']
|
78
|
-
member_md += f"* Member Unique Name: {member_unique}\n* Member GUID: {member_guid}"
|
79
|
-
proj_props_md += f"\n### Team Members\n {member_md}"
|
80
|
-
|
81
|
-
proj_props_out = Markdown(proj_props_md)
|
82
|
-
p = Panel.fit(proj_props_out, style=style, title=project_name)
|
83
|
-
t = tree.add(p)
|
84
|
-
|
85
|
-
linked_projects = project_client.get_linked_projects(proj_guid)
|
86
|
-
if type(linked_projects) is list:
|
87
|
-
for proj in linked_projects:
|
88
|
-
child_md = ""
|
89
|
-
child_guid = proj['elementHeader']['guid']
|
90
|
-
child_name = proj['properties']['name']
|
91
|
-
relationship = proj['relatedElement']['relationshipHeader']['type']['typeName']
|
92
|
-
if relationship != 'ProjectHierarchy':
|
93
|
-
continue
|
94
|
-
walk_project_hierarchy(project_client, child_name, t)
|
95
|
-
|
96
|
-
else:
|
97
|
-
return t
|
98
|
-
|
99
|
-
try:
|
100
|
-
console = Console(width=width, force_terminal=not jupyter)
|
101
|
-
tree = Tree(f"[bold bright green on black]{root}", guide_style="bold bright_blue")
|
102
|
-
p_client = ProjectManager(server_name, platform_url, user_id=user)
|
103
|
-
|
104
|
-
token1 = p_client.create_egeria_bearer_token(user, user_password)
|
105
|
-
|
106
|
-
walk_project_hierarchy(p_client, root, tree, root=True)
|
107
|
-
print(tree)
|
108
|
-
|
109
|
-
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
110
|
-
print_exception_response(e)
|
111
|
-
|
112
|
-
|
113
|
-
def main():
|
114
|
-
parser = argparse.ArgumentParser()
|
115
|
-
|
116
|
-
parser.add_argument("--server", help="Name of the server to display status for")
|
117
|
-
parser.add_argument("--url", help="URL Platform to connect to")
|
118
|
-
parser.add_argument("--userid", help="User Id")
|
119
|
-
parser.add_argument("--password", help="User Password")
|
120
|
-
args = parser.parse_args()
|
121
|
-
|
122
|
-
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
123
|
-
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
124
|
-
userid = args.userid if args.userid is not None else EGERIA_USER
|
125
|
-
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
126
|
-
|
127
|
-
try:
|
128
|
-
root_project = Prompt.ask("Enter the Root Project to start from:", default="Sustainability Campaign")
|
129
|
-
project_structure_viewer(root_project, server, url, userid, user_pass)
|
130
|
-
except (KeyboardInterrupt):
|
131
|
-
pass
|
132
|
-
|
133
|
-
|
134
|
-
if __name__ == "__main__":
|
135
|
-
main()
|
File without changes
|
File without changes
|
File without changes
|
{pyegeria-0.8.3 → pyegeria-0.8.4.1}/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
|
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
|