pyegeria 0.6.3__py3-none-any.whl → 0.6.6__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.
- examples/widgets/cat/get_project_structure.py +165 -0
- examples/widgets/cat/list_cert_types.py +176 -0
- examples/widgets/cat/list_projects.py +20 -3
- examples/widgets/ops/monitor_engine_activity.py +14 -3
- pyegeria/__init__.py +4 -2
- pyegeria/_globals.py +1 -0
- pyegeria/asset_catalog_omvs.py +24 -29
- pyegeria/classification_manager_omvs.py +1830 -0
- pyegeria/feedback_manager_omvs.py +667 -674
- pyegeria/my_profile_omvs.py +6 -5
- pyegeria/project_manager_omvs.py +1 -1
- {pyegeria-0.6.3.dist-info → pyegeria-0.6.6.dist-info}/METADATA +3 -1
- {pyegeria-0.6.3.dist-info → pyegeria-0.6.6.dist-info}/RECORD +16 -14
- {pyegeria-0.6.3.dist-info → pyegeria-0.6.6.dist-info}/entry_points.txt +1 -0
- pyegeria/Xfeedback_manager_omvs.py +0 -238
- {pyegeria-0.6.3.dist-info → pyegeria-0.6.6.dist-info}/LICENSE +0 -0
- {pyegeria-0.6.3.dist-info → pyegeria-0.6.6.dist-info}/WHEEL +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")
|
@@ -111,9 +112,25 @@ def display_project_list(project_name: str, server: str, url: str,
|
|
111
112
|
additional_properties = project.get('additionalProperties')
|
112
113
|
if additional_properties is not None:
|
113
114
|
props = json.dumps(additional_properties)
|
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 = "---"
|
129
|
+
|
130
|
+
|
114
131
|
table.add_row(
|
115
132
|
name, description, classification, qualified_name, identifier, phase, health, status, start,
|
116
|
-
end,
|
133
|
+
end, certified_partner)
|
117
134
|
|
118
135
|
p_client.close_session()
|
119
136
|
return table
|
@@ -103,9 +103,20 @@ def display_engine_activity(server: str, url: str, user: str, user_pass: str, pa
|
|
103
103
|
else:
|
104
104
|
action_status = f"[red]{action['actionStatus']}"
|
105
105
|
|
106
|
-
|
107
|
-
if type(
|
108
|
-
|
106
|
+
targets = action.get("actionTargetElements", "Empty")
|
107
|
+
if type(targets) is list:
|
108
|
+
tgt_tab = Table()
|
109
|
+
tgt_tab.add_column('name')
|
110
|
+
tgt_tab.add_column('guid', no_wrap=True)
|
111
|
+
tgt_tab.add_column('type_name')
|
112
|
+
targets_md = ""
|
113
|
+
for target in targets:
|
114
|
+
t_name = target['actionTargetName']
|
115
|
+
t_guid = target['actionTargetGUID']
|
116
|
+
t_type = target['targetElement']['type']['typeName']
|
117
|
+
tgt_tab.add_row(t_name, t_guid, t_type)
|
118
|
+
# target_element = json.dumps(target[0]["targetElement"]["elementProperties"]["propertiesAsStrings"])
|
119
|
+
target_element = tgt_tab
|
109
120
|
else:
|
110
121
|
target_element = " "
|
111
122
|
|
pyegeria/__init__.py
CHANGED
@@ -11,8 +11,9 @@ the server platform and servers.
|
|
11
11
|
|
12
12
|
"""
|
13
13
|
|
14
|
-
from ._globals import (is_debug, disable_ssl_warnings, max_paging_size, TEMPLATE_GUIDS, INTEGRATION_GUIDS
|
15
|
-
|
14
|
+
from ._globals import (is_debug, disable_ssl_warnings, max_paging_size, TEMPLATE_GUIDS, INTEGRATION_GUIDS,
|
15
|
+
default_time_out
|
16
|
+
)
|
16
17
|
|
17
18
|
if disable_ssl_warnings:
|
18
19
|
from urllib3.exceptions import InsecureRequestWarning
|
@@ -47,6 +48,7 @@ from .runtime_manager_omvs import RuntimeManager
|
|
47
48
|
from .action_author_omvs import GovernanceAuthor
|
48
49
|
from .glossary_manager_omvs import GlossaryManager
|
49
50
|
from .create_tech_guid_lists import build_global_guid_lists
|
51
|
+
from .classification_manager_omvs import ClassificationManager
|
50
52
|
|
51
53
|
|
52
54
|
#
|
pyegeria/_globals.py
CHANGED
pyegeria/asset_catalog_omvs.py
CHANGED
@@ -9,16 +9,15 @@ Copyright Contributors to the ODPi Egeria project.
|
|
9
9
|
|
10
10
|
"""
|
11
11
|
import asyncio
|
12
|
-
from datetime import datetime
|
13
12
|
import json
|
14
13
|
|
15
14
|
from httpx import Response
|
16
15
|
|
17
|
-
from pyegeria import Client, max_paging_size, body_slimmer, TEMPLATE_GUIDS
|
16
|
+
from pyegeria import Client, max_paging_size, body_slimmer, TEMPLATE_GUIDS
|
18
17
|
from pyegeria._exceptions import (
|
19
18
|
InvalidParameterException,
|
20
19
|
)
|
21
|
-
from ._validators import
|
20
|
+
from ._validators import validate_search_string
|
22
21
|
|
23
22
|
|
24
23
|
class AssetCatalog(Client):
|
@@ -34,9 +33,6 @@ class AssetCatalog(Client):
|
|
34
33
|
when the user doesn't pass the user_id on a method call.
|
35
34
|
user_pwd: str
|
36
35
|
The password associated with the user_id. Defaults to None
|
37
|
-
verify_flag: bool
|
38
|
-
Flag to indicate if SSL Certificates should be verified in the HTTP requests.
|
39
|
-
Defaults to False.
|
40
36
|
|
41
37
|
"""
|
42
38
|
|
@@ -46,12 +42,10 @@ class AssetCatalog(Client):
|
|
46
42
|
platform_url: str,
|
47
43
|
user_id: str,
|
48
44
|
user_pwd: str = None,
|
49
|
-
verify_flag: bool = False,
|
50
45
|
):
|
51
|
-
Client.__init__(self, server_name, platform_url, user_id, user_pwd
|
46
|
+
Client.__init__(self, server_name, platform_url, user_id, user_pwd)
|
52
47
|
self.cur_command_root = f"{platform_url}/servers/"
|
53
48
|
|
54
|
-
|
55
49
|
async def _async_create_element_from_template(self, body: dict, server: str = None) -> str:
|
56
50
|
""" Create a new metadata element from a template. Async version.
|
57
51
|
Parameters
|
@@ -304,9 +298,9 @@ class AssetCatalog(Client):
|
|
304
298
|
#
|
305
299
|
|
306
300
|
async def _async_find_assets_in_domain(self, search_string: str, start_from: int = 0,
|
307
|
-
|
308
|
-
|
309
|
-
|
301
|
+
page_size: int = max_paging_size, starts_with: bool = True,
|
302
|
+
ends_with: bool = False, ignore_case: bool = True,
|
303
|
+
server: str = None, time_out: int = 60) -> list | str:
|
310
304
|
""" Retrieve the list of engine action metadata elements that contain the search string. Async Version.
|
311
305
|
Parameters
|
312
306
|
----------
|
@@ -366,9 +360,9 @@ class AssetCatalog(Client):
|
|
366
360
|
return response.json().get("searchMatches", "no assets found")
|
367
361
|
|
368
362
|
def find_assets_in_domain(self, search_string: str, start_from: int = 0,
|
369
|
-
|
370
|
-
|
371
|
-
|
363
|
+
page_size: int = max_paging_size, starts_with: bool = True,
|
364
|
+
ends_with: bool = False, ignore_case: bool = True,
|
365
|
+
server: str = None, time_out: int = 60) -> list | str:
|
372
366
|
""" Retrieve the list of engine action metadata elements that contain the search string. Async Version.
|
373
367
|
Parameters
|
374
368
|
----------
|
@@ -411,14 +405,13 @@ class AssetCatalog(Client):
|
|
411
405
|
"""
|
412
406
|
loop = asyncio.get_event_loop()
|
413
407
|
response = loop.run_until_complete(
|
414
|
-
self._async_find_assets_in_domain(search_string,
|
408
|
+
self._async_find_assets_in_domain(search_string, start_from, page_size,
|
415
409
|
starts_with, ends_with, ignore_case, server, time_out)
|
416
410
|
)
|
417
411
|
return response
|
418
412
|
|
419
|
-
|
420
|
-
|
421
|
-
page_size: int = max_paging_size) -> str| dict:
|
413
|
+
async def _async_get_asset_graph(self, asset_guid: str, server: str = None, start_from: int = 0,
|
414
|
+
page_size: int = max_paging_size) -> str | dict:
|
422
415
|
""" Return all the elements that are anchored to an asset plus relationships between these elements and to
|
423
416
|
other elements. Async Version.
|
424
417
|
Parameters
|
@@ -456,7 +449,7 @@ class AssetCatalog(Client):
|
|
456
449
|
return response.json().get("assetGraph", "no asset found")
|
457
450
|
|
458
451
|
def get_asset_graph(self, asset_guid: str, server: str = None, start_from: int = 0,
|
459
|
-
|
452
|
+
page_size: int = max_paging_size) -> str | dict:
|
460
453
|
""" Return all the elements that are anchored to an asset plus relationships between these elements and to
|
461
454
|
other elements.
|
462
455
|
Parameters
|
@@ -488,13 +481,14 @@ class AssetCatalog(Client):
|
|
488
481
|
|
489
482
|
loop = asyncio.get_event_loop()
|
490
483
|
response = loop.run_until_complete(
|
491
|
-
self._async_get_asset_graph(asset_guid, server,start_from, page_size)
|
484
|
+
self._async_get_asset_graph(asset_guid, server, start_from, page_size)
|
492
485
|
)
|
493
486
|
return response
|
494
487
|
|
495
|
-
async def _async_get_assets_by_metadata_collection_id(self, metadata_collection_id:str, type_name: str = None,
|
488
|
+
async def _async_get_assets_by_metadata_collection_id(self, metadata_collection_id: str, type_name: str = None,
|
496
489
|
effective_time: str = None, server: str = None,
|
497
|
-
start_from: int = 0,
|
490
|
+
start_from: int = 0,
|
491
|
+
page_size: int = max_paging_size) -> str | list:
|
498
492
|
""" Return a list of assets that come from the requested metadata collection. Can optionally
|
499
493
|
specify an type name as a filter and an effective time. Async Version.
|
500
494
|
|
@@ -545,9 +539,9 @@ class AssetCatalog(Client):
|
|
545
539
|
return response.json().get("assets", "no assets found")
|
546
540
|
|
547
541
|
def get_assets_by_metadata_collection_id(self, metadata_collection_id: str, type_name: str = None,
|
548
|
-
|
549
|
-
|
550
|
-
|
542
|
+
effective_time: str = None, server: str = None,
|
543
|
+
start_from: int = 0,
|
544
|
+
page_size: int = max_paging_size) -> str | list:
|
551
545
|
""" Return a list of assets that come from the requested metadata collection. Can optionally
|
552
546
|
specify an type name as a filter and an effective time. Async Version.
|
553
547
|
|
@@ -587,12 +581,12 @@ class AssetCatalog(Client):
|
|
587
581
|
loop = asyncio.get_event_loop()
|
588
582
|
response = loop.run_until_complete(
|
589
583
|
self._async_get_assets_by_metadata_collection_id(metadata_collection_id, type_name,
|
590
|
-
effective_time,server,start_from,
|
584
|
+
effective_time, server, start_from,
|
591
585
|
page_size)
|
592
586
|
)
|
593
587
|
return response
|
594
588
|
|
595
|
-
async def _async_get_asset_catalog_types(self, server: str = None) -> str| dict:
|
589
|
+
async def _async_get_asset_catalog_types(self, server: str = None) -> str | dict:
|
596
590
|
""" Return all the elements that are anchored to an asset plus relationships between these elements and to
|
597
591
|
other elements. Async Version.
|
598
592
|
Parameters
|
@@ -627,7 +621,7 @@ class AssetCatalog(Client):
|
|
627
621
|
|
628
622
|
response = await self._async_make_request("GET", url)
|
629
623
|
|
630
|
-
return response.json().get('types',"No assets found")
|
624
|
+
return response.json().get('types', "No assets found")
|
631
625
|
|
632
626
|
def get_asset_catalog_types(self, server: str = None) -> str | dict:
|
633
627
|
""" Return all the elements that are anchored to an asset plus relationships between these elements and to
|
@@ -665,6 +659,7 @@ class AssetCatalog(Client):
|
|
665
659
|
)
|
666
660
|
return response
|
667
661
|
|
662
|
+
|
668
663
|
if __name__ == "__main__":
|
669
664
|
p = AssetCatalog("active-metadata-store", "https://127.0.0.1:9443", "garygeeke", verify_flag=False)
|
670
665
|
response = p.get_assets_by_metadata_collection_id()
|