pyegeria 0.5.6.6__py3-none-any.whl → 0.5.8.1__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/catalog_user/get_asset_graph.py +11 -9
- examples/widgets/catalog_user/get_collection.py +5 -3
- examples/widgets/{operational → catalog_user}/get_tech_type_elements.py +5 -2
- examples/widgets/{operational → catalog_user}/get_tech_type_template.py +6 -2
- examples/widgets/catalog_user/list_assets.py +5 -4
- examples/widgets/catalog_user/list_glossary.py +5 -3
- examples/widgets/developer/get_guid_info.py +9 -7
- examples/widgets/developer/get_tech_details.py +5 -2
- examples/widgets/developer/list_registered_services.py +5 -2
- examples/widgets/developer/list_tech_templates.py +5 -2
- examples/widgets/developer/list_tech_types.py +5 -2
- examples/widgets/developer/list_valid_metadata_values.py +7 -2
- examples/widgets/operational/__init__.py +1 -1
- examples/widgets/operational/egeria_ops.py +215 -0
- examples/widgets/operational/engine_actions.py +91 -0
- examples/widgets/operational/integration_daemon_actions.py +122 -0
- examples/widgets/operational/list_catalog_targets.py +121 -0
- examples/widgets/operational/monitor_asset_events.py +4 -0
- examples/widgets/operational/monitor_coco_status.py +2 -1
- examples/widgets/operational/{monitor_eng_action_status.py → monitor_engine_activity.py} +6 -5
- examples/widgets/operational/monitor_gov_eng_status.py +14 -5
- examples/widgets/operational/monitor_integ_daemon_status.py +7 -5
- examples/widgets/operational/monitor_platform_status.py +2 -1
- examples/widgets/operational/monitor_server_list.py +2 -1
- examples/widgets/operational/monitor_server_status.py +6 -3
- examples/widgets/operational/ops_config.py +29 -0
- examples/widgets/operational/refresh_integration_daemon.py +22 -13
- examples/widgets/operational/restart_integration_daemon.py +73 -0
- examples/widgets/personal_organizer/list_projects.py +11 -3
- examples/widgets/personal_organizer/list_todos.py +10 -3
- examples/widgets/personal_organizer/monitor_my_todos.py +10 -3
- examples/widgets/personal_organizer/monitor_open_todos.py +2 -1
- pyegeria/__init__.py +8 -0
- pyegeria/create_tech_guid_lists.py +19 -1
- {pyegeria-0.5.6.6.dist-info → pyegeria-0.5.8.1.dist-info}/METADATA +1 -1
- pyegeria-0.5.8.1.dist-info/RECORD +75 -0
- {pyegeria-0.5.6.6.dist-info → pyegeria-0.5.8.1.dist-info}/entry_points.txt +3 -0
- pyegeria-0.5.6.6.dist-info/RECORD +0 -69
- {pyegeria-0.5.6.6.dist-info → pyegeria-0.5.8.1.dist-info}/LICENSE +0 -0
- {pyegeria-0.5.6.6.dist-info → pyegeria-0.5.8.1.dist-info}/WHEEL +0 -0
@@ -9,7 +9,6 @@ import argparse
|
|
9
9
|
import os
|
10
10
|
import sys
|
11
11
|
|
12
|
-
from rich import print
|
13
12
|
from rich.console import Console
|
14
13
|
from rich.markdown import Markdown
|
15
14
|
from rich.panel import Panel
|
@@ -35,6 +34,7 @@ EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
|
|
35
34
|
EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
|
36
35
|
|
37
36
|
disable_ssl_warnings = True
|
37
|
+
|
38
38
|
console = Console(width=200)
|
39
39
|
|
40
40
|
|
@@ -89,8 +89,6 @@ def asset_viewer(asset_guid: str, server_name:str, platform_url:str, user:str, u
|
|
89
89
|
|
90
90
|
try:
|
91
91
|
|
92
|
-
console = Console(width=200)
|
93
|
-
|
94
92
|
a_client = AssetCatalog(server_name, platform_url,
|
95
93
|
user_id=user)
|
96
94
|
|
@@ -146,6 +144,7 @@ def asset_viewer(asset_guid: str, server_name:str, platform_url:str, user:str, u
|
|
146
144
|
f"* Asset Origin: {asset_origin}\n{prop_md}\n"
|
147
145
|
)
|
148
146
|
core_md = Markdown(core_md)
|
147
|
+
|
149
148
|
p1 = Panel.fit(core_md, style = "bold bright_white")
|
150
149
|
l2 = tree.add(p1)
|
151
150
|
if asset_class_md is not None:
|
@@ -225,9 +224,9 @@ def asset_viewer(asset_guid: str, server_name:str, platform_url:str, user:str, u
|
|
225
224
|
relationship_panel = Panel.fit(Markdown(relationship_md), style="bold bright_white", title = "Asset Relationships")
|
226
225
|
tree.add(relationship_panel)
|
227
226
|
|
228
|
-
|
229
|
-
|
230
|
-
|
227
|
+
with console.screen():
|
228
|
+
print("\n\n")
|
229
|
+
print(tree)
|
231
230
|
|
232
231
|
except (
|
233
232
|
InvalidParameterException,
|
@@ -250,9 +249,12 @@ def main():
|
|
250
249
|
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
251
250
|
userid = args.userid if args.userid is not None else EGERIA_USER
|
252
251
|
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
253
|
-
|
254
|
-
|
255
|
-
|
252
|
+
try:
|
253
|
+
asset_guid = Prompt.ask("Enter the Asset GUID to view:", default="")
|
254
|
+
asset_viewer(asset_guid,server, url, userid, user_pass)
|
255
|
+
except (KeyboardInterrupt) as e:
|
256
|
+
# console.print_exception()
|
257
|
+
pass
|
256
258
|
|
257
259
|
if __name__ == "__main__":
|
258
260
|
main()
|
@@ -87,8 +87,10 @@ def main():
|
|
87
87
|
userid = args.userid if args.userid is not None else EGERIA_USER
|
88
88
|
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
try:
|
91
|
+
root_collection = Prompt.ask("Enter the Root Collection to start from:", default="Root Sustainability Collection")
|
92
|
+
collection_viewer(root_collection, server, url, userid, user_pass)
|
93
|
+
except (KeyboardInterrupt):
|
94
|
+
pass
|
93
95
|
if __name__ == "__main__":
|
94
96
|
main()
|
@@ -142,9 +142,12 @@ def main():
|
|
142
142
|
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
143
143
|
userid = args.userid if args.userid is not None else EGERIA_USER
|
144
144
|
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
145
|
+
try:
|
146
|
+
tech_name = Prompt.ask("Enter the Asset Name to view:", default="Apache Kafka Server")
|
147
|
+
tech_viewer(tech_name,server, url, userid, user_pass)
|
148
|
+
except (KeyboardInterrupt):
|
149
|
+
pass
|
145
150
|
|
146
|
-
tech_name = Prompt.ask("Enter the Asset Name to view:", default="Apache Kafka Server")
|
147
|
-
tech_viewer(tech_name,server, url, userid, user_pass)
|
148
151
|
|
149
152
|
if __name__ == "__main__":
|
150
153
|
main()
|
@@ -135,8 +135,12 @@ def main():
|
|
135
135
|
userid = args.userid if args.userid is not None else EGERIA_USER
|
136
136
|
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
137
137
|
|
138
|
-
|
139
|
-
|
138
|
+
try:
|
139
|
+
tech_name = Prompt.ask("Enter the Asset Name to view:", default="Apache Kafka Server")
|
140
|
+
tech_viewer(tech_name,server, url, userid, user_pass)
|
141
|
+
except(KeyboardInterrupt):
|
142
|
+
pass
|
143
|
+
|
140
144
|
|
141
145
|
if __name__ == "__main__":
|
142
146
|
main()
|
@@ -139,9 +139,10 @@ def main():
|
|
139
139
|
userid = args.userid if args.userid is not None else EGERIA_USER
|
140
140
|
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
141
141
|
time_out = args.time_out if args.time_out is not None else 60
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
142
|
+
try:
|
143
|
+
search_string = Prompt.ask("Enter an asset search string:", default="")
|
144
|
+
display_assets(search_string, server, url, userid, user_pass, time_out)
|
145
|
+
except(KeyboardInterrupt):
|
146
|
+
pass
|
146
147
|
if __name__ == "__main__":
|
147
148
|
main()
|
@@ -125,8 +125,10 @@ def main():
|
|
125
125
|
guid = args.guid if args.guid is not None else None
|
126
126
|
guid = sus_guid if args.sustainability else None
|
127
127
|
|
128
|
-
|
129
|
-
|
130
|
-
|
128
|
+
try:
|
129
|
+
search_string = Prompt.ask("Enter the term you are searching for:", default="*")
|
130
|
+
display_glossary_terms(search_string, guid,server, url, userid, user_pass)
|
131
|
+
except(KeyboardInterrupt):
|
132
|
+
pass
|
131
133
|
if __name__ == "__main__":
|
132
134
|
main()
|
@@ -18,6 +18,7 @@ from rich.console import Console
|
|
18
18
|
from rich.prompt import Prompt
|
19
19
|
from rich.text import Text
|
20
20
|
from rich.tree import Tree
|
21
|
+
from rich.panel import Panel
|
21
22
|
|
22
23
|
from pyegeria import (
|
23
24
|
InvalidParameterException,
|
@@ -46,7 +47,7 @@ def display_guid(guid: str, server: str, url: str, username: str, user_password:
|
|
46
47
|
|
47
48
|
|
48
49
|
try:
|
49
|
-
console = Console(width =
|
50
|
+
console = Console(width = 160, style="bold white on black")
|
50
51
|
r = c.make_request("GET", url)
|
51
52
|
if r.status_code == 200:
|
52
53
|
pass
|
@@ -63,7 +64,7 @@ def display_guid(guid: str, server: str, url: str, username: str, user_password:
|
|
63
64
|
tree = tree.add(type_name)
|
64
65
|
tree.add(metadataCollection)
|
65
66
|
tree.add(created)
|
66
|
-
tree.add(details)
|
67
|
+
tree.add(Panel(details,title="Element Details", expand=False))
|
67
68
|
print(tree)
|
68
69
|
|
69
70
|
c.close_session()
|
@@ -72,8 +73,7 @@ def display_guid(guid: str, server: str, url: str, username: str, user_password:
|
|
72
73
|
if type(e) is str:
|
73
74
|
console.print_exception()
|
74
75
|
else:
|
75
|
-
console.print(f"\n Looks like the GUID isn't known
|
76
|
-
console.print_exception()
|
76
|
+
console.print(f"\n Looks like the GUID isn't known...\n")
|
77
77
|
|
78
78
|
def main():
|
79
79
|
|
@@ -90,9 +90,11 @@ def main():
|
|
90
90
|
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
91
91
|
userid = args.userid if args.userid is not None else EGERIA_USER
|
92
92
|
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
93
|
-
guid = Prompt.ask("Enter the GUID to retrieve:", default=None)
|
94
|
-
|
95
|
-
display_guid(guid, server, url, userid, user_pass)
|
96
93
|
|
94
|
+
try:
|
95
|
+
guid = Prompt.ask("Enter the GUID to retrieve", default=None)
|
96
|
+
display_guid(guid, server, url, userid, user_pass)
|
97
|
+
except (KeyboardInterrupt):
|
98
|
+
pass
|
97
99
|
if __name__ == "__main__":
|
98
100
|
main()
|
@@ -111,9 +111,12 @@ def main():
|
|
111
111
|
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
112
112
|
userid = args.userid if args.userid is not None else EGERIA_USER
|
113
113
|
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
114
|
+
try:
|
115
|
+
tech = Prompt.ask("Enter the Technology to start from:", default="PostgreSQL Server")
|
116
|
+
tech_viewer(tech,server, url, userid, user_pass)
|
117
|
+
except(KeyboardInterrupt):
|
118
|
+
pass
|
114
119
|
|
115
|
-
tech = Prompt.ask("Enter the Technology to start from:", default="PostgreSQL Server")
|
116
|
-
tech_viewer(tech,server, url, userid, user_pass)
|
117
120
|
|
118
121
|
if __name__ == "__main__":
|
119
122
|
main()
|
@@ -142,9 +142,12 @@ def main():
|
|
142
142
|
userid = args.userid if args.userid is not None else EGERIA_ADMIN_USER
|
143
143
|
password = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
144
144
|
|
145
|
-
|
145
|
+
try:
|
146
|
+
svc_kind = Prompt.ask("Enter the service type you are searching for:", default="all")
|
147
|
+
display_registered_svcs(svc_kind, server, url, userid, password=password)
|
148
|
+
except(KeyboardInterrupt):
|
149
|
+
pass
|
146
150
|
|
147
|
-
display_registered_svcs(svc_kind, server, url, userid, password=password)
|
148
151
|
|
149
152
|
if __name__ == "__main__":
|
150
153
|
main()
|
@@ -134,9 +134,12 @@ def main():
|
|
134
134
|
password = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
135
135
|
guid = None
|
136
136
|
|
137
|
-
|
137
|
+
try:
|
138
|
+
search_string = Prompt.ask("Enter the technology you are searching for:", default="*")
|
139
|
+
display_tech_types(search_string, server, url, userid, password)
|
140
|
+
except(KeyboardInterrupt):
|
141
|
+
pass
|
138
142
|
|
139
|
-
display_tech_types(search_string, server, url, userid, password)
|
140
143
|
|
141
144
|
if __name__ == "__main__":
|
142
145
|
main()
|
@@ -113,9 +113,12 @@ def main():
|
|
113
113
|
userid = args.userid if args.userid is not None else EGERIA_USER
|
114
114
|
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
115
115
|
|
116
|
-
|
116
|
+
try:
|
117
|
+
search_string = Prompt.ask("Enter the technology you are searching for:", default="*")
|
118
|
+
display_tech_types(search_string, server, url, userid, user_pass)
|
119
|
+
except (KeyboardInterrupt):
|
120
|
+
pass
|
117
121
|
|
118
|
-
display_tech_types(search_string, server, url, userid, user_pass)
|
119
122
|
|
120
123
|
if __name__ == "__main__":
|
121
124
|
main()
|
@@ -132,8 +132,13 @@ def main():
|
|
132
132
|
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
133
133
|
save_output = args.save_output if args.save_output is not None else False
|
134
134
|
property_name = Prompt.ask("Enter the Property to retrieve:", default="projectHealth")
|
135
|
-
|
136
|
-
|
135
|
+
|
136
|
+
try:
|
137
|
+
type_name = Prompt.ask("Enter the Metadata Type to filter on:", default="Project")
|
138
|
+
display_values(property_name, type_name,server, url, userid, user_pass, save_output)
|
139
|
+
except(KeyboardInterrupt):
|
140
|
+
pass
|
141
|
+
|
137
142
|
|
138
143
|
if __name__ == "__main__":
|
139
144
|
main()
|
@@ -0,0 +1,215 @@
|
|
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 command line interface for Egeria operations.
|
8
|
+
|
9
|
+
This is an emerging capability based on the **click** package. Feedback welcome!
|
10
|
+
|
11
|
+
"""
|
12
|
+
import click
|
13
|
+
from trogon import tui
|
14
|
+
from pyegeria import ServerOps
|
15
|
+
from ops_config import Config, pass_config
|
16
|
+
import monitor_gov_eng_status
|
17
|
+
import monitor_server_status
|
18
|
+
import monitor_server_list
|
19
|
+
import monitor_integ_daemon_status
|
20
|
+
import monitor_platform_status
|
21
|
+
import monitor_engine_activity
|
22
|
+
import refresh_integration_daemon
|
23
|
+
import restart_integration_daemon
|
24
|
+
import integration_daemon_actions
|
25
|
+
import list_catalog_targets
|
26
|
+
|
27
|
+
# class Config(object):
|
28
|
+
# def __init__(self, server: str = None, url: str = None, userid:str = None, password:str = None,
|
29
|
+
# timeout:int = 30, paging: bool = False):
|
30
|
+
# self.server = server
|
31
|
+
# self.url = url
|
32
|
+
# self.userid = userid
|
33
|
+
# self.password = password
|
34
|
+
# self.timeout = timeout
|
35
|
+
# self.paging = paging
|
36
|
+
#
|
37
|
+
#
|
38
|
+
# pass_config = click.make_pass_decorator(Config)
|
39
|
+
|
40
|
+
# @tui
|
41
|
+
@tui()
|
42
|
+
@click.version_option("0.0.1", prog_name="egeria_ops")
|
43
|
+
@click.group()
|
44
|
+
@click.option('--server', default = 'active-metadata-store', envvar = 'EGERIA_METADATA_STORE',
|
45
|
+
help='Egeria metadata store to work with')
|
46
|
+
@click.option('--url', default = 'https://localhost:9443', envvar= 'EGERIA_PLATFORM_URL',
|
47
|
+
help='URL of Egeria metadata store platform to connect to')
|
48
|
+
@click.option('--integration-daemon', default = 'integration-daemon', envvar = 'EGERIA_INTEGRATION_DAEMON',
|
49
|
+
help='Egeria integration daemon to work with')
|
50
|
+
@click.option('--integration_daemon_url', default = 'https://localhost:9443', envvar= 'EGERIA_INTEGRATION_DAEMON_URL',
|
51
|
+
help='URL of Egeria integration daemon platform to connect to')
|
52
|
+
@click.option('--view_server', default = 'view-server', envvar = 'EGERIA_VIEW_SERVER',
|
53
|
+
help='Egeria view server to work with')
|
54
|
+
@click.option('--view_server_url', default = 'https://localhost:9443', envvar= 'EGERIA_VIEW_SERVER_URL',
|
55
|
+
help='URL of Egeria view server platform to connect to')
|
56
|
+
@click.option('--engine_host', default = 'engine-host', envvar = 'EGERIA_ENGINE_HOST',
|
57
|
+
help='Egeria engine host to work with')
|
58
|
+
@click.option('--engine_host_url', default = 'https://localhost:9443', envvar= 'EGERIA_ENGINE_HOST_URL',
|
59
|
+
help='URL of Egeria engine host platform to connect to')
|
60
|
+
@click.option('--admin_user', default = 'garygeeke', envvar = 'EGERIA_ADMIN_USER', help='Egeria admin user')
|
61
|
+
@click.option('--admin_user_password', default = 'secret', envvar = 'EGERIA_ADMIN_PASSWORD',
|
62
|
+
help='Egeria admin password')
|
63
|
+
@click.option('--userid', default = 'garygeeke', envvar = 'EGERIA_USER', help='Egeria user')
|
64
|
+
@click.option('--password', default = 'secret', envvar = 'EGERIA_PASSWORD',
|
65
|
+
help='Egeria user password')
|
66
|
+
@click.option('--timeout', default = 60, help = 'Number of seconds to wait')
|
67
|
+
@click.option('--verbose', is_flag = True, default = False, help = 'Enable verbose mode')
|
68
|
+
@click.option('--paging', is_flag = True, default = False, help = 'Enable paging snapshots vs live updates')
|
69
|
+
@click.pass_context
|
70
|
+
def cli(ctx, server, url, view_server, view_server_url, integration_daemon, integration_daemon_url,
|
71
|
+
engine_host, engine_host_url, admin_user, admin_user_password, userid, password, timeout, paging, verbose):
|
72
|
+
"""An Egeria Command Line interface for Operations """
|
73
|
+
ctx.obj = Config(server, url, view_server, view_server_url, integration_daemon,
|
74
|
+
integration_daemon_url, engine_host, engine_host_url,
|
75
|
+
admin_user, admin_user_password,userid, password,
|
76
|
+
timeout, paging, verbose)
|
77
|
+
ctx.max_content_width = 200
|
78
|
+
ctx.ensure_object(Config)
|
79
|
+
if verbose:
|
80
|
+
click.echo(f"we are in verbose mode - server is {server}")
|
81
|
+
|
82
|
+
|
83
|
+
@cli.group("show")
|
84
|
+
@click.pass_context
|
85
|
+
def show(ctx):
|
86
|
+
"""Display an Egeria Object"""
|
87
|
+
pass
|
88
|
+
|
89
|
+
@show.group('platforms')
|
90
|
+
@click.pass_context
|
91
|
+
def show_platform(ctx):
|
92
|
+
"""Group of commands to show information about Egeria platforms"""
|
93
|
+
pass
|
94
|
+
|
95
|
+
@show_platform.command('status')
|
96
|
+
@click.pass_context
|
97
|
+
def show_platform_status(ctx):
|
98
|
+
"""Display a live status view of known platforms"""
|
99
|
+
c = ctx.obj
|
100
|
+
monitor_platform_status.display_status(c.view_server,c.view_server_url,
|
101
|
+
c.admin_user,c.admin_user_password)
|
102
|
+
|
103
|
+
|
104
|
+
@show.group("servers")
|
105
|
+
@click.pass_context
|
106
|
+
def show_server(ctx):
|
107
|
+
"""Group of commands to show information about Egeria servers"""
|
108
|
+
pass
|
109
|
+
|
110
|
+
@show_server.command('status')
|
111
|
+
@click.option('--full', is_flag=True, default = False, help='If True, full server descriptions will be shown')
|
112
|
+
@click.pass_context
|
113
|
+
def show_server_status(ctx, full):
|
114
|
+
"""Display a live status view of Egeria servers for the specified Egeria platform"""
|
115
|
+
c = ctx.obj
|
116
|
+
if full:
|
117
|
+
monitor_server_list.display_status(c.metadata_store, c.metadata_store_url, c.admin_user,c.admin_user_password)
|
118
|
+
else:
|
119
|
+
monitor_server_status.display_status(c.metadata_store, c.metadata_store_url, c.admin_user,c.admin_user_password)
|
120
|
+
|
121
|
+
@show.group("engines")
|
122
|
+
@click.pass_context
|
123
|
+
def engine_host(ctx):
|
124
|
+
"""Group of commands to show information about Egeria engines"""
|
125
|
+
pass
|
126
|
+
|
127
|
+
@engine_host.command("status")
|
128
|
+
@click.option('--list', is_flag=True, default = False, help='If True, a paged list will be shown')
|
129
|
+
@click.pass_context
|
130
|
+
def gov_eng_status(ctx,list):
|
131
|
+
"""Display engine-host status information"""
|
132
|
+
c = ctx.obj
|
133
|
+
monitor_gov_eng_status.display_gov_eng_status(c.engine_host, c.engine_host_url,
|
134
|
+
c.userid, c.password,
|
135
|
+
list)
|
136
|
+
|
137
|
+
@engine_host.command('activity')
|
138
|
+
@click.option('--list', is_flag=True, default = False, help='If True, a paged list will be shown')
|
139
|
+
@click.pass_context
|
140
|
+
def eng_activity_status(ctx,list):
|
141
|
+
"""Show Governance Activity in engine-host"""
|
142
|
+
c = ctx.obj
|
143
|
+
monitor_engine_activity.display_engine_activity(c.view_server, c.view_server_url,
|
144
|
+
c.userid, c.password,
|
145
|
+
list)
|
146
|
+
|
147
|
+
|
148
|
+
@show.group('integrations')
|
149
|
+
@click.pass_context
|
150
|
+
def integrations(ctx):
|
151
|
+
"""Group of commands to show information about Egeria integrations"""
|
152
|
+
pass
|
153
|
+
|
154
|
+
@integrations.command("status")
|
155
|
+
@click.option('--list', is_flag=True, default = False, help='If True, a paged list will be shown')
|
156
|
+
@click.pass_context
|
157
|
+
def integrations_status(ctx,list):
|
158
|
+
"""Display integration-daemon status information"""
|
159
|
+
c = ctx.obj
|
160
|
+
monitor_integ_daemon_status.display_integration_daemon_status(c.integration_daemon, c.integration_daemon_url,
|
161
|
+
c.view_server, c.view_server_url,
|
162
|
+
c.userid, c.password, list)
|
163
|
+
|
164
|
+
@integrations.command("targets")
|
165
|
+
@click.pass_context
|
166
|
+
@click.argument('connector',nargs=1)
|
167
|
+
def integrations_status(ctx,connector):
|
168
|
+
"""Display Catalog Targets for a connector"""
|
169
|
+
c = ctx.obj
|
170
|
+
list_catalog_targets.display_catalog_targets(connector, c.view_server, c.view_server_url,
|
171
|
+
c.userid, c.password)
|
172
|
+
|
173
|
+
#
|
174
|
+
# Tell
|
175
|
+
#
|
176
|
+
|
177
|
+
@cli.group('tell')
|
178
|
+
@click.pass_context
|
179
|
+
def tell(ctx):
|
180
|
+
"""Perform actions an Egeria Objects"""
|
181
|
+
pass
|
182
|
+
|
183
|
+
@tell.group('integration_daemon')
|
184
|
+
@click.pass_context
|
185
|
+
def integration_daemon(ctx):
|
186
|
+
"""Group of commands to an integration-daemon"""
|
187
|
+
pass
|
188
|
+
|
189
|
+
@integration_daemon.command('refresh')
|
190
|
+
@click.pass_context
|
191
|
+
@click.option('--connector', default = 'all', help="Name of connector to refresh or 'all' to refresh all")
|
192
|
+
def refresh_connectors(ctx,connector):
|
193
|
+
"""Refresh the specified integration connector or ALL connectors if not specified"""
|
194
|
+
c = ctx.obj
|
195
|
+
refresh_integration_daemon.refresh_connector(connector,c.integration_daemon, c.integration_daemon_url,
|
196
|
+
c.userid, c.passwordcatalog_target_actions.py )
|
197
|
+
|
198
|
+
@integration_daemon.command('restart')
|
199
|
+
@click.pass_context
|
200
|
+
@click.option('--connector', default = 'all', help="Name of connector to restart or 'all' to restart all")
|
201
|
+
def restart_connectors(ctx,connector):
|
202
|
+
"""Restart the specified integration connector or ALL connectors if not specified"""
|
203
|
+
c = ctx.obj
|
204
|
+
restart_integration_daemon.restart_connector(connector,c.integration_daemon, c.integration_daemon_url,
|
205
|
+
c.userid, c.password)
|
206
|
+
|
207
|
+
integration_daemon.add_command(integration_daemon_actions.add_catalog_target)
|
208
|
+
integration_daemon.add_command(integration_daemon_actions.remove_catalog_target)
|
209
|
+
integration_daemon.add_command(integration_daemon_actions.update_catalog_target)
|
210
|
+
integration_daemon.add_command(integration_daemon_actions.stop_server)
|
211
|
+
integration_daemon.add_command(integration_daemon_actions.start_server)
|
212
|
+
|
213
|
+
|
214
|
+
if __name__ == '__main__':
|
215
|
+
cli()
|
@@ -0,0 +1,91 @@
|
|
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
|
+
from rich import print, print_json
|
13
|
+
from rich.console import Console
|
14
|
+
|
15
|
+
import time
|
16
|
+
import click
|
17
|
+
from ops_config import Config, pass_config
|
18
|
+
from pyegeria import ServerOps, AutomatedCuration, INTEGRATION_GUIDS
|
19
|
+
from pyegeria._exceptions import (
|
20
|
+
InvalidParameterException,
|
21
|
+
PropertyServerException,
|
22
|
+
UserNotAuthorizedException,
|
23
|
+
print_exception_response,
|
24
|
+
)
|
25
|
+
|
26
|
+
|
27
|
+
@click.command('add-target')
|
28
|
+
@click.argument('integration-connector')
|
29
|
+
@click.argument('metadata-element')
|
30
|
+
@click.argument('catalog-target-name')
|
31
|
+
@click.pass_context
|
32
|
+
def add_catalog_target(ctx, integration_connector: str, metadata_element_guid:str, catalog_target_name:str)-> str:
|
33
|
+
"""Add catalog targets to the specified integration connector"""
|
34
|
+
try:
|
35
|
+
if integration_connector not in INTEGRATION_GUIDS.keys():
|
36
|
+
click.echo('Integration connector is not known')
|
37
|
+
|
38
|
+
c = ctx.obj
|
39
|
+
a_client = AutomatedCuration(c.view_server, c.view_server_url, c.userid, c.password)
|
40
|
+
token = a_client.create_egeria_bearer_token()
|
41
|
+
|
42
|
+
guid = a_client.add_catalog_target(INTEGRATION_GUIDS[integration_connector], metadata_element_guid,
|
43
|
+
catalog_target_name)
|
44
|
+
|
45
|
+
click.echo(f"Added catalog target to {integration_connector} with a return guid of {guid}")
|
46
|
+
|
47
|
+
|
48
|
+
except (InvalidParameterException, PropertyServerException) as e:
|
49
|
+
print_exception_response(e)
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
@click.command('remove-target')
|
54
|
+
@click.argument('relationship-guid')
|
55
|
+
@click.pass_context
|
56
|
+
def remove_catalog_target(ctx, relationship_guid: str):
|
57
|
+
"""Remove the catalog target specified by the relationship guidr"""
|
58
|
+
try:
|
59
|
+
c = ctx.obj
|
60
|
+
a_client = AutomatedCuration(c.view_server, c.view_server_url, c.userid, c.password)
|
61
|
+
token = a_client.create_egeria_bearer_token()
|
62
|
+
|
63
|
+
a_client.remove_catalog_target(relationship_guid)
|
64
|
+
|
65
|
+
click.echo(f"Removed catalog target with relationship guid of {relationship_guid}")
|
66
|
+
|
67
|
+
|
68
|
+
except (InvalidParameterException, PropertyServerException) as e:
|
69
|
+
print_exception_response(e)
|
70
|
+
|
71
|
+
|
72
|
+
@click.command('update-target')
|
73
|
+
@click.argument('relationship-guid')
|
74
|
+
@click.argument('catalog-target-name')
|
75
|
+
@click.pass_context
|
76
|
+
def update_catalog_target(ctx, relationship_guid: str, catalog_target_name:str):
|
77
|
+
"""Update the catalog target specified by the relationship guid """
|
78
|
+
try:
|
79
|
+
c = ctx.obj
|
80
|
+
a_client = AutomatedCuration(c.view_server, c.view_server_url, c.userid, c.password)
|
81
|
+
token = a_client.create_egeria_bearer_token()
|
82
|
+
|
83
|
+
guid = a_client.update_catalog_target(relationship_guid, catalog_target_name)
|
84
|
+
|
85
|
+
click.echo(f"Update catalog target with relationship guid of {relationship_guid} to a catalog target name of "
|
86
|
+
f"{catalog_target_name} with a return guid of {guid}")
|
87
|
+
|
88
|
+
|
89
|
+
except (InvalidParameterException, PropertyServerException) as e:
|
90
|
+
print_exception_response(e)
|
91
|
+
|