pyegeria 1.5.1.0.16__py3-none-any.whl → 1.5.1.0.18__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.
- commands/cat/list_deployed_database_schemas.py +1 -13
- commands/cli/egeria.py +1 -1
- commands/ops/monitor_integ_daemon_status.py +4 -0
- commands/ops/table_integ_daemon_status.py +292 -0
- commands/tech/table_tech_templates.py +173 -0
- {pyegeria-1.5.1.0.16.dist-info → pyegeria-1.5.1.0.18.dist-info}/METADATA +1 -1
- {pyegeria-1.5.1.0.16.dist-info → pyegeria-1.5.1.0.18.dist-info}/RECORD +10 -9
- commands/cat/old_list_deployed_database_schemas.py +0 -218
- {pyegeria-1.5.1.0.16.dist-info → pyegeria-1.5.1.0.18.dist-info}/LICENSE +0 -0
- {pyegeria-1.5.1.0.16.dist-info → pyegeria-1.5.1.0.18.dist-info}/WHEEL +0 -0
- {pyegeria-1.5.1.0.16.dist-info → pyegeria-1.5.1.0.18.dist-info}/entry_points.txt +0 -0
@@ -114,15 +114,6 @@ def list_deployed_database_schemas(
|
|
114
114
|
continue
|
115
115
|
|
116
116
|
el_name = element["properties"].get("name", "---")
|
117
|
-
# el_type = header["type"]["typeName"]
|
118
|
-
# el_home = header["origin"]["homeMetadataCollectionName"]
|
119
|
-
# el_create_time = header["versions"]["createTime"][:-10]
|
120
|
-
# el_created_by = header["versions"]["createdBy"]
|
121
|
-
# el_created_md = (
|
122
|
-
# f"* **Created By**: {el_created_by}\n"
|
123
|
-
# f"* **Created Time**: {el_create_time}"
|
124
|
-
# )
|
125
|
-
# el_created_out = Markdown(el_created_md)
|
126
117
|
|
127
118
|
el_guid = header["guid"]
|
128
119
|
|
@@ -148,9 +139,6 @@ def list_deployed_database_schemas(
|
|
148
139
|
|
149
140
|
# get the schema properties
|
150
141
|
el_props_md = make_prop_md(element["properties"])
|
151
|
-
# el_props_md = ""
|
152
|
-
# for prop in element["properties"].keys():
|
153
|
-
# el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
|
154
142
|
|
155
143
|
# Now get property facets related to us
|
156
144
|
el_facets = c_client.get_related_elements(
|
@@ -189,7 +177,7 @@ def list_deployed_database_schemas(
|
|
189
177
|
# spacer = "---\n"
|
190
178
|
# elif count > len_els:
|
191
179
|
# spacer = ""
|
192
|
-
rel_el_md = f"{rel_el_md}\n* **{rel_type}**:\n\t{rel_guid}\n{props_md}{spacer}"
|
180
|
+
# rel_el_md = f"{rel_el_md}\n* **{rel_type}**:\n\t{rel_guid}\n{props_md}{spacer}"
|
193
181
|
if count == len_els:
|
194
182
|
rel_el_md = rel_el_md[:-4]
|
195
183
|
rel_el_out = Markdown(rel_el_md)
|
commands/cli/egeria.py
CHANGED
@@ -32,7 +32,7 @@ from commands.my.list_my_profile import display_my_profile
|
|
32
32
|
from commands.my.list_my_roles import display_my_roles
|
33
33
|
from commands.my.monitor_my_todos import display_my_todos
|
34
34
|
from commands.my.monitor_open_todos import display_todos
|
35
|
-
from commands.cat.
|
35
|
+
from commands.cat.list_deployed_database_schemas import (
|
36
36
|
list_deployed_database_schemas,
|
37
37
|
)
|
38
38
|
from commands.cat.list_deployed_catalogs import list_deployed_catalogs
|
@@ -16,6 +16,9 @@ from rich import box
|
|
16
16
|
from rich.console import Console
|
17
17
|
from rich.live import Live
|
18
18
|
from rich.table import Table
|
19
|
+
import nest_asyncio
|
20
|
+
from typing import Union
|
21
|
+
from textual.widgets import DataTable
|
19
22
|
|
20
23
|
from pyegeria import EgeriaTech, AutomatedCuration
|
21
24
|
from pyegeria._exceptions import (
|
@@ -44,6 +47,7 @@ EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
|
44
47
|
disable_ssl_warnings = True
|
45
48
|
|
46
49
|
|
50
|
+
|
47
51
|
def display_integration_daemon_status(
|
48
52
|
integ_server: str = EGERIA_INTEGRATION_DAEMON,
|
49
53
|
integ_url: str = EGERIA_INTEGRATION_DAEMON_URL,
|
@@ -0,0 +1,292 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
|
7
|
+
A simple status display for the Integration Daemon.
|
8
|
+
|
9
|
+
|
10
|
+
"""
|
11
|
+
import argparse
|
12
|
+
import os
|
13
|
+
import time
|
14
|
+
|
15
|
+
from rich import box
|
16
|
+
from rich.console import Console
|
17
|
+
from rich.live import Live
|
18
|
+
from rich.table import Table
|
19
|
+
import nest_asyncio
|
20
|
+
from typing import Union
|
21
|
+
from textual.widgets import DataTable
|
22
|
+
|
23
|
+
from pyegeria import EgeriaTech, AutomatedCuration
|
24
|
+
from pyegeria._exceptions import (
|
25
|
+
InvalidParameterException,
|
26
|
+
PropertyServerException,
|
27
|
+
UserNotAuthorizedException,
|
28
|
+
print_exception_response,
|
29
|
+
)
|
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(
|
36
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
37
|
+
)
|
38
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
39
|
+
EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
|
40
|
+
"EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
|
41
|
+
)
|
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
|
+
disable_ssl_warnings = True
|
48
|
+
|
49
|
+
|
50
|
+
def add_row(
|
51
|
+
table: Union[Table, DataTable],
|
52
|
+
connector_name: str,
|
53
|
+
connector_status: str,
|
54
|
+
last_refresh_time: str,
|
55
|
+
refresh_interval: str,
|
56
|
+
targets_out,
|
57
|
+
exception_msg,
|
58
|
+
) -> Table | DataTable:
|
59
|
+
table.add_row(
|
60
|
+
connector_name,
|
61
|
+
connector_status,
|
62
|
+
last_refresh_time,
|
63
|
+
refresh_interval,
|
64
|
+
targets_out,
|
65
|
+
exception_msg,
|
66
|
+
)
|
67
|
+
return table
|
68
|
+
|
69
|
+
|
70
|
+
def display_integration_daemon_status(
|
71
|
+
integ_server: str = EGERIA_INTEGRATION_DAEMON,
|
72
|
+
integ_url: str = EGERIA_INTEGRATION_DAEMON_URL,
|
73
|
+
view_server: str = EGERIA_VIEW_SERVER,
|
74
|
+
view_url: str = EGERIA_VIEW_SERVER_URL,
|
75
|
+
user: str = EGERIA_USER,
|
76
|
+
user_pass: str = EGERIA_USER_PASSWORD,
|
77
|
+
paging: bool = True,
|
78
|
+
jupyter: bool = EGERIA_JUPYTER,
|
79
|
+
width: int = EGERIA_WIDTH,
|
80
|
+
sort: bool = True,
|
81
|
+
data_table: bool = False,
|
82
|
+
) -> Table | DataTable:
|
83
|
+
s_client = EgeriaTech(view_server, view_url, user, user_pass)
|
84
|
+
nest_asyncio.apply()
|
85
|
+
|
86
|
+
def generate_table() -> Table:
|
87
|
+
"""Make a new table."""
|
88
|
+
|
89
|
+
if data_table:
|
90
|
+
table = DataTable()
|
91
|
+
table.add_columns(
|
92
|
+
"Connector Name",
|
93
|
+
"Status",
|
94
|
+
"Last Refresh Time",
|
95
|
+
"Min Refresh (Mins)",
|
96
|
+
"Target Element",
|
97
|
+
"Exception Message",
|
98
|
+
)
|
99
|
+
else:
|
100
|
+
table = Table(
|
101
|
+
title=f"Integration Daemon Status @ {time.asctime()}",
|
102
|
+
style="bold white on black",
|
103
|
+
row_styles=["bold white on black"],
|
104
|
+
header_style="white on dark_blue",
|
105
|
+
title_style="bold white on black",
|
106
|
+
caption_style="white on black",
|
107
|
+
show_lines=True,
|
108
|
+
box=box.ROUNDED,
|
109
|
+
caption=f"Integration Daemon Status for Server '{integ_server}' @ Platform - {integ_url}",
|
110
|
+
expand=True,
|
111
|
+
)
|
112
|
+
table.add_column("Connector Name", min_width=15)
|
113
|
+
table.add_column("Status", max_width=6)
|
114
|
+
table.add_column("Last Refresh Time", min_width=12)
|
115
|
+
table.add_column("Min Refresh (mins)", max_width=6)
|
116
|
+
table.add_column("Target Element", min_width=20)
|
117
|
+
table.add_column("Exception Message", min_width=10)
|
118
|
+
|
119
|
+
# Now get the integration connector report
|
120
|
+
token = s_client.create_egeria_bearer_token()
|
121
|
+
daemon_status = s_client.get_server_report(None, integ_server)
|
122
|
+
|
123
|
+
reports = daemon_status["integrationConnectorReports"]
|
124
|
+
if sort is True:
|
125
|
+
connector_reports = sorted(
|
126
|
+
reports, key=lambda x: x.get("connectorName", "---")
|
127
|
+
)
|
128
|
+
else:
|
129
|
+
connector_reports = reports
|
130
|
+
|
131
|
+
for connector in connector_reports:
|
132
|
+
connector_name = connector.get("connectorName", "---")
|
133
|
+
connector_status = connector.get("connectorStatus", "---")
|
134
|
+
connector_guid = connector.get("connectorGUID", "---")
|
135
|
+
last_refresh_time = connector.get("lastRefreshTime", "---")[:-10]
|
136
|
+
refresh_interval = str(connector.get("minMinutesBetweenRefresh", "---"))
|
137
|
+
exception_msg = " "
|
138
|
+
if connector_guid != "---":
|
139
|
+
targets = s_client.get_catalog_targets(connector_guid)
|
140
|
+
tgt_tab = Table()
|
141
|
+
tgt_tab.add_column("Target")
|
142
|
+
tgt_tab.add_column("UniqueName")
|
143
|
+
tgt_tab.add_column("Relationship GUID", no_wrap=True)
|
144
|
+
|
145
|
+
if type(targets) == list:
|
146
|
+
targets_md = True
|
147
|
+
for target in targets:
|
148
|
+
t_name = target["catalogTargetName"]
|
149
|
+
# t_sync = target["permittedSynchronization"]
|
150
|
+
t_unique_name = target["catalogTargetElement"]["uniqueName"]
|
151
|
+
t_rel_guid = target["relationshipGUID"]
|
152
|
+
# targets_m += f"* Target Name: __{t_name}__\n* Sync: {t_sync}\n* Unique Name: {t_unique_name}\n\n"
|
153
|
+
tgt_tab.add_row(t_name, t_unique_name, t_rel_guid)
|
154
|
+
# targets_md = Markdown(targets_m)
|
155
|
+
else:
|
156
|
+
targets_md = False
|
157
|
+
else:
|
158
|
+
targets_md = False
|
159
|
+
if targets_md is False:
|
160
|
+
targets_out = ""
|
161
|
+
else:
|
162
|
+
targets_out = tgt_tab
|
163
|
+
|
164
|
+
if connector_status in ("RUNNING", "REFRESHING", "WAITING"):
|
165
|
+
connector_status = f"[green]{connector_status}"
|
166
|
+
elif connector_status in ("INITIALIZE FAILED", "CONFIG_FAILED", "FAILED"):
|
167
|
+
connector_status = f"[red]{connector_status}"
|
168
|
+
else:
|
169
|
+
connector_status = f"[yellow]{connector_status}"
|
170
|
+
|
171
|
+
add_row(
|
172
|
+
table,
|
173
|
+
connector_name,
|
174
|
+
connector_status,
|
175
|
+
last_refresh_time,
|
176
|
+
refresh_interval,
|
177
|
+
targets_out,
|
178
|
+
exception_msg,
|
179
|
+
)
|
180
|
+
return table
|
181
|
+
|
182
|
+
try:
|
183
|
+
if paging is True:
|
184
|
+
console = Console(width=width, force_terminal=not jupyter)
|
185
|
+
with console.pager():
|
186
|
+
console.print(generate_table())
|
187
|
+
else:
|
188
|
+
with Live(
|
189
|
+
generate_table(),
|
190
|
+
refresh_per_second=1,
|
191
|
+
screen=True,
|
192
|
+
vertical_overflow="visible",
|
193
|
+
) as live:
|
194
|
+
while True:
|
195
|
+
time.sleep(2)
|
196
|
+
live.update(generate_table())
|
197
|
+
|
198
|
+
except (
|
199
|
+
InvalidParameterException,
|
200
|
+
PropertyServerException,
|
201
|
+
UserNotAuthorizedException,
|
202
|
+
) as e:
|
203
|
+
print_exception_response(e)
|
204
|
+
|
205
|
+
except KeyboardInterrupt:
|
206
|
+
pass
|
207
|
+
|
208
|
+
finally:
|
209
|
+
s_client.close_session()
|
210
|
+
|
211
|
+
|
212
|
+
def main_live():
|
213
|
+
parser = argparse.ArgumentParser()
|
214
|
+
parser.add_argument(
|
215
|
+
"--integ_server", help="Name of the integration server to display status for"
|
216
|
+
)
|
217
|
+
parser.add_argument("--integ_url", help="URL Platform to connect to")
|
218
|
+
parser.add_argument("--view_server", help="Name of the view server to use")
|
219
|
+
parser.add_argument("--view_url", help="view server URL Platform to connect to")
|
220
|
+
parser.add_argument("--userid", help="User Id")
|
221
|
+
parser.add_argument("--password", help="User Password")
|
222
|
+
args = parser.parse_args()
|
223
|
+
|
224
|
+
integ_server = (
|
225
|
+
args.integ_server
|
226
|
+
if args.integ_server is not None
|
227
|
+
else EGERIA_INTEGRATION_DAEMON
|
228
|
+
)
|
229
|
+
integ_url = (
|
230
|
+
args.integ_url if args.integ_url is not None else EGERIA_INTEGRATION_DAEMON_URL
|
231
|
+
)
|
232
|
+
view_server = (
|
233
|
+
args.view_server if args.view_server is not None else EGERIA_VIEW_SERVER
|
234
|
+
)
|
235
|
+
view_url = args.view_url if args.view_url is not None else EGERIA_VIEW_SERVER_URL
|
236
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
237
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
238
|
+
display_integration_daemon_status(
|
239
|
+
integ_server=integ_server,
|
240
|
+
integ_url=integ_url,
|
241
|
+
view_server=view_server,
|
242
|
+
view_url=view_url,
|
243
|
+
user=userid,
|
244
|
+
user_pass=user_pass,
|
245
|
+
paging=False,
|
246
|
+
data_table=False,
|
247
|
+
)
|
248
|
+
|
249
|
+
|
250
|
+
def main_paging():
|
251
|
+
parser = argparse.ArgumentParser()
|
252
|
+
parser.add_argument(
|
253
|
+
"--integ_server", help="Name of the integration server to display status for"
|
254
|
+
)
|
255
|
+
parser.add_argument("--integ_url", help="URL Platform to connect to")
|
256
|
+
parser.add_argument("--view_server", help="Name of the view server to use")
|
257
|
+
parser.add_argument("--view_url", help="view server URL Platform to connect to")
|
258
|
+
parser.add_argument("--userid", help="User Id")
|
259
|
+
parser.add_argument("--password", help="User Password")
|
260
|
+
args = parser.parse_args()
|
261
|
+
|
262
|
+
integ_server = (
|
263
|
+
args.integ_server
|
264
|
+
if args.integ_server is not None
|
265
|
+
else EGERIA_INTEGRATION_DAEMON
|
266
|
+
)
|
267
|
+
integ_url = (
|
268
|
+
args.integ_url if args.integ_url is not None else EGERIA_INTEGRATION_DAEMON_URL
|
269
|
+
)
|
270
|
+
view_server = (
|
271
|
+
args.view_server if args.view_server is not None else EGERIA_VIEW_SERVER
|
272
|
+
)
|
273
|
+
view_url = args.view_url if args.view_url is not None else EGERIA_VIEW_SERVER_URL
|
274
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
275
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
276
|
+
display_integration_daemon_status(
|
277
|
+
integ_server=integ_server,
|
278
|
+
integ_url=integ_url,
|
279
|
+
view_server=view_server,
|
280
|
+
view_url=view_url,
|
281
|
+
user=userid,
|
282
|
+
user_pass=user_pass,
|
283
|
+
paging=True,
|
284
|
+
data_table=False,
|
285
|
+
)
|
286
|
+
|
287
|
+
|
288
|
+
if __name__ == "__main__":
|
289
|
+
main_live()
|
290
|
+
|
291
|
+
if __name__ == "__main_paging__":
|
292
|
+
main_paging()
|
@@ -0,0 +1,173 @@
|
|
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
|
+
import os
|
5
|
+
from pyegeria import AutomatedCuration, _client
|
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
|
+
import asyncio
|
14
|
+
import nest_asyncio
|
15
|
+
from typing import Union
|
16
|
+
|
17
|
+
from pyegeria import (
|
18
|
+
InvalidParameterException,
|
19
|
+
PropertyServerException,
|
20
|
+
UserNotAuthorizedException,
|
21
|
+
print_exception_response,
|
22
|
+
RegisteredInfo
|
23
|
+
)
|
24
|
+
from textual.widgets import DataTable
|
25
|
+
|
26
|
+
console = Console()
|
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 add_row(table: Union[Table,DataTable], name: str, template_name:str, template_guid: str,
|
41
|
+
placeholder_table: Table) -> Table | DataTable:
|
42
|
+
if isinstance(table, Table):
|
43
|
+
table.add_row(name, template_name, template_guid, placeholder_table)
|
44
|
+
elif isinstance(table, DataTable):
|
45
|
+
table.add_row(name, template_name, template_guid, placeholder_table)
|
46
|
+
|
47
|
+
return table
|
48
|
+
|
49
|
+
def display_templates_spec(search_string:str, server: str,
|
50
|
+
url: str, username: str, password: str, jupyter:bool=EGERIA_JUPYTER,
|
51
|
+
width:int = EGERIA_WIDTH, data_table: bool = False
|
52
|
+
)-> Table | DataTable:
|
53
|
+
|
54
|
+
a_client = AutomatedCuration(server, url, username)
|
55
|
+
nest_asyncio.apply()
|
56
|
+
token = a_client.create_egeria_bearer_token(username, password)
|
57
|
+
tech_list = a_client.find_technology_types(search_string, page_size=0)
|
58
|
+
|
59
|
+
def generate_table(data_table: bool) -> Table | DataTable:
|
60
|
+
"""Make a new table."""
|
61
|
+
if data_table:
|
62
|
+
table = DataTable()
|
63
|
+
table.add_columns("Name", "Template Name", "Template GUID", "Placeholders")
|
64
|
+
else:
|
65
|
+
table = Table(
|
66
|
+
title=f"Technology Templates for: {url} @ {time.asctime()}",
|
67
|
+
style="bold bright_white on black",
|
68
|
+
row_styles=["bold bright_white on black"],
|
69
|
+
header_style="white on dark_blue",
|
70
|
+
title_style="bold bright_white on black",
|
71
|
+
caption_style="white on black",
|
72
|
+
show_lines=True,
|
73
|
+
box=box.ROUNDED,
|
74
|
+
caption=f"Templates from Server '{server}' @ Platform - {url}",
|
75
|
+
expand=True,
|
76
|
+
# width=500
|
77
|
+
)
|
78
|
+
|
79
|
+
table.add_column("Name", width=20)
|
80
|
+
table.add_column("Template Name", width=20)
|
81
|
+
table.add_column("Template GUID", width = 38,no_wrap=True)
|
82
|
+
table.add_column("Placeholders")
|
83
|
+
|
84
|
+
|
85
|
+
if type(tech_list) is list:
|
86
|
+
for item in tech_list:
|
87
|
+
if 'deployedImplementationType' not in item['qualifiedName']:
|
88
|
+
continue
|
89
|
+
placeholder_table = Table(expand=False, show_lines=True)
|
90
|
+
placeholder_table.add_column("Name", width = 20,no_wrap=True)
|
91
|
+
placeholder_table.add_column("Type", width = 10)
|
92
|
+
placeholder_table.add_column("Required", width = 10)
|
93
|
+
placeholder_table.add_column("Example", width = 20)
|
94
|
+
placeholder_table.add_column("Description", width = 40)
|
95
|
+
|
96
|
+
|
97
|
+
name = item.get("name", "none")
|
98
|
+
|
99
|
+
details = a_client.get_technology_type_detail(name)
|
100
|
+
if type(details) is str:
|
101
|
+
console.log(f"Missing details for - {name}: {details}")
|
102
|
+
continue
|
103
|
+
|
104
|
+
templates = details.get("catalogTemplates", "Not Found")
|
105
|
+
if type(templates) is not str:
|
106
|
+
for template in templates:
|
107
|
+
template_name = template.get("name", None)
|
108
|
+
|
109
|
+
template_name = f"{name}_Template" if template_name is None else template_name
|
110
|
+
|
111
|
+
specification = template["specification"]["placeholderProperty"]
|
112
|
+
template_guid = template["relatedElement"]["guid"]
|
113
|
+
|
114
|
+
for placeholder in specification:
|
115
|
+
placeholder_data_type = placeholder["dataType"]
|
116
|
+
placeholder_description = placeholder["description"]
|
117
|
+
placeholder_name = placeholder["placeholderPropertyName"]
|
118
|
+
placeholder_required = placeholder["required"]
|
119
|
+
placeholder_example = placeholder.get("example", None)
|
120
|
+
placeholder_table.add_row(placeholder_name, placeholder_data_type, placeholder_required,
|
121
|
+
placeholder_example, placeholder_description,)
|
122
|
+
|
123
|
+
# table.add_row(name, template_name, template_guid, placeholder_table)
|
124
|
+
table = add_row(table, name, template_name, template_guid, placeholder_table)
|
125
|
+
|
126
|
+
return table
|
127
|
+
else:
|
128
|
+
print("Unknown technology type")
|
129
|
+
sys.exit(1)
|
130
|
+
|
131
|
+
try:
|
132
|
+
if data_table:
|
133
|
+
return generate_table(data_table)
|
134
|
+
else:
|
135
|
+
console = Console(width=width, force_terminal=not jupyter)
|
136
|
+
|
137
|
+
with console.pager(styles=True):
|
138
|
+
console.print(generate_table(data_table))
|
139
|
+
|
140
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
141
|
+
print_exception_response(e)
|
142
|
+
assert e.related_http_code != "200", "Invalid parameters"
|
143
|
+
finally:
|
144
|
+
a_client.close_session()
|
145
|
+
|
146
|
+
|
147
|
+
def main():
|
148
|
+
parser = argparse.ArgumentParser()
|
149
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
150
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
151
|
+
parser.add_argument("--userid", help="User Id")
|
152
|
+
parser.add_argument("--password", help="Password")
|
153
|
+
|
154
|
+
args = parser.parse_args()
|
155
|
+
|
156
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
157
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
158
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
159
|
+
password = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
160
|
+
guid = None
|
161
|
+
|
162
|
+
try:
|
163
|
+
search_string = Prompt.ask("Enter the technology you are searching for:", default="*")
|
164
|
+
display_templates_spec(search_string, server, url, userid, password,data_table=False)
|
165
|
+
except(KeyboardInterrupt):
|
166
|
+
pass
|
167
|
+
|
168
|
+
|
169
|
+
if __name__ == "__main__":
|
170
|
+
main()
|
171
|
+
|
172
|
+
|
173
|
+
|
@@ -11,7 +11,7 @@ commands/cat/list_archives.py,sha256=FEZ2XYnQIWo2PztWqnj6unn0pbblPU0-bMbTyI3csv4
|
|
11
11
|
commands/cat/list_assets.py,sha256=bNwSaBDz661hfnc2Rn4j4HPHAugKvz0XwN9L1m4FVQk,6529
|
12
12
|
commands/cat/list_cert_types.py,sha256=mbCls_EqC5JKG5rvS4o69k7KgZ6aNXlcqoJ3DtHsTFA,7127
|
13
13
|
commands/cat/list_deployed_catalogs.py,sha256=eG8K-d7BijD34el_yVx9yfnLJdfwTUiJVxd-gcGwo7k,7157
|
14
|
-
commands/cat/list_deployed_database_schemas.py,sha256=
|
14
|
+
commands/cat/list_deployed_database_schemas.py,sha256=HNAR8qXU7FWUxPJw6yBxmlsJ_eVXqsD_DrswKmY1iv0,8824
|
15
15
|
commands/cat/list_deployed_databases.py,sha256=HE8nG-mIlxa9iSUEH-n71o-G2a4ss1Zzalq7YJQIix0,6668
|
16
16
|
commands/cat/list_glossary.py,sha256=tUtQQoTGTlDLU-yFbfO3zjiJC9QyEJfg8NxnGCo2mnI,5811
|
17
17
|
commands/cat/list_projects.py,sha256=Jzs-DtIpPhCH-gY4PYT6mnRBWnEf4m18TFfcw8UymNU,8011
|
@@ -19,9 +19,8 @@ commands/cat/list_relationships.py,sha256=U9f78cOi4HyaacqNaFSMq_7rRxVcEczvwPv468
|
|
19
19
|
commands/cat/list_tech_types.py,sha256=20T4v6L5qeebSsaL1nGkFMDAIsy2W3A3SMm1RcgFoh0,4609
|
20
20
|
commands/cat/list_todos.py,sha256=iPxHRyW3X5tiREio4TUOwRPvNPjU0gxm3pVnUI79ir4,6542
|
21
21
|
commands/cat/list_user_ids.py,sha256=7JinL7rknPbGusIb8ikXKEaV1vvbuvx_WWtbmlfS_DY,5093
|
22
|
-
commands/cat/old_list_deployed_database_schemas.py,sha256=56n81Ks7g_g90begVVeqObQJxvnDjMRc1_ORJfkXbd4,7913
|
23
22
|
commands/cli/__init__.py,sha256=hpTVSMP2gnPRhcAZPdeUEsQ-eaDySlXlk239dNWYmng,292
|
24
|
-
commands/cli/egeria.py,sha256=
|
23
|
+
commands/cli/egeria.py,sha256=5ktUIbf5PIuHUQbcx_-HpI3Xolx38euvLT25AQhBWvE,31265
|
25
24
|
commands/cli/egeria_cat.py,sha256=NwPCRTIjwQtna5vvjInT6L0krwp2c6k-Fm-oxN6qrnw,14800
|
26
25
|
commands/cli/egeria_my.py,sha256=9zIpUDLeA_R-0rgCSQfEZTtVmkxPcEAsYcCTn1wQFrE,6181
|
27
26
|
commands/cli/egeria_ops.py,sha256=fxDXYWXRhexx06PdSLCp2FhgUtS13NdDpyg7ea775fc,11531
|
@@ -44,7 +43,7 @@ commands/ops/monitor_asset_events.py,sha256=cjdlVqE0XYnoRW3aorNbsVkjByDXefPBnlla
|
|
44
43
|
commands/ops/monitor_engine_activity.py,sha256=m18OSnRoo5ut0WKKOWNoFGXJW_npjp6hzHK3RUQG8T0,8479
|
45
44
|
commands/ops/monitor_engine_activity_c.py,sha256=rSEUD3elhsiYdUhQRn613OM_R4VecFb0uq39MhYhltQ,9371
|
46
45
|
commands/ops/monitor_gov_eng_status.py,sha256=HOcPLqOqceVjxbYqAtYK0fjlJBJxsR9SxbfKzwwUz8c,7237
|
47
|
-
commands/ops/monitor_integ_daemon_status.py,sha256=
|
46
|
+
commands/ops/monitor_integ_daemon_status.py,sha256=JCKQdyK4u60nXyuZlXY1GL1X1EJOvgHPZ3xp_uQUObQ,9309
|
48
47
|
commands/ops/monitor_platform_status.py,sha256=xmngiuQK9X6X4-stGSITzfMSAdqpswVk-DY7kh8M0P0,6401
|
49
48
|
commands/ops/monitor_server_startup.py,sha256=0pwnhv761uuFHGJXVANa5RhQQPPTXFldJ45TfeT7qfk,3901
|
50
49
|
commands/ops/monitor_server_status.py,sha256=eeZY4o_HwrH-csrhHPi95LLGu00j6AYl48A7fDYTG34,6061
|
@@ -52,6 +51,7 @@ commands/ops/orig_monitor_server_list.py,sha256=Uhtn8lv7QVXJBi9DSR3Nelmz8TB0vOsa
|
|
52
51
|
commands/ops/orig_monitor_server_status.py,sha256=A-8hMDfbscdcq-b1OD4wKn0tphumX8WIK-Hz8uPoFkc,3974
|
53
52
|
commands/ops/refresh_integration_daemon.py,sha256=aEaN3RAqlu2Fu9TgbJqnsfyXZ__WBml2EgRKaC48Pig,2961
|
54
53
|
commands/ops/restart_integration_daemon.py,sha256=dqsQ6nOBw-EJgf7NvwTcR__h317dq_cxUWYRTGxvWaM,2901
|
54
|
+
commands/ops/table_integ_daemon_status.py,sha256=6K_r8OeU42z2EqRwupHKk2S_YirvVrYQwSWGaLc3UjU,10238
|
55
55
|
commands/tech/README.md,sha256=nxDnfr3BCiGgW5G1VxWxiwUWJXIe5wreNuUeRyIt_hY,1343
|
56
56
|
commands/tech/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
57
57
|
commands/tech/get_element_graph.py,sha256=YhpvHPNuSd-Ft-dBRLswGfqGYv2AlByyV0IyjhV4SSk,7367
|
@@ -69,6 +69,7 @@ commands/tech/list_related_specification.py,sha256=mWrKenXOskL4cl0DHjH2Z8M9-FJzj
|
|
69
69
|
commands/tech/list_relationship_types.py,sha256=BlVzrPznZXqMVLN2-2vYEVRGeYsiJrqXxIJEikobyoo,5875
|
70
70
|
commands/tech/list_tech_templates.py,sha256=RiyA8a4fIL9BGeGf37Bkk471mK5ECkDJMN9QVNReC1M,6192
|
71
71
|
commands/tech/list_valid_metadata_values.py,sha256=N3D0_BmREPszgde3uvvYdfzq7DJ46uMOv2t1vtncGsw,6333
|
72
|
+
commands/tech/table_tech_templates.py,sha256=xa_mA10P_6Su3zRsvyoZhWoSUQ5LuyLTG1kNCumzxZA,7268
|
72
73
|
commands/tech/x_list_related_elements.py,sha256=qBsf1619cecaMCTzG0MG22fAT32WNH2Z3CXrjo9z-5Y,5853
|
73
74
|
pyegeria/README.md,sha256=PwX5OC7-YSZUCIsoyHh1O-WBM2hE84sm3Bd4O353NOk,1464
|
74
75
|
pyegeria/__init__.py,sha256=mZOa16y_LUUZevlHVQY-X_q0ZE2mEcgAE-eoe16DLls,21893
|
@@ -102,8 +103,8 @@ pyegeria/server_operations.py,sha256=ciH890hYT85YQ6OpByn4w7s3a7TtvWZpIG5rkRqbcI0
|
|
102
103
|
pyegeria/utils.py,sha256=1h6bwveadd6GpbnGLTmqPBmBk68QvxdjGTI9RfbrgKY,5415
|
103
104
|
pyegeria/valid_metadata_omvs.py,sha256=tfCGXed5LLt59YA8uZNNtd9UJ-lRZfPU_uZxK31Yux0,65069
|
104
105
|
pyegeria/x_action_author_omvs.py,sha256=xu1IQ0YbhIKi17C5a7Aq9u1Az2czwahNPpX9czmyVxE,6454
|
105
|
-
pyegeria-1.5.1.0.
|
106
|
-
pyegeria-1.5.1.0.
|
107
|
-
pyegeria-1.5.1.0.
|
108
|
-
pyegeria-1.5.1.0.
|
109
|
-
pyegeria-1.5.1.0.
|
106
|
+
pyegeria-1.5.1.0.18.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
107
|
+
pyegeria-1.5.1.0.18.dist-info/METADATA,sha256=TseBdJPVaIPtYgRPrOhPcUbnSbn8CR5ekZibRLC-c0M,2998
|
108
|
+
pyegeria-1.5.1.0.18.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
109
|
+
pyegeria-1.5.1.0.18.dist-info/entry_points.txt,sha256=Pc5kHnxv-vbRpwVMxSSWl66vmf7EZjgzf7nZzz1ow3M,4002
|
110
|
+
pyegeria-1.5.1.0.18.dist-info/RECORD,,
|
@@ -1,218 +0,0 @@
|
|
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
|
-
import os
|
5
|
-
import argparse
|
6
|
-
import time
|
7
|
-
import sys
|
8
|
-
from rich import box
|
9
|
-
from rich.console import Console
|
10
|
-
from rich.table import Table
|
11
|
-
|
12
|
-
from pyegeria import (
|
13
|
-
InvalidParameterException,
|
14
|
-
PropertyServerException,
|
15
|
-
UserNotAuthorizedException,
|
16
|
-
print_exception_response,
|
17
|
-
EgeriaTech,
|
18
|
-
)
|
19
|
-
|
20
|
-
|
21
|
-
console = Console()
|
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(
|
27
|
-
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
28
|
-
)
|
29
|
-
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
30
|
-
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
31
|
-
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
32
|
-
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
33
|
-
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
34
|
-
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
35
|
-
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
36
|
-
|
37
|
-
|
38
|
-
def check_if_template(header: dict) -> bool:
|
39
|
-
"""Check if the the template classification is set"""
|
40
|
-
classifications = header.get("classifications", None)
|
41
|
-
if classifications is None:
|
42
|
-
return False
|
43
|
-
for c in classifications:
|
44
|
-
if c["type"]["typeName"] == "Template":
|
45
|
-
return True
|
46
|
-
return False
|
47
|
-
|
48
|
-
|
49
|
-
def list_deployed_database_schemas(
|
50
|
-
db_name: str,
|
51
|
-
server: str,
|
52
|
-
url: str,
|
53
|
-
username: str,
|
54
|
-
password: str,
|
55
|
-
jupyter: bool = EGERIA_JUPYTER,
|
56
|
-
width: int = EGERIA_WIDTH,
|
57
|
-
):
|
58
|
-
c_client = EgeriaTech(server, url, user_id=username, user_pwd=password)
|
59
|
-
token = c_client.create_egeria_bearer_token()
|
60
|
-
|
61
|
-
def generate_table() -> Table:
|
62
|
-
"""Make a new table."""
|
63
|
-
table = Table(
|
64
|
-
caption=f"Databases found: {url} - {server} @ {time.asctime()}",
|
65
|
-
style="bold bright_white on black",
|
66
|
-
row_styles=["bold bright_white on black"],
|
67
|
-
header_style="white on dark_blue",
|
68
|
-
title_style="bold bright_white on black",
|
69
|
-
caption_style="white on black",
|
70
|
-
show_lines=True,
|
71
|
-
box=box.ROUNDED,
|
72
|
-
# title=f"Elements for Open Metadata Type: '{om_type}' ",
|
73
|
-
expand=True,
|
74
|
-
# width=500
|
75
|
-
)
|
76
|
-
|
77
|
-
table.add_column("Schema in Catalog")
|
78
|
-
table.add_column("Schema Properties")
|
79
|
-
|
80
|
-
table.add_column("Cataloged Resource")
|
81
|
-
|
82
|
-
om_type = "DeployedDatabaseSchema"
|
83
|
-
|
84
|
-
# get the guid for the database or catalog
|
85
|
-
|
86
|
-
if db_name in (None, "*"):
|
87
|
-
dbs = c_client.get_elements(om_type)
|
88
|
-
else:
|
89
|
-
db_guid = c_client.get_guid_for_name(db_name)
|
90
|
-
dbs = c_client.get_elements_by_classification_with_property_value(
|
91
|
-
"Anchors", db_guid, ["anchorGUID"], om_type
|
92
|
-
)
|
93
|
-
|
94
|
-
if type(dbs) is not list:
|
95
|
-
print("No instances found")
|
96
|
-
sys.exit(1)
|
97
|
-
|
98
|
-
for element in dbs:
|
99
|
-
header = element["elementHeader"]
|
100
|
-
|
101
|
-
if check_if_template(header):
|
102
|
-
continue
|
103
|
-
|
104
|
-
el_name = element["properties"].get("name", "---")
|
105
|
-
el_type = header["type"]["typeName"]
|
106
|
-
el_home = header["origin"]["homeMetadataCollectionName"]
|
107
|
-
el_create_time = header["versions"]["createTime"][:-10]
|
108
|
-
el_created_by = header["versions"]["createdBy"]
|
109
|
-
el_created_md = (
|
110
|
-
f"* **Created By**: {el_created_by}\n"
|
111
|
-
f"* **Created Time**: {el_create_time}"
|
112
|
-
)
|
113
|
-
el_created_out = Markdown(el_created_md)
|
114
|
-
|
115
|
-
el_guid = header["guid"]
|
116
|
-
|
117
|
-
el_classification = header["classifications"]
|
118
|
-
for c in el_classification:
|
119
|
-
if c["type"]["typeName"] == "Anchors":
|
120
|
-
el_anchor_guid = c["classificationProperties"]["anchorGUID"]
|
121
|
-
el_anchor_type_name = c["classificationProperties"][
|
122
|
-
"anchorTypeName"
|
123
|
-
]
|
124
|
-
if el_anchor_type_name == "Catalog":
|
125
|
-
el_cat = c_client.get_element_by_guid(el_anchor_guid)
|
126
|
-
el_cat_name = el_cat["properties"].get("name", None)
|
127
|
-
if el_cat_name is None:
|
128
|
-
el_cat_name = el_cat["properties"].get(
|
129
|
-
"qualifiedName", "---"
|
130
|
-
)
|
131
|
-
el_cat_guid = el_cat["elementHeader"]["guid"]
|
132
|
-
el_schema_id = (
|
133
|
-
f"{el_name}\n{el_guid}\n\n\t\tin\n\n{el_cat_name}\n{el_cat_guid}"
|
134
|
-
)
|
135
|
-
el_props_md = ""
|
136
|
-
for prop in element["properties"].keys():
|
137
|
-
el_props_md += f"* **{prop}**: {element['properties'][prop]}\n"
|
138
|
-
el_props_out = Markdown(el_props_md)
|
139
|
-
|
140
|
-
rel_elements = c_client.get_elements_by_property_value(
|
141
|
-
el_guid, ["anchorGUID"]
|
142
|
-
)
|
143
|
-
schema_md = ""
|
144
|
-
count = 0
|
145
|
-
rel_el_out = ""
|
146
|
-
if type(rel_elements) is list:
|
147
|
-
len_els = len(rel_elements)
|
148
|
-
rel_el_md = ""
|
149
|
-
spacer = "---\n"
|
150
|
-
for rel_element in rel_elements:
|
151
|
-
count += 1
|
152
|
-
rel_type = rel_element["elementHeader"]["type"]["typeName"]
|
153
|
-
rel_guid = rel_element["elementHeader"]["guid"]
|
154
|
-
rel_props = rel_element["properties"]
|
155
|
-
props_md = ""
|
156
|
-
for key in rel_props.keys():
|
157
|
-
props_md += f"\t* **{key}**: {rel_props[key]}\n"
|
158
|
-
rel_el_md = f"{rel_el_md}\n* **{rel_type}**:\n\t{rel_guid}\n{props_md}{spacer}"
|
159
|
-
|
160
|
-
# rel_el_md = f"{rel_el_md}\n* **{rel_type}**:\n\t{rel_guid}\n{props_md}{spacer}"
|
161
|
-
if count == len_els:
|
162
|
-
rel_el_md = rel_el_md[:-4]
|
163
|
-
rel_el_out = Markdown(rel_el_md)
|
164
|
-
|
165
|
-
table.add_row(
|
166
|
-
el_schema_id,
|
167
|
-
# el_type,
|
168
|
-
# el_created_out,
|
169
|
-
# el_home,
|
170
|
-
# el_guid,
|
171
|
-
el_props_out,
|
172
|
-
rel_el_out,
|
173
|
-
)
|
174
|
-
|
175
|
-
return table
|
176
|
-
|
177
|
-
try:
|
178
|
-
console = Console(width=width, force_terminal=not jupyter)
|
179
|
-
|
180
|
-
with console.pager(styles=True):
|
181
|
-
console.print(generate_table())
|
182
|
-
|
183
|
-
except (
|
184
|
-
InvalidParameterException,
|
185
|
-
PropertyServerException,
|
186
|
-
UserNotAuthorizedException,
|
187
|
-
) as e:
|
188
|
-
print_exception_response(e)
|
189
|
-
print("\n\nPerhaps the type name isn't known")
|
190
|
-
finally:
|
191
|
-
c_client.close_session()
|
192
|
-
|
193
|
-
|
194
|
-
def main():
|
195
|
-
parser = argparse.ArgumentParser()
|
196
|
-
parser.add_argument("--server", help="Name of the server to display status for")
|
197
|
-
parser.add_argument("--url", help="URL Platform to connect to")
|
198
|
-
parser.add_argument("--userid", help="User Id")
|
199
|
-
parser.add_argument("--password", help="Password")
|
200
|
-
|
201
|
-
args = parser.parse_args()
|
202
|
-
|
203
|
-
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
204
|
-
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
205
|
-
userid = args.userid if args.userid is not None else EGERIA_USER
|
206
|
-
password = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
207
|
-
|
208
|
-
try:
|
209
|
-
db_name = Prompt.ask(
|
210
|
-
"Enter the name of a database/catalog to retrieve schemas for", default="*"
|
211
|
-
)
|
212
|
-
list_deployed_database_schemas(db_name, server, url, userid, password)
|
213
|
-
except KeyboardInterrupt:
|
214
|
-
pass
|
215
|
-
|
216
|
-
|
217
|
-
if __name__ == "__main__":
|
218
|
-
main()
|
File without changes
|
File without changes
|
File without changes
|