pyegeria 0.3.8__py3-none-any.whl → 0.3.9__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/Xasset_catalog_omvs.py +539 -0
- pyegeria/Xfeedback_manager_omvs.py +251 -0
- pyegeria/Xglossary_manager_omvs.py +3001 -0
- pyegeria/Xloaded_resources_omvs.py +91 -0
- pyegeria/__init__.py +6 -10
- pyegeria/_client.py +4 -6
- pyegeria/{gov_engine.py → _deprecated_gov_engine.py} +2 -59
- pyegeria/_exceptions.py +5 -6
- pyegeria/_globals.py +1 -1
- pyegeria/automated_curation_omvs.py +320 -315
- pyegeria/collection_manager_omvs.py +187 -248
- pyegeria/core_omag_server_config.py +1 -5
- pyegeria/full_omag_server_config.py +53 -83
- pyegeria/glossary_browser_omvs.py +2208 -0
- pyegeria/my_profile_omvs.py +2 -7
- pyegeria/platform_services.py +0 -3
- pyegeria/project_manager_omvs.py +9 -15
- pyegeria/registered_info.py +12 -52
- pyegeria/server_operations.py +1 -5
- pyegeria/valid_metadata_omvs.py +11 -23
- pyegeria-0.3.9.data/scripts/Create_Collection_Sample.py +292 -0
- pyegeria-0.3.9.data/scripts/Create_Sustainability_Collection_Sample.py +115 -0
- pyegeria-0.3.9.data/scripts/coco_status.py +98 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/collection_viewer.py +12 -31
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/engine_action_status.py +9 -28
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/find_todos.py +9 -38
- pyegeria-0.3.9.data/scripts/get_registered_services.py +135 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/get_relationship_types.py +16 -35
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/glossary_view.py +2 -2
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/gov_engine_status.py +0 -1
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/list_asset_types.py +3 -25
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/my_todos.py +1 -1
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/open_todos.py +3 -24
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/project_list_viewer.py +12 -26
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/server_status.py +1 -20
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/view_my_profile.py +8 -34
- {pyegeria-0.3.8.dist-info → pyegeria-0.3.9.dist-info}/METADATA +1 -3
- pyegeria-0.3.9.dist-info/RECORD +49 -0
- pyegeria/glossary_omvs.py +0 -789
- pyegeria/loaded_resources_omvs.py +0 -159
- pyegeria-0.3.8.dist-info/RECORD +0 -42
- /pyegeria/{governance_author.py → Xaction_author_omvs.py} +0 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/get_tech_details.py +0 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/get_tech_types.py +0 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/integration_daemon_status.py +0 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/multi-server_status.py +0 -0
- {pyegeria-0.3.8.data → pyegeria-0.3.9.data}/scripts/server_status_widget.py +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.3.9.dist-info}/LICENSE +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.3.9.dist-info}/WHEEL +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.3.9.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,115 @@
|
|
1
|
+
"""
|
2
|
+
SPDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
This sample creates a collection structure for a sustainability reporting project. It is
|
6
|
+
simplistic but shows how we can set up a collection hierarchy that can hold different kinds of
|
7
|
+
assets.
|
8
|
+
|
9
|
+
"""
|
10
|
+
|
11
|
+
import time
|
12
|
+
|
13
|
+
from rich import print
|
14
|
+
from rich.console import Console
|
15
|
+
|
16
|
+
from pyegeria import CollectionManager, InvalidParameterException, PropertyServerException, UserNotAuthorizedException
|
17
|
+
|
18
|
+
view_server = 'view-server'
|
19
|
+
platform_url = 'https://localhost:9443'
|
20
|
+
user = 'erinoverview'
|
21
|
+
console = Console()
|
22
|
+
|
23
|
+
try:
|
24
|
+
c_client = CollectionManager(view_server, platform_url,
|
25
|
+
user_id=user)
|
26
|
+
|
27
|
+
token = c_client.create_egeria_bearer_token(user, "secret")
|
28
|
+
start_time = time.perf_counter()
|
29
|
+
|
30
|
+
# Create a root collection for the sustainability project
|
31
|
+
parent_guid = None
|
32
|
+
parent_relationship_type_name = None
|
33
|
+
display_name = "Root Sustainability Collection"
|
34
|
+
description = "The root collection for our sustainability reporting project."
|
35
|
+
collection_type = "Sustainability Collection"
|
36
|
+
|
37
|
+
root = c_client.create_root_collection(None, parent_guid,
|
38
|
+
parent_relationship_type_name,
|
39
|
+
False, display_name, description,
|
40
|
+
collection_type, True)
|
41
|
+
print(f"\n\n created a root with guid {root}")
|
42
|
+
# create a folder for Scope 1 Emissions
|
43
|
+
anchor_guid = root
|
44
|
+
parent_guid = root
|
45
|
+
parent_relationship_type_name = "CollectionMembership"
|
46
|
+
display_name = "Scope 1 Emissions"
|
47
|
+
description = "A folder for information about scope 1 emissions."
|
48
|
+
collection_type = "Sustainability Collection"
|
49
|
+
|
50
|
+
scope1_folder = c_client.create_folder_collection(anchor_guid, parent_guid,
|
51
|
+
parent_relationship_type_name,
|
52
|
+
True, display_name, description,
|
53
|
+
collection_type, False, "DATE_CREATED",
|
54
|
+
None
|
55
|
+
)
|
56
|
+
print(f"\n\n created scope1_folder with guid {scope1_folder}")
|
57
|
+
|
58
|
+
# create a folder for Scope 2 Emissions.
|
59
|
+
anchor_guid = root
|
60
|
+
parent_guid = root
|
61
|
+
parent_relationship_type_name = "CollectionMembership"
|
62
|
+
display_name = "Scope 2 Emissions"
|
63
|
+
description = "A folder for information about scope 2 emissions."
|
64
|
+
collection_type = "Sustainability Collection"
|
65
|
+
|
66
|
+
scope2_folder = c_client.create_folder_collection(anchor_guid, parent_guid,
|
67
|
+
parent_relationship_type_name,
|
68
|
+
True, display_name, description,
|
69
|
+
collection_type, False, "DATE_CREATED",
|
70
|
+
None
|
71
|
+
)
|
72
|
+
print(f"\n\n created scope2_folder with guid {scope2_folder}")
|
73
|
+
|
74
|
+
# create a folder for Scope 3 Emissions.
|
75
|
+
anchor_guid = root
|
76
|
+
parent_guid = root
|
77
|
+
parent_relationship_type_name = "CollectionMembership"
|
78
|
+
display_name = "Scope 3 Emissions"
|
79
|
+
description = "A folder for information about scope 3 emissions."
|
80
|
+
collection_type = "Sustainability Collection"
|
81
|
+
|
82
|
+
scope3_folder = c_client.create_folder_collection(anchor_guid, parent_guid,
|
83
|
+
parent_relationship_type_name,
|
84
|
+
True, display_name, description,
|
85
|
+
collection_type, False, "DATE_CREATED",
|
86
|
+
None
|
87
|
+
)
|
88
|
+
print(f"\n\n created scope3_folder with guid {scope3_folder}")
|
89
|
+
|
90
|
+
# create a folder for Business Travel Emissions.
|
91
|
+
anchor_guid = root
|
92
|
+
parent_guid = scope3_folder
|
93
|
+
parent_relationship_type_name = "CollectionMembership"
|
94
|
+
display_name = "Business Travel Emissions"
|
95
|
+
description = "A folder for information about scope 3 business travel emissions."
|
96
|
+
collection_type = "Sustainability Collection"
|
97
|
+
|
98
|
+
travel_folder = c_client.create_folder_collection(anchor_guid, parent_guid,
|
99
|
+
parent_relationship_type_name,
|
100
|
+
True, display_name, description,
|
101
|
+
collection_type, False, "DATE_CREATED",
|
102
|
+
None
|
103
|
+
)
|
104
|
+
print(f"\n\n created travel_folder with guid {travel_folder}")
|
105
|
+
|
106
|
+
|
107
|
+
except (
|
108
|
+
InvalidParameterException,
|
109
|
+
PropertyServerException,
|
110
|
+
UserNotAuthorizedException
|
111
|
+
) as e:
|
112
|
+
console.print_exception(show_locals=True)
|
113
|
+
|
114
|
+
finally:
|
115
|
+
c_client.close_session()
|
@@ -0,0 +1,98 @@
|
|
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 server status display for the Coco Pharmaceuticals Configuration
|
10
|
+
"""
|
11
|
+
|
12
|
+
import argparse
|
13
|
+
import time
|
14
|
+
|
15
|
+
from rich import box
|
16
|
+
from rich import print
|
17
|
+
from rich.layout import Layout
|
18
|
+
from rich.live import Live
|
19
|
+
from rich.panel import Panel
|
20
|
+
from rich.table import Table
|
21
|
+
|
22
|
+
from pyegeria._exceptions import (
|
23
|
+
InvalidParameterException,
|
24
|
+
PropertyServerException,
|
25
|
+
UserNotAuthorizedException,
|
26
|
+
print_exception_response,
|
27
|
+
)
|
28
|
+
from pyegeria.server_operations import ServerOps
|
29
|
+
|
30
|
+
disable_ssl_warnings = True
|
31
|
+
|
32
|
+
|
33
|
+
def test_display_status(server: str, url: str, username: str):
|
34
|
+
layout = Layout()
|
35
|
+
print(layout)
|
36
|
+
|
37
|
+
print(layout)
|
38
|
+
p_client1 = ServerOps("Core Catalog", "https://localhost:9443", username)
|
39
|
+
p_client2 = ServerOps('Datalake Catalog', "https://localhost:9444", username)
|
40
|
+
p_client3 = ServerOps('DevCatalog', "https://localhost:9445", username)
|
41
|
+
|
42
|
+
def generate_table(p_client) -> Table:
|
43
|
+
"""Make a new table."""
|
44
|
+
table = Table(
|
45
|
+
title=f"Server Status for Platform - {time.asctime()}",
|
46
|
+
# style = "black on grey66",
|
47
|
+
header_style="white on dark_blue",
|
48
|
+
caption=f"Server Status for Platform - '{url}'",
|
49
|
+
# show_lines=True,
|
50
|
+
)
|
51
|
+
|
52
|
+
table.add_column("Known Server")
|
53
|
+
table.add_column("Status")
|
54
|
+
|
55
|
+
known_server_list = p_client.get_known_servers()
|
56
|
+
active_server_list = p_client.get_active_server_list()
|
57
|
+
if len(known_server_list) == 0:
|
58
|
+
return table
|
59
|
+
|
60
|
+
for server in known_server_list:
|
61
|
+
if server in active_server_list:
|
62
|
+
status = "Active"
|
63
|
+
else:
|
64
|
+
status = "Inactive"
|
65
|
+
|
66
|
+
table.add_row(server,
|
67
|
+
"[red]Inactive" if status == "Inactive" else "[green]Active",
|
68
|
+
)
|
69
|
+
return table
|
70
|
+
|
71
|
+
try:
|
72
|
+
layout.split_row(
|
73
|
+
Layout(Panel(generate_table(p_client1), box.ROUNDED)),
|
74
|
+
Layout(Panel(generate_table(p_client2), box.ROUNDED)),
|
75
|
+
Layout(Panel(generate_table(p_client3), box.ROUNDED))
|
76
|
+
)
|
77
|
+
with Live(layout, refresh_per_second=4, screen=True) as live:
|
78
|
+
while True:
|
79
|
+
time.sleep(2)
|
80
|
+
live.update(layout)
|
81
|
+
|
82
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
83
|
+
print_exception_response(e)
|
84
|
+
assert e.related_http_code != "200", "Invalid parameters"
|
85
|
+
|
86
|
+
|
87
|
+
if __name__ == "__main__":
|
88
|
+
parser = argparse.ArgumentParser()
|
89
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
90
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
91
|
+
parser.add_argument("--userid", help="User Id")
|
92
|
+
args = parser.parse_args()
|
93
|
+
|
94
|
+
server = args.server if args.server is not None else "active-metadata-store"
|
95
|
+
url = args.url if args.url is not None else "https://cray.local:9443"
|
96
|
+
userid = args.userid if args.userid is not None else 'garygeeke'
|
97
|
+
|
98
|
+
test_display_status(server, url, userid)
|
@@ -7,43 +7,25 @@ A simple viewer for collections - provide the root and we display the hierarchy
|
|
7
7
|
|
8
8
|
"""
|
9
9
|
|
10
|
-
import time
|
11
10
|
import argparse
|
12
11
|
|
13
|
-
from rich
|
14
|
-
from rich.
|
12
|
+
from rich import print
|
13
|
+
from rich.panel import Panel
|
15
14
|
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
15
|
from rich.text import Text
|
26
16
|
from rich.tree import Tree
|
27
|
-
from rich.markdown import Markdown
|
28
17
|
|
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
18
|
from pyegeria import CollectionManager, UserNotAuthorizedException, PropertyServerException, InvalidParameterException
|
19
|
+
from pyegeria._exceptions import (
|
20
|
+
print_exception_response,
|
21
|
+
)
|
36
22
|
|
37
23
|
disable_ssl_warnings = True
|
38
24
|
|
39
|
-
platform = "https://127.0.0.1:9443"
|
40
|
-
user = "erinoverview"
|
41
|
-
view_server = "view-server"
|
42
25
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
def walk_collection_hierarchy(collection_client: CollectionManager, root_collection_name: str, tree: Tree) -> Tree:
|
26
|
+
def collection_viewer(root: str, server_name: str, platform_url: str, user: str):
|
27
|
+
""" A simple collection viewer"""
|
28
|
+
def walk_collection_hierarchy(collection_client: CollectionManager, root_collection_name: str, tree: Tree) -> None:
|
47
29
|
"""Recursively build a Tree with collection contents."""
|
48
30
|
members = collection_client.get_member_list(root_collection_name)
|
49
31
|
if members:
|
@@ -56,7 +38,7 @@ def collection_viewer(root: str, server_name:str, platform_url:str, user:str):
|
|
56
38
|
text_collection_type = Text(f"* Collection Type: {member['collectionType']}", "cyan")
|
57
39
|
text_description = Text(f"* Description: {member['description']}", "cyan")
|
58
40
|
p = Panel.fit(f"[white]{text_collection_name}[green]\n{text_qualified_name}\n{text_guid}\n"
|
59
|
-
|
41
|
+
f"{text_collection_type}\n{text_description}")
|
60
42
|
tt = tree.add(p, style=style)
|
61
43
|
|
62
44
|
children = collection_client.get_collection_members(member['guid'])
|
@@ -64,14 +46,13 @@ def collection_viewer(root: str, server_name:str, platform_url:str, user:str):
|
|
64
46
|
branch = tt.add(f"[bold magenta]Members", style=style, guide_style=style)
|
65
47
|
walk_collection_hierarchy(collection_client, member['qualifiedName'], branch),
|
66
48
|
|
67
|
-
|
68
49
|
try:
|
69
50
|
tree = Tree(f"[bold bright green]{root}", guide_style="bold bright_blue")
|
70
|
-
c_client = CollectionManager(
|
51
|
+
c_client = CollectionManager(server_name, platform_url,
|
71
52
|
user_id=user)
|
72
53
|
|
73
54
|
token = c_client.create_egeria_bearer_token(user, "secret")
|
74
|
-
walk_collection_hierarchy(c_client,root,tree)
|
55
|
+
walk_collection_hierarchy(c_client, root, tree)
|
75
56
|
print(tree)
|
76
57
|
|
77
58
|
except (
|
@@ -95,4 +76,4 @@ if __name__ == "__main__":
|
|
95
76
|
userid = args.userid if args.userid is not None else 'erinoverview'
|
96
77
|
|
97
78
|
root_collection = Prompt.ask("Enter the Root Collection to start from:", default="Digital Products Root")
|
98
|
-
collection_viewer(root_collection,server, url, userid)
|
79
|
+
collection_viewer(root_collection, server, url, userid)
|
@@ -11,52 +11,31 @@ A simple status display for Engine Actions
|
|
11
11
|
|
12
12
|
import argparse
|
13
13
|
import json
|
14
|
-
import time
|
15
14
|
import sys
|
15
|
+
import time
|
16
16
|
|
17
17
|
from rich import box
|
18
|
-
from rich.live import Live
|
19
|
-
from rich.table import Table
|
20
18
|
from rich.console import Console
|
19
|
+
from rich.table import Table
|
21
20
|
|
21
|
+
from pyegeria import AutomatedCuration
|
22
22
|
from pyegeria import (
|
23
23
|
InvalidParameterException,
|
24
24
|
PropertyServerException,
|
25
25
|
UserNotAuthorizedException,
|
26
26
|
print_exception_response,
|
27
27
|
)
|
28
|
-
from pyegeria import GovEng, AutomatedCuration
|
29
28
|
|
30
29
|
disable_ssl_warnings = True
|
31
30
|
|
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
31
|
|
40
|
-
|
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_status_engine_actions(server: str = good_server_3, url: str = good_platform1_url, user: str = good_user_1):
|
32
|
+
def display_status_engine_actions(server: str, url: str, user: str):
|
54
33
|
g_client = AutomatedCuration(server, url, user, user_pwd="secret")
|
55
34
|
|
56
35
|
def generate_table() -> Table:
|
57
36
|
"""Make a new table."""
|
58
37
|
table = Table(
|
59
|
-
title=f"Engine Action Status for Platform {
|
38
|
+
title=f"Engine Action Status for Platform {url} @ {time.asctime()}",
|
60
39
|
# style = "black on grey66",
|
61
40
|
header_style="white on dark_blue",
|
62
41
|
show_lines=True,
|
@@ -103,7 +82,7 @@ def display_status_engine_actions(server: str = good_server_3, url: str = good_p
|
|
103
82
|
else:
|
104
83
|
action_status = f"[red]{action['actionStatus']}"
|
105
84
|
|
106
|
-
target= action.get("actionTargetElements","Empty")
|
85
|
+
target= action.get("actionTargetElements", "Empty")
|
107
86
|
if type(target) is list:
|
108
87
|
target_element = json.dumps(target[0]["targetElement"]["elementProperties"]["propertiesAsStrings"])
|
109
88
|
else:
|
@@ -119,7 +98,7 @@ def display_status_engine_actions(server: str = good_server_3, url: str = good_p
|
|
119
98
|
else:
|
120
99
|
print("Egeria integration daemon not running")
|
121
100
|
sys.exit()
|
122
|
-
|
101
|
+
|
123
102
|
return table
|
124
103
|
|
125
104
|
try:
|
@@ -130,6 +109,8 @@ def display_status_engine_actions(server: str = good_server_3, url: str = good_p
|
|
130
109
|
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
131
110
|
print_exception_response(e)
|
132
111
|
assert e.related_http_code != "200", "Invalid parameters"
|
112
|
+
finally:
|
113
|
+
g_client.close_session()
|
133
114
|
|
134
115
|
|
135
116
|
if __name__ == "__main__":
|
@@ -10,51 +10,24 @@ Unit tests for the Utils helper functions using the Pytest framework.
|
|
10
10
|
A simple display for glossary terms
|
11
11
|
"""
|
12
12
|
|
13
|
-
import time
|
14
|
-
import json
|
15
13
|
import argparse
|
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
|
+
|
16
21
|
from pyegeria import (
|
17
22
|
InvalidParameterException,
|
18
23
|
PropertyServerException,
|
19
24
|
UserNotAuthorizedException,
|
20
25
|
print_exception_response,
|
21
26
|
)
|
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
27
|
from pyegeria.my_profile_omvs import MyProfile
|
30
28
|
|
31
|
-
from pyegeria.server_operations import ServerOps
|
32
|
-
from pyegeria.gov_engine import GovEng
|
33
|
-
from pyegeria.glossary_omvs import GlossaryBrowser
|
34
|
-
disable_ssl_warnings = True
|
35
|
-
|
36
|
-
good_platform1_url = "https://127.0.0.1:9443"
|
37
|
-
good_platform2_url = "https://egeria.pdr-associates.com:7443"
|
38
|
-
bad_platform1_url = "https://localhost:9443"
|
39
|
-
|
40
|
-
# good_platform1_url = "https://127.0.0.1:30080"
|
41
|
-
# good_platform2_url = "https://127.0.0.1:30081"
|
42
|
-
# bad_platform1_url = "https://localhost:9443"
|
43
|
-
|
44
|
-
good_user_1 = "garygeeke"
|
45
|
-
good_user_2 = "erinoverview"
|
46
|
-
bad_user_1 = "eviledna"
|
47
|
-
bad_user_2 = ""
|
48
|
-
|
49
|
-
good_server_1 = "active-metadata-store"
|
50
|
-
good_server_2 = "simple-metadata-store"
|
51
|
-
good_server_3 = "view-server"
|
52
|
-
good_server_4 = "engine-host"
|
53
|
-
bad_server_1 = "coco"
|
54
|
-
bad_server_2 = ""
|
55
|
-
|
56
29
|
|
57
|
-
def display_to_dos(search_string: str, guid:
|
30
|
+
def display_to_dos(search_string: str, guid:str, server: str, url: str, username: str):
|
58
31
|
|
59
32
|
m_client = MyProfile(server, url, user_id=username)
|
60
33
|
token = m_client.create_egeria_bearer_token(username, "secret")
|
@@ -62,7 +35,7 @@ def display_to_dos(search_string: str, guid: str=None, server: str = good_server
|
|
62
35
|
def generate_table(search_string:str = '*') -> Table:
|
63
36
|
"""Make a new table."""
|
64
37
|
table = Table(
|
65
|
-
title=f"Open ToDos for Platform {
|
38
|
+
title=f"Open ToDos for Platform {url} @ {time.asctime()}",
|
66
39
|
# style = "black on grey66",
|
67
40
|
header_style="white on dark_blue",
|
68
41
|
show_lines=True,
|
@@ -134,7 +107,6 @@ def display_to_dos(search_string: str, guid: str=None, server: str = good_server
|
|
134
107
|
assert e.related_http_code != "200", "Invalid parameters"
|
135
108
|
|
136
109
|
if __name__ == "__main__":
|
137
|
-
sus_guid = "f9b78b26-6025-43fa-9299-a905cc6d1575"
|
138
110
|
parser = argparse.ArgumentParser()
|
139
111
|
parser.add_argument("--server", help="Name of the server to display status for")
|
140
112
|
parser.add_argument("--url", help="URL Platform to connect to")
|
@@ -145,7 +117,6 @@ if __name__ == "__main__":
|
|
145
117
|
server = args.server if args.server is not None else "view-server"
|
146
118
|
url = args.url if args.url is not None else "https://localhost:9443"
|
147
119
|
userid = args.userid if args.userid is not None else 'erinoverview'
|
148
|
-
# guid = args.guid if args.guid is not None else None
|
149
120
|
guid = None
|
150
121
|
|
151
122
|
search_string = Prompt.ask("Enter the ToDo you are searching for:", default="*")
|
@@ -0,0 +1,135 @@
|
|
1
|
+
#!python
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
A simple widget to retrieve the registered services.
|
7
|
+
|
8
|
+
"""
|
9
|
+
|
10
|
+
import argparse
|
11
|
+
import sys
|
12
|
+
import time
|
13
|
+
|
14
|
+
from rich import box
|
15
|
+
from rich.console import Console
|
16
|
+
from rich.prompt import Prompt
|
17
|
+
from rich.table import Table
|
18
|
+
|
19
|
+
from pyegeria import (
|
20
|
+
InvalidParameterException,
|
21
|
+
PropertyServerException,
|
22
|
+
UserNotAuthorizedException,
|
23
|
+
RegisteredInfo,
|
24
|
+
)
|
25
|
+
|
26
|
+
|
27
|
+
def display_registered_svcs(service: str, server: str , url: str,
|
28
|
+
username: str, password: str ):
|
29
|
+
""" Display the registered services list
|
30
|
+
Parameters
|
31
|
+
----------
|
32
|
+
service : str, optional
|
33
|
+
The type of service to display information for. Default is "help".
|
34
|
+
|
35
|
+
server : str, optional
|
36
|
+
The server to connect to. Default is `default_server`.
|
37
|
+
|
38
|
+
url : str, optional
|
39
|
+
The platform URL. Default is `default_platform`.
|
40
|
+
|
41
|
+
username : str, optional
|
42
|
+
The username for authentication. Default is `default_user`.
|
43
|
+
|
44
|
+
password : str, optional
|
45
|
+
The password for authentication. Default is `default_password`.
|
46
|
+
"""
|
47
|
+
def generate_table(svc_list) -> Table:
|
48
|
+
"""Make a new table."""
|
49
|
+
table = Table(
|
50
|
+
title=f"Technology Types for: {url} @ {time.asctime()}",
|
51
|
+
# style = "black on grey66",
|
52
|
+
header_style="white on dark_blue",
|
53
|
+
show_lines=True,
|
54
|
+
box=box.ROUNDED,
|
55
|
+
caption=f"Registered Services from Server '{server}' @ Platform - {url}",
|
56
|
+
expand=True
|
57
|
+
)
|
58
|
+
table.add_column("Service Id")
|
59
|
+
table.add_column("Service Name")
|
60
|
+
table.add_column("Service Development Status")
|
61
|
+
table.add_column("URL Marker")
|
62
|
+
table.add_column("Description")
|
63
|
+
table.add_column("Wiki")
|
64
|
+
table.add_column("Server Type")
|
65
|
+
table.add_column("Partner Service Name")
|
66
|
+
table.add_column("Partner Service Type")
|
67
|
+
|
68
|
+
if type(svc_list) is list:
|
69
|
+
for svc in svc_list:
|
70
|
+
svc_id = str(svc.get("serviceId", " "))
|
71
|
+
svc_name = svc.get("serviceName", "b")
|
72
|
+
svc_dev_status = svc.get("serviceDevelopmentStatus", " ")
|
73
|
+
svc_url_marker = svc.get("serviceUrlMarker", " ")
|
74
|
+
svc_description = svc.get("serviceDescription", " ")
|
75
|
+
svc_wiki = svc.get("serviceWiki", " ")
|
76
|
+
svc_partner_svc_name = svc.get("partnerServiceName", " ")
|
77
|
+
svc_partner_svc_type = svc.get("partnerServiceType", " ")
|
78
|
+
|
79
|
+
table.add_row(
|
80
|
+
svc_id, svc_name, svc_dev_status, svc_url_marker, svc_description, svc_wiki,
|
81
|
+
svc_partner_svc_name, svc_partner_svc_type
|
82
|
+
)
|
83
|
+
return table
|
84
|
+
elif type(svc_list) is str:
|
85
|
+
help = """
|
86
|
+
The kinds of services that you can get more information include:
|
87
|
+
all.....................lists all registered services
|
88
|
+
access-services.........lists all registered access services
|
89
|
+
common-services.........lists all registered common services
|
90
|
+
engine-services.........lists all registered engine services
|
91
|
+
governance-services.....lists all registered governance services
|
92
|
+
integration-services....lists all registered integration services
|
93
|
+
view-services...........lists all registered view services
|
94
|
+
|
95
|
+
Pass in a parameter from the left-hand column into the function to
|
96
|
+
get more details on the specified service category.
|
97
|
+
"""
|
98
|
+
console.print(help)
|
99
|
+
|
100
|
+
else:
|
101
|
+
print("Unknown service type")
|
102
|
+
sys.exit(1)
|
103
|
+
|
104
|
+
console = Console()
|
105
|
+
try:
|
106
|
+
a_client = RegisteredInfo(server, url, username)
|
107
|
+
# token = a_client.create_egeria_bearer_token(username, password)
|
108
|
+
svc_list = a_client.list_registered_svcs(service)
|
109
|
+
|
110
|
+
with console.pager():
|
111
|
+
console.print(generate_table(svc_list))
|
112
|
+
|
113
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
114
|
+
console.print_exception(show_locals=True)
|
115
|
+
finally:
|
116
|
+
a_client.close_session()
|
117
|
+
|
118
|
+
|
119
|
+
if __name__ == "__main__":
|
120
|
+
parser = argparse.ArgumentParser()
|
121
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
122
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
123
|
+
parser.add_argument("--userid", help="User Id")
|
124
|
+
parser.add_argument("--password", help="Password")
|
125
|
+
|
126
|
+
args = parser.parse_args()
|
127
|
+
|
128
|
+
server = args.server if args.server is not None else "active-metadata-store"
|
129
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
130
|
+
userid = args.userid if args.userid is not None else 'garygeeke'
|
131
|
+
password = args.password if args.password is not None else 'secret'
|
132
|
+
|
133
|
+
svc_kind = Prompt.ask("Enter the service type you are searching for:", default="all")
|
134
|
+
|
135
|
+
display_registered_svcs(svc_kind, server, url, userid, password=password)
|