pyegeria 0.6.5__tar.gz → 0.6.6__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.6.5 → pyegeria-0.6.6}/PKG-INFO +1 -1
- pyegeria-0.6.6/examples/widgets/cat/get_project_structure.py +165 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/my_profile_omvs.py +6 -5
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/project_manager_omvs.py +1 -1
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyproject.toml +1 -1
- pyegeria-0.6.5/examples/widgets/cat/get_project_structure.py +0 -109
- {pyegeria-0.6.5 → pyegeria-0.6.6}/LICENSE +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/README.md +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/doc_samples/Create_Collection_Sample.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/doc_samples/Create_Sustainability_Collection_Sample.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cat/README.md +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cat/__init__.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cat/get_asset_graph.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cat/get_collection.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cat/get_tech_type_elements.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cat/get_tech_type_template.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cat/list_assets.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cat/list_cert_types.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cat/list_glossary.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cat/list_projects.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cat/list_tech_types.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cat/list_todos.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cli/__init__.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cli/egeria.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cli/egeria_cat.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cli/egeria_my.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cli/egeria_ops.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cli/egeria_tech.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/cli/ops_config.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/my/README.md +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/my/__init__.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/my/list_my_profile.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/my/list_my_roles.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/my/monitor_my_todos.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/my/monitor_open_todos.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/my/my_profile_actions.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/README.md +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/__init__.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/engine_actions.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/integration_daemon_actions.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/list_catalog_targets.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/load_archive.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/monitor_asset_events.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/monitor_coco_status.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/monitor_engine_activity.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/monitor_gov_eng_status.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/monitor_integ_daemon_status.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/monitor_platform_status.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/monitor_server_list.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/monitor_server_status.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/refresh_integration_daemon.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/ops/restart_integration_daemon.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/tech/README.md +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/tech/__init__.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/tech/get_guid_info.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/tech/get_tech_details.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/tech/list_asset_types.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/tech/list_registered_services.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/tech/list_relationship_types.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/tech/list_tech_templates.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/examples/widgets/tech/list_valid_metadata_values.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/Xloaded_resources_omvs.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/__init__.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/_client.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/_deprecated_gov_engine.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/_exceptions.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/_globals.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/_validators.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/action_author_omvs.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/asset_catalog_omvs.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/automated_curation_omvs.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/classification_manager_omvs.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/collection_manager_omvs.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/core_omag_server_config.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/create_tech_guid_lists.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/feedback_manager_omvs.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/full_omag_server_config.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/glossary_browser_omvs.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/glossary_manager_omvs.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/platform_services.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/registered_info.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/runtime_manager_omvs.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/server_operations.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/utils.py +0 -0
- {pyegeria-0.6.5 → pyegeria-0.6.6}/pyegeria/valid_metadata_omvs.py +0 -0
@@ -0,0 +1,165 @@
|
|
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 collections - provide the root and we display the hierarchy
|
7
|
+
|
8
|
+
"""
|
9
|
+
|
10
|
+
import argparse
|
11
|
+
import os
|
12
|
+
from rich import print
|
13
|
+
from rich.panel import Panel
|
14
|
+
from rich.prompt import Prompt
|
15
|
+
from rich.text import Text
|
16
|
+
from rich.tree import Tree
|
17
|
+
from rich.markdown import Markdown
|
18
|
+
from rich.console import Console
|
19
|
+
|
20
|
+
from pyegeria import (ProjectManager, MyProfile, UserNotAuthorizedException, PropertyServerException,
|
21
|
+
InvalidParameterException)
|
22
|
+
from pyegeria._exceptions import (
|
23
|
+
print_exception_response,
|
24
|
+
)
|
25
|
+
|
26
|
+
disable_ssl_warnings = True
|
27
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
28
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
|
29
|
+
EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
|
30
|
+
EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
|
31
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
|
32
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
|
33
|
+
EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
|
34
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
|
35
|
+
EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
|
36
|
+
EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
|
37
|
+
EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
|
38
|
+
EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
|
39
|
+
|
40
|
+
def project_structure_viewer(root: str, server_name: str, platform_url: str, user: str, user_password: str,
|
41
|
+
jupyter:bool=EGERIA_JUPYTER, width:int = EGERIA_WIDTH):
|
42
|
+
""" A simple collection viewer"""
|
43
|
+
def walk_project_hierarchy(project_client: ProjectManager, project_name: str, tree: Tree, 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(proj_props_out, style = style, title=project_name)
|
83
|
+
t = tree.add(p)
|
84
|
+
|
85
|
+
|
86
|
+
linked_projects = project_client.get_linked_projects(proj_guid)
|
87
|
+
if type(linked_projects) is list:
|
88
|
+
for proj in linked_projects:
|
89
|
+
child_md = ""
|
90
|
+
child_guid = proj['elementHeader']['guid']
|
91
|
+
child_name = proj['properties']['name']
|
92
|
+
# child_props = proj['properties']
|
93
|
+
# for key in child_props.keys():
|
94
|
+
# child_md += f"* {key}: {child_props[key]}\n"
|
95
|
+
# child_md += f"* GUID: {child_guid}"
|
96
|
+
walk_project_hierarchy(project_client, child_name, t)
|
97
|
+
|
98
|
+
else:
|
99
|
+
return t
|
100
|
+
# tt= tree.add(f"[bold magenta on black]No projects match {root_project_name}")
|
101
|
+
|
102
|
+
#
|
103
|
+
# branch = tt.add(f"[bold magenta on black]Members", style=style, guide_style=style)
|
104
|
+
# walk_collection_hierarchy(collection_client, member['qualifiedName'], branch),
|
105
|
+
|
106
|
+
# members = project_client.get_member_list(root_project_name)
|
107
|
+
# if members:
|
108
|
+
# for member in members:
|
109
|
+
# style = "bold white on black"
|
110
|
+
# text_collection_name = Text(f"[bold white on black]Name: {member['name']}", style=style)
|
111
|
+
# text_qualified_name = Text(f"* QualifiedName: {member['qualifiedName']}")
|
112
|
+
# text_guid = Text(f"* GUID: {member['guid']}", "green")
|
113
|
+
# text_collection_type = Text(f"* Collection Type: {member['collectionType']}")
|
114
|
+
# text_description = Text(f"* Description: {member['description']}")
|
115
|
+
# p = Panel.fit(f"{text_collection_name}[green]\n{text_qualified_name}\n{text_guid}\n"
|
116
|
+
# f"{text_collection_type}\n{text_description}")
|
117
|
+
# tt = tree.add(p, style=style)
|
118
|
+
#
|
119
|
+
#
|
120
|
+
# linked_projects = project_client.get_linked_projects()
|
121
|
+
# if type(children) is list:
|
122
|
+
# branch = tt.add(f"[bold magenta on black]Members", style=style, guide_style=style)
|
123
|
+
# walk_collection_hierarchy(collection_client, member['qualifiedName'], branch),
|
124
|
+
# else:
|
125
|
+
# tt = tree.add(f"[bold magenta on black]No collections match {root_collection_name}")
|
126
|
+
try:
|
127
|
+
console = Console(width=EGERIA_WIDTH)
|
128
|
+
tree = Tree(f"[bold bright green on black]{root}",guide_style="bold bright_blue")
|
129
|
+
p_client = ProjectManager(server_name, platform_url,
|
130
|
+
user_id=user)
|
131
|
+
|
132
|
+
token1= p_client.create_egeria_bearer_token(user, user_password)
|
133
|
+
|
134
|
+
walk_project_hierarchy(p_client,root, tree, root = True)
|
135
|
+
print(tree)
|
136
|
+
|
137
|
+
except (
|
138
|
+
InvalidParameterException,
|
139
|
+
PropertyServerException,
|
140
|
+
UserNotAuthorizedException
|
141
|
+
) as e:
|
142
|
+
print_exception_response(e)
|
143
|
+
|
144
|
+
|
145
|
+
def main():
|
146
|
+
parser = argparse.ArgumentParser()
|
147
|
+
|
148
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
149
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
150
|
+
parser.add_argument("--userid", help="User Id")
|
151
|
+
parser.add_argument("--password", help="User Password")
|
152
|
+
args = parser.parse_args()
|
153
|
+
|
154
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
155
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
156
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
157
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
158
|
+
|
159
|
+
try:
|
160
|
+
root_project = Prompt.ask("Enter the Root Project to start from:", default="Sustainability Campaign")
|
161
|
+
project_structure_viewer(root_project, server, url, userid, user_pass)
|
162
|
+
except (KeyboardInterrupt):
|
163
|
+
pass
|
164
|
+
if __name__ == "__main__":
|
165
|
+
main()
|
@@ -43,7 +43,8 @@ class MyProfile(Client):
|
|
43
43
|
sync_mode: bool = True
|
44
44
|
):
|
45
45
|
|
46
|
-
Client.__init__(self, server_name, platform_url, user_id=user_id,
|
46
|
+
Client.__init__(self, server_name, platform_url, user_id=user_id, user_pwd=user_pwd,
|
47
|
+
token=token, async_mode=sync_mode)
|
47
48
|
self.my_profile_command_root: str = f"{platform_url}/servers"
|
48
49
|
|
49
50
|
#
|
@@ -818,7 +819,7 @@ class MyProfile(Client):
|
|
818
819
|
ends_with, ignore_case, start_from, page_size))
|
819
820
|
return response
|
820
821
|
|
821
|
-
async def _async_get_to_dos_by_type(self, todo_type: str,
|
822
|
+
async def _async_get_to_dos_by_type(self, todo_type: str, server_name: str = None, status: str = "OPEN",
|
822
823
|
start_from: int = 0, page_size: int = 100) -> list | str:
|
823
824
|
""" Get To-Do items by type. Async version
|
824
825
|
Parameters
|
@@ -861,9 +862,9 @@ class MyProfile(Client):
|
|
861
862
|
f"{todo_type}?startFrom={start_from}&pageSize={page_size}")
|
862
863
|
|
863
864
|
response = await self._async_make_request("POST", url, body)
|
864
|
-
return response.json().get("elements","No ToDos found")
|
865
|
+
return response.json().get("elements", "No ToDos found")
|
865
866
|
|
866
|
-
def get_to_dos_by_type(self, todo_type: str,
|
867
|
+
def get_to_dos_by_type(self, todo_type: str, server_name: str = None, status: str = "OPEN",
|
867
868
|
start_from: int = 0, page_size: int = 100) -> list | str:
|
868
869
|
""" Get To-Do items by type.
|
869
870
|
Parameters
|
@@ -894,7 +895,7 @@ class MyProfile(Client):
|
|
894
895
|
The principle specified by the user_id does not have authorization for the requested action
|
895
896
|
"""
|
896
897
|
loop = asyncio.get_event_loop()
|
897
|
-
response = loop.run_until_complete(self._async_get_to_dos_by_type(todo_type,
|
898
|
+
response = loop.run_until_complete(self._async_get_to_dos_by_type(todo_type, server_name, status,
|
898
899
|
start_from, page_size))
|
899
900
|
return response
|
900
901
|
|
@@ -104,7 +104,7 @@ class ProjectManager(Client):
|
|
104
104
|
f"metadata-elements/{parent_guid}/projects?startFrom={start_from}&pageSize={page_size}")
|
105
105
|
|
106
106
|
resp = await self._async_make_request("POST", url, body_s)
|
107
|
-
return resp.json()
|
107
|
+
return resp.json().get('elements','No linked projects found')
|
108
108
|
|
109
109
|
def get_linked_projects(self, parent_guid: str, project_status: str = None, effective_time: str = None,
|
110
110
|
server_name: str = None, start_from: int = 0, page_size: int = None) -> list | str:
|
@@ -1,109 +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 collections - provide the root and we display the hierarchy
|
7
|
-
|
8
|
-
"""
|
9
|
-
|
10
|
-
import argparse
|
11
|
-
import os
|
12
|
-
from rich import print
|
13
|
-
from rich.panel import Panel
|
14
|
-
from rich.prompt import Prompt
|
15
|
-
from rich.text import Text
|
16
|
-
from rich.tree import Tree
|
17
|
-
|
18
|
-
from pyegeria import ProjectManager, UserNotAuthorizedException, PropertyServerException, InvalidParameterException
|
19
|
-
from pyegeria._exceptions import (
|
20
|
-
print_exception_response,
|
21
|
-
)
|
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
|
-
def project_structure_viewer(root: str, server_name: str, platform_url: str, user: str, user_password: str,
|
38
|
-
jupyter:bool=EGERIA_JUPYTER, width:int = EGERIA_WIDTH):
|
39
|
-
""" A simple collection viewer"""
|
40
|
-
def walk_project_hierarchy(project_client: ProjectManager, root_project_name: str, tree: Tree) -> None:
|
41
|
-
"""Recursively build a Tree with collection contents."""
|
42
|
-
project = project_client.get_projects_by_name(root_project_name)
|
43
|
-
if type(project) is list:
|
44
|
-
root_guid = project['elementHeader']['guid']
|
45
|
-
proj_props = project['properties']
|
46
|
-
proj_props_md = ""
|
47
|
-
for key in proj_props.keys():
|
48
|
-
proj_props_md += f"* {key}: {proj_props[key]}\n"
|
49
|
-
|
50
|
-
t = tree.add()
|
51
|
-
|
52
|
-
|
53
|
-
members = project_client.get_member_list(root_collection_name)
|
54
|
-
if members:
|
55
|
-
for member in members:
|
56
|
-
style = "bold white on black"
|
57
|
-
text_collection_name = Text(f"[bold white on black]Name: {member['name']}", style=style)
|
58
|
-
text_qualified_name = Text(f"* QualifiedName: {member['qualifiedName']}")
|
59
|
-
text_guid = Text(f"* GUID: {member['guid']}", "green")
|
60
|
-
text_collection_type = Text(f"* Collection Type: {member['collectionType']}")
|
61
|
-
text_description = Text(f"* Description: {member['description']}")
|
62
|
-
p = Panel.fit(f"{text_collection_name}[green]\n{text_qualified_name}\n{text_guid}\n"
|
63
|
-
f"{text_collection_type}\n{text_description}")
|
64
|
-
tt = tree.add(p, style=style)
|
65
|
-
|
66
|
-
children = collection_client.get_collection_members(member['guid'])
|
67
|
-
if type(children) is list:
|
68
|
-
branch = tt.add(f"[bold magenta on black]Members", style=style, guide_style=style)
|
69
|
-
walk_collection_hierarchy(collection_client, member['qualifiedName'], branch),
|
70
|
-
else:
|
71
|
-
tt = tree.add(f"[bold magenta on black]No collections match {root_collection_name}")
|
72
|
-
try:
|
73
|
-
tree = Tree(f"[bold bright green on black]{root}",guide_style="bold bright_blue")
|
74
|
-
p_client = ProjectManager(server_name, platform_url,
|
75
|
-
user_id=user)
|
76
|
-
|
77
|
-
token = p_client.create_egeria_bearer_token(user, user_password)
|
78
|
-
walk_project_hierarchy(p_client, root, tree)
|
79
|
-
print(tree)
|
80
|
-
|
81
|
-
except (
|
82
|
-
InvalidParameterException,
|
83
|
-
PropertyServerException,
|
84
|
-
UserNotAuthorizedException
|
85
|
-
) as e:
|
86
|
-
print_exception_response(e)
|
87
|
-
|
88
|
-
|
89
|
-
def main():
|
90
|
-
parser = argparse.ArgumentParser()
|
91
|
-
|
92
|
-
parser.add_argument("--server", help="Name of the server to display status for")
|
93
|
-
parser.add_argument("--url", help="URL Platform to connect to")
|
94
|
-
parser.add_argument("--userid", help="User Id")
|
95
|
-
parser.add_argument("--password", help="User Password")
|
96
|
-
args = parser.parse_args()
|
97
|
-
|
98
|
-
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
99
|
-
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
100
|
-
userid = args.userid if args.userid is not None else EGERIA_USER
|
101
|
-
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
102
|
-
|
103
|
-
try:
|
104
|
-
root_project = Prompt.ask("Enter the Root Project to start from:", default="Sustainability Campaign")
|
105
|
-
project_structure_viewer(root_project, server, url, userid, user_pass)
|
106
|
-
except (KeyboardInterrupt):
|
107
|
-
pass
|
108
|
-
if __name__ == "__main__":
|
109
|
-
main()
|
File without changes
|
File without changes
|
File without changes
|
{pyegeria-0.6.5 → pyegeria-0.6.6}/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
|