pyegeria 0.8.4.9__py3-none-any.whl → 0.8.4.10__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/ops/README.md +24 -0
- examples/widgets/ops/__init__.py +19 -0
- examples/widgets/ops/engine_actions.py +83 -0
- examples/widgets/ops/integration_daemon_actions.py +139 -0
- examples/widgets/ops/list_catalog_targets.py +157 -0
- examples/widgets/ops/load_archive.py +62 -0
- examples/widgets/ops/monitor_asset_events.py +102 -0
- examples/widgets/ops/monitor_coco_status.py +103 -0
- examples/widgets/ops/monitor_engine_activity.py +236 -0
- examples/widgets/ops/monitor_engine_activity_c.py +253 -0
- examples/widgets/ops/monitor_gov_eng_status.py +188 -0
- examples/widgets/ops/monitor_integ_daemon_status.py +256 -0
- examples/widgets/ops/monitor_platform_status.py +176 -0
- examples/widgets/ops/monitor_server_list.py +140 -0
- examples/widgets/ops/monitor_server_status.py +109 -0
- examples/widgets/ops/refresh_integration_daemon.py +73 -0
- examples/widgets/ops/restart_integration_daemon.py +73 -0
- pyegeria/classification_manager_omvs.py +195 -9
- {pyegeria-0.8.4.9.dist-info → pyegeria-0.8.4.10.dist-info}/METADATA +1 -1
- {pyegeria-0.8.4.9.dist-info → pyegeria-0.8.4.10.dist-info}/RECORD +23 -6
- {pyegeria-0.8.4.9.dist-info → pyegeria-0.8.4.10.dist-info}/LICENSE +0 -0
- {pyegeria-0.8.4.9.dist-info → pyegeria-0.8.4.10.dist-info}/WHEEL +0 -0
- {pyegeria-0.8.4.9.dist-info → pyegeria-0.8.4.10.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,140 @@
|
|
1
|
+
#!/usr/bin/env python3
|
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
|
10
|
+
"""
|
11
|
+
import argparse
|
12
|
+
import os
|
13
|
+
import time
|
14
|
+
|
15
|
+
from rich.live import Live
|
16
|
+
from rich.table import Table
|
17
|
+
|
18
|
+
from pyegeria._exceptions import (
|
19
|
+
InvalidParameterException,
|
20
|
+
PropertyServerException,
|
21
|
+
UserNotAuthorizedException,
|
22
|
+
print_exception_response,
|
23
|
+
)
|
24
|
+
from pyegeria.core_omag_server_config import CoreServerConfig
|
25
|
+
from pyegeria.server_operations import ServerOps
|
26
|
+
|
27
|
+
disable_ssl_warnings = True
|
28
|
+
|
29
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
30
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
31
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
32
|
+
EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
|
33
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
34
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
35
|
+
)
|
36
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
37
|
+
EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
|
38
|
+
"EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
|
39
|
+
)
|
40
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
41
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
42
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
43
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
44
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
45
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
46
|
+
|
47
|
+
|
48
|
+
def display_status(
|
49
|
+
server: str,
|
50
|
+
url: str,
|
51
|
+
username: str,
|
52
|
+
user_pass: str,
|
53
|
+
jupyter: bool = EGERIA_JUPYTER,
|
54
|
+
width: int = EGERIA_WIDTH,
|
55
|
+
):
|
56
|
+
p_client = ServerOps(server, url, username)
|
57
|
+
c_client = CoreServerConfig(server, url, username, user_pass)
|
58
|
+
|
59
|
+
def generate_table() -> Table:
|
60
|
+
"""Make a new table."""
|
61
|
+
table = Table(
|
62
|
+
title=f"Server Status for Platform - {time.asctime()}",
|
63
|
+
style="bold white on black",
|
64
|
+
row_styles=["bold white on black"],
|
65
|
+
header_style="white on dark_blue",
|
66
|
+
title_style="bold white on black",
|
67
|
+
caption_style="white on black",
|
68
|
+
caption=f"Server Status for Platform - '{url}'",
|
69
|
+
show_lines=True,
|
70
|
+
# expand=True
|
71
|
+
)
|
72
|
+
|
73
|
+
table.add_column("Known Server")
|
74
|
+
table.add_column("Status")
|
75
|
+
table.add_column("Server Type")
|
76
|
+
table.add_column("Server Description")
|
77
|
+
known_server_list = p_client.get_known_servers()
|
78
|
+
active_server_list = p_client.get_active_server_list()
|
79
|
+
if len(known_server_list) == 0:
|
80
|
+
return table
|
81
|
+
|
82
|
+
for server in known_server_list:
|
83
|
+
if server in active_server_list:
|
84
|
+
status = "Active"
|
85
|
+
else:
|
86
|
+
status = "Inactive"
|
87
|
+
server_type = c_client.get_server_type_classification(server)[
|
88
|
+
"serverTypeName"
|
89
|
+
]
|
90
|
+
description = c_client.get_basic_server_properties(server).get(
|
91
|
+
"localServerDescription", " "
|
92
|
+
)
|
93
|
+
|
94
|
+
table.add_row(
|
95
|
+
server,
|
96
|
+
"[red]Inactive" if status == "Inactive" else "[green]Active",
|
97
|
+
server_type,
|
98
|
+
description,
|
99
|
+
)
|
100
|
+
|
101
|
+
return table
|
102
|
+
|
103
|
+
try:
|
104
|
+
with Live(generate_table(), refresh_per_second=4, screen=True) as live:
|
105
|
+
while True:
|
106
|
+
time.sleep(2)
|
107
|
+
live.update(generate_table())
|
108
|
+
|
109
|
+
except (
|
110
|
+
InvalidParameterException,
|
111
|
+
PropertyServerException,
|
112
|
+
UserNotAuthorizedException,
|
113
|
+
) as e:
|
114
|
+
print_exception_response(e)
|
115
|
+
except KeyboardInterrupt:
|
116
|
+
pass
|
117
|
+
|
118
|
+
finally:
|
119
|
+
p_client.close_session()
|
120
|
+
c_client.close_session()
|
121
|
+
|
122
|
+
|
123
|
+
def main():
|
124
|
+
parser = argparse.ArgumentParser()
|
125
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
126
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
127
|
+
parser.add_argument("--userid", help="User Id")
|
128
|
+
parser.add_argument("--password", help="User Password")
|
129
|
+
args = parser.parse_args()
|
130
|
+
|
131
|
+
server = args.server if args.server is not None else EGERIA_METADATA_STORE
|
132
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
133
|
+
userid = args.userid if args.userid is not None else EGERIA_ADMIN_USER
|
134
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
135
|
+
|
136
|
+
display_status(server, url, userid, user_pass)
|
137
|
+
|
138
|
+
|
139
|
+
if __name__ == "__main__":
|
140
|
+
main()
|
@@ -0,0 +1,109 @@
|
|
1
|
+
#!/usr/bin/env python3
|
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
|
10
|
+
"""
|
11
|
+
import argparse
|
12
|
+
import os
|
13
|
+
import time
|
14
|
+
|
15
|
+
from rich.live import Live
|
16
|
+
from rich.table import Table
|
17
|
+
|
18
|
+
from pyegeria import (
|
19
|
+
InvalidParameterException,
|
20
|
+
PropertyServerException,
|
21
|
+
UserNotAuthorizedException,
|
22
|
+
print_exception_response,
|
23
|
+
ServerOps
|
24
|
+
)
|
25
|
+
|
26
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
27
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
|
28
|
+
EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
|
29
|
+
EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
|
30
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
|
31
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
|
32
|
+
EGERIA_INTEGRATION_DAEMON_URL = os.environ.get('EGERIA_INTEGRATION_DAEMON_URL', 'https://localhost:9443')
|
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
|
+
|
41
|
+
def display_status(server: str, url: str, username: str, user_pass: str, jupyter: bool = EGERIA_JUPYTER,
|
42
|
+
width: int = EGERIA_WIDTH):
|
43
|
+
p_client = ServerOps(server, url, username, user_pass)
|
44
|
+
|
45
|
+
def generate_table() -> Table:
|
46
|
+
"""Make a new table."""
|
47
|
+
table = Table(
|
48
|
+
title=f"Server Status for Platform - {time.asctime()}",
|
49
|
+
style="bold white on black",
|
50
|
+
row_styles=["bold white on black"],
|
51
|
+
header_style="white on dark_blue",
|
52
|
+
title_style="bold white on black",
|
53
|
+
caption_style="white on black",
|
54
|
+
caption=f"Server Status for Platform - '{url}'",
|
55
|
+
# show_lines=True,
|
56
|
+
)
|
57
|
+
|
58
|
+
table.add_column("Known Server")
|
59
|
+
table.add_column("Status")
|
60
|
+
|
61
|
+
known_server_list = p_client.get_known_servers()
|
62
|
+
active_server_list = p_client.get_active_server_list()
|
63
|
+
if len(known_server_list) == 0:
|
64
|
+
return table
|
65
|
+
|
66
|
+
for server in known_server_list:
|
67
|
+
if server in active_server_list:
|
68
|
+
status = "Active"
|
69
|
+
else:
|
70
|
+
status = "Inactive"
|
71
|
+
|
72
|
+
table.add_row(server,
|
73
|
+
"[red]Inactive" if status == "Inactive" else "[green]Active",
|
74
|
+
)
|
75
|
+
# p_client.close_session()
|
76
|
+
return table
|
77
|
+
|
78
|
+
try:
|
79
|
+
with Live(generate_table(), refresh_per_second=4, screen=True) as live:
|
80
|
+
while True:
|
81
|
+
time.sleep(2)
|
82
|
+
live.update(generate_table())
|
83
|
+
|
84
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
85
|
+
print_exception_response(e)
|
86
|
+
except KeyboardInterrupt:
|
87
|
+
pass
|
88
|
+
finally:
|
89
|
+
p_client.close_session()
|
90
|
+
|
91
|
+
|
92
|
+
def main():
|
93
|
+
parser = argparse.ArgumentParser()
|
94
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
95
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
96
|
+
parser.add_argument("--userid", help="User Id")
|
97
|
+
parser.add_argument("--password", help="User Password")
|
98
|
+
args = parser.parse_args()
|
99
|
+
|
100
|
+
server = args.server if args.server is not None else EGERIA_METADATA_STORE
|
101
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
102
|
+
userid = args.userid if args.userid is not None else EGERIA_ADMIN_USER
|
103
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
104
|
+
|
105
|
+
display_status(server, url, userid, user_pass)
|
106
|
+
|
107
|
+
|
108
|
+
if __name__ == "__main__":
|
109
|
+
main()
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"""
|
2
|
+
SPDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
This script refreshed an integration daemon.
|
8
|
+
|
9
|
+
"""
|
10
|
+
|
11
|
+
import os
|
12
|
+
import argparse
|
13
|
+
import time
|
14
|
+
|
15
|
+
from pyegeria import ServerOps, AutomatedCuration
|
16
|
+
from pyegeria._exceptions import (
|
17
|
+
InvalidParameterException,
|
18
|
+
PropertyServerException,
|
19
|
+
UserNotAuthorizedException,
|
20
|
+
print_exception_response,
|
21
|
+
)
|
22
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
23
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
|
24
|
+
EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
|
25
|
+
EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
|
26
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
|
27
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
|
28
|
+
EGERIA_INTEGRATION_DAEMON_URL = os.environ.get('EGERIA_INTEGRATION_DAEMON_URL', 'https://localhost:9443')
|
29
|
+
EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
|
30
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
|
31
|
+
EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
|
32
|
+
EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
def refresh_connector(connector: str, server:str, url:str, userid:str, password:str):
|
37
|
+
try:
|
38
|
+
|
39
|
+
s_client = ServerOps(server, url, userid)
|
40
|
+
if connector == 'all':
|
41
|
+
connector = None
|
42
|
+
statement = "ALL connectors"
|
43
|
+
else:
|
44
|
+
statement = f"the {connector} "
|
45
|
+
|
46
|
+
s_client.refresh_integration_connectors(connector, server, time_out = 60)
|
47
|
+
|
48
|
+
print(f"\n===> Integration Daemon \'{server}\' refreshed {statement}.")
|
49
|
+
|
50
|
+
|
51
|
+
except (InvalidParameterException, PropertyServerException) as e:
|
52
|
+
print_exception_response(e)
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
def main():
|
58
|
+
parser = argparse.ArgumentParser()
|
59
|
+
parser.add_argument("--server", help="Name of the integration daemon to refresh")
|
60
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
61
|
+
parser.add_argument("--userid", help="User Id")
|
62
|
+
parser.add_argument("--password", help="User Password")
|
63
|
+
parser.add_argument("--connector", default='all', help="Name of the connector to refresh")
|
64
|
+
args = parser.parse_args()
|
65
|
+
|
66
|
+
server = args.server if args.server is not None else EGERIA_INTEGRATION_DAEMON
|
67
|
+
url = args.url if args.url is not None else EGERIA_INTEGRATION_DAEMON_URL
|
68
|
+
userid = args.userid if args.userid is not None else EGERIA_ADMIN_USER
|
69
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
70
|
+
refresh_connector(args.connector, server, url, userid, user_pass)
|
71
|
+
|
72
|
+
if __name__ == "__main__":
|
73
|
+
main()
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"""
|
2
|
+
SPDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
This script restarts an integration daemon.
|
8
|
+
|
9
|
+
"""
|
10
|
+
|
11
|
+
import os
|
12
|
+
import argparse
|
13
|
+
import time
|
14
|
+
|
15
|
+
from pyegeria import ServerOps, AutomatedCuration
|
16
|
+
from pyegeria._exceptions import (
|
17
|
+
InvalidParameterException,
|
18
|
+
PropertyServerException,
|
19
|
+
UserNotAuthorizedException,
|
20
|
+
print_exception_response,
|
21
|
+
)
|
22
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
23
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get('KAFKA_ENDPOINT', 'localhost:9092')
|
24
|
+
EGERIA_PLATFORM_URL = os.environ.get('EGERIA_PLATFORM_URL', 'https://localhost:9443')
|
25
|
+
EGERIA_VIEW_SERVER = os.environ.get('VIEW_SERVER', 'view-server')
|
26
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
|
27
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
|
28
|
+
EGERIA_INTEGRATION_DAEMON_URL = os.environ.get('EGERIA_INTEGRATION_DAEMON_URL', 'https://localhost:9443')
|
29
|
+
EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
|
30
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
|
31
|
+
EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
|
32
|
+
EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
def restart_connector(connector: str, server:str, url:str, userid:str, password:str):
|
37
|
+
try:
|
38
|
+
|
39
|
+
s_client = ServerOps(server, url, userid)
|
40
|
+
if connector == 'all':
|
41
|
+
connector = None
|
42
|
+
statement = "ALL connectors"
|
43
|
+
else:
|
44
|
+
statement = f"the {connector} "
|
45
|
+
|
46
|
+
s_client.restart_integration_connector(connector, server, time_out = 60)
|
47
|
+
|
48
|
+
print(f"\n===> Integration Daemon \'{server}\' restarted {statement}.")
|
49
|
+
|
50
|
+
|
51
|
+
except (InvalidParameterException, PropertyServerException) as e:
|
52
|
+
print_exception_response(e)
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
def main():
|
58
|
+
parser = argparse.ArgumentParser()
|
59
|
+
parser.add_argument("--server", help="Name of the integration daemon to refresh")
|
60
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
61
|
+
parser.add_argument("--userid", help="User Id")
|
62
|
+
parser.add_argument("--password", help="User Password")
|
63
|
+
parser.add_argument("--connector", default='all', help="Name of the connector to refresh")
|
64
|
+
args = parser.parse_args()
|
65
|
+
|
66
|
+
server = args.server if args.server is not None else EGERIA_INTEGRATION_DAEMON
|
67
|
+
url = args.url if args.url is not None else EGERIA_INTEGRATION_DAEMON_URL
|
68
|
+
userid = args.userid if args.userid is not None else EGERIA_ADMIN_USER
|
69
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
70
|
+
restart_connector(args.connector, server, url, userid, user_pass)
|
71
|
+
|
72
|
+
if __name__ == "__main__":
|
73
|
+
main()
|
@@ -431,17 +431,159 @@ class ClassificationManager(Client):
|
|
431
431
|
)
|
432
432
|
return response
|
433
433
|
|
434
|
+
async def _async_get_element_by_guid(
|
435
|
+
self,
|
436
|
+
element_guid: str,
|
437
|
+
effective_time: str = None,
|
438
|
+
for_lineage: bool = None,
|
439
|
+
for_duplicate_processing: bool = None,
|
440
|
+
server_name: str = None,
|
441
|
+
time_out: int = default_time_out,
|
442
|
+
) -> dict | str:
|
443
|
+
"""
|
444
|
+
Retrieve element by its unique identifier. Async version.
|
445
|
+
|
446
|
+
https://egeria-project.org/types/
|
447
|
+
|
448
|
+
Parameters
|
449
|
+
----------
|
450
|
+
element_guid: str
|
451
|
+
- unique identifier for the element
|
452
|
+
effective_time: str, default = None
|
453
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
454
|
+
for_lineage: bool, default is set by server
|
455
|
+
- determines if elements classified as Memento should be returned - normally false
|
456
|
+
for_duplicate_processing: bool, default is set by server
|
457
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
458
|
+
server_name: str, default = None
|
459
|
+
- name of the server instances for this request.
|
460
|
+
time_out: int, default = default_time_out
|
461
|
+
- http request timeout for this request
|
462
|
+
|
463
|
+
Returns
|
464
|
+
-------
|
465
|
+
dict | str
|
466
|
+
Returns a string if no elements found; otherwise a dict of the element.
|
467
|
+
|
468
|
+
Raises
|
469
|
+
------
|
470
|
+
InvalidParameterException
|
471
|
+
one of the parameters is null or invalid or
|
472
|
+
PropertyServerException
|
473
|
+
There is a problem adding the element properties to the metadata repository or
|
474
|
+
UserNotAuthorizedException
|
475
|
+
the requesting user is not authorized to issue this request.
|
476
|
+
"""
|
477
|
+
if server_name is None:
|
478
|
+
server_name = self.server_name
|
479
|
+
|
480
|
+
possible_query_params = query_string(
|
481
|
+
[
|
482
|
+
("forLineage", for_lineage),
|
483
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
484
|
+
]
|
485
|
+
)
|
486
|
+
|
487
|
+
body = {
|
488
|
+
"class": "EffectiveTimeQueryRequestBody",
|
489
|
+
"effectiveTime": effective_time,
|
490
|
+
}
|
491
|
+
|
492
|
+
url = f"{base_path(self, server_name)}/elements/{element_guid}{possible_query_params}"
|
493
|
+
|
494
|
+
response: Response = await self._async_make_request(
|
495
|
+
"POST", url, body_slimmer(body), time_out=time_out
|
496
|
+
)
|
497
|
+
|
498
|
+
elements = response.json().get("elements", "No elements found")
|
499
|
+
if type(elements) is list:
|
500
|
+
if len(elements) == 0:
|
501
|
+
return "No elements found"
|
502
|
+
return elements
|
503
|
+
|
504
|
+
def get_element_by_guid(
|
505
|
+
self,
|
506
|
+
element_guid: str,
|
507
|
+
effective_time: str = None,
|
508
|
+
for_lineage: bool = None,
|
509
|
+
for_duplicate_processing: bool = None,
|
510
|
+
server_name: str = None,
|
511
|
+
time_out: int = default_time_out,
|
512
|
+
) -> dict | str:
|
513
|
+
"""
|
514
|
+
Retrieve element by its unique identifier.
|
515
|
+
|
516
|
+
https://egeria-project.org/types/
|
517
|
+
|
518
|
+
Parameters
|
519
|
+
----------
|
520
|
+
element_guid: str
|
521
|
+
- unique identifier for the element
|
522
|
+
effective_time: str, default = None
|
523
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
524
|
+
for_lineage: bool, default is set by server
|
525
|
+
- determines if elements classified as Memento should be returned - normally false
|
526
|
+
for_duplicate_processing: bool, default is set by server
|
527
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
528
|
+
server_name: str, default = None
|
529
|
+
- name of the server instances for this request.
|
530
|
+
time_out: int, default = default_time_out
|
531
|
+
- http request timeout for this request
|
532
|
+
|
533
|
+
Returns
|
534
|
+
-------
|
535
|
+
dict | str
|
536
|
+
Returns a string if no elements found; otherwise a dict of the element.
|
537
|
+
|
538
|
+
Raises
|
539
|
+
------
|
540
|
+
InvalidParameterException
|
541
|
+
one of the parameters is null or invalid or
|
542
|
+
PropertyServerException
|
543
|
+
There is a problem adding the element properties to the metadata repository or
|
544
|
+
UserNotAuthorizedException
|
545
|
+
the requesting user is not authorized to issue this request.
|
546
|
+
"""
|
547
|
+
|
548
|
+
loop = asyncio.get_event_loop()
|
549
|
+
response = loop.run_until_complete(
|
550
|
+
self._async_get_element_by_guid(
|
551
|
+
element_guid,
|
552
|
+
effective_time,
|
553
|
+
for_lineage,
|
554
|
+
for_duplicate_processing,
|
555
|
+
server_name,
|
556
|
+
time_out,
|
557
|
+
)
|
558
|
+
)
|
559
|
+
return response
|
560
|
+
|
434
561
|
async def _async_get_guid_for_name(
|
435
|
-
self,
|
562
|
+
self,
|
563
|
+
name: str,
|
564
|
+
property_name: str = None,
|
565
|
+
for_lineage: bool = None,
|
566
|
+
for_duplicate_processing: bool = None,
|
567
|
+
effective_time: str = None,
|
568
|
+
server_name: str = None,
|
569
|
+
time_out: int = default_time_out,
|
436
570
|
) -> list | str:
|
437
571
|
"""
|
438
|
-
Retrieve the guid associated with the supplied element name.
|
572
|
+
Retrieve the guid associated with the supplied unique element name.
|
439
573
|
If more than one element returned, an exception is thrown. Async version.
|
440
574
|
|
441
575
|
Parameters
|
442
576
|
----------
|
443
577
|
name: str
|
444
578
|
- element name to be searched.
|
579
|
+
property_name: str, optional
|
580
|
+
- optional name of property to search. If not specified, defaults to qualifiedName
|
581
|
+
for_lineage: bool, default is set by server
|
582
|
+
- determines if elements classified as Memento should be returned - normally false
|
583
|
+
for_duplicate_processing: bool, default is set by server
|
584
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
585
|
+
effective_time: str, default = None
|
586
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
445
587
|
server_name: str, default = None
|
446
588
|
- name of the server instances for this request.
|
447
589
|
time_out: int, default = default_time_out
|
@@ -463,11 +605,32 @@ class ClassificationManager(Client):
|
|
463
605
|
"""
|
464
606
|
if server_name is None:
|
465
607
|
server_name = self.server_name
|
466
|
-
property_name =
|
467
|
-
|
468
|
-
|
608
|
+
property_name = "qualifiedName" if property_name is None else property_name
|
609
|
+
|
610
|
+
possible_query_params = query_string(
|
611
|
+
[
|
612
|
+
("forLineage", for_lineage),
|
613
|
+
("forDuplicateProcessing", for_duplicate_processing),
|
614
|
+
]
|
615
|
+
)
|
616
|
+
|
617
|
+
body = {
|
618
|
+
"class": "NameRequestBody",
|
619
|
+
"name": name,
|
620
|
+
"forLineage": for_lineage,
|
621
|
+
"forDuplicateProcessing": for_duplicate_processing,
|
622
|
+
"namePropertyName": property_name,
|
623
|
+
"effectiveTime": effective_time,
|
624
|
+
}
|
625
|
+
|
626
|
+
url = f"{base_path(self, server_name)}/elements/guid-by-unique-name{possible_query_params}"
|
627
|
+
|
628
|
+
response: Response = await self._async_make_request(
|
629
|
+
"POST", url, body_slimmer(body), time_out=time_out
|
469
630
|
)
|
470
631
|
|
632
|
+
elements = response.json().get("elements", "No elements found")
|
633
|
+
|
471
634
|
if type(elements) is list:
|
472
635
|
if len(elements) == 0:
|
473
636
|
return "No elements found"
|
@@ -478,16 +641,31 @@ class ClassificationManager(Client):
|
|
478
641
|
return elements
|
479
642
|
|
480
643
|
def get_guid_for_name(
|
481
|
-
self,
|
644
|
+
self,
|
645
|
+
name: str,
|
646
|
+
property_name: str = None,
|
647
|
+
for_lineage: bool = None,
|
648
|
+
for_duplicate_processing: bool = None,
|
649
|
+
effective_time: str = None,
|
650
|
+
server_name: str = None,
|
651
|
+
time_out: int = default_time_out,
|
482
652
|
) -> list | str:
|
483
653
|
"""
|
484
|
-
Retrieve the guid associated with the supplied element name.
|
654
|
+
Retrieve the guid associated with the supplied unique element name.
|
485
655
|
If more than one element returned, an exception is thrown.
|
486
656
|
|
487
657
|
Parameters
|
488
658
|
----------
|
489
659
|
name: str
|
490
660
|
- element name to be searched.
|
661
|
+
property_name: str, optional
|
662
|
+
- optional name of property to search. If not specified, defaults to qualifiedName
|
663
|
+
for_lineage: bool, default is set by server
|
664
|
+
- determines if elements classified as Memento should be returned - normally false
|
665
|
+
for_duplicate_processing: bool, default is set by server
|
666
|
+
- Normally false. Set true when the caller is part of a deduplication function
|
667
|
+
effective_time: str, default = None
|
668
|
+
- Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
|
491
669
|
server_name: str, default = None
|
492
670
|
- name of the server instances for this request.
|
493
671
|
time_out: int, default = default_time_out
|
@@ -510,7 +688,15 @@ class ClassificationManager(Client):
|
|
510
688
|
|
511
689
|
loop = asyncio.get_event_loop()
|
512
690
|
response = loop.run_until_complete(
|
513
|
-
self._async_get_guid_for_name(
|
691
|
+
self._async_get_guid_for_name(
|
692
|
+
name,
|
693
|
+
property_name,
|
694
|
+
for_lineage,
|
695
|
+
for_duplicate_processing,
|
696
|
+
effective_time,
|
697
|
+
server_name,
|
698
|
+
time_out,
|
699
|
+
)
|
514
700
|
)
|
515
701
|
return response
|
516
702
|
|
@@ -4199,7 +4385,7 @@ class ClassificationManager(Client):
|
|
4199
4385
|
time_out: int = default_time_out,
|
4200
4386
|
) -> None:
|
4201
4387
|
"""
|
4202
|
-
Add or replace the security tags for an element. Async
|
4388
|
+
Add or replace the security tags for an element. Async version,
|
4203
4389
|
|
4204
4390
|
Security Tags: https://egeria-project.org/types/4/0423-Security-Definitions/
|
4205
4391
|
|