pyegeria 0.6.4__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.4 → pyegeria-0.6.6}/PKG-INFO +1 -1
- pyegeria-0.6.6/examples/widgets/cat/get_project_structure.py +165 -0
- pyegeria-0.6.6/examples/widgets/cat/list_cert_types.py +176 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cat/list_projects.py +17 -3
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/my_profile_omvs.py +6 -5
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/project_manager_omvs.py +1 -1
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyproject.toml +3 -1
- {pyegeria-0.6.4 → pyegeria-0.6.6}/LICENSE +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/README.md +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/doc_samples/Create_Collection_Sample.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/doc_samples/Create_Sustainability_Collection_Sample.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cat/README.md +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cat/__init__.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cat/get_asset_graph.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cat/get_collection.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cat/get_tech_type_elements.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cat/get_tech_type_template.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cat/list_assets.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cat/list_glossary.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cat/list_tech_types.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cat/list_todos.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cli/__init__.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cli/egeria.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cli/egeria_cat.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cli/egeria_my.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cli/egeria_ops.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cli/egeria_tech.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/cli/ops_config.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/my/README.md +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/my/__init__.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/my/list_my_profile.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/my/list_my_roles.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/my/monitor_my_todos.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/my/monitor_open_todos.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/my/my_profile_actions.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/README.md +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/__init__.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/engine_actions.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/integration_daemon_actions.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/list_catalog_targets.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/load_archive.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/monitor_asset_events.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/monitor_coco_status.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/monitor_engine_activity.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/monitor_gov_eng_status.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/monitor_integ_daemon_status.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/monitor_platform_status.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/monitor_server_list.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/monitor_server_status.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/refresh_integration_daemon.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/ops/restart_integration_daemon.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/tech/README.md +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/tech/__init__.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/tech/get_guid_info.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/tech/get_tech_details.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/tech/list_asset_types.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/tech/list_registered_services.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/tech/list_relationship_types.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/tech/list_tech_templates.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/examples/widgets/tech/list_valid_metadata_values.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/Xloaded_resources_omvs.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/__init__.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/_client.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/_deprecated_gov_engine.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/_exceptions.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/_globals.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/_validators.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/action_author_omvs.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/asset_catalog_omvs.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/automated_curation_omvs.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/classification_manager_omvs.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/collection_manager_omvs.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/core_omag_server_config.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/create_tech_guid_lists.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/feedback_manager_omvs.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/full_omag_server_config.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/glossary_browser_omvs.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/glossary_manager_omvs.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/platform_services.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/registered_info.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/runtime_manager_omvs.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/server_operations.py +0 -0
- {pyegeria-0.6.4 → pyegeria-0.6.6}/pyegeria/utils.py +0 -0
- {pyegeria-0.6.4 → 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()
|
@@ -0,0 +1,176 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
List certification types
|
7
|
+
|
8
|
+
|
9
|
+
A simple display for certification types
|
10
|
+
"""
|
11
|
+
import argparse
|
12
|
+
import os
|
13
|
+
import sys
|
14
|
+
import time
|
15
|
+
import json
|
16
|
+
|
17
|
+
from rich import box
|
18
|
+
from rich.console import Console
|
19
|
+
from rich.prompt import Prompt
|
20
|
+
from rich.markdown import Markdown
|
21
|
+
from rich.table import Table
|
22
|
+
|
23
|
+
from pyegeria import (
|
24
|
+
InvalidParameterException,
|
25
|
+
PropertyServerException,
|
26
|
+
UserNotAuthorizedException,
|
27
|
+
print_exception_response,
|
28
|
+
AssetCatalog,
|
29
|
+
ClassificationManager
|
30
|
+
)
|
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('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
|
36
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
|
37
|
+
EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
|
38
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
|
39
|
+
EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
|
40
|
+
EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
|
41
|
+
EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
|
42
|
+
EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
|
43
|
+
|
44
|
+
|
45
|
+
disable_ssl_warnings = True
|
46
|
+
|
47
|
+
|
48
|
+
def display_certifications(search_string: str, server: str, url: str, username: str, user_password: str, time_out: int = 60,
|
49
|
+
jupyter: bool = EGERIA_JUPYTER, width: int = EGERIA_WIDTH):
|
50
|
+
console = Console(width=width, force_terminal=not jupyter, soft_wrap=True)
|
51
|
+
if (search_string is None) or ((len(search_string) < 3)) and (search_string != '*'):
|
52
|
+
raise ValueError("Invalid Search String - must be greater than four characters long")
|
53
|
+
g_client = ClassificationManager(server, url, user_id=username,user_pwd=user_password )
|
54
|
+
token = g_client.create_egeria_bearer_token(username, user_password)
|
55
|
+
|
56
|
+
|
57
|
+
def generate_table(search_string:str = None) -> Table:
|
58
|
+
"""Make a new table."""
|
59
|
+
table = Table(
|
60
|
+
title=f"Certifications Types @ {time.asctime()}",
|
61
|
+
header_style="white on dark_blue",
|
62
|
+
style="bold white on black",
|
63
|
+
row_styles=["bold white on black"],
|
64
|
+
title_style="bold white on black",
|
65
|
+
caption_style="white on black",
|
66
|
+
show_lines=True,
|
67
|
+
box=box.ROUNDED,
|
68
|
+
caption=f"View Server '{server}' @ Platform - {url}",
|
69
|
+
expand=True
|
70
|
+
)
|
71
|
+
table.add_column("Title", max_width=15)
|
72
|
+
table.add_column('summary')
|
73
|
+
table.add_column("domainID")
|
74
|
+
table.add_column("Unique Name")
|
75
|
+
table.add_column("Scope")
|
76
|
+
# table.add_column("Qualified Name",max_width=15)
|
77
|
+
table.add_column("Description")
|
78
|
+
table.add_column("Details")
|
79
|
+
table.add_column("Related Elements")
|
80
|
+
|
81
|
+
|
82
|
+
certs = g_client.get_elements(search_string, page_size=100, time_out=time_out)
|
83
|
+
if type(certs) is str:
|
84
|
+
return table
|
85
|
+
|
86
|
+
for element in certs:
|
87
|
+
properties = element['properties']
|
88
|
+
summary = properties.get('summary',"---")
|
89
|
+
domain = properties.get("domainIdentifier",'---')
|
90
|
+
unique_name = properties.get('qualifiedName','---')
|
91
|
+
scope = properties.get('scope','---')
|
92
|
+
description = properties.get('description','---')
|
93
|
+
details = properties.get('details','---')
|
94
|
+
title = properties.get('title','---')
|
95
|
+
cert_guid = element['elementHeader']['guid']
|
96
|
+
|
97
|
+
related = g_client.get_all_related_elements(cert_guid)
|
98
|
+
if (len(related) > 0) and (type(related) is list):
|
99
|
+
rel_md = ''
|
100
|
+
for rel in related:
|
101
|
+
rel_type = rel['relationshipHeader']['type']['typeName']
|
102
|
+
rel_element_props = rel['relatedElement']['properties']
|
103
|
+
rel_el_md = f"* Rel Type: {rel_type}\n"
|
104
|
+
for key in rel_element_props.keys():
|
105
|
+
rel_el_md += f"* {key}: {rel_element_props[key]}\n"
|
106
|
+
rel_md += f"----\n{rel_el_md}\n"
|
107
|
+
else:
|
108
|
+
rel_md = '---'
|
109
|
+
|
110
|
+
# match_tab = Table(expand=True)
|
111
|
+
# match_tab.add_column("Type Name")
|
112
|
+
# match_tab.add_column("GUID", no_wrap=True, width=36)
|
113
|
+
# match_tab.add_column("Properties")
|
114
|
+
#
|
115
|
+
# for match in nested:
|
116
|
+
# match_type_name = match['type']['typeName']
|
117
|
+
# matching_guid = match['guid']
|
118
|
+
# match_props = match['properties']
|
119
|
+
# match_details_md = ""
|
120
|
+
# for key in match_props.keys():
|
121
|
+
# match_details_md += f"* {key}: {match_props[key]}\n"
|
122
|
+
# match_details_out = Markdown(match_details_md)
|
123
|
+
# match_tab.add_row(match_type_name, matching_guid, match_details_out)
|
124
|
+
|
125
|
+
|
126
|
+
table.add_row(
|
127
|
+
title, summary, domain, unique_name,scope,description,details, rel_md
|
128
|
+
)
|
129
|
+
|
130
|
+
g_client.close_session()
|
131
|
+
|
132
|
+
return table
|
133
|
+
|
134
|
+
try:
|
135
|
+
# with Live(generate_table(), refresh_per_second=4, screen=True) as live:
|
136
|
+
# while True:
|
137
|
+
# time.sleep(2)
|
138
|
+
# live.update(generate_table())
|
139
|
+
|
140
|
+
with console.pager(styles=True):
|
141
|
+
console.print(generate_table(search_string), soft_wrap=True)
|
142
|
+
|
143
|
+
|
144
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
145
|
+
console.print_exception()
|
146
|
+
sys.exit(1)
|
147
|
+
|
148
|
+
except ValueError as e:
|
149
|
+
console.print(f"\n\n====> Invalid Search String - must be greater than four characters long")
|
150
|
+
sys.exit(1)
|
151
|
+
|
152
|
+
|
153
|
+
def main():
|
154
|
+
parser = argparse.ArgumentParser()
|
155
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
156
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
157
|
+
parser.add_argument("--userid", help="User Id")
|
158
|
+
parser.add_argument("--password", help="User Password")
|
159
|
+
parser.add_argument("--time_out", help="Time Out")
|
160
|
+
|
161
|
+
args = parser.parse_args()
|
162
|
+
|
163
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
164
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
165
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
166
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
167
|
+
time_out = args.time_out if args.time_out is not None else 60
|
168
|
+
try:
|
169
|
+
# search_string = Prompt.ask("Enter an asset search string:", default="*")
|
170
|
+
search_string = 'CertificationType'
|
171
|
+
display_certifications(search_string, server, url, userid, user_pass, time_out)
|
172
|
+
except(KeyboardInterrupt):
|
173
|
+
pass
|
174
|
+
|
175
|
+
if __name__ == "__main__":
|
176
|
+
main()
|
@@ -26,7 +26,7 @@ from pyegeria import (
|
|
26
26
|
UserNotAuthorizedException,
|
27
27
|
print_exception_response,
|
28
28
|
)
|
29
|
-
from pyegeria import ProjectManager
|
29
|
+
from pyegeria import ProjectManager, ClassificationManager
|
30
30
|
|
31
31
|
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
32
32
|
EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
|
@@ -48,6 +48,7 @@ def display_project_list(project_name: str, server: str, url: str,
|
|
48
48
|
width: int = EGERIA_WIDTH):
|
49
49
|
p_client = ProjectManager(server, url, user_id=username)
|
50
50
|
token = p_client.create_egeria_bearer_token(username, user_pass)
|
51
|
+
c_client = ClassificationManager(server, url, token)
|
51
52
|
|
52
53
|
def generate_table(project_name: str) -> Table:
|
53
54
|
"""Make a new table."""
|
@@ -60,7 +61,7 @@ def display_project_list(project_name: str, server: str, url: str,
|
|
60
61
|
expand=True
|
61
62
|
)
|
62
63
|
|
63
|
-
table.add_column("
|
64
|
+
table.add_column("Project Name")
|
64
65
|
table.add_column("Description")
|
65
66
|
|
66
67
|
table.add_column("Classifications")
|
@@ -112,11 +113,24 @@ def display_project_list(project_name: str, server: str, url: str,
|
|
112
113
|
if additional_properties is not None:
|
113
114
|
props = json.dumps(additional_properties)
|
114
115
|
|
116
|
+
governed_by = c_client.get_related_elements(guid,'GovernedBy')
|
117
|
+
if type(governed_by) is list:
|
118
|
+
for gov in governed_by:
|
119
|
+
rel_guid = gov['relatedElement']['elementHeader']['guid']
|
120
|
+
rel_title = gov['relatedElement']['properties'].get('title','---')
|
121
|
+
certified_partner= f"{rel_title}: \n"
|
122
|
+
certified = c_client.get_related_elements(rel_guid, "Certification")
|
123
|
+
if type(certified) is list:
|
124
|
+
for rel_elem in certified:
|
125
|
+
p_name = rel_elem['relatedElement']['properties']['name']
|
126
|
+
certified_partner += f"* {p_name}\n"
|
127
|
+
else:
|
128
|
+
certified_partner = "---"
|
115
129
|
|
116
130
|
|
117
131
|
table.add_row(
|
118
132
|
name, description, classification, qualified_name, identifier, phase, health, status, start,
|
119
|
-
end,
|
133
|
+
end, certified_partner)
|
120
134
|
|
121
135
|
p_client.close_session()
|
122
136
|
return table
|
@@ -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,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "pyegeria"
|
3
|
-
version = "0.6.
|
3
|
+
version = "0.6.6"
|
4
4
|
license = 'Apache 2.0'
|
5
5
|
authors = ["Dan Wolfson <dan.wolfson@pdr-associates.com>"]
|
6
6
|
readme = "README.md"
|
@@ -61,6 +61,8 @@ pytest = "^8.2.2"
|
|
61
61
|
get_tech_type_template = "examples.widgets.cat.get_tech_type_template:main"
|
62
62
|
list_projects = "examples.widgets.cat.list_projects:main"
|
63
63
|
list_todos = "examples.widgets.cat.list_todos:main"
|
64
|
+
list_cert_types = "examples.widgets.cat.list_cert_types:main"
|
65
|
+
|
64
66
|
|
65
67
|
monitor_asset_events = "examples.widgets.ops.monitor_asset_events:main"
|
66
68
|
monitor_coco_status = "examples.widgets.ops.monitor_coco_status:main"
|
File without changes
|
File without changes
|
File without changes
|
{pyegeria-0.6.4 → 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
|