pyegeria 0.7.19__tar.gz → 0.7.21__tar.gz

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 (94) hide show
  1. {pyegeria-0.7.19 → pyegeria-0.7.21}/PKG-INFO +1 -1
  2. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/list_todos.py +1 -1
  3. pyegeria-0.7.21/examples/widgets/cat/list_user_ids.py +119 -0
  4. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cli/egeria.py +11 -2
  5. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cli/egeria_cat.py +9 -0
  6. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cli/egeria_ops.py +2 -2
  7. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/my/monitor_open_todos.py +1 -1
  8. pyegeria-0.7.21/examples/widgets/my/todo_actions.py +188 -0
  9. pyegeria-0.7.21/examples/widgets/ops/engine_actions.py +71 -0
  10. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/glossary_manager_omvs.py +33 -135
  11. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyproject.toml +6 -2
  12. pyegeria-0.7.19/examples/widgets/my/todo_actions.py +0 -160
  13. pyegeria-0.7.19/examples/widgets/ops/engine_actions.py +0 -52
  14. {pyegeria-0.7.19 → pyegeria-0.7.21}/LICENSE +0 -0
  15. {pyegeria-0.7.19 → pyegeria-0.7.21}/README.md +0 -0
  16. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/doc_samples/Create_Collection_Sample.py +0 -0
  17. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/doc_samples/Create_Sustainability_Collection_Sample.py +0 -0
  18. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/README.md +0 -0
  19. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/__init__.py +0 -0
  20. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/get_asset_graph.py +0 -0
  21. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/get_collection.py +0 -0
  22. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/get_project_dependencies.py +0 -0
  23. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/get_project_structure.py +0 -0
  24. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/get_tech_type_elements.py +0 -0
  25. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/get_tech_type_template.py +0 -0
  26. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/list_assets.py +0 -0
  27. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/list_cert_types.py +0 -0
  28. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/list_glossary.py +0 -0
  29. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/list_projects.py +0 -0
  30. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/list_relationships.py +0 -0
  31. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cat/list_tech_types.py +0 -0
  32. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cli/__init__.py +0 -0
  33. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cli/egeria_my.py +0 -0
  34. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cli/egeria_tech.py +0 -0
  35. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/cli/ops_config.py +0 -0
  36. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/my/README.md +0 -0
  37. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/my/__init__.py +0 -0
  38. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/my/list_my_profile.py +0 -0
  39. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/my/list_my_roles.py +0 -0
  40. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/my/monitor_my_todos.py +0 -0
  41. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/my/my_profile_actions.py +0 -0
  42. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/README.md +0 -0
  43. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/__init__.py +0 -0
  44. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/integration_daemon_actions.py +0 -0
  45. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/list_catalog_targets.py +0 -0
  46. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/load_archive.py +0 -0
  47. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/monitor_asset_events.py +0 -0
  48. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/monitor_coco_status.py +0 -0
  49. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/monitor_engine_activity.py +0 -0
  50. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/monitor_gov_eng_status.py +0 -0
  51. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/monitor_integ_daemon_status.py +0 -0
  52. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/monitor_platform_status.py +0 -0
  53. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/monitor_server_list.py +0 -0
  54. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/monitor_server_status.py +0 -0
  55. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/refresh_integration_daemon.py +0 -0
  56. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/ops/restart_integration_daemon.py +0 -0
  57. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/tech/README.md +0 -0
  58. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/tech/__init__.py +0 -0
  59. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/tech/get_element_info.py +0 -0
  60. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/tech/get_guid_info.py +0 -0
  61. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/tech/get_tech_details.py +0 -0
  62. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/tech/list_asset_types.py +0 -0
  63. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/tech/list_elements.py +0 -0
  64. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/tech/list_registered_services.py +0 -0
  65. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/tech/list_related_specification.py +0 -0
  66. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/tech/list_relationship_types.py +0 -0
  67. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/tech/list_tech_templates.py +0 -0
  68. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/tech/list_valid_metadata_values.py +0 -0
  69. {pyegeria-0.7.19 → pyegeria-0.7.21}/examples/widgets/tech/x_list_related_elements.py +0 -0
  70. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/Xloaded_resources_omvs.py +0 -0
  71. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/__init__.py +0 -0
  72. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/_client.py +0 -0
  73. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/_deprecated_gov_engine.py +0 -0
  74. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/_exceptions.py +0 -0
  75. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/_globals.py +0 -0
  76. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/_validators.py +0 -0
  77. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/action_author_omvs.py +0 -0
  78. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/asset_catalog_omvs.py +0 -0
  79. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/automated_curation_omvs.py +0 -0
  80. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/classification_manager_omvs.py +0 -0
  81. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/collection_manager_omvs.py +0 -0
  82. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/core_omag_server_config.py +0 -0
  83. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/create_tech_guid_lists.py +0 -0
  84. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/feedback_manager_omvs.py +0 -0
  85. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/full_omag_server_config.py +0 -0
  86. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/glossary_browser_omvs.py +0 -0
  87. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/my_profile_omvs.py +0 -0
  88. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/platform_services.py +0 -0
  89. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/project_manager_omvs.py +0 -0
  90. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/registered_info.py +0 -0
  91. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/runtime_manager_omvs.py +0 -0
  92. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/server_operations.py +0 -0
  93. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/utils.py +0 -0
  94. {pyegeria-0.7.19 → pyegeria-0.7.21}/pyegeria/valid_metadata_omvs.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyegeria
