pyegeria 0.3.8__py3-none-any.whl → 0.4.0__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/Xfeedback_manager_omvs.py +238 -0
- pyegeria/Xloaded_resources_omvs.py +91 -0
- pyegeria/__init__.py +15 -12
- pyegeria/_client.py +4 -6
- pyegeria/{gov_engine.py → _deprecated_gov_engine.py} +2 -59
- pyegeria/_exceptions.py +5 -6
- pyegeria/_globals.py +3 -1
- pyegeria/asset_catalog_omvs.py +672 -0
- pyegeria/automated_curation_omvs.py +627 -359
- pyegeria/collection_manager_omvs.py +187 -248
- pyegeria/core_guids.py +128 -0
- pyegeria/core_omag_server_config.py +1 -5
- pyegeria/full_omag_server_config.py +53 -83
- pyegeria/glossary_browser_omvs.py +2208 -0
- pyegeria/glossary_manager_omvs.py +3002 -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/runtime_manager_omvs.py +967 -0
- pyegeria/server_operations.py +1 -5
- pyegeria/valid_metadata_omvs.py +204 -43
- pyegeria-0.4.0.data/scripts/Create_Collection_Sample.py +292 -0
- pyegeria-0.4.0.data/scripts/Create_Sustainability_Collection_Sample.py +115 -0
- pyegeria-0.4.0.data/scripts/get_guid_info.py +86 -0
- pyegeria-0.3.8.data/scripts/view_my_profile.py → pyegeria-0.4.0.data/scripts/get_my_profile.py +8 -34
- {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/get_tech_details.py +1 -37
- pyegeria-0.4.0.data/scripts/get_tech_type_elements.py +137 -0
- pyegeria-0.4.0.data/scripts/get_tech_type_template.py +137 -0
- {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/list_asset_types.py +3 -25
- pyegeria-0.4.0.data/scripts/list_assets.py +138 -0
- pyegeria-0.3.8.data/scripts/project_list_viewer.py → pyegeria-0.4.0.data/scripts/list_projects.py +13 -27
- pyegeria-0.4.0.data/scripts/list_registered_services.py +135 -0
- pyegeria-0.3.8.data/scripts/get_relationship_types.py → pyegeria-0.4.0.data/scripts/list_relationship_types.py +25 -43
- pyegeria-0.4.0.data/scripts/list_tech_templates.py +134 -0
- pyegeria-0.3.8.data/scripts/find_todos.py → pyegeria-0.4.0.data/scripts/list_todos.py +11 -39
- pyegeria-0.4.0.data/scripts/list_valid_metadata_values.py +144 -0
- pyegeria-0.4.0.data/scripts/view_asset_graph.py +236 -0
- pyegeria-0.3.8.data/scripts/multi-server_status.py → pyegeria-0.4.0.data/scripts/view_coco_status.py +17 -39
- pyegeria-0.3.8.data/scripts/collection_viewer.py → pyegeria-0.4.0.data/scripts/view_collection.py +12 -31
- pyegeria-0.3.8.data/scripts/engine_action_status.py → pyegeria-0.4.0.data/scripts/view_eng_action_status.py +17 -31
- pyegeria-0.3.8.data/scripts/glossary_view.py → pyegeria-0.4.0.data/scripts/view_glossary.py +2 -2
- pyegeria-0.3.8.data/scripts/gov_engine_status.py → pyegeria-0.4.0.data/scripts/view_gov_eng_status.py +0 -1
- pyegeria-0.3.8.data/scripts/integration_daemon_status.py → pyegeria-0.4.0.data/scripts/view_integ_daemon_status.py +30 -42
- pyegeria-0.3.8.data/scripts/my_todos.py → pyegeria-0.4.0.data/scripts/view_my_todos.py +1 -1
- pyegeria-0.3.8.data/scripts/open_todos.py → pyegeria-0.4.0.data/scripts/view_open_todos.py +3 -24
- pyegeria-0.4.0.data/scripts/view_platform_status.py +123 -0
- pyegeria-0.3.8.data/scripts/server_status.py → pyegeria-0.4.0.data/scripts/view_server_status.py +1 -20
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/METADATA +5 -4
- pyegeria-0.4.0.dist-info/RECORD +58 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/WHEEL +1 -1
- 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 → action_author_omvs.py} +0 -0
- /pyegeria-0.3.8.data/scripts/get_tech_types.py → /pyegeria-0.4.0.data/scripts/list_tech_types.py +0 -0
- /pyegeria-0.3.8.data/scripts/server_status_widget.py → /pyegeria-0.4.0.data/scripts/view_server_list.py +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/LICENSE +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/top_level.txt +0 -0
@@ -8,41 +8,26 @@ Copyright Contributors to the ODPi Egeria project.
|
|
8
8
|
Get valid relationship types.
|
9
9
|
"""
|
10
10
|
|
11
|
-
import time
|
12
|
-
import json
|
13
11
|
import argparse
|
12
|
+
import time
|
13
|
+
|
14
|
+
from rich import box
|
15
|
+
from rich import print
|
16
|
+
from rich.console import Console
|
17
|
+
from rich.prompt import Prompt
|
18
|
+
from rich.table import Table
|
19
|
+
|
14
20
|
from pyegeria import (
|
15
21
|
InvalidParameterException,
|
16
22
|
PropertyServerException,
|
17
23
|
UserNotAuthorizedException,
|
18
24
|
print_exception_response,
|
19
25
|
)
|
20
|
-
from
|
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
|
26
|
+
from pyegeria import ValidMetadataManager
|
28
27
|
|
29
|
-
disable_ssl_warnings = True
|
30
28
|
|
31
|
-
|
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):
|
29
|
+
def display_list(type_name:str, server: str, url: str ,
|
30
|
+
username: str, save_output: bool = False):
|
46
31
|
|
47
32
|
p_client = ValidMetadataManager(server, url, user_id=username)
|
48
33
|
token = p_client.create_egeria_bearer_token(username, "secret")
|
@@ -58,20 +43,19 @@ def display_list(type_name:str, server: str = good_server_3, url: str = good_pla
|
|
58
43
|
expand=True
|
59
44
|
)
|
60
45
|
|
61
|
-
|
46
|
+
table.add_column("Status")
|
62
47
|
table.add_column("Name")
|
63
48
|
# table.add_column("GUID", no_wrap=True,)
|
64
|
-
|
49
|
+
|
65
50
|
table.add_column("Description")
|
66
|
-
table.add_column("
|
67
|
-
table.add_column("
|
68
|
-
table.add_column("
|
69
|
-
table.add_column("
|
70
|
-
|
71
|
-
table.add_column("Attribute Description")
|
51
|
+
table.add_column("Attrib Name")
|
52
|
+
table.add_column("Attrib Status")
|
53
|
+
table.add_column("Attrib Type")
|
54
|
+
table.add_column("Attrib Description")
|
55
|
+
table.add_column("Description Wiki", no_wrap=True)
|
72
56
|
|
73
57
|
types_list = p_client.get_valid_relationship_types(type_name)
|
74
|
-
|
58
|
+
|
75
59
|
print(type(types_list))
|
76
60
|
if types_list is None:
|
77
61
|
name = " "
|
@@ -97,19 +81,17 @@ def display_list(type_name:str, server: str = good_server_3, url: str = good_pla
|
|
97
81
|
attr_status = attr['attributeStatus']
|
98
82
|
attr_type = attr['attributeType']["name"]
|
99
83
|
table.add_row(
|
100
|
-
|
84
|
+
status, name, description, attr_name, attr_status, attr_type, attr_desc,
|
85
|
+
description_wiki
|
101
86
|
)
|
102
87
|
else:
|
103
|
-
table.add_row(name,
|
88
|
+
table.add_row(status,name,description,description_wiki," ", " ", " "," " )
|
104
89
|
|
105
90
|
p_client.close_session()
|
106
91
|
return table
|
107
92
|
|
108
93
|
try:
|
109
|
-
|
110
|
-
# while True:
|
111
|
-
# time.sleep(2)
|
112
|
-
# live.update(generate_table())
|
94
|
+
|
113
95
|
console = Console(record=True)
|
114
96
|
with console.pager():
|
115
97
|
console.print(generate_table(type_name))
|
@@ -129,13 +111,13 @@ if __name__ == "__main__":
|
|
129
111
|
parser.add_argument("--url", help="URL Platform to connect to")
|
130
112
|
parser.add_argument("--userid", help="User Id")
|
131
113
|
parser.add_argument("--save-output", help="Save output to file?")
|
132
|
-
|
114
|
+
|
133
115
|
args = parser.parse_args()
|
134
116
|
|
135
117
|
server = args.server if args.server is not None else "view-server"
|
136
118
|
url = args.url if args.url is not None else "https://localhost:9443"
|
137
119
|
userid = args.userid if args.userid is not None else 'erinoverview'
|
138
120
|
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="
|
121
|
+
type_name = Prompt.ask("Enter the Type Name to retrieve:", default="AssetOwner")
|
140
122
|
|
141
123
|
display_list(type_name, server, url, userid, save_output)
|
@@ -0,0 +1,134 @@
|
|
1
|
+
"""This creates a templates guid file from the core metadata archive"""
|
2
|
+
from rich.markdown import Markdown
|
3
|
+
from rich.prompt import Prompt
|
4
|
+
|
5
|
+
from pyegeria import AutomatedCuration
|
6
|
+
from datetime import datetime
|
7
|
+
import argparse
|
8
|
+
import time
|
9
|
+
import sys
|
10
|
+
from rich import box
|
11
|
+
from rich.console import Console
|
12
|
+
from rich.table import Table
|
13
|
+
|
14
|
+
from pyegeria import (
|
15
|
+
InvalidParameterException,
|
16
|
+
PropertyServerException,
|
17
|
+
UserNotAuthorizedException,
|
18
|
+
print_exception_response,
|
19
|
+
RegisteredInfo
|
20
|
+
)
|
21
|
+
|
22
|
+
|
23
|
+
console = Console()
|
24
|
+
server = "active-metadata-server"
|
25
|
+
platform = "https://localhost:9443"
|
26
|
+
user = "erinoverview"
|
27
|
+
password = "secret"
|
28
|
+
|
29
|
+
def display_tech_types(search_string:str = "*", server: str = server,
|
30
|
+
url: str = platform, username: str = user, password: str = password,):
|
31
|
+
|
32
|
+
a_client = AutomatedCuration(server, url, username)
|
33
|
+
token = a_client.create_egeria_bearer_token(user, password)
|
34
|
+
tech_list = a_client.find_technology_types(search_string, page_size=0)
|
35
|
+
|
36
|
+
def generate_table() -> Table:
|
37
|
+
"""Make a new table."""
|
38
|
+
table = Table(
|
39
|
+
title=f"Technology Templates for: {url} @ {time.asctime()}",
|
40
|
+
# style = "black on grey66",
|
41
|
+
header_style="white on dark_blue",
|
42
|
+
show_lines=True,
|
43
|
+
box=box.ROUNDED,
|
44
|
+
caption=f"Templates from Server '{server}' @ Platform - {url}",
|
45
|
+
expand=True,
|
46
|
+
# width=500
|
47
|
+
)
|
48
|
+
|
49
|
+
table.add_column("Name", width=20)
|
50
|
+
table.add_column("Template Name", width=20)
|
51
|
+
table.add_column("Template GUID", width = 38,no_wrap=True)
|
52
|
+
table.add_column("Placeholders")
|
53
|
+
|
54
|
+
|
55
|
+
if type(tech_list) is list:
|
56
|
+
for item in tech_list:
|
57
|
+
if 'deployedImplementationType' not in item['qualifiedName']:
|
58
|
+
continue
|
59
|
+
placeholder_table = Table(expand=False, show_lines=True)
|
60
|
+
placeholder_table.add_column("Name", width = 20,no_wrap=True)
|
61
|
+
placeholder_table.add_column("Type", width = 10)
|
62
|
+
placeholder_table.add_column("Required", width = 10)
|
63
|
+
placeholder_table.add_column("Example", width = 20)
|
64
|
+
placeholder_table.add_column("Description", width = 40)
|
65
|
+
|
66
|
+
|
67
|
+
name = item.get("name", "none")
|
68
|
+
|
69
|
+
details = a_client.get_technology_type_detail(name)
|
70
|
+
if type(details) is str:
|
71
|
+
console.log(f"Missing details for - {name}: {details}")
|
72
|
+
continue
|
73
|
+
|
74
|
+
templates = details.get("catalogTemplates", "Not Found")
|
75
|
+
if type(templates) is not str:
|
76
|
+
for template in templates:
|
77
|
+
template_name = template.get("name", None)
|
78
|
+
|
79
|
+
template_name = f"{name}_Template" if template_name is None else template_name
|
80
|
+
|
81
|
+
specification = template["specification"]["placeholderProperty"]
|
82
|
+
template_guid = template["relatedElement"]["guid"]
|
83
|
+
|
84
|
+
for placeholder in specification:
|
85
|
+
placeholder_data_type = placeholder["dataType"]
|
86
|
+
placeholder_description = placeholder["description"]
|
87
|
+
placeholder_name = placeholder["placeholderPropertyName"]
|
88
|
+
placeholder_required = placeholder["required"]
|
89
|
+
placeholder_example = placeholder.get("example", None)
|
90
|
+
placeholder_table.add_row(placeholder_name, placeholder_data_type, placeholder_required,
|
91
|
+
placeholder_example, placeholder_description,)
|
92
|
+
|
93
|
+
table.add_row(name, template_name, template_guid, placeholder_table)
|
94
|
+
|
95
|
+
return table
|
96
|
+
else:
|
97
|
+
print("Unknown technology type")
|
98
|
+
sys.exit(1)
|
99
|
+
|
100
|
+
try:
|
101
|
+
console = Console()
|
102
|
+
with console.pager():
|
103
|
+
console.print(generate_table())
|
104
|
+
|
105
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
106
|
+
print_exception_response(e)
|
107
|
+
assert e.related_http_code != "200", "Invalid parameters"
|
108
|
+
finally:
|
109
|
+
a_client.close_session()
|
110
|
+
|
111
|
+
|
112
|
+
if __name__ == "__main__":
|
113
|
+
parser = argparse.ArgumentParser()
|
114
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
115
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
116
|
+
parser.add_argument("--userid", help="User Id")
|
117
|
+
parser.add_argument("--password", help="Password")
|
118
|
+
|
119
|
+
args = parser.parse_args()
|
120
|
+
|
121
|
+
server = args.server if args.server is not None else "view-server"
|
122
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
123
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
124
|
+
password = args.password if args.password is not None else 'secret'
|
125
|
+
guid = None
|
126
|
+
|
127
|
+
search_string = Prompt.ask("Enter the technology you are searching for:", default="*")
|
128
|
+
|
129
|
+
display_tech_types(search_string, server, url, userid, password)
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
@@ -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
29
|
|
44
|
-
|
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
|
-
|
57
|
-
def display_to_dos(search_string: str, guid: str=None, server: str = good_server_3, url: str = good_platform1_url, username: str = good_user_2):
|
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,
|
@@ -124,8 +97,9 @@ def display_to_dos(search_string: str, guid: str=None, server: str = good_server
|
|
124
97
|
# while True:
|
125
98
|
# time.sleep(2)
|
126
99
|
# live.update(generate_table())
|
127
|
-
console = Console()
|
100
|
+
console = Console(width = 200)
|
128
101
|
with console.pager():
|
102
|
+
|
129
103
|
console.print(generate_table(search_string))
|
130
104
|
|
131
105
|
|
@@ -134,7 +108,6 @@ def display_to_dos(search_string: str, guid: str=None, server: str = good_server
|
|
134
108
|
assert e.related_http_code != "200", "Invalid parameters"
|
135
109
|
|
136
110
|
if __name__ == "__main__":
|
137
|
-
sus_guid = "f9b78b26-6025-43fa-9299-a905cc6d1575"
|
138
111
|
parser = argparse.ArgumentParser()
|
139
112
|
parser.add_argument("--server", help="Name of the server to display status for")
|
140
113
|
parser.add_argument("--url", help="URL Platform to connect to")
|
@@ -145,7 +118,6 @@ if __name__ == "__main__":
|
|
145
118
|
server = args.server if args.server is not None else "view-server"
|
146
119
|
url = args.url if args.url is not None else "https://localhost:9443"
|
147
120
|
userid = args.userid if args.userid is not None else 'erinoverview'
|
148
|
-
# guid = args.guid if args.guid is not None else None
|
149
121
|
guid = None
|
150
122
|
|
151
123
|
search_string = Prompt.ask("Enter the ToDo you are searching for:", default="*")
|
@@ -0,0 +1,144 @@
|
|
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
|
30
|
+
|
31
|
+
disable_ssl_warnings = True
|
32
|
+
|
33
|
+
good_platform1_url = "https://127.0.0.1:9443"
|
34
|
+
good_platform2_url = "https://egeria.pdr-associates.com:7443"
|
35
|
+
bad_platform1_url = "https://localhost:9443"
|
36
|
+
|
37
|
+
# good_platform1_url = "https://127.0.0.1:30080"
|
38
|
+
# good_platform2_url = "https://127.0.0.1:30081"
|
39
|
+
# bad_platform1_url = "https://localhost:9443"
|
40
|
+
|
41
|
+
good_user_1 = "garygeeke"
|
42
|
+
good_user_2 = "erinoverview"
|
43
|
+
bad_user_1 = "eviledna"
|
44
|
+
bad_user_2 = ""
|
45
|
+
|
46
|
+
good_server_1 = "active-metadata-store"
|
47
|
+
good_server_2 = "simple-metadata-store"
|
48
|
+
good_server_3 = "view-server"
|
49
|
+
good_server_4 = "engine-host"
|
50
|
+
bad_server_1 = "coco"
|
51
|
+
bad_server_2 = ""
|
52
|
+
|
53
|
+
|
54
|
+
def display_values(property_name: str, type_name: str=None, server: str = good_server_3, url: str = good_platform1_url,
|
55
|
+
username: str = good_user_2, save_output: bool = False):
|
56
|
+
|
57
|
+
m_client = ValidMetadataManager(server, url, user_id=username)
|
58
|
+
token = m_client.create_egeria_bearer_token(username, "secret")
|
59
|
+
|
60
|
+
def generate_table(property_name: str, type_name: str) -> Table:
|
61
|
+
"""Make a new table."""
|
62
|
+
table = Table(
|
63
|
+
title=f"Valid Metadata Values for Property: {property_name} of type {type_name} @ {time.asctime()}",
|
64
|
+
header_style="white on dark_blue",
|
65
|
+
show_lines=True,
|
66
|
+
box=box.ROUNDED,
|
67
|
+
caption=f"Valid Metadata Values for Server '{server}' @ Platform - {url}",
|
68
|
+
expand=True
|
69
|
+
)
|
70
|
+
|
71
|
+
table.add_column("Category")
|
72
|
+
table.add_column("Display Name")
|
73
|
+
|
74
|
+
table.add_column("Preferred Value")
|
75
|
+
table.add_column("Deprecated")
|
76
|
+
table.add_column("Case Sensitive")
|
77
|
+
table.add_column("Additional Properties")
|
78
|
+
table.add_column("Description")
|
79
|
+
|
80
|
+
valid_values = m_client.get_valid_metadata_values(property_name, type_name)
|
81
|
+
|
82
|
+
if valid_values is None:
|
83
|
+
name = " "
|
84
|
+
type_name = " "
|
85
|
+
created = " "
|
86
|
+
priority = " "
|
87
|
+
due = " "
|
88
|
+
completed = " "
|
89
|
+
status = " "
|
90
|
+
sponsor = " "
|
91
|
+
elif type(valid_values[0]) == str:
|
92
|
+
raise ValueError("-->This is not a known metadata property with a valid value")
|
93
|
+
else:
|
94
|
+
for value in valid_values:
|
95
|
+
category = value.get("category","None")
|
96
|
+
display_name = value.get("displayName","None")
|
97
|
+
preferred_value = value.get("preferredValue", "None ")
|
98
|
+
deprecated = str(value.get("isDeprecated", "None "))
|
99
|
+
case_sensitive = str(value.get("isCaseSensitive", "None"))
|
100
|
+
description = value.get("description", "None")
|
101
|
+
additional_properties = value.get('additionalProperties',"None")
|
102
|
+
if additional_properties is not None:
|
103
|
+
props = json.dumps(additional_properties)
|
104
|
+
table.add_row(
|
105
|
+
category, display_name, preferred_value, deprecated, case_sensitive, props,description
|
106
|
+
)
|
107
|
+
|
108
|
+
m_client.close_session()
|
109
|
+
return table
|
110
|
+
|
111
|
+
try:
|
112
|
+
# with Live(generate_table(), refresh_per_second=4, screen=True) as live:
|
113
|
+
# while True:
|
114
|
+
# time.sleep(2)
|
115
|
+
# live.update(generate_table())
|
116
|
+
console = Console(record=True)
|
117
|
+
with console.pager():
|
118
|
+
console.print(generate_table(property_name, type_name))
|
119
|
+
if save_output:
|
120
|
+
console.save_html("valid-metadata-values.html")
|
121
|
+
|
122
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ValueError) as e:
|
123
|
+
if type(e) is str:
|
124
|
+
print(e)
|
125
|
+
else:
|
126
|
+
print_exception_response(e)
|
127
|
+
|
128
|
+
if __name__ == "__main__":
|
129
|
+
|
130
|
+
parser = argparse.ArgumentParser()
|
131
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
132
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
133
|
+
parser.add_argument("--userid", help="User Id")
|
134
|
+
parser.add_argument("--save-output", help="Save output to file?")
|
135
|
+
# parser.add_argument("--sponsor", help="Name of sponsor to search")
|
136
|
+
args = parser.parse_args()
|
137
|
+
|
138
|
+
server = args.server if args.server is not None else "view-server"
|
139
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
140
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
141
|
+
save_output = args.save_output if args.save_output is not None else False
|
142
|
+
property_name = Prompt.ask("Enter the Property to retrieve:", default="projectHealth")
|
143
|
+
type_name = Prompt.ask("Enter the Metadata Type to filter on:", default="Project")
|
144
|
+
display_values(property_name, type_name,server, url, userid, save_output)
|