pyegeria 0.3.6__py3-none-any.whl → 0.3.7__py3-none-any.whl
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.3.7.data/scripts/collection_viewer.py +98 -0
- pyegeria-0.3.7.data/scripts/get_relationship_types.py +141 -0
- pyegeria-0.3.7.data/scripts/get_tech_details.py +147 -0
- pyegeria-0.3.7.data/scripts/get_tech_types.py +124 -0
- pyegeria-0.3.7.data/scripts/project_list_viewer.py +153 -0
- {pyegeria-0.3.6.dist-info → pyegeria-0.3.7.dist-info}/METADATA +1 -1
- {pyegeria-0.3.6.dist-info → pyegeria-0.3.7.dist-info}/RECORD +22 -17
- {pyegeria-0.3.6.data → pyegeria-0.3.7.data}/scripts/engine_action_status.py +0 -0
- {pyegeria-0.3.6.data → pyegeria-0.3.7.data}/scripts/find_todos.py +0 -0
- {pyegeria-0.3.6.data → pyegeria-0.3.7.data}/scripts/glossary_view.py +0 -0
- {pyegeria-0.3.6.data → pyegeria-0.3.7.data}/scripts/gov_engine_status.py +0 -0
- {pyegeria-0.3.6.data → pyegeria-0.3.7.data}/scripts/integration_daemon_status.py +0 -0
- {pyegeria-0.3.6.data → pyegeria-0.3.7.data}/scripts/list_asset_types.py +0 -0
- {pyegeria-0.3.6.data → pyegeria-0.3.7.data}/scripts/multi-server_status.py +0 -0
- {pyegeria-0.3.6.data → pyegeria-0.3.7.data}/scripts/my_todos.py +0 -0
- {pyegeria-0.3.6.data → pyegeria-0.3.7.data}/scripts/open_todos.py +0 -0
- {pyegeria-0.3.6.data → pyegeria-0.3.7.data}/scripts/server_status.py +0 -0
- {pyegeria-0.3.6.data → pyegeria-0.3.7.data}/scripts/server_status_widget.py +0 -0
- {pyegeria-0.3.6.data → pyegeria-0.3.7.data}/scripts/view_my_profile.py +0 -0
- {pyegeria-0.3.6.dist-info → pyegeria-0.3.7.dist-info}/LICENSE +0 -0
- {pyegeria-0.3.6.dist-info → pyegeria-0.3.7.dist-info}/WHEEL +0 -0
- {pyegeria-0.3.6.dist-info → pyegeria-0.3.7.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,98 @@
|
|
1
|
+
#!python
|
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 time
|
11
|
+
import argparse
|
12
|
+
|
13
|
+
from rich.box import Box
|
14
|
+
from rich.markdown import Markdown
|
15
|
+
from rich.prompt import Prompt
|
16
|
+
|
17
|
+
from pyegeria._exceptions import (
|
18
|
+
InvalidParameterException,
|
19
|
+
PropertyServerException,
|
20
|
+
UserNotAuthorizedException,
|
21
|
+
print_exception_response,
|
22
|
+
)
|
23
|
+
from rich.table import Table
|
24
|
+
from rich.live import Live
|
25
|
+
from rich.text import Text
|
26
|
+
from rich.tree import Tree
|
27
|
+
from rich.markdown import Markdown
|
28
|
+
|
29
|
+
from rich import print
|
30
|
+
from rich.console import Group
|
31
|
+
from rich.panel import Panel
|
32
|
+
from rich import box, align
|
33
|
+
from rich.layout import Layout
|
34
|
+
import rich
|
35
|
+
from pyegeria import CollectionManager, UserNotAuthorizedException, PropertyServerException, InvalidParameterException
|
36
|
+
|
37
|
+
disable_ssl_warnings = True
|
38
|
+
|
39
|
+
platform = "https://127.0.0.1:9443"
|
40
|
+
user = "erinoverview"
|
41
|
+
view_server = "view-server"
|
42
|
+
|
43
|
+
|
44
|
+
def collection_viewer(root: str, server_name:str, platform_url:str, user:str):
|
45
|
+
|
46
|
+
def walk_collection_hierarchy(collection_client: CollectionManager, root_collection_name: str, tree: Tree) -> Tree:
|
47
|
+
"""Recursively build a Tree with collection contents."""
|
48
|
+
members = collection_client.get_member_list(root_collection_name)
|
49
|
+
if members:
|
50
|
+
for member in members:
|
51
|
+
|
52
|
+
style = ""
|
53
|
+
text_collection_name = Text(f"[bold white] Name: {member['name']}", "")
|
54
|
+
text_qualified_name = Text(f"* QualifiedName: {member['qualifiedName']}""yellow")
|
55
|
+
text_guid = Text(f"* GUID: {member['guid']}", "green")
|
56
|
+
text_collection_type = Text(f"* Collection Type: {member['collectionType']}", "cyan")
|
57
|
+
text_description = Text(f"* Description: {member['description']}", "cyan")
|
58
|
+
p = Panel.fit(f"[white]{text_collection_name}[green]\n{text_qualified_name}\n{text_guid}\n"
|
59
|
+
f"{text_collection_type}\n{text_description}")
|
60
|
+
tt = tree.add(p, style=style)
|
61
|
+
|
62
|
+
children = collection_client.get_collection_members(member['guid'])
|
63
|
+
if type(children) is list:
|
64
|
+
branch = tt.add(f"[bold magenta]Members", style=style, guide_style=style)
|
65
|
+
walk_collection_hierarchy(collection_client, member['qualifiedName'], branch),
|
66
|
+
|
67
|
+
|
68
|
+
try:
|
69
|
+
tree = Tree(f"[bold bright green]{root}", guide_style="bold bright_blue")
|
70
|
+
c_client = CollectionManager(view_server, platform,
|
71
|
+
user_id=user)
|
72
|
+
|
73
|
+
token = c_client.create_egeria_bearer_token(user, "secret")
|
74
|
+
walk_collection_hierarchy(c_client,root,tree)
|
75
|
+
print(tree)
|
76
|
+
|
77
|
+
except (
|
78
|
+
InvalidParameterException,
|
79
|
+
PropertyServerException,
|
80
|
+
UserNotAuthorizedException
|
81
|
+
) as e:
|
82
|
+
print_exception_response(e)
|
83
|
+
|
84
|
+
|
85
|
+
if __name__ == "__main__":
|
86
|
+
parser = argparse.ArgumentParser()
|
87
|
+
|
88
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
89
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
90
|
+
parser.add_argument("--userid", help="User Id")
|
91
|
+
args = parser.parse_args()
|
92
|
+
|
93
|
+
server = args.server if args.server is not None else "view-server"
|
94
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
95
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
96
|
+
|
97
|
+
root_collection = Prompt.ask("Enter the Root Collection to start from:", default="Digital Products Root")
|
98
|
+
collection_viewer(root_collection,server, url, userid)
|
@@ -0,0 +1,141 @@
|
|
1
|
+
#!python
|
2
|
+
"""
|
3
|
+
SPDX-Lic
|
4
|
+
ense-Identifier: Apache-2.0
|
5
|
+
Copyright Contributors to the ODPi Egeria project.
|
6
|
+
|
7
|
+
|
8
|
+
Get valid relationship types.
|
9
|
+
"""
|
10
|
+
|
11
|
+
import time
|
12
|
+
import json
|
13
|
+
import argparse
|
14
|
+
from pyegeria import (
|
15
|
+
InvalidParameterException,
|
16
|
+
PropertyServerException,
|
17
|
+
UserNotAuthorizedException,
|
18
|
+
print_exception_response,
|
19
|
+
)
|
20
|
+
from rich.table import Table
|
21
|
+
from rich.live import Live
|
22
|
+
from rich import box
|
23
|
+
from rich.prompt import Prompt
|
24
|
+
from rich.tree import Tree
|
25
|
+
from rich import print
|
26
|
+
from rich.console import Console
|
27
|
+
from pyegeria import ValidMetadataManager, ProjectManager
|
28
|
+
|
29
|
+
disable_ssl_warnings = True
|
30
|
+
|
31
|
+
good_platform1_url = "https://127.0.0.1:9443"
|
32
|
+
|
33
|
+
|
34
|
+
# good_platform1_url = "https://127.0.0.1:30080"
|
35
|
+
# good_platform2_url = "https://127.0.0.1:30081"
|
36
|
+
# bad_platform1_url = "https://localhost:9443"
|
37
|
+
|
38
|
+
good_user_1 = "garygeeke"
|
39
|
+
good_user_2 = "erinoverview"
|
40
|
+
good_server_3 = "view-server"
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
def display_list(type_name:str, server: str = good_server_3, url: str = good_platform1_url,
|
45
|
+
username: str = good_user_2, save_output: bool = False):
|
46
|
+
|
47
|
+
p_client = ValidMetadataManager(server, url, user_id=username)
|
48
|
+
token = p_client.create_egeria_bearer_token(username, "secret")
|
49
|
+
|
50
|
+
def generate_table(type_name: str) -> Table:
|
51
|
+
"""Make a new table."""
|
52
|
+
table = Table(
|
53
|
+
title=f"Relationship types for: {type_name} @ {time.asctime()}",
|
54
|
+
header_style="white on dark_blue",
|
55
|
+
show_lines=True,
|
56
|
+
box=box.ROUNDED,
|
57
|
+
caption=f"list for Server '{server}' @ Platform - {url}",
|
58
|
+
expand=True
|
59
|
+
)
|
60
|
+
|
61
|
+
|
62
|
+
table.add_column("Name")
|
63
|
+
# table.add_column("GUID", no_wrap=True,)
|
64
|
+
table.add_column("Status")
|
65
|
+
table.add_column("Description")
|
66
|
+
table.add_column("Description Wiki")
|
67
|
+
table.add_column("Attribute Name")
|
68
|
+
table.add_column("Attribute Status")
|
69
|
+
table.add_column("Attribute Type")
|
70
|
+
# table.add_column("Attribute Type")
|
71
|
+
table.add_column("Attribute Description")
|
72
|
+
|
73
|
+
types_list = p_client.get_valid_relationship_types(type_name)
|
74
|
+
# print(json.dumps(types_list, indent=4))
|
75
|
+
print(type(types_list))
|
76
|
+
if types_list is None:
|
77
|
+
name = " "
|
78
|
+
guid = " "
|
79
|
+
status = " "
|
80
|
+
|
81
|
+
elif type(types_list) == str:
|
82
|
+
print(types_list)
|
83
|
+
raise ValueError("-->This is not a known Type")
|
84
|
+
else:
|
85
|
+
for types in types_list:
|
86
|
+
|
87
|
+
name = types['name']
|
88
|
+
# guid = types['guid']
|
89
|
+
status = types['initialStatus']
|
90
|
+
description = types['description']
|
91
|
+
description_wiki = types.get("descriptionWiki"," ")
|
92
|
+
attribute_defs = types.get("attributeDefinitions")
|
93
|
+
if attribute_defs:
|
94
|
+
for attr in attribute_defs:
|
95
|
+
attr_name = attr['attributeName']
|
96
|
+
attr_desc = attr['attributeDescription']
|
97
|
+
attr_status = attr['attributeStatus']
|
98
|
+
attr_type = attr['attributeType']["name"]
|
99
|
+
table.add_row(
|
100
|
+
name, status, description, description_wiki, attr_name, attr_status, attr_type, attr_desc
|
101
|
+
)
|
102
|
+
else:
|
103
|
+
table.add_row(name,status,description,description_wiki," ", " ", " "," " )
|
104
|
+
|
105
|
+
p_client.close_session()
|
106
|
+
return table
|
107
|
+
|
108
|
+
try:
|
109
|
+
# with Live(generate_table(), refresh_per_second=4, screen=True) as live:
|
110
|
+
# while True:
|
111
|
+
# time.sleep(2)
|
112
|
+
# live.update(generate_table())
|
113
|
+
console = Console(record=True)
|
114
|
+
with console.pager():
|
115
|
+
console.print(generate_table(type_name))
|
116
|
+
if save_output:
|
117
|
+
console.save_html("projects.html")
|
118
|
+
|
119
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ValueError) as e:
|
120
|
+
if type(e) is str:
|
121
|
+
print(e)
|
122
|
+
else:
|
123
|
+
print_exception_response(e)
|
124
|
+
|
125
|
+
if __name__ == "__main__":
|
126
|
+
|
127
|
+
parser = argparse.ArgumentParser()
|
128
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
129
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
130
|
+
parser.add_argument("--userid", help="User Id")
|
131
|
+
parser.add_argument("--save-output", help="Save output to file?")
|
132
|
+
# parser.add_argument("--sponsor", help="Name of sponsor to search")
|
133
|
+
args = parser.parse_args()
|
134
|
+
|
135
|
+
server = args.server if args.server is not None else "view-server"
|
136
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
137
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
138
|
+
save_output = args.save_output if args.save_output is not None else False
|
139
|
+
type_name = Prompt.ask("Enter the Type Name to retrieve:", default="*")
|
140
|
+
|
141
|
+
display_list(type_name, server, url, userid, save_output)
|
@@ -0,0 +1,147 @@
|
|
1
|
+
#!python
|
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 time
|
11
|
+
import argparse
|
12
|
+
|
13
|
+
from rich.box import Box
|
14
|
+
from rich.markdown import Markdown
|
15
|
+
from rich.prompt import Prompt
|
16
|
+
|
17
|
+
from pyegeria._exceptions import (
|
18
|
+
InvalidParameterException,
|
19
|
+
PropertyServerException,
|
20
|
+
UserNotAuthorizedException,
|
21
|
+
print_exception_response,
|
22
|
+
)
|
23
|
+
from rich.table import Table
|
24
|
+
from rich.live import Live
|
25
|
+
from rich.text import Text
|
26
|
+
from rich.tree import Tree
|
27
|
+
from rich.markdown import Markdown
|
28
|
+
|
29
|
+
from rich import print
|
30
|
+
from rich.console import Group
|
31
|
+
from rich.panel import Panel
|
32
|
+
from rich import box, align
|
33
|
+
from rich.layout import Layout
|
34
|
+
import rich
|
35
|
+
from pyegeria import (CollectionManager, UserNotAuthorizedException, PropertyServerException,
|
36
|
+
InvalidParameterException, AutomatedCuration)
|
37
|
+
|
38
|
+
disable_ssl_warnings = True
|
39
|
+
|
40
|
+
platform = "https://127.0.0.1:9443"
|
41
|
+
user = "erinoverview"
|
42
|
+
view_server = "view-server"
|
43
|
+
|
44
|
+
|
45
|
+
def tech_viewer(tech: str, server_name:str, platform_url:str, user:str):
|
46
|
+
|
47
|
+
def view_tech_details(a_client: AutomatedCuration, root_collection_name: str, tree: Tree) -> Tree:
|
48
|
+
l2: Tree = None
|
49
|
+
tech_details = a_client.get_technology_type_detail(tech)
|
50
|
+
if type(tech_details) is dict:
|
51
|
+
style = ""
|
52
|
+
l2 = tree.add(Text(f"Name: {tech_details['name']}", "bold red"))
|
53
|
+
l2 = tree.add(Text(f"* QualifiedName: {tech_details['qualifiedName']}","bold white"))
|
54
|
+
l2 = tree.add(Text(f"* Category: {tech_details['category']}", "bold white"))
|
55
|
+
l2 = tree.add(Text(f"* Technology Description: {tech_details['description']}", "bold white"))
|
56
|
+
ext_ref = tech_details.get('externalReferences', None)
|
57
|
+
if ext_ref is not None:
|
58
|
+
l2 = tree.add(Text(f'* URI: {ext_ref[0]["properties"]["uri"]}', "bold white"))
|
59
|
+
|
60
|
+
# catalog_temp = tech_details.get("catalogTemplates", None)
|
61
|
+
# if catalog_temp is not None:
|
62
|
+
# l2 = tree.add("Catalog Templates")
|
63
|
+
# for catalog in catalog_temp:
|
64
|
+
# cat_name = catalog["relatedElement"].get("name", None)
|
65
|
+
# if cat_name is None:
|
66
|
+
# continue
|
67
|
+
# l3 = l2.add(f'[white] Template Name: {cat_name}, style=style)')
|
68
|
+
# l3 = l2.add(f'[white] Template GUID: {catalog["relatedElement"].get("guid", None)}, style=style)')
|
69
|
+
# classifications = catalog["relatedElement"].get("classifications", None)
|
70
|
+
# if classifications is not None:
|
71
|
+
# l4 = l3.add(f"[red]Classifications")
|
72
|
+
# for classification in classifications:
|
73
|
+
# props = classification['classificationProperties']
|
74
|
+
# c_name = Text(f'[white] Name: {props.get("name", None)}[white]')
|
75
|
+
# c_ver = Text(f'[white] Version: {props.get("versionIdentifier", None)}')
|
76
|
+
# c_desc = Text(f'[white] Description: {props.get("description", None)}')
|
77
|
+
# class_text = (f"[bold red]Classification \n"
|
78
|
+
# f"[white] Name: {c_name} \n"
|
79
|
+
# f"[white] Version: {c_ver} \n"
|
80
|
+
# f"[white] Description: {c_desc}")
|
81
|
+
# c = Panel.fit(class_text)
|
82
|
+
# l4 = l3.add(c, style = style)
|
83
|
+
#
|
84
|
+
# placeholders = catalog.get("specification", None)
|
85
|
+
# if placeholders is not None:
|
86
|
+
# specs = placeholders.get("placeholderProperty", None)
|
87
|
+
# if specs is not None:
|
88
|
+
# l4 = l3.add(f"[red]Placeholder Properties")
|
89
|
+
# for spec in specs:
|
90
|
+
# l5 = l4.add(f'[white] Placeholder Name: {spec.get("placeholderName", None)})')
|
91
|
+
# l5 = l4.add(f'[white] Data Type: {spec["dataType"]}')
|
92
|
+
# l5 = l4.add(f'[white] Placeholder Name: {str(spec["required"])})')
|
93
|
+
# l5 = l4.add(f'[white] Example: {spec.get("example", None)})')
|
94
|
+
# l5 = l4.add(f'[white] Description: {spec.get("description", None)}[white])')
|
95
|
+
|
96
|
+
|
97
|
+
resource_list = tech_details.get('resourceList',None)
|
98
|
+
if resource_list:
|
99
|
+
t_r = tree.add("Resource List[bold red]")
|
100
|
+
for resource in resource_list:
|
101
|
+
resource_use = Text(f"[bold white]{resource['resourceUse']}", "")
|
102
|
+
resource_use_description = Text(f"[bold white]{resource['resourceUseDescription']}", "")
|
103
|
+
type_name = Text(f"[bold white]{resource['relatedElement']['type']['typeName']}", "")
|
104
|
+
unique_name = Text(f"[bold white]{resource['relatedElement']['uniqueName']}", "")
|
105
|
+
related_guid = Text(f"[bold white]{resource['relatedElement']['guid']}", "")
|
106
|
+
resource_text = (f"[bold red]Resource\n"
|
107
|
+
f"[white]Resource use: {resource_use}[white]\nDescription: "
|
108
|
+
f"{resource_use_description}\nType Name: {type_name}\n"
|
109
|
+
f"[white]Unique Name: {unique_name}\n[white]Related GUID: {related_guid}\n")
|
110
|
+
p = Panel.fit(resource_text)
|
111
|
+
tt = t_r.add(p, style=style)
|
112
|
+
|
113
|
+
|
114
|
+
return tt
|
115
|
+
|
116
|
+
|
117
|
+
try:
|
118
|
+
tree = Tree(f"[bold bright green]{tech}", guide_style="bold bright_blue")
|
119
|
+
a_client = AutomatedCuration(view_server, platform,
|
120
|
+
user_id=user)
|
121
|
+
|
122
|
+
token = a_client.create_egeria_bearer_token(user, "secret")
|
123
|
+
view_tech_details(a_client,tech,tree)
|
124
|
+
print(tree)
|
125
|
+
|
126
|
+
except (
|
127
|
+
InvalidParameterException,
|
128
|
+
PropertyServerException,
|
129
|
+
UserNotAuthorizedException
|
130
|
+
) as e:
|
131
|
+
print_exception_response(e)
|
132
|
+
|
133
|
+
|
134
|
+
if __name__ == "__main__":
|
135
|
+
parser = argparse.ArgumentParser()
|
136
|
+
|
137
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
138
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
139
|
+
parser.add_argument("--userid", help="User Id")
|
140
|
+
args = parser.parse_args()
|
141
|
+
|
142
|
+
server = args.server if args.server is not None else "view-server"
|
143
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
144
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
145
|
+
|
146
|
+
tech = Prompt.ask("Enter the Technology to start from:", default="PostgreSQL Server")
|
147
|
+
tech_viewer(tech,server, url, userid)
|
@@ -0,0 +1,124 @@
|
|
1
|
+
#!python
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
Unit tests for the Utils helper functions using the Pytest framework.
|
7
|
+
|
8
|
+
|
9
|
+
A simple display for my profile
|
10
|
+
"""
|
11
|
+
|
12
|
+
import argparse
|
13
|
+
import sys
|
14
|
+
import time
|
15
|
+
|
16
|
+
from rich import box
|
17
|
+
from rich.console import Console
|
18
|
+
from rich.prompt import Prompt
|
19
|
+
from rich.table import Table
|
20
|
+
|
21
|
+
from pyegeria import (
|
22
|
+
InvalidParameterException,
|
23
|
+
PropertyServerException,
|
24
|
+
UserNotAuthorizedException,
|
25
|
+
print_exception_response,
|
26
|
+
RegisteredInfo,
|
27
|
+
AutomatedCuration
|
28
|
+
)
|
29
|
+
|
30
|
+
disable_ssl_warnings = True
|
31
|
+
|
32
|
+
good_platform1_url = "https://127.0.0.1:9443"
|
33
|
+
good_platform2_url = "https://egeria.pdr-associates.com:7443"
|
34
|
+
bad_platform1_url = "https://localhost:9443"
|
35
|
+
|
36
|
+
# good_platform1_url = "https://127.0.0.1:30080"
|
37
|
+
# good_platform2_url = "https://127.0.0.1:30081"
|
38
|
+
# bad_platform1_url = "https://localhost:9443"
|
39
|
+
|
40
|
+
good_user_1 = "garygeeke"
|
41
|
+
good_user_2 = "erinoverview"
|
42
|
+
bad_user_1 = "eviledna"
|
43
|
+
bad_user_2 = ""
|
44
|
+
|
45
|
+
good_server_1 = "active-metadata-store"
|
46
|
+
good_server_2 = "simple-metadata-store"
|
47
|
+
good_server_3 = "view-server"
|
48
|
+
good_server_4 = "engine-host"
|
49
|
+
bad_server_1 = "coco"
|
50
|
+
bad_server_2 = ""
|
51
|
+
|
52
|
+
|
53
|
+
def display_tech_types(search_string:str = "*", server: str = good_server_3, url: str = good_platform1_url, username: str = good_user_2):
|
54
|
+
a_client = AutomatedCuration(server, url, username)
|
55
|
+
token = a_client.create_egeria_bearer_token(good_user_2, "secret")
|
56
|
+
tech_list = a_client.find_technology_types(search_string, page_size=0)
|
57
|
+
|
58
|
+
def generate_table() -> Table:
|
59
|
+
"""Make a new table."""
|
60
|
+
table = Table(
|
61
|
+
title=f"Technology Types for: {good_platform1_url} @ {time.asctime()}",
|
62
|
+
# style = "black on grey66",
|
63
|
+
header_style="white on dark_blue",
|
64
|
+
show_lines=True,
|
65
|
+
box=box.ROUNDED,
|
66
|
+
caption=f"Technology Types from Server '{server}' @ Platform - {url}",
|
67
|
+
expand=True
|
68
|
+
)
|
69
|
+
|
70
|
+
table.add_column("Name")
|
71
|
+
table.add_column("Qualified Name")
|
72
|
+
table.add_column("Category")
|
73
|
+
table.add_column("Description")
|
74
|
+
|
75
|
+
|
76
|
+
name = " "
|
77
|
+
description = " "
|
78
|
+
version = " "
|
79
|
+
super_type = " "
|
80
|
+
if type(tech_list) is list:
|
81
|
+
for item in tech_list:
|
82
|
+
if 'deployedImplementationType' not in item['qualifiedName']:
|
83
|
+
continue
|
84
|
+
qualified_name = item.get("qualifiedName", " ")
|
85
|
+
name = item.get("name", "none")
|
86
|
+
category = item.get("category", "none")
|
87
|
+
description = item.get("description", "none")
|
88
|
+
|
89
|
+
table.add_row(
|
90
|
+
name, qualified_name, category, description
|
91
|
+
)
|
92
|
+
return table
|
93
|
+
else:
|
94
|
+
print("Unknown technology type")
|
95
|
+
sys.exit(1)
|
96
|
+
|
97
|
+
try:
|
98
|
+
console = Console()
|
99
|
+
with console.pager():
|
100
|
+
console.print(generate_table())
|
101
|
+
|
102
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
103
|
+
print_exception_response(e)
|
104
|
+
assert e.related_http_code != "200", "Invalid parameters"
|
105
|
+
finally:
|
106
|
+
a_client.close_session()
|
107
|
+
|
108
|
+
|
109
|
+
if __name__ == "__main__":
|
110
|
+
parser = argparse.ArgumentParser()
|
111
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
112
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
113
|
+
parser.add_argument("--userid", help="User Id")
|
114
|
+
|
115
|
+
args = parser.parse_args()
|
116
|
+
|
117
|
+
server = args.server if args.server is not None else "view-server"
|
118
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
119
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
120
|
+
# guid = args.guid if args.guid is not None else None
|
121
|
+
guid = None
|
122
|
+
search_string = Prompt.ask("Enter the technology you are searching for:", default="*")
|
123
|
+
|
124
|
+
display_tech_types(search_string, server, url, userid)
|
@@ -0,0 +1,153 @@
|
|
1
|
+
#!python
|
2
|
+
"""
|
3
|
+
SPDX-Lic
|
4
|
+
ense-Identifier: Apache-2.0
|
5
|
+
Copyright Contributors to the ODPi Egeria project.
|
6
|
+
|
7
|
+
Unit tests for the Utils helper functions using the Pytest framework.
|
8
|
+
|
9
|
+
|
10
|
+
A simple display for glossary terms
|
11
|
+
"""
|
12
|
+
|
13
|
+
import time
|
14
|
+
import json
|
15
|
+
import argparse
|
16
|
+
from pyegeria import (
|
17
|
+
InvalidParameterException,
|
18
|
+
PropertyServerException,
|
19
|
+
UserNotAuthorizedException,
|
20
|
+
print_exception_response,
|
21
|
+
)
|
22
|
+
from rich.table import Table
|
23
|
+
from rich.live import Live
|
24
|
+
from rich import box
|
25
|
+
from rich.prompt import Prompt
|
26
|
+
from rich.tree import Tree
|
27
|
+
from rich import print
|
28
|
+
from rich.console import Console
|
29
|
+
from pyegeria import ValidMetadataManager, ProjectManager
|
30
|
+
|
31
|
+
disable_ssl_warnings = True
|
32
|
+
|
33
|
+
good_platform1_url = "https://127.0.0.1:9443"
|
34
|
+
|
35
|
+
|
36
|
+
# good_platform1_url = "https://127.0.0.1:30080"
|
37
|
+
# good_platform2_url = "https://127.0.0.1:30081"
|
38
|
+
# bad_platform1_url = "https://localhost:9443"
|
39
|
+
|
40
|
+
good_user_1 = "garygeeke"
|
41
|
+
good_user_2 = "erinoverview"
|
42
|
+
good_server_3 = "view-server"
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
def display_list(project_name: str, server: str = good_server_3, url: str = good_platform1_url,
|
47
|
+
username: str = good_user_2, save_output: bool = False):
|
48
|
+
|
49
|
+
p_client = ProjectManager(server, url, user_id=username)
|
50
|
+
token = p_client.create_egeria_bearer_token(username, "secret")
|
51
|
+
|
52
|
+
def generate_table(project_name: str) -> Table:
|
53
|
+
"""Make a new table."""
|
54
|
+
table = Table(
|
55
|
+
title=f"Project List: {project_name} @ {time.asctime()}",
|
56
|
+
header_style="white on dark_blue",
|
57
|
+
show_lines=True,
|
58
|
+
box=box.ROUNDED,
|
59
|
+
caption=f"Project list for Server '{server}' @ Platform - {url}",
|
60
|
+
expand=True
|
61
|
+
)
|
62
|
+
|
63
|
+
|
64
|
+
table.add_column("Display Name")
|
65
|
+
table.add_column("Project GUID", no_wrap=True,)
|
66
|
+
table.add_column("Classifications")
|
67
|
+
table.add_column("Qualified Name")
|
68
|
+
table.add_column("Identifier")
|
69
|
+
table.add_column("Phase")
|
70
|
+
table.add_column("Health")
|
71
|
+
table.add_column("Status")
|
72
|
+
table.add_column("Start Date")
|
73
|
+
table.add_column("End Date")
|
74
|
+
table.add_column("Description")
|
75
|
+
|
76
|
+
projects = p_client.find_projects(project_name)
|
77
|
+
|
78
|
+
if projects is None:
|
79
|
+
name = " "
|
80
|
+
guid = " "
|
81
|
+
classification = " "
|
82
|
+
qualified_name = " "
|
83
|
+
identifier = " "
|
84
|
+
phase= " "
|
85
|
+
health = " "
|
86
|
+
status = " "
|
87
|
+
start = " "
|
88
|
+
end = " "
|
89
|
+
description = " "
|
90
|
+
elif type(projects) == str:
|
91
|
+
raise ValueError("-->This is not a known project")
|
92
|
+
else:
|
93
|
+
for project in projects:
|
94
|
+
classification = ""
|
95
|
+
guid = project['elementHeader']['guid']
|
96
|
+
props = project["properties"]
|
97
|
+
name = props.get("name","None")
|
98
|
+
p_class = project['elementHeader'].get("classifications")
|
99
|
+
if p_class:
|
100
|
+
for classif in p_class:
|
101
|
+
classification = f"{classif.get('classificationName')}, {classification}"
|
102
|
+
qualified_name = props.get("qualifiedName"," ")
|
103
|
+
identifier = props.get("identifier", " ")
|
104
|
+
phase = props.get("projectPhase", " ")
|
105
|
+
health = props.get("projectHealth", " ")
|
106
|
+
status = props.get("projectStatus", " ")
|
107
|
+
description = props.get("description", " ")
|
108
|
+
start = props.get("startDate"," ")
|
109
|
+
end = props.get("plannedEndDate", " ")
|
110
|
+
additional_properties = project.get('additionalProperties')
|
111
|
+
if additional_properties is not None:
|
112
|
+
props = json.dumps(additional_properties)
|
113
|
+
table.add_row(
|
114
|
+
name, guid, classification, qualified_name, identifier, phase, health, status, start,
|
115
|
+
end,description)
|
116
|
+
|
117
|
+
p_client.close_session()
|
118
|
+
return table
|
119
|
+
|
120
|
+
try:
|
121
|
+
# with Live(generate_table(), refresh_per_second=4, screen=True) as live:
|
122
|
+
# while True:
|
123
|
+
# time.sleep(2)
|
124
|
+
# live.update(generate_table())
|
125
|
+
console = Console(record=True)
|
126
|
+
with console.pager():
|
127
|
+
console.print(generate_table(project_name))
|
128
|
+
if save_output:
|
129
|
+
console.save_html("projects.html")
|
130
|
+
|
131
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ValueError) as e:
|
132
|
+
if type(e) is str:
|
133
|
+
print(e)
|
134
|
+
else:
|
135
|
+
print_exception_response(e)
|
136
|
+
|
137
|
+
if __name__ == "__main__":
|
138
|
+
|
139
|
+
parser = argparse.ArgumentParser()
|
140
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
141
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
142
|
+
parser.add_argument("--userid", help="User Id")
|
143
|
+
parser.add_argument("--save-output", help="Save output to file?")
|
144
|
+
# parser.add_argument("--sponsor", help="Name of sponsor to search")
|
145
|
+
args = parser.parse_args()
|
146
|
+
|
147
|
+
server = args.server if args.server is not None else "view-server"
|
148
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
149
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
150
|
+
save_output = args.save_output if args.save_output is not None else False
|
151
|
+
project_name = Prompt.ask("Enter the Property to retrieve:", default="*")
|
152
|
+
|
153
|
+
display_list(project_name, server, url, userid, save_output)
|
@@ -17,20 +17,25 @@ pyegeria/registered_info.py,sha256=H7mgH83JKtMeDZ1vVOWoFM9iARD38Rnb6igvfEM46AA,8
|
|
17
17
|
pyegeria/server_operations.py,sha256=iMBfIgPGqFM1TkABqFFJDt8tVUSY2qwSrRURrmWuma0,16323
|
18
18
|
pyegeria/utils.py,sha256=H0mew9IRcbsEi-pZfaT9HGuPO9CMOwnhOgIltyNvqTY,5240
|
19
19
|
pyegeria/valid_metadata_omvs.py,sha256=Li_XLLIXJTN9gUqB_H1WbVpnDMSgc7ne6yuzKoBW7sU,29710
|
20
|
-
pyegeria-0.3.
|
21
|
-
pyegeria-0.3.
|
22
|
-
pyegeria-0.3.
|
23
|
-
pyegeria-0.3.
|
24
|
-
pyegeria-0.3.
|
25
|
-
pyegeria-0.3.
|
26
|
-
pyegeria-0.3.
|
27
|
-
pyegeria-0.3.
|
28
|
-
pyegeria-0.3.
|
29
|
-
pyegeria-0.3.
|
30
|
-
pyegeria-0.3.
|
31
|
-
pyegeria-0.3.
|
32
|
-
pyegeria-0.3.
|
33
|
-
pyegeria-0.3.
|
34
|
-
pyegeria-0.3.
|
35
|
-
pyegeria-0.3.
|
36
|
-
pyegeria-0.3.
|
20
|
+
pyegeria-0.3.7.data/scripts/collection_viewer.py,sha256=KWyOt4XeJ5ZaPrzNeMIH-qA3BeV9G7P64kAPceMsRmk,3628
|
21
|
+
pyegeria-0.3.7.data/scripts/engine_action_status.py,sha256=vtZhXTGsZS3_xui7QLSX7aj2IWHT5TJ5Fje7CSOA6Co,5220
|
22
|
+
pyegeria-0.3.7.data/scripts/find_todos.py,sha256=A75s7cwtXVukMCbVYFlbJoDYFg1A8fHU3dCTK2s6JtM,5171
|
23
|
+
pyegeria-0.3.7.data/scripts/get_relationship_types.py,sha256=STySVwdbSo_nMcpYlBRqmF0DNxKwrb3621GU688jhXM,4933
|
24
|
+
pyegeria-0.3.7.data/scripts/get_tech_details.py,sha256=Tg4UCazeEh7He9-l7yQbCuJso7ZcpaLhdmMUT866RzU,6843
|
25
|
+
pyegeria-0.3.7.data/scripts/get_tech_types.py,sha256=xZoCrnmBXa-_WXDW3tBG6dt6IxH-aeQfg07pXM2IrsA,3924
|
26
|
+
pyegeria-0.3.7.data/scripts/glossary_view.py,sha256=tZvdX9Sc7Q2rL9oiEjRIFFt-saqwMs8PQ3BCgp-v710,4594
|
27
|
+
pyegeria-0.3.7.data/scripts/gov_engine_status.py,sha256=ZTVbhrvGsfzmN4j9Xz95rEMTjqTNvKi9Ojvy43Z5sI8,4000
|
28
|
+
pyegeria-0.3.7.data/scripts/integration_daemon_status.py,sha256=9XRQKdjmYqwfxwNoo4EUhX8vrplR0etS-5Yq89lXGMw,4575
|
29
|
+
pyegeria-0.3.7.data/scripts/list_asset_types.py,sha256=09xmGyEoScq4OeSflElhI-ThJL2RUPV6mb9zRA7UzEA,3485
|
30
|
+
pyegeria-0.3.7.data/scripts/multi-server_status.py,sha256=XlBaIERVqYXjHO2x18WY64Oo0fUZS1onpOLAJcIlJk0,3690
|
31
|
+
pyegeria-0.3.7.data/scripts/my_todos.py,sha256=wzGKekUAT-DfzE-R8O1_byvh0trB_FMd0YvdNkTw10Q,5660
|
32
|
+
pyegeria-0.3.7.data/scripts/open_todos.py,sha256=f02BXZ-LgqjUOe5QiK1SKA9RDSH9m6-u_x0HTCQAD8E,4649
|
33
|
+
pyegeria-0.3.7.data/scripts/project_list_viewer.py,sha256=yTZR0KS-PTCxDjbjkIRniWk7DR1qvUzuTGQ3eN37-7o,5434
|
34
|
+
pyegeria-0.3.7.data/scripts/server_status.py,sha256=BgBLjYeMDN41zk9ADyPWZFBaQX0TqiCZ9pjesnByUhM,3346
|
35
|
+
pyegeria-0.3.7.data/scripts/server_status_widget.py,sha256=tyx1I7olr6e5kJF22ou9rqsztrRDdrPCq5uVa3hhPBU,3088
|
36
|
+
pyegeria-0.3.7.data/scripts/view_my_profile.py,sha256=KFeGAkR-DHX01jcOPOP7HMCTrAyY3i4mQKhq1dG86vE,4605
|
37
|
+
pyegeria-0.3.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
38
|
+
pyegeria-0.3.7.dist-info/METADATA,sha256=rf_0Bd7zF0K5gOXRsgMxN8OmFSuY4OALk66qVbok1pM,2398
|
39
|
+
pyegeria-0.3.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
40
|
+
pyegeria-0.3.7.dist-info/top_level.txt,sha256=tHowU8jow7WJGmbr4QdIk7gJWdslRgbWBiF2lMeduLQ,9
|
41
|
+
pyegeria-0.3.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|