pyegeria 0.5.6.5__py3-none-any.whl → 0.5.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. examples/widgets/catalog_user/get_asset_graph.py +11 -9
  2. examples/widgets/catalog_user/get_collection.py +5 -3
  3. examples/widgets/{operational → catalog_user}/get_tech_type_elements.py +5 -2
  4. examples/widgets/{operational → catalog_user}/get_tech_type_template.py +6 -2
  5. examples/widgets/catalog_user/list_assets.py +5 -4
  6. examples/widgets/catalog_user/list_glossary.py +5 -3
  7. examples/widgets/developer/get_guid_info.py +9 -7
  8. examples/widgets/developer/get_tech_details.py +5 -2
  9. examples/widgets/developer/list_registered_services.py +5 -2
  10. examples/widgets/developer/list_tech_templates.py +5 -2
  11. examples/widgets/developer/list_tech_types.py +5 -2
  12. examples/widgets/developer/list_valid_metadata_values.py +7 -2
  13. examples/widgets/operational/__init__.py +1 -1
  14. examples/widgets/operational/egeria_ops.py +215 -0
  15. examples/widgets/operational/engine_actions.py +91 -0
  16. examples/widgets/operational/integration_daemon_actions.py +122 -0
  17. examples/widgets/operational/list_catalog_targets.py +121 -0
  18. examples/widgets/operational/monitor_asset_events.py +4 -0
  19. examples/widgets/operational/monitor_coco_status.py +2 -1
  20. examples/widgets/operational/{monitor_eng_action_status.py → monitor_engine_activity.py} +6 -5
  21. examples/widgets/operational/monitor_gov_eng_status.py +14 -5
  22. examples/widgets/operational/monitor_integ_daemon_status.py +7 -5
  23. examples/widgets/operational/monitor_platform_status.py +2 -1
  24. examples/widgets/operational/monitor_server_list.py +2 -1
  25. examples/widgets/operational/monitor_server_status.py +6 -3
  26. examples/widgets/operational/ops_config.py +29 -0
  27. examples/widgets/operational/refresh_integration_daemon.py +22 -13
  28. examples/widgets/operational/restart_integration_daemon.py +73 -0
  29. examples/widgets/personal_organizer/list_projects.py +11 -3
  30. examples/widgets/personal_organizer/list_todos.py +10 -3
  31. examples/widgets/personal_organizer/monitor_my_todos.py +10 -3
  32. examples/widgets/personal_organizer/monitor_open_todos.py +2 -1
  33. pyegeria/__init__.py +8 -0
  34. pyegeria/create_tech_guid_lists.py +19 -1
  35. {pyegeria-0.5.6.5.dist-info → pyegeria-0.5.8.0.dist-info}/METADATA +1 -1
  36. pyegeria-0.5.8.0.dist-info/RECORD +75 -0
  37. {pyegeria-0.5.6.5.dist-info → pyegeria-0.5.8.0.dist-info}/entry_points.txt +5 -2
  38. pyegeria-0.5.6.5.dist-info/RECORD +0 -69
  39. {pyegeria-0.5.6.5.dist-info → pyegeria-0.5.8.0.dist-info}/LICENSE +0 -0
  40. {pyegeria-0.5.6.5.dist-info → pyegeria-0.5.8.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,122 @@
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, Platform
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-guid')
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
+
92
+
93
+ @click.command('stop')
94
+ @click.pass_context
95
+ def stop_server(ctx):
96
+ """Stop the integration daemon"""
97
+ try:
98
+ c = ctx.obj
99
+ p_client = Platform(c.integration_daemon, c.integration_daemon_url, c.userid, c.password)
100
+
101
+ p_client.shutdown_server()
102
+
103
+ click.echo(f"Stopped server {c.integration_daemon}")
104
+ except (InvalidParameterException, PropertyServerException) as e:
105
+ print_exception_response(e)
106
+
107
+
108
+ @click.command('start')
109
+ @click.pass_context
110
+ def start_server(ctx):
111
+ """Start the integration daemon from its known configuration """
112
+ try:
113
+ c = ctx.obj
114
+ p_client = Platform(c.integration_daemon, c.integration_daemon_url, c.userid, c.password)
115
+
116
+ p_client.activate_server_stored_config()
117
+
118
+ click.echo(f"Started server {c.integration_daemon}")
119
+
120
+ except (InvalidParameterException, PropertyServerException) as e:
121
+ print_exception_response(e)
122
+
@@ -0,0 +1,121 @@
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
+ List catalog targets
10
+ """
11
+ import os
12
+ import argparse
13
+ import time
14
+
15
+ from rich import box
16
+ from rich.console import Console
17
+ from rich.table import Table
18
+ from rich.prompt import Prompt
19
+
20
+ from pyegeria import (
21
+ InvalidParameterException,
22
+ PropertyServerException,
23
+ UserNotAuthorizedException,
24
+ print_exception_response,
25
+ AutomatedCuration,
26
+ INTEGRATION_GUIDS
27
+ )
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('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
34
+ EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
35
+ EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
36
+ EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
37
+ EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
38
+ EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
39
+
40
+
41
+ def display_catalog_targets(connector:str, server: str, url: str, username: str, user_password: str):
42
+
43
+
44
+ def generate_table() -> Table:
45
+ """Make a new table."""
46
+ table = Table(
47
+ title=f"All Catalog Targets for Integration Connector {connector} @ {time.asctime()}",
48
+ style="bold white on black",
49
+ row_styles=["bold white on black"],
50
+ header_style="white on dark_blue",
51
+ title_style="bold white on black",
52
+ show_lines=True,
53
+ box=box.ROUNDED,
54
+ caption=f"Catalog Targets for '{server}' @ Platform - {url}",
55
+ expand=True
56
+ )
57
+ table.add_column("Connector Name")
58
+ table.add_column("Catalog Target Name")
59
+ table.add_column("Relationship GUID", no_wrap=True)
60
+ table.add_column("Synchronization")
61
+ table.add_column("Delete Method")
62
+
63
+
64
+
65
+ if type(cat_targets) is list:
66
+ for target in cat_targets:
67
+ target_name = target.get('catalogTargetName','---')
68
+ target_rel = target.get('relationshipGUID','---')
69
+ target_sync = target.get('permittedSynchronization')
70
+ target_delete = target.get('deleteMethod','---')
71
+ # target_guid = target['catalogTargetElement']['guid']
72
+ connector_unique = target['catalogTargetElement']['uniqueName']
73
+ table.add_row(
74
+ connector_unique, target_name, target_rel, target_sync, target_delete,
75
+ )
76
+
77
+ return table
78
+
79
+ try:
80
+ a_client = AutomatedCuration(server, url, username)
81
+ token = a_client.create_egeria_bearer_token(username, user_password)
82
+ if connector not in INTEGRATION_GUIDS.keys():
83
+ raise Exception
84
+
85
+ connector_guid = INTEGRATION_GUIDS[connector]
86
+ cat_targets = a_client.get_catalog_targets(connector_guid)
87
+ console = Console()
88
+ with console.pager(styles=True):
89
+ console.print(generate_table())
90
+
91
+ except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
92
+ print_exception_response(e)
93
+ except Exception:
94
+ print(f"\n\n===> Perhaps integration connector {connector} is not known?\n\n")
95
+ finally:
96
+ a_client.close_session()
97
+
98
+
99
+ def main():
100
+ parser = argparse.ArgumentParser()
101
+ parser.add_argument("--server", help="Name of the server to display status for")
102
+ parser.add_argument("--url", help="URL Platform to connect to")
103
+ parser.add_argument("--userid", help="User Id")
104
+ parser.add_argument("--password", help="User Password")
105
+
106
+ args = parser.parse_args()
107
+
108
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
109
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
110
+ userid = args.userid if args.userid is not None else EGERIA_USER
111
+ user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
112
+
113
+ try:
114
+ connector = Prompt.ask("Enter the Integration Connector to list catalog targets for")
115
+ display_catalog_targets(connector, server, url, userid, user_pass)
116
+
117
+ except KeyboardInterrupt:
118
+ pass
119
+
120
+ if __name__ == "__main__":
121
+ main()
@@ -82,6 +82,10 @@ def main(ep: str = EGERIA_KAFKA_ENDPOINT):
82
82
  msg = Markdown(msg)
83
83
 
84
84
  console.print(msg)
85
+
86
+ except KeyboardInterrupt:
87
+ pass
88
+
85
89
  finally:
86
90
  # Close down consumer to commit final offsets.
87
91
  consumer.close()
@@ -78,7 +78,8 @@ def display_status(server: str, url: str, username: str):
78
78
 
79
79
  except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
80
80
  print_exception_response(e)
81
- assert e.related_http_code != "200", "Invalid parameters"
81
+ except KeyboardInterrupt:
82
+ pass
82
83
 
83
84
  finally:
84
85
  p_client1.close_session()
@@ -43,7 +43,7 @@ EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
43
43
  disable_ssl_warnings = True
44
44
 
45
45
 
46
- def display_status_engine_actions(server: str, url: str, user: str, user_pass:str, paging: bool):
46
+ def display_engine_activity(server: str, url: str, user: str, user_pass:str, paging: bool):
47
47
  g_client = AutomatedCuration(server, url, user, user_pwd=user_pass)
48
48
 
49
49
  def generate_table() -> Table:
@@ -131,7 +131,8 @@ def display_status_engine_actions(server: str, url: str, user: str, user_pass:st
131
131
 
132
132
  except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
133
133
  print_exception_response(e)
134
- assert e.related_http_code != "200", "Invalid parameters"
134
+ except KeyboardInterrupt:
135
+ pass
135
136
  finally:
136
137
  g_client.close_session()
137
138
 
@@ -150,7 +151,7 @@ def main_live():
150
151
  userid = args.userid if args.userid is not None else EGERIA_USER
151
152
  user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
152
153
 
153
- display_status_engine_actions(server=server, url=url, user=userid, user_pass=user_pass, paging=False)
154
+ display_engine_activity(server=server, url=url, user=userid, user_pass=user_pass, paging=False)
154
155
 
155
156
  def main_paging():
156
157
  parser = argparse.ArgumentParser()
@@ -166,9 +167,9 @@ def main_paging():
166
167
  userid = args.userid if args.userid is not None else EGERIA_USER
167
168
  user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
168
169
 
169
- display_status_engine_actions(server=server, url=url, user=userid, user_pass=user_pass, paging=True)
170
+ display_engine_activity(server=server, url=url, user=userid, user_pass=user_pass, paging=True)
170
171
 
171
- if __name__ == "__main_live__":
172
+ if __name__ == "__main__":
172
173
  main_live()
173
174
 
174
175
  if __name__ == "__main_paging__":
@@ -12,6 +12,9 @@ import os
12
12
  import time
13
13
  import json
14
14
  import argparse
15
+ import click
16
+ from ops_config import Config, pass_config
17
+
15
18
 
16
19
  from pyegeria import (
17
20
  InvalidParameterException,
@@ -40,7 +43,9 @@ EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
40
43
 
41
44
  disable_ssl_warnings = True
42
45
 
43
- def display_gov_actions_status(server: str, url: str, username: str, user_pass:str, paging:bool):
46
+
47
+
48
+ def display_gov_eng_status(server: str , url: str, username: str, user_pass:str, paging:bool):
44
49
  server_name = server
45
50
  s_client = ServerOps(server_name, url, username, user_pass)
46
51
 
@@ -99,7 +104,9 @@ def display_gov_actions_status(server: str, url: str, username: str, user_pass:s
99
104
 
100
105
  except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
101
106
  print_exception_response(e)
102
- assert e.related_http_code != "200", "Invalid parameters"
107
+
108
+ except KeyboardInterrupt:
109
+ pass
103
110
 
104
111
  finally:
105
112
  s_client.close_session()
@@ -117,7 +124,7 @@ def main_live():
117
124
  url = args.url if args.url is not None else EGERIA_PLATFORM_URL
118
125
  userid = args.userid if args.userid is not None else EGERIA_USER
119
126
  user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
120
- display_gov_actions_status(server=server, url=url, username=userid, user_pass=user_pass, paging=False)
127
+ display_gov_eng_status(server=server, url=url, username=userid, user_pass=user_pass, paging=False)
121
128
 
122
129
  def main_paging():
123
130
  parser = argparse.ArgumentParser()
@@ -131,9 +138,11 @@ def main_paging():
131
138
  url = args.url if args.url is not None else EGERIA_PLATFORM_URL
132
139
  userid = args.userid if args.userid is not None else EGERIA_USER
133
140
  user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
134
- display_gov_actions_status(server=server, url=url, username=userid, user_pass=user_pass, paging=True)
141
+ display_gov_eng_status(server=server, url=url, username=userid, user_pass=user_pass, paging=True)
142
+
143
+
135
144
 
136
- if __name__ == "__main_live__":
145
+ if __name__ == "__main__":
137
146
  main_live()
138
147
 
139
148
 
@@ -6,15 +6,13 @@ Copyright Contributors to the ODPi Egeria project.
6
6
 
7
7
  A simple status display for the Integration Daemon.
8
8
 
9
- Note that there are a couple of assumptions currently being made that need to get resolved in future
10
- versions. First, we assume that the view-server used by AutomatedCuration is called "view-server". Second, we
11
- assume that the user password is always "secret".
12
9
 
13
10
  """
14
11
  import os
15
12
  import argparse
16
13
  import time
17
14
  from datetime import datetime
15
+ from ops_config import Config
18
16
 
19
17
  from rich import box
20
18
  from rich.console import Console
@@ -133,7 +131,9 @@ def display_integration_daemon_status(integ_server: str, integ_url: str,
133
131
 
134
132
  except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
135
133
  print_exception_response(e)
136
- assert e.related_http_code != "200", "Invalid parameters"
134
+
135
+ except KeyboardInterrupt:
136
+ pass
137
137
 
138
138
  finally:
139
139
  s_client.close_session()
@@ -179,7 +179,9 @@ def main_paging():
179
179
  display_integration_daemon_status(integ_server=integ_server, integ_url=integ_url,
180
180
  view_server = view_server, view_url = view_url,
181
181
  user=userid, user_pass = user_pass, paging = True)
182
- if __name__ == "__main_live__":
182
+
183
+
184
+ if __name__ == "__main__":
183
185
  main_live()
184
186
 
185
187
  if __name__ == "__main_paging__":
@@ -119,7 +119,8 @@ def display_status(server: str, url: str, username: str, user_pass:str):
119
119
  except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
120
120
  print_exception_response(e)
121
121
 
122
-
122
+ except KeyboardInterrupt:
123
+ pass
123
124
  finally:
124
125
  r_client.close_session()
125
126
 
@@ -87,7 +87,8 @@ def display_status(server: str, url: str, username: str, user_pass:str):
87
87
 
88
88
  except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
89
89
  print_exception_response(e)
90
- assert e.related_http_code != "200", "Invalid parameters"
90
+ except KeyboardInterrupt:
91
+ pass
91
92
 
92
93
  finally:
93
94
  p_client.close_session()
@@ -34,7 +34,7 @@ EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
34
34
  EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
35
35
  EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
36
36
 
37
- def test_display_status(server: str, url: str , username: str , user_pass:str):
37
+ def display_status(server: str, url: str , username: str , user_pass:str):
38
38
  p_client = ServerOps(server, url, username, user_pass)
39
39
 
40
40
  def generate_table() -> Table:
@@ -82,7 +82,10 @@ def test_display_status(server: str, url: str , username: str , user_pass:str):
82
82
 
83
83
  except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
84
84
  print_exception_response(e)
85
- assert e.related_http_code != "200", "Invalid parameters"
85
+ except KeyboardInterrupt:
86
+ pass
87
+ finally:
88
+ p_client.close_session()
86
89
 
87
90
 
88
91
  def main():
@@ -98,7 +101,7 @@ def main():
98
101
  userid = args.userid if args.userid is not None else EGERIA_ADMIN_USER
99
102
  user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
100
103
 
101
- test_display_status(server, url, userid, user_pass)
104
+ display_status(server, url, userid, user_pass)
102
105
 
103
106
  if __name__ == "__main__":
104
107
  main()
@@ -0,0 +1,29 @@
1
+ import click
2
+
3
+
4
+ class Config(object):
5
+ def __init__(self, server: str = None, url: str = None,
6
+ view_server: str = 'view-server', view_server_url: str = 'https://localhost:9443',
7
+ integration_daemon: str = 'integration-daemon', integration_daemon_url: str = 'https://localhost:9443',
8
+ engine_host: str = 'engine-host', engine_host_url: str = 'https://localhost:9443',
9
+ admin_user: str = 'garygeeke', admin_user_password: str = 'secret',
10
+ userid: str = None, password: str = None,
11
+ timeout: int = 30, paging: bool = False, verbose: bool = False):
12
+ self.metadata_store = server
13
+ self.metadata_store_url = url
14
+ self.view_server = view_server
15
+ self.view_server_url = view_server_url
16
+ self.integration_daemon = integration_daemon
17
+ self.integration_daemon_url = integration_daemon_url
18
+ self.engine_host = engine_host
19
+ self.engine_host_url = engine_host_url
20
+ self.admin_user = admin_user
21
+ self.admin_user_password = admin_user_password
22
+ self.userid = userid
23
+ self.password = password
24
+ self.timeout = timeout
25
+ self.paging = paging
26
+ self.verbose = verbose
27
+
28
+
29
+ pass_config = click.make_pass_decorator(Config)
@@ -33,6 +33,26 @@ EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
33
33
 
34
34
 
35
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
+
36
56
 
37
57
  def main():
38
58
  parser = argparse.ArgumentParser()
@@ -40,25 +60,14 @@ def main():
40
60
  parser.add_argument("--url", help="URL Platform to connect to")
41
61
  parser.add_argument("--userid", help="User Id")
42
62
  parser.add_argument("--password", help="User Password")
63
+ parser.add_argument("--connector", default='all', help="Name of the connector to refresh")
43
64
  args = parser.parse_args()
44
65
 
45
66
  server = args.server if args.server is not None else EGERIA_INTEGRATION_DAEMON
46
67
  url = args.url if args.url is not None else EGERIA_INTEGRATION_DAEMON_URL
47
68
  userid = args.userid if args.userid is not None else EGERIA_ADMIN_USER
48
69
  user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
49
-
50
- try:
51
-
52
- s_client = ServerOps(server, url, userid)
53
-
54
- s_client.refresh_integration_connectors(None, server, time_out = 60)
55
-
56
- print(f"\n===> Integration Daemon: \'{server}\' was refreshed.")
57
-
58
-
59
- except (InvalidParameterException, PropertyServerException) as e:
60
- print_exception_response(e)
61
-
70
+ refresh_connector(args.connector, server, url, userid, user_pass)
62
71
 
63
72
  if __name__ == "__main__":
64
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()
@@ -131,6 +131,10 @@ def display_list(project_name: str, server: str, url: str,
131
131
  print(e)
132
132
  else:
133
133
  print_exception_response(e)
134
+ except KeyboardInterrupt:
135
+ pass
136
+ finally:
137
+ p_client.close_session()
134
138
 
135
139
  def main():
136
140
  parser = argparse.ArgumentParser()
@@ -147,10 +151,14 @@ def main():
147
151
  userid = args.userid if args.userid is not None else EGERIA_USER
148
152
  user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
149
153
 
150
- save_output = args.save_output if args.save_output is not None else False
151
- project_name = Prompt.ask("Enter the Project to retrieve:", default="*")
154
+ try:
155
+ save_output = args.save_output if args.save_output is not None else False
156
+ project_name = Prompt.ask("Enter the Project to retrieve:", default="*")
157
+ display_list(project_name, server, url, userid, user_pass, save_output)
158
+
159
+ except KeyboardInterrupt:
160
+ pass
152
161
 
153
- display_list(project_name, server, url, userid, user_pass, save_output)
154
162
 
155
163
  if __name__ == "__main__":
156
164
  main()
@@ -117,7 +117,11 @@ def display_to_dos(search_string: str, guid:str, server: str, url: str, username
117
117
 
118
118
  except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
119
119
  print_exception_response(e)
120
- assert e.related_http_code != "200", "Invalid parameters"
120
+ except KeyboardInterrupt:
121
+ pass
122
+ finally:
123
+ m_client.close_session()
124
+
121
125
 
122
126
  def main():
123
127
  parser = argparse.ArgumentParser()
@@ -133,9 +137,12 @@ def main():
133
137
  userid = args.userid if args.userid is not None else EGERIA_USER
134
138
  user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
135
139
  guid = None
140
+ try:
141
+ search_string = Prompt.ask("Enter the ToDo you are searching for:", default="*")
142
+ display_to_dos(search_string, guid,server, url, userid, user_pass)
143
+ except KeyboardInterrupt:
144
+ pass
136
145
 
137
- search_string = Prompt.ask("Enter the ToDo you are searching for:", default="*")
138
- display_to_dos(search_string, guid,server, url, userid, user_pass)
139
146
 
140
147
  if __name__ == "__main__":
141
148
  main()