3
- Version: 0.7.19
3
+ Version: 0.7.21
4
4
  Summary: A python client for Egeria
5
5
  Home-page: https://github.com/odpi/egeria-python
6
6
  License: Apache 2.0
@@ -96,7 +96,7 @@ def display_to_dos(search_string: str, status_filter: str, server: str, url: str
96
96
  status = props.get("toDoStatus")
97
97
 
98
98
  assigned_out = ''
99
- assigned_actors = item["assignedActors"]
99
+ assigned_actors = item.get("assignedActors",'---')
100
100
  if type(assigned_actors) is list:
101
101
  assigned_md = ''
102
102
  for actor in assigned_actors:
@@ -0,0 +1,119 @@
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
+ ClassificationManager
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('EGERIA_VIEW_SERVER_URL', 'https://localhost:9443')
27
+ EGERIA_INTEGRATION_DAEMON = os.environ.get('INTEGRATION_DAEMON', 'integration-daemon')
28
+ EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
29
+ EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
30
+ EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
31
+ EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
32
+ EGERIA_JUPYTER = bool(os.environ.get('EGERIA_JUPYTER', 'False'))
33
+ EGERIA_WIDTH = int(os.environ.get('EGERIA_WIDTH', '200'))
34
+
35
+
36
+
37
+ def list_user_ids(server: str,
38
+ url: str, username: str, password: str, jupyter:bool=EGERIA_JUPYTER, width:int = EGERIA_WIDTH
39
+ ):
40
+
41
+ c_client = ClassificationManager(server, url, user_id=username, user_pwd=password)
42
+ token = c_client.create_egeria_bearer_token()
43
+ elements = c_client.get_elements('UserIdentity')
44
+
45
+ def generate_table() -> Table:
46
+ """Make a new table."""
47
+ table = Table(
48
+ caption=f"Metadata Elements for: {url} - {server} @ {time.asctime()}",
49
+ style="bold bright_white on black",
50
+ row_styles=["bold bright_white on black"],
51
+ header_style="white on dark_blue",
52
+ title_style="bold bright_white on black",
53
+ caption_style="white on black",
54
+ show_lines=True,
55
+ box=box.ROUNDED,
56
+ title=f"Elements for Open Metadata Type: 'User Identities' ",
57
+ expand=True,
58
+ # width=500
59
+ )
60
+
61
+ table.add_column("Qualified Name")
62
+ table.add_column("Created")
63
+ table.add_column("GUID", width = 38,no_wrap=True)
64
+ table.add_column("UserId")
65
+
66
+
67
+ if type(elements) is list:
68
+ for element in elements:
69
+ header = element['elementHeader']
70
+ el_q_name = element['properties'].get('qualifiedName',"---")
71
+ el_create_time = header['versions']['createTime'][:-10]
72
+ el_guid = header['guid']
73
+ el_user_id = element['properties'].get('userId',"---")
74
+
75
+ table.add_row(el_q_name, el_create_time, el_guid, el_user_id)
76
+
77
+ return table
78
+ else:
79
+ print("No instances found")
80
+ sys.exit(1)
81
+
82
+ try:
83
+ console = Console(width=width, force_terminal=not jupyter)
84
+
85
+ with console.pager(styles=True):
86
+ console.print(generate_table())
87
+
88
+ except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
89
+ print_exception_response(e)
90
+ print("Perhaps the type name isn't known")
91
+ finally:
92
+ c_client.close_session()
93
+
94
+
95
+ def main():
96
+ parser = argparse.ArgumentParser()
97
+ parser.add_argument("--server", help="Name of the server to display status for")
98
+ parser.add_argument("--url", help="URL Platform to connect to")
99
+ parser.add_argument("--userid", help="User Id")
100
+ parser.add_argument("--password", help="Password")
101
+
102
+ args = parser.parse_args()
103
+
104
+ server = args.server if args.server is not None else EGERIA_VIEW_SERVER
105
+ url = args.url if args.url is not None else EGERIA_PLATFORM_URL
106
+ userid = args.userid if args.userid is not None else EGERIA_USER
107
+ password = args.password if args.password is not None else EGERIA_USER_PASSWORD
108
+
109
+ try:
110
+ list_user_ids(server, url, userid, password)
111
+ except(KeyboardInterrupt):
112
+ pass
113
+
114
+
115
+ if __name__ == "__main__":
116
+ main()
117
+
118
+
119
+
@@ -26,9 +26,10 @@ from examples.widgets.cat.list_tech_types import display_tech_types
26
26
  from examples.widgets.cat.list_todos import display_to_dos as list_todos
27
27
  from examples.widgets.cli.ops_config import Config
28
28
  from examples.widgets.cat.list_relationships import list_relationships
29
+ from examples.widgets.cat.list_user_ids import list_user_ids
29
30
 
30
- from examples.widgets.ops.engine_actions import start_server as start_engine_host, \
31
- stop_server as stop_engine_host
31
+ from examples.widgets.ops.engine_actions import start_daemon as start_engine_host, \
32
+ stop_daemon as stop_engine_host
32
33
  from examples.widgets.ops.integration_daemon_actions import (add_catalog_target, remove_catalog_target,
33
34
  update_catalog_target, stop_server, start_server)
34
35
  from examples.widgets.ops.list_catalog_targets import display_catalog_targets
@@ -522,6 +523,14 @@ def show_todos(ctx, search_string, status):
522
523
  list_todos(search_string, status, c.view_server, c.view_server_url, c.userid,
523
524
  c.password, c.jupyter, c.width)
524
525
 
526
+ @show.command('user-ids')
527
+ @click.pass_context
528
+ def show_todos(ctx):
529
+ """Display a tree graph of information about an asset """
530
+ c = ctx.obj
531
+ list_user_ids( c.view_server, c.view_server_url, c.userid,
532
+ c.password, c.jupyter, c.width)
533
+
525
534
 
526
535
  #
527
536
  # Catalog User: Tell
@@ -25,6 +25,7 @@ from examples.widgets.cat.get_project_structure import project_structure_viewer
25
25
  from examples.widgets.cat.get_project_dependencies import project_dependency_viewer
26
26
  from examples.widgets.cat.list_cert_types import display_certifications
27
27
  from examples.widgets.cat.list_relationships import list_relationships
28
+ from examples.widgets.cat.list_user_ids import list_user_ids
28
29
 
29
30
  # from pyegeria import ServerOps
30
31
  from examples.widgets.cli.ops_config import Config
@@ -249,6 +250,14 @@ def show_todos(ctx, search_string, status):
249
250
  list_todos(search_string, status, c.view_server, c.view_server_url, c.userid,
250
251
  c.password, c.jupyter, c.width)
251
252
 
253
+ @show.command('user-ids')
254
+ @click.pass_context
255
+ def show_todos(ctx):
256
+ """Display a tree graph of information about an asset """
257
+ c = ctx.obj
258
+ list_user_ids( c.view_server, c.view_server_url, c.userid,
259
+ c.password, c.jupyter, c.width)
260
+
252
261
  #
253
262
  # Tell
254
263
  #
@@ -14,8 +14,8 @@ from trogon import tui
14
14
 
15
15
  # from pyegeria import ServerOps
16
16
  from examples.widgets.cli.ops_config import Config
17
- from examples.widgets.ops.engine_actions import start_server as start_engine_host, \
18
- stop_server as stop_engine_host
17
+ from examples.widgets.ops.engine_actions import start_daemon as start_engine_host, \
18
+ stop_daemon as stop_engine_host
19
19
  from examples.widgets.ops.integration_daemon_actions import (add_catalog_target, remove_catalog_target,
20
20
  update_catalog_target, stop_server, start_server)
21
21
  from examples.widgets.ops.list_catalog_targets import display_catalog_targets
@@ -95,7 +95,7 @@ def display_todos(server: str , url: str, user: str, user_pass:str,
95
95
  priority = str(props.get("priority", " "))
96
96
  due = props.get("dueTime", " ")
97
97
  completed = props.get("completionTime", " ")
98
- status = props.get("status")
98
+ status = props.get("todoStatus")
99
99
  # assigned_actors = item["assignedActors"]
100
100
  # sponsor = assigned_actors[0].get("uniqueName", " ")
101
101
  sponsor = "erinoverview"
@@ -0,0 +1,188 @@
1
+ """
2
+ SPDX-License-Identifier: Apache-2.0
3
+ Copyright Contributors to the ODPi Egeria project.
4
+
5
+
6
+
7
+ Execute ToDo actions.
8
+
9
+ """
10
+ import os
11
+ import time
12
+
13
+ import click
14
+
15
+ # from ops_config import Config, pass_config
16
+ from pyegeria import MyProfile
17
+ from pyegeria._exceptions import (
18
+ InvalidParameterException,
19
+ PropertyServerException,
20
+ print_exception_response,
21
+ )
22
+
23
+ erins_guid = "a588fb08-ae09-4415-bd5d-991882ceacba"
24
+ peter_guid = "a187bc48-8154-491f-97b4-a2f3c3f1a00e"
25
+ tanya_guid = "26ec1614-bede-4b25-a2a3-f8ed26db3aaa"
26
+
27
+ ERIA_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_INTEGRATION_DAEMON_URL = os.environ.get('EGERIA_INTEGRATION_DAEMON_URL', 'https://localhost:9443')
34
+ EGERIA_ADMIN_USER = os.environ.get('ADMIN_USER', 'garygeeke')
35
+ EGERIA_ADMIN_PASSWORD = os.environ.get('ADMIN_PASSWORD', 'secret')
36
+ EGERIA_USER = os.environ.get('EGERIA_USER', 'erinoverview')
37
+ EGERIA_USER_PASSWORD = os.environ.get('EGERIA_USER_PASSWORD', 'secret')
38
+
39
+
40
+ @click.command('create-todo')
41
+ @click.option('--server', default=EGERIA_VIEW_SERVER, help='Egeria metadata store to load')
42
+ @click.option('--url', default=EGERIA_VIEW_SERVER_URL, help='URL of Egeria platform to connect to')
43
+ @click.option('--userid', default=EGERIA_USER, help='Egeria user')
44
+ @click.option('--password', default=EGERIA_USER_PASSWORD, help='Egeria user password')
45
+ @click.option('--timeout', default=60, help='Number of seconds to wait')
46
+ @click.option('--name', prompt='Todo Name', help='Name of Todo', required=True)
47
+ @click.option('--description', prompt='Description', help='Brief description of To Do item', required=True)
48
+ @click.option('--type', prompt='Todo Type', help='Type of Todo', required=True, default='forMe')
49
+ @click.option('--priority', prompt='Todo Priority', type=int, help='Priority of Todo', required=True, default=0)
50
+ @click.option('--due', prompt='Due Date', help='Due date of Todo (yyyy-mm-dd)', required=True)
51
+ @click.option('--assigned-to', prompt='Assigned to', help='Party the Todo is assigned to', required=True,
52
+ default=peter_guid)
53
+ def create_todo(server, url, userid, password, timeout, name, description, type, priority, due, assigned_to):
54
+ """Create a new ToDo item"""
55
+ m_client = MyProfile(server, url, user_id=userid, user_pwd=password)
56
+ token = m_client.create_egeria_bearer_token()
57
+ try:
58
+ body = {
59
+ "properties": {
60
+ "class": "ToDoProperties",
61
+ "qualifiedName": f"{name}-{time.asctime()}",
62
+ "name": name,
63
+ "description": description,
64
+ "toDoType": type,
65
+ "priority": priority,
66
+ "dueTime": due,
67
+ "status": "OPEN"
68
+ },
69
+ "assignToActorGUID": assigned_to
70
+ }
71
+
72
+ resp = m_client.create_to_do(body)
73
+ # if type(resp) is str:
74
+ click.echo(f"Response was {resp}")
75
+ # elif type(resp) is dict:
76
+ # click.echo(json.dumps(resp), indent = 2)
77
+
78
+ except (InvalidParameterException, PropertyServerException) as e:
79
+ print_exception_response(e)
80
+ finally:
81
+ m_client.close_session()
82
+
83
+
84
+ @click.command('delete-todo')
85
+ @click.option('--server', default=EGERIA_VIEW_SERVER, help='Egeria metadata store to load')
86
+ @click.option('--url', default=EGERIA_VIEW_SERVER_URL, help='URL of Egeria platform to connect to')
87
+ @click.option('--userid', default=EGERIA_USER, help='Egeria user')
88
+ @click.option('--password', default=EGERIA_USER_PASSWORD, help='Egeria user password')
89
+ @click.option('--timeout', default=60, help='Number of seconds to wait')
90
+ @click.argument('todo-guid')
91
+ def delete_todo(server, url, userid, password, timeout, todo_guid):
92
+ """Delete the todo item specified """
93
+ m_client = MyProfile(server, url, user_id=userid, user_pwd=password)
94
+ token = m_client.create_egeria_bearer_token()
95
+ try:
96
+ m_client.delete_to_do(todo_guid)
97
+
98
+ click.echo(f"Deleted Todo item {todo_guid}")
99
+
100
+ except (InvalidParameterException, PropertyServerException) as e:
101
+ print_exception_response(e)
102
+ finally:
103
+ m_client.close_session()
104
+
105
+
106
+ @click.command('change-todo-status')
107
+ @click.argument('todo-guid')
108
+ @click.option('--server', default=EGERIA_VIEW_SERVER, help='Egeria metadata store to load')
109
+ @click.option('--url', default=EGERIA_VIEW_SERVER_URL, help='URL of Egeria platform to connect to')
110
+ @click.option('--userid', default=EGERIA_USER, help='Egeria user')
111
+ @click.option('--password', default=EGERIA_USER_PASSWORD, help='Egeria user password')
112
+ @click.option('--timeout', default=60, help='Number of seconds to wait')
113
+ @click.option('--new-status', type=click.Choice(['OPEN', 'IN_PROGRESS', 'WAITING', 'COMPLETE', 'ABANDONED'],
114
+ case_sensitive='False'), help='Enter the new ToDo item status',
115
+ required=True)
116
+ def change_todo_status(server, url, userid, password, timeout, todo_guid, new_status):
117
+ """Update a ToDo item status"""
118
+ m_client = MyProfile(server, url, user_id=userid, user_pwd=password)
119
+ token = m_client.create_egeria_bearer_token()
120
+ try:
121
+
122
+ body = {
123
+ "properties": {
124
+ "class": "ToDoProperties",
125
+ "toDoStatus": new_status
126
+ },
127
+ }
128
+ m_client.update_to_do(todo_guid, body, is_merge_update=True)
129
+
130
+ click.echo(f"Marked todo item {todo_guid} as complete.")
131
+
132
+ except (InvalidParameterException, PropertyServerException) as e:
133
+ print_exception_response(e)
134
+ finally:
135
+ m_client.close_session()
136
+
137
+
138
+ @click.command('mark-todo-complete')
139
+ @click.option('--server', default=EGERIA_VIEW_SERVER, help='Egeria metadata store to load')
140
+ @click.option('--url', default=EGERIA_VIEW_SERVER_URL, help='URL of Egeria platform to connect to')
141
+ @click.option('--userid', default=EGERIA_USER, help='Egeria user')
142
+ @click.option('--password', default=EGERIA_USER_PASSWORD, help='Egeria user password')
143
+ @click.option('--timeout', default=60, help='Number of seconds to wait')
144
+ @click.argument('todo-guid')
145
+ def mark_todo_complete(server, url, userid, password, timeout, todo_guid):
146
+ """Mark the specified todo as complete"""
147
+ try:
148
+ m_client = MyProfile(server, url, user_id=userid, user_pwd=password)
149
+ token = m_client.create_egeria_bearer_token()
150
+ body = {
151
+ "properties": {
152
+ "class": "ToDoProperties",
153
+ "completionTime": time.asctime(),
154
+ "toDoStatus": "COMPLETE"
155
+ },
156
+ }
157
+ m_client.update_to_do(todo_guid, body, is_merge_update=True)
158
+
159
+ click.echo(f"Marked todo item {todo_guid} as complete.")
160
+
161
+ except (InvalidParameterException, PropertyServerException) as e:
162
+ print_exception_response(e)
163
+ finally:
164
+ m_client.close_session()
165
+
166
+
167
+ @click.command('reassign-todo')
168
+ @click.option('--server', default=EGERIA_VIEW_SERVER, help='Egeria metadata store to load')
169
+ @click.option('--url', default=EGERIA_VIEW_SERVER_URL, help='URL of Egeria platform to connect to')
170
+ @click.option('--userid', default=EGERIA_USER, help='Egeria user')
171
+ @click.option('--password', default=EGERIA_USER_PASSWORD, help='Egeria user password')
172
+ @click.option('--timeout', default=60, help='Number of seconds to wait')
173
+ @click.argument('todo-guid')
174
+ @click.argument('new-actor-guid')
175
+ def reassign_todo(server, url, userid, password, timeout, todo_guid, new_actor_guid):
176
+ """Reassign ToDo item to new actor"""
177
+ m_client = MyProfile(server, url, user_id=userid, user_pwd=password)
178
+ token = m_client.create_egeria_bearer_token()
179
+ try:
180
+
181
+ m_client.reassign_to_do(todo_guid, new_actor_guid)
182
+
183
+ click.echo(f"Reassigned Todo item {todo_guid} to {new_actor_guid}")
184
+
185
+ except (InvalidParameterException, PropertyServerException) as e:
186
+ print_exception_response(e)
187
+ finally:
188
+ m_client.close_session()
@@ -0,0 +1,71 @@
1
+ """
2
+ SPDX-License-Identifier: Apache-2.0
3
+ Copyright Contributors to the ODPi Egeria project.
4
+
5
+
6
+
7
+ Execute engine actions.
8
+
9
+ """
10
+ import os
11
+
12
+ import click
13
+
14
+ # from ops_config import Config, pass_config
15
+ from pyegeria import Platform
16
+ from pyegeria._exceptions import (
17
+ InvalidParameterException,
18
+ PropertyServerException,
19
+ print_exception_response,
20
+ )
21
+
22
+ GERIA_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
+ @click.command('stop')
36
+ @click.option('--server', default=EGERIA_VIEW_SERVER, help='Egeria metadata store to load')
37
+ @click.option('--url', default=EGERIA_VIEW_SERVER_URL, help='URL of Egeria platform to connect to')
38
+ @click.option('--userid', default=EGERIA_ADMIN_USER, help='Egeria admin user')
39
+ @click.option('--password', default=EGERIA_ADMIN_PASSWORD, help='Egeria admin password')
40
+ @click.option('--timeout', default=60, help='Number of seconds to wait')
41
+ def stop_daemon(file, server, url, userid, password, timeout):
42
+ """Stop an engine-host daemon"""
43
+ p_client = Platform(server, url, userid, password)
44
+ try:
45
+ p_client.shutdown_server()
46
+
47
+ click.echo(f"Stopped server {server}")
48
+ except (InvalidParameterException, PropertyServerException) as e:
49
+ print_exception_response(e)
50
+ finally:
51
+ p_client.close_session()
52
+
53
+
54
+ @click.command('start')
55
+ @click.option('--server', default=EGERIA_VIEW_SERVER, help='Egeria metadata store to load')
56
+ @click.option('--url', default=EGERIA_VIEW_SERVER_URL, help='URL of Egeria platform to connect to')
57
+ @click.option('--userid', default=EGERIA_ADMIN_USER, help='Egeria admin user')
58
+ @click.option('--password', default=EGERIA_ADMIN_PASSWORD, help='Egeria admin password')
59
+ @click.option('--timeout', default=60, help='Number of seconds to wait')
60
+ def start_daemon(file, server, url, userid, password, timeout):
61
+ """Start or restart an engine-host from its known configuration """
62
+ p_client = Platform(server, url, userid, password)
63
+ try:
64
+ p_client.activate_server_stored_config()
65
+
66
+ click.echo(f"Started server {server}")
67
+
68
+ except (InvalidParameterException, PropertyServerException) as e:
69
+ print_exception_response(e)
70
+ finally:
71
+ p_client.close_session()