pyegeria 0.8.2__tar.gz → 0.8.4__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.2 → pyegeria-0.8.4}/PKG-INFO +1 -1
- pyegeria-0.8.4/examples/widgets/cat/get_project_dependencies.py +168 -0
- pyegeria-0.8.4/examples/widgets/cat/get_project_structure.py +168 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/list_todos.py +59 -33
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/my/list_my_profile.py +61 -36
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/my/list_my_roles.py +40 -23
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/my/monitor_my_todos.py +45 -23
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/my/monitor_open_todos.py +36 -22
- pyegeria-0.8.4/examples/widgets/my/todo_actions.py +249 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/__init__.py +1 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/_client.py +1 -9
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/egeria_cat_client.py +2 -12
- pyegeria-0.8.4/pyegeria/egeria_client.py +108 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/egeria_my_client.py +1 -1
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/egeria_ops_client.py +6 -2
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/glossary_browser_omvs.py +2 -3
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/glossary_manager_omvs.py +1 -3
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/project_manager_omvs.py +1 -2
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyproject.toml +1 -1
- pyegeria-0.8.2/examples/widgets/cat/get_project_dependencies.py +0 -135
- pyegeria-0.8.2/examples/widgets/cat/get_project_structure.py +0 -135
- pyegeria-0.8.2/examples/widgets/my/todo_actions.py +0 -188
- {pyegeria-0.8.2 → pyegeria-0.8.4}/LICENSE +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/README.md +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/doc_samples/Create_Collection_Sample.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/doc_samples/Create_Sustainability_Collection_Sample.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/README.md +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/__init__.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/get_asset_graph.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/get_collection.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/get_tech_type_elements.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/get_tech_type_template.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/list_archives.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/list_assets.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/list_cert_types.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/list_glossary.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/list_projects.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/list_relationships.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/list_tech_types.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cat/list_user_ids.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cli/__init__.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cli/egeria.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cli/egeria_cat.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cli/egeria_my.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cli/egeria_ops.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cli/egeria_tech.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/cli/ops_config.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/my/README.md +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/my/__init__.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/my/my_profile_actions.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/README.md +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/__init__.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/engine_actions.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/integration_daemon_actions.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/list_catalog_targets.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/load_archive.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/monitor_asset_events.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/monitor_coco_status.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/monitor_engine_activity.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/monitor_engine_activity_c.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/monitor_gov_eng_status.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/monitor_integ_daemon_status.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/monitor_platform_status.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/monitor_server_list.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/monitor_server_status.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/refresh_integration_daemon.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/ops/restart_integration_daemon.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/README.md +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/__init__.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/get_element_info.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/get_guid_info.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/get_tech_details.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/list_asset_types.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/list_elements.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/list_elements_x.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/list_registered_services.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/list_related_specification.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/list_relationship_types.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/list_tech_templates.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/list_valid_metadata_values.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/examples/widgets/tech/x_list_related_elements.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/Xloaded_resources_omvs.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/_deprecated_gov_engine.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/_exceptions.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/_globals.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/_validators.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/action_author_omvs.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/asset_catalog_omvs.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/automated_curation_omvs.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/classification_manager_omvs.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/collection_manager_omvs.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/core_omag_server_config.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/create_tech_guid_lists.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/egeria_config_client.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/egeria_tech_client.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/feedback_manager_omvs.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/full_omag_server_config.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/mermaid_utilities.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/my_profile_omvs.py +1 -1
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/platform_services.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/registered_info.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/runtime_manager_omvs.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/server_operations.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/pyegeria/utils.py +0 -0
- {pyegeria-0.8.2 → pyegeria-0.8.4}/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()
|
@@ -28,26 +28,38 @@ from pyegeria import (
|
|
28
28
|
from pyegeria.my_profile_omvs import MyProfile
|
29
29
|
|
30
30
|
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
31
|
-
EGERIA_KAFKA_ENDPOINT = os.environ.get(
|
32
|
-
EGERIA_PLATFORM_URL = os.environ.get(
|
33
|
-
EGERIA_VIEW_SERVER = os.environ.get(
|
34
|
-
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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(
|
35
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
36
|
+
)
|
37
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
38
|
+
EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
|
39
|
+
"EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
|
40
|
+
)
|
41
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
42
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
43
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
44
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
45
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
46
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
47
|
+
|
48
|
+
|
49
|
+
def display_to_dos(
|
50
|
+
search_string: str,
|
51
|
+
status_filter: str,
|
52
|
+
server: str,
|
53
|
+
url: str,
|
54
|
+
username: str,
|
55
|
+
user_pass: str,
|
56
|
+
jupyter: bool = EGERIA_JUPYTER,
|
57
|
+
width: int = EGERIA_WIDTH,
|
58
|
+
):
|
47
59
|
m_client = MyProfile(server, url, user_id=username)
|
48
60
|
token = m_client.create_egeria_bearer_token(username, user_pass)
|
49
61
|
|
50
|
-
def generate_table(search_string:str =
|
62
|
+
def generate_table(search_string: str = "*") -> Table:
|
51
63
|
"""Make a new table."""
|
52
64
|
table = Table(
|
53
65
|
title=f"Open ToDos for Platform {url} @ {time.asctime()}",
|
@@ -56,7 +68,7 @@ def display_to_dos(search_string: str, status_filter: str, server: str, url: str
|
|
56
68
|
show_lines=True,
|
57
69
|
box=box.ROUNDED,
|
58
70
|
caption=f"ToDos for Server '{server}' @ Platform - {url}",
|
59
|
-
expand=True
|
71
|
+
expand=True,
|
60
72
|
)
|
61
73
|
|
62
74
|
table.add_column("Name")
|
@@ -70,7 +82,7 @@ def display_to_dos(search_string: str, status_filter: str, server: str, url: str
|
|
70
82
|
table.add_column("Sponsor")
|
71
83
|
table.add_column("Assigned")
|
72
84
|
|
73
|
-
todo_items = m_client.find_to_do(search_string,status
|
85
|
+
todo_items = m_client.find_to_do(search_string, status=status_filter)
|
74
86
|
|
75
87
|
if type(todo_items) is str:
|
76
88
|
name = " "
|
@@ -82,10 +94,10 @@ def display_to_dos(search_string: str, status_filter: str, server: str, url: str
|
|
82
94
|
|
83
95
|
status = " "
|
84
96
|
sponsor = " "
|
85
|
-
assigned_out =
|
97
|
+
assigned_out = ""
|
86
98
|
else:
|
87
99
|
for item in todo_items:
|
88
|
-
guid = item[
|
100
|
+
guid = item["elementHeader"]["guid"]
|
89
101
|
props = item["properties"]
|
90
102
|
name = props["name"]
|
91
103
|
type_name = props.get("toDoType", " ")
|
@@ -93,12 +105,12 @@ def display_to_dos(search_string: str, status_filter: str, server: str, url: str
|
|
93
105
|
priority = str(props.get("priority", " "))
|
94
106
|
due = props.get("dueTime", " ")[:-19]
|
95
107
|
completed = props.get("completionTime", " ")[:-10]
|
96
|
-
status = props.get("toDoStatus",
|
108
|
+
status = props.get("toDoStatus", "---")
|
97
109
|
|
98
|
-
assigned_out =
|
99
|
-
assigned_actors = item.get("assignedActors",
|
110
|
+
assigned_out = ""
|
111
|
+
assigned_actors = item.get("assignedActors", "---")
|
100
112
|
if type(assigned_actors) is list:
|
101
|
-
assigned_md =
|
113
|
+
assigned_md = ""
|
102
114
|
for actor in assigned_actors:
|
103
115
|
assigned_md += f"* {actor['uniqueName'].split(',')[0]}\n"
|
104
116
|
assigned_out = Markdown(assigned_md)
|
@@ -112,7 +124,16 @@ def display_to_dos(search_string: str, status_filter: str, server: str, url: str
|
|
112
124
|
status = f"[red]{status}"
|
113
125
|
|
114
126
|
table.add_row(
|
115
|
-
name,
|
127
|
+
name,
|
128
|
+
type_name,
|
129
|
+
guid,
|
130
|
+
created,
|
131
|
+
priority,
|
132
|
+
due,
|
133
|
+
completed,
|
134
|
+
status,
|
135
|
+
sponsor,
|
136
|
+
assigned_out,
|
116
137
|
)
|
117
138
|
|
118
139
|
m_client.close_session()
|
@@ -125,11 +146,13 @@ def display_to_dos(search_string: str, status_filter: str, server: str, url: str
|
|
125
146
|
# live.update(generate_table())
|
126
147
|
console = Console(width=width, force_terminal=not jupyter)
|
127
148
|
with console.pager():
|
128
|
-
|
129
149
|
console.print(generate_table(search_string))
|
130
150
|
|
131
|
-
|
132
|
-
|
151
|
+
except (
|
152
|
+
InvalidParameterException,
|
153
|
+
PropertyServerException,
|
154
|
+
UserNotAuthorizedException,
|
155
|
+
) as e:
|
133
156
|
print_exception_response(e)
|
134
157
|
except KeyboardInterrupt:
|
135
158
|
pass
|
@@ -152,12 +175,15 @@ def main():
|
|
152
175
|
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
153
176
|
try:
|
154
177
|
search_string = Prompt.ask("Enter the ToDo you are searching for", default="*")
|
155
|
-
status_filter = Prompt.ask(
|
156
|
-
|
157
|
-
|
178
|
+
status_filter = Prompt.ask(
|
179
|
+
"Enter an optional status filter ['OPEN','IN_PROGRESS','WAITING','COMPLETE',"
|
180
|
+
"'ABANDONED', 'None']",
|
181
|
+
default=None,
|
182
|
+
)
|
183
|
+
display_to_dos(search_string, status_filter, server, url, userid, user_pass)
|
158
184
|
except KeyboardInterrupt:
|
159
185
|
pass
|
160
186
|
|
161
187
|
|
162
188
|
if __name__ == "__main__":
|
163
|
-
main()
|
189
|
+
main()
|
@@ -30,22 +30,32 @@ from pyegeria.my_profile_omvs import MyProfile
|
|
30
30
|
|
31
31
|
disable_ssl_warnings = True
|
32
32
|
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
33
|
-
EGERIA_KAFKA_ENDPOINT = os.environ.get(
|
34
|
-
EGERIA_PLATFORM_URL = os.environ.get(
|
35
|
-
EGERIA_VIEW_SERVER = os.environ.get(
|
36
|
-
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
33
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
34
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
35
|
+
EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
|
36
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
37
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
38
|
+
)
|
39
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
40
|
+
EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
|
41
|
+
"EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
|
42
|
+
)
|
43
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
44
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
45
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
46
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
47
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
48
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "150"))
|
49
|
+
|
50
|
+
|
51
|
+
def display_my_profile(
|
52
|
+
server: str,
|
53
|
+
url: str,
|
54
|
+
username: str,
|
55
|
+
user_pass: str,
|
56
|
+
jupyter: bool = EGERIA_JUPYTER,
|
57
|
+
width: int = EGERIA_WIDTH,
|
58
|
+
):
|
49
59
|
try:
|
50
60
|
m_client = MyProfile(server, url, user_id=username, user_pwd=user_pass)
|
51
61
|
token = m_client.create_egeria_bearer_token(username, user_pass)
|
@@ -56,10 +66,14 @@ def display_my_profile(server: str, url: str, username: str, user_pass:str,
|
|
56
66
|
|
57
67
|
console = Console(width=width, force_terminal=not jupyter, soft_wrap=True)
|
58
68
|
|
59
|
-
profile_props = my_profiles.get(
|
69
|
+
profile_props = my_profiles.get("profileProperties", "---")
|
60
70
|
name = profile_props["fullName"]
|
61
|
-
tree = Tree(
|
62
|
-
|
71
|
+
tree = Tree(
|
72
|
+
Panel(f"Profile of {name}", title="Personal Profile"),
|
73
|
+
expanded=True,
|
74
|
+
style="bright_white on black",
|
75
|
+
guide_style="bold bright_blue",
|
76
|
+
)
|
63
77
|
|
64
78
|
profile_props_md = f"\n* GUID: {my_profiles['elementHeader']['guid']}\n"
|
65
79
|
if type(profile_props) is dict:
|
@@ -67,32 +81,39 @@ def display_my_profile(server: str, url: str, username: str, user_pass:str,
|
|
67
81
|
if type(profile_props[key]) is str:
|
68
82
|
profile_props_md += f"* {key}: {profile_props[key]}\n"
|
69
83
|
elif type(profile_props[key]) is dict:
|
70
|
-
p_md =
|
84
|
+
p_md = "\n* Additional Details:\n"
|
71
85
|
for k in profile_props[key].keys():
|
72
86
|
p_md += f"\t* {k}: {profile_props[key][k]}\n"
|
73
87
|
profile_props_md += p_md
|
74
|
-
t1 = tree.add(
|
75
|
-
|
88
|
+
t1 = tree.add(
|
89
|
+
Panel(
|
90
|
+
Markdown(profile_props_md), title="Profile Properties", expand=False
|
91
|
+
)
|
92
|
+
)
|
76
93
|
|
77
|
-
id_list_md=""
|
94
|
+
id_list_md = ""
|
78
95
|
for identities in my_profiles["userIdentities"]:
|
79
96
|
id_list_md += f"* {identities['userIdentity']['properties']['userId']}\n"
|
80
97
|
t2 = tree.add(Panel(Markdown(id_list_md), title="Identities", expand=False))
|
81
98
|
|
82
|
-
contact_methods = my_profiles[
|
99
|
+
contact_methods = my_profiles["contactMethods"]
|
83
100
|
for method in contact_methods:
|
84
|
-
contact = method[
|
101
|
+
contact = method["properties"]
|
85
102
|
contact_methods_md = ""
|
86
103
|
for key in contact.keys():
|
87
104
|
contact_methods_md += f"* {key}: {contact[key]}\n"
|
88
|
-
t3 = tree.add(
|
105
|
+
t3 = tree.add(
|
106
|
+
Panel(
|
107
|
+
Markdown(contact_methods_md), title="Contact Methods", expand=False
|
108
|
+
)
|
109
|
+
)
|
89
110
|
|
90
111
|
my_roles = my_profiles["roles"]
|
91
112
|
table = Table(
|
92
|
-
title
|
93
|
-
show_lines=
|
113
|
+
title=f" Roles of {name}",
|
114
|
+
show_lines=True,
|
94
115
|
box=box.ROUNDED,
|
95
|
-
expand=
|
116
|
+
expand=True,
|
96
117
|
)
|
97
118
|
table.add_column("Role Type")
|
98
119
|
table.add_column("Role")
|
@@ -100,20 +121,23 @@ def display_my_profile(server: str, url: str, username: str, user_pass:str,
|
|
100
121
|
for a_role in my_roles:
|
101
122
|
my_role_props = a_role["properties"]
|
102
123
|
role_type = my_role_props["typeName"]
|
103
|
-
role = my_role_props.get("title"," ")
|
124
|
+
role = my_role_props.get("title", " ")
|
104
125
|
role_guid = a_role["elementHeader"]["guid"]
|
105
|
-
table.add_row(
|
106
|
-
|
107
|
-
)
|
108
|
-
t4 = tree.add(Panel(table, title="Roles", expand=False ),expanded=True)
|
126
|
+
table.add_row(role_type, role, role_guid)
|
127
|
+
t4 = tree.add(Panel(table, title="Roles", expand=False), expanded=True)
|
109
128
|
|
110
129
|
print(tree)
|
111
130
|
|
112
|
-
except (
|
131
|
+
except (
|
132
|
+
InvalidParameterException,
|
133
|
+
PropertyServerException,
|
134
|
+
UserNotAuthorizedException,
|
135
|
+
) as e:
|
113
136
|
print_exception_response(e)
|
114
137
|
finally:
|
115
138
|
m_client.close_session()
|
116
139
|
|
140
|
+
|
117
141
|
def main():
|
118
142
|
parser = argparse.ArgumentParser()
|
119
143
|
parser.add_argument("--server", help="Name of the server to display status for")
|
@@ -130,5 +154,6 @@ def main():
|
|
130
154
|
|
131
155
|
display_my_profile(server, url, userid, user_pass)
|
132
156
|
|
157
|
+
|
133
158
|
if __name__ == "__main__":
|
134
|
-
main()
|
159
|
+
main()
|