pyegeria 0.3.8__py3-none-any.whl → 0.4.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 (59) hide show
  1. pyegeria/Xfeedback_manager_omvs.py +238 -0
  2. pyegeria/Xloaded_resources_omvs.py +91 -0
  3. pyegeria/__init__.py +15 -12
  4. pyegeria/_client.py +4 -6
  5. pyegeria/{gov_engine.py → _deprecated_gov_engine.py} +2 -59
  6. pyegeria/_exceptions.py +5 -6
  7. pyegeria/_globals.py +3 -1
  8. pyegeria/asset_catalog_omvs.py +672 -0
  9. pyegeria/automated_curation_omvs.py +627 -359
  10. pyegeria/collection_manager_omvs.py +187 -248
  11. pyegeria/core_guids.py +128 -0
  12. pyegeria/core_omag_server_config.py +1 -5
  13. pyegeria/full_omag_server_config.py +53 -83
  14. pyegeria/glossary_browser_omvs.py +2208 -0
  15. pyegeria/glossary_manager_omvs.py +3002 -0
  16. pyegeria/my_profile_omvs.py +2 -7
  17. pyegeria/platform_services.py +0 -3
  18. pyegeria/project_manager_omvs.py +9 -15
  19. pyegeria/registered_info.py +12 -52
  20. pyegeria/runtime_manager_omvs.py +967 -0
  21. pyegeria/server_operations.py +1 -5
  22. pyegeria/valid_metadata_omvs.py +204 -43
  23. pyegeria-0.4.0.data/scripts/Create_Collection_Sample.py +292 -0
  24. pyegeria-0.4.0.data/scripts/Create_Sustainability_Collection_Sample.py +115 -0
  25. pyegeria-0.4.0.data/scripts/get_guid_info.py +86 -0
  26. pyegeria-0.3.8.data/scripts/view_my_profile.py → pyegeria-0.4.0.data/scripts/get_my_profile.py +8 -34
  27. {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/get_tech_details.py +1 -37
  28. pyegeria-0.4.0.data/scripts/get_tech_type_elements.py +137 -0
  29. pyegeria-0.4.0.data/scripts/get_tech_type_template.py +137 -0
  30. {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/list_asset_types.py +3 -25
  31. pyegeria-0.4.0.data/scripts/list_assets.py +138 -0
  32. pyegeria-0.3.8.data/scripts/project_list_viewer.py → pyegeria-0.4.0.data/scripts/list_projects.py +13 -27
  33. pyegeria-0.4.0.data/scripts/list_registered_services.py +135 -0
  34. pyegeria-0.3.8.data/scripts/get_relationship_types.py → pyegeria-0.4.0.data/scripts/list_relationship_types.py +25 -43
  35. pyegeria-0.4.0.data/scripts/list_tech_templates.py +134 -0
  36. pyegeria-0.3.8.data/scripts/find_todos.py → pyegeria-0.4.0.data/scripts/list_todos.py +11 -39
  37. pyegeria-0.4.0.data/scripts/list_valid_metadata_values.py +144 -0
  38. pyegeria-0.4.0.data/scripts/view_asset_graph.py +236 -0
  39. pyegeria-0.3.8.data/scripts/multi-server_status.py → pyegeria-0.4.0.data/scripts/view_coco_status.py +17 -39
  40. pyegeria-0.3.8.data/scripts/collection_viewer.py → pyegeria-0.4.0.data/scripts/view_collection.py +12 -31
  41. pyegeria-0.3.8.data/scripts/engine_action_status.py → pyegeria-0.4.0.data/scripts/view_eng_action_status.py +17 -31
  42. pyegeria-0.3.8.data/scripts/glossary_view.py → pyegeria-0.4.0.data/scripts/view_glossary.py +2 -2
  43. pyegeria-0.3.8.data/scripts/gov_engine_status.py → pyegeria-0.4.0.data/scripts/view_gov_eng_status.py +0 -1
  44. pyegeria-0.3.8.data/scripts/integration_daemon_status.py → pyegeria-0.4.0.data/scripts/view_integ_daemon_status.py +30 -42
  45. pyegeria-0.3.8.data/scripts/my_todos.py → pyegeria-0.4.0.data/scripts/view_my_todos.py +1 -1
  46. pyegeria-0.3.8.data/scripts/open_todos.py → pyegeria-0.4.0.data/scripts/view_open_todos.py +3 -24
  47. pyegeria-0.4.0.data/scripts/view_platform_status.py +123 -0
  48. pyegeria-0.3.8.data/scripts/server_status.py → pyegeria-0.4.0.data/scripts/view_server_status.py +1 -20
  49. {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/METADATA +5 -4
  50. pyegeria-0.4.0.dist-info/RECORD +58 -0
  51. {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/WHEEL +1 -1
  52. pyegeria/glossary_omvs.py +0 -789
  53. pyegeria/loaded_resources_omvs.py +0 -159
  54. pyegeria-0.3.8.dist-info/RECORD +0 -42
  55. /pyegeria/{governance_author.py → action_author_omvs.py} +0 -0
  56. /pyegeria-0.3.8.data/scripts/get_tech_types.py → /pyegeria-0.4.0.data/scripts/list_tech_types.py +0 -0
  57. /pyegeria-0.3.8.data/scripts/server_status_widget.py → /pyegeria-0.4.0.data/scripts/view_server_list.py +0 -0
  58. {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/LICENSE +0 -0
  59. {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,137 @@
1
+ #!python
2
+ """
3
+ SPDX-License-Identifier: Apache-2.0
4
+ Copyright Contributors to the ODPi Egeria project.
5
+
6
+ Display the status of cataloged platforms and servers.
7
+ """
8
+ import sys
9
+ import time
10
+ import argparse
11
+
12
+ from rich import json
13
+ from rich.panel import Panel
14
+
15
+ from pyegeria import (
16
+ InvalidParameterException,
17
+ PropertyServerException,
18
+ UserNotAuthorizedException,
19
+ print_exception_response,
20
+ AutomatedCuration
21
+ )
22
+ from rich.table import Table
23
+ from rich.live import Live
24
+ from rich.console import Console
25
+ from rich.markdown import Markdown
26
+ from rich.tree import Tree
27
+ from rich.prompt import Prompt
28
+ from rich.panel import Panel
29
+ from rich.text import Text
30
+ from rich import print
31
+
32
+ disable_ssl_warnings = True
33
+ console = Console(width=200)
34
+
35
+ platform = "https://127.0.0.1:9443"
36
+ user = "erinoverview"
37
+ view_server = "view-server"
38
+
39
+ guid_list = []
40
+
41
+ def tech_viewer(tech_name: str, server_name:str, platform_url:str, user:str):
42
+
43
+ def build_classifications(classification: dict) -> Markdown:
44
+
45
+ class_md = ("\n")
46
+ for c in classification:
47
+ c_type = c["classificationName"]
48
+ if c_type == "Anchors":
49
+ continue
50
+ class_md += f"* Classification: {c_type}\n"
51
+ class_props = c.get("classificationProperties", None)
52
+ if class_props is None:
53
+ continue
54
+ for prop in class_props.keys():
55
+ class_md += f"\t* {prop}: {class_props[prop]}\n"
56
+ if class_md == "-":
57
+ output = None
58
+ else:
59
+ output = class_md
60
+ return output
61
+
62
+ try:
63
+
64
+ console = Console()
65
+
66
+ a_client = AutomatedCuration(view_server, platform,
67
+ user_id=user)
68
+
69
+ token = a_client.create_egeria_bearer_token(user, "secret")
70
+ tech_elements = a_client.get_technology_type_elements(tech_name, get_templates=False)
71
+ if type(tech_elements) is str:
72
+ console.print(f"No elements found for {tech_name}")
73
+ sys.exit(1)
74
+ tree = Tree(f"Deployed Technology Type: {tech_name}", style="bold bright_white", guide_style="bold bright_blue")
75
+ note: str =" "
76
+ for element in tech_elements:
77
+ header = element['elementHeader']
78
+ tech_type = header["type"]["typeName"]
79
+ tech_collection = header["origin"]['homeMetadataCollectionName']
80
+ tech_created_by = header['versions']['createdBy']
81
+ tech_created_at = header['versions']['createTime']
82
+ tech_guid = header['guid']
83
+ tech_classifications = header['classifications']
84
+ class_md = build_classifications(tech_classifications)
85
+
86
+ referenceables = element['referenceableProperties']
87
+ tech_qualified_name = referenceables['qualifiedName']
88
+ extended = referenceables['extendedProperties']
89
+ ex_md:str = ""
90
+ for key, value in extended.items():
91
+ ex_md += f"* {key}: {value}\n"
92
+
93
+ note = (f"* Qualified Name: {tech_qualified_name}\n"
94
+ f"* GUID: {tech_guid}\n"
95
+ f"* Createdy by: {tech_created_by}\n"
96
+ f"* Created at: {tech_created_at}\n"
97
+ f"* Home Collection: {tech_collection}\n"
98
+ f"{class_md}\n"
99
+ f"{ex_md}\n"
100
+ )
101
+
102
+ interfaces = extended.get('connectorInterfaces', None)
103
+ if interfaces is not None:
104
+ interface_type_name = interfaces['typeName']
105
+ interface_array_cnt = interfaces['arrayCount']
106
+ note += f"* Interface Type: {interface_type_name}\n"
107
+ for i in range(0, int(interface_array_cnt)):
108
+ note += (f"\t* Type: {interfaces['arrayValues']['propertyValueMap'][str(i)]['typeName']}"
109
+ f"\tName: {interfaces['arrayValues']['propertiesAsStrings'][str(i)]}\n"
110
+ )
111
+ note_md = Panel.fit(Markdown(note), style = 'bold bright_white')
112
+ t = tree.add(note_md)
113
+
114
+ print(tree)
115
+
116
+ except (
117
+ InvalidParameterException,
118
+ PropertyServerException,
119
+ UserNotAuthorizedException
120
+ ) as e:
121
+ print_exception_response(e)
122
+
123
+
124
+ if __name__ == "__main__":
125
+ parser = argparse.ArgumentParser()
126
+
127
+ parser.add_argument("--server", help="Name of the server to display status for")
128
+ parser.add_argument("--url", help="URL Platform to connect to")
129
+ parser.add_argument("--userid", help="User Id")
130
+ args = parser.parse_args()
131
+
132
+ server = args.server if args.server is not None else "view-server"
133
+ url = args.url if args.url is not None else "https://localhost:9443"
134
+ userid = args.userid if args.userid is not None else 'erinoverview'
135
+
136
+ tech_name = Prompt.ask("Enter the Asset Name to view:", default="Apache Kafka Server")
137
+ tech_viewer(tech_name,server, url, userid)
@@ -0,0 +1,137 @@
1
+ #!python
2
+ """
3
+ SPDX-License-Identifier: Apache-2.0
4
+ Copyright Contributors to the ODPi Egeria project.
5
+
6
+ Display the status of cataloged platforms and servers.
7
+ """
8
+ import sys
9
+ import time
10
+ import argparse
11
+
12
+ from rich import json
13
+ from rich.panel import Panel
14
+
15
+ from pyegeria import (
16
+ InvalidParameterException,
17
+ PropertyServerException,
18
+ UserNotAuthorizedException,
19
+ print_exception_response,
20
+ AutomatedCuration
21
+ )
22
+ from rich.table import Table
23
+ from rich.live import Live
24
+ from rich.console import Console
25
+ from rich.markdown import Markdown
26
+ from rich.tree import Tree
27
+ from rich.prompt import Prompt
28
+ from rich.panel import Panel
29
+ from rich.text import Text
30
+ from rich import print
31
+
32
+ disable_ssl_warnings = True
33
+ console = Console(width=200)
34
+
35
+ platform = "https://127.0.0.1:9443"
36
+ user = "erinoverview"
37
+ view_server = "view-server"
38
+
39
+ guid_list = []
40
+
41
+ def tech_viewer(tech_name: str, server_name:str, platform_url:str, user:str):
42
+
43
+ def build_classifications(classification: dict) -> Markdown:
44
+
45
+ class_md = ("\n")
46
+ for c in classification:
47
+ c_type = c["classificationName"]
48
+ if c_type == "Anchors":
49
+ continue
50
+ class_md += f"* Classification: {c_type}\n"
51
+ class_props = c.get("classificationProperties", None)
52
+ if class_props is None:
53
+ continue
54
+ for prop in class_props.keys():
55
+ class_md += f"\t* {prop}: {class_props[prop]}\n"
56
+ if class_md == "-":
57
+ output = None
58
+ else:
59
+ output = class_md
60
+ return output
61
+
62
+ try:
63
+
64
+ console = Console()
65
+
66
+ a_client = AutomatedCuration(view_server, platform,
67
+ user_id=user)
68
+
69
+ token = a_client.create_egeria_bearer_token(user, "secret")
70
+ tech_elements = a_client.get_technology_type_elements(tech_name, get_templates=True)
71
+ if len(tech_elements) <= 1:
72
+ console.print(f"No elements found for {tech_name}")
73
+ sys.exit(1)
74
+ tree = Tree(f"Deployed Technology Type: {tech_name}", style="bold bright_white", guide_style="bold bright_blue")
75
+ note: str =" "
76
+ for element in tech_elements:
77
+ header = element['elementHeader']
78
+ tech_type = header["type"]["typeName"]
79
+ tech_collection = header["origin"]['homeMetadataCollectionName']
80
+ tech_created_by = header['versions']['createdBy']
81
+ tech_created_at = header['versions']['createTime']
82
+ tech_guid = header['guid']
83
+ tech_classifications = header['classifications']
84
+ class_md = build_classifications(tech_classifications)
85
+
86
+ referenceables = element['referenceableProperties']
87
+ tech_qualified_name = referenceables['qualifiedName']
88
+ extended = referenceables['extendedProperties']
89
+ ex_md:str = ""
90
+ for key, value in extended.items():
91
+ ex_md += f"* {key}: {value}\n"
92
+
93
+ note = (f"* Qualified Name: {tech_qualified_name}\n"
94
+ f"* GUID: {tech_guid}\n"
95
+ f"* Createdy by: {tech_created_by}\n"
96
+ f"* Created at: {tech_created_at}\n"
97
+ f"* Home Collection: {tech_collection}\n"
98
+ f"{class_md}\n"
99
+ f"{ex_md}\n"
100
+ )
101
+
102
+ interfaces = extended.get('connectorInterfaces', None)
103
+ if interfaces is not None:
104
+ interface_type_name = interfaces['typeName']
105
+ interface_array_cnt = interfaces['arrayCount']
106
+ note += f"* Interface Type: {interface_type_name}\n"
107
+ for i in range(0, int(interface_array_cnt)):
108
+ note += (f"\t* Type: {interfaces['arrayValues']['propertyValueMap'][str(i)]['typeName']}"
109
+ f"\tName: {interfaces['arrayValues']['propertiesAsStrings'][str(i)]}\n"
110
+ )
111
+ note_md = Panel.fit(Markdown(note), style = 'bold bright_white')
112
+ t = tree.add(note_md)
113
+
114
+ print(tree)
115
+
116
+ except (
117
+ InvalidParameterException,
118
+ PropertyServerException,
119
+ UserNotAuthorizedException
120
+ ) as e:
121
+ print_exception_response(e)
122
+
123
+
124
+ if __name__ == "__main__":
125
+ parser = argparse.ArgumentParser()
126
+
127
+ parser.add_argument("--server", help="Name of the server to display status for")
128
+ parser.add_argument("--url", help="URL Platform to connect to")
129
+ parser.add_argument("--userid", help="User Id")
130
+ args = parser.parse_args()
131
+
132
+ server = args.server if args.server is not None else "view-server"
133
+ url = args.url if args.url is not None else "https://localhost:9443"
134
+ userid = args.userid if args.userid is not None else 'erinoverview'
135
+
136
+ tech_name = Prompt.ask("Enter the Asset Name to view:", default="Apache Kafka Server")
137
+ tech_viewer(tech_name,server, url, userid)
@@ -24,38 +24,16 @@ from pyegeria import (
24
24
  RegisteredInfo
25
25
  )
26
26
 
27
- disable_ssl_warnings = True
28
27
 
29
- good_platform1_url = "https://127.0.0.1:9443"
30
- good_platform2_url = "https://egeria.pdr-associates.com:7443"
31
- bad_platform1_url = "https://localhost:9443"
32
-
33
- # good_platform1_url = "https://127.0.0.1:30080"
34
- # good_platform2_url = "https://127.0.0.1:30081"
35
- # bad_platform1_url = "https://localhost:9443"
36
-
37
- good_user_1 = "garygeeke"
38
- good_user_2 = "erinoverview"
39
- bad_user_1 = "eviledna"
40
- bad_user_2 = ""
41
-
42
- good_server_1 = "active-metadata-store"
43
- good_server_2 = "simple-metadata-store"
44
- good_server_3 = "view-server"
45
- good_server_4 = "engine-host"
46
- bad_server_1 = "coco"
47
- bad_server_2 = ""
48
-
49
-
50
- def display_asset_types(server: str = good_server_3, url: str = good_platform1_url, username: str = good_user_2):
28
+ def display_asset_types(server: str, url: str, username: str):
51
29
  r_client = RegisteredInfo(server, url, username)
52
- token = r_client.create_egeria_bearer_token(good_user_2, "secret")
30
+ token = r_client.create_egeria_bearer_token(username, "secret")
53
31
  asset_types = r_client.list_asset_types()
54
32
 
55
33
  def generate_table() -> Table:
56
34
  """Make a new table."""
57
35
  table = Table(
58
- title=f"Asset Types for: {good_platform1_url} @ {time.asctime()}",
36
+ title=f"Asset Types for: {url} @ {time.asctime()}",
59
37
  # style = "black on grey66",
60
38
  header_style="white on dark_blue",
61
39
  show_lines=True,
@@ -0,0 +1,138 @@
1
+ #!python
2
+ """
3
+ SPDX-License-Identifier: Apache-2.0
4
+ Copyright Contributors to the ODPi Egeria project.
5
+
6
+ Unit tests for the Utils helper functions using the Pytest framework.
7
+
8
+
9
+ A simple display for glossary terms
10
+ """
11
+
12
+ import time
13
+ import json
14
+ import argparse
15
+ from pyegeria import (
16
+ InvalidParameterException,
17
+ PropertyServerException,
18
+ UserNotAuthorizedException,
19
+ print_exception_response,
20
+ AssetCatalog
21
+ )
22
+ # import pyegeria.X_asset_catalog_omvs
23
+ from rich.table import Table
24
+ from rich.live import Live
25
+ from rich import box
26
+ from rich.prompt import Prompt
27
+ from rich.tree import Tree
28
+ from rich import print
29
+ from rich.console import Console
30
+
31
+
32
+ from pyegeria.server_operations import ServerOps
33
+ from pyegeria._deprecated_gov_engine import GovEng
34
+ from pyegeria.glossary_browser_omvs import GlossaryBrowser
35
+ disable_ssl_warnings = True
36
+
37
+ good_platform1_url = "https://127.0.0.1:9443"
38
+ good_platform2_url = "https://egeria.pdr-associates.com:7443"
39
+ bad_platform1_url = "https://localhost:9443"
40
+
41
+ # good_platform1_url = "https://127.0.0.1:30080"
42
+ # good_platform2_url = "https://127.0.0.1:30081"
43
+ # bad_platform1_url = "https://localhost:9443"
44
+
45
+ good_user_1 = "garygeeke"
46
+ good_user_2 = "erinoverview"
47
+ bad_user_1 = "eviledna"
48
+ bad_user_2 = ""
49
+
50
+ good_server_1 = "active-metadata-store"
51
+ good_server_2 = "simple-metadata-store"
52
+ good_server_3 = "view-server"
53
+ good_server_4 = "engine-host"
54
+ bad_server_1 = "coco"
55
+ bad_server_2 = ""
56
+
57
+
58
+ def display_assets(search_string: str, guid: str=None, server: str = good_server_3, url: str = good_platform1_url, username: str = good_user_2):
59
+
60
+ g_client = AssetCatalog(server, url, username)
61
+ token = g_client.create_egeria_bearer_token(username, "secret")
62
+
63
+
64
+ def generate_table(search_string:str = '*') -> Table:
65
+ """Make a new table."""
66
+ table = Table(
67
+ title=f"Asset Definitions for assets like {search_string} @ {time.asctime()}",
68
+ # style = "black on grey66",
69
+ header_style="white on dark_blue",
70
+ show_lines=True,
71
+ box=box.ROUNDED,
72
+ caption=f"View Server '{server}' @ Platform - {url}",
73
+ expand=True
74
+ )
75
+ table.add_column("Display Name")
76
+ table.add_column("Type Name")
77
+ table.add_column("GUID", no_wrap=True)
78
+ table.add_column("Network Address/Path")
79
+ table.add_column("Qualified Name")
80
+
81
+
82
+ assets = g_client.find_assets_in_domain(search_string, starts_with=False,
83
+ ends_with=False, ignore_case=True, page_size=10)
84
+ if type(assets) is str:
85
+ return table
86
+
87
+ for element in assets:
88
+ display_name = element["displayName"]
89
+ qualified_name = element["qualifiedName"]
90
+ type_name = element["type"]["typeName"]
91
+ guid = element["guid"]
92
+ path_name = element.get("extendedProperties", None)
93
+ if path_name:
94
+ path = path_name.get("pathName"," ")
95
+ else:
96
+ path = " "
97
+
98
+
99
+
100
+ table.add_row(
101
+ display_name, type_name,guid, path, qualified_name
102
+ )
103
+
104
+ g_client.close_session()
105
+ return table
106
+
107
+ try:
108
+ # with Live(generate_table(), refresh_per_second=4, screen=True) as live:
109
+ # while True:
110
+ # time.sleep(2)
111
+ # live.update(generate_table())
112
+ console = Console()
113
+ with console.pager():
114
+ console.print(generate_table(search_string))
115
+
116
+
117
+ except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
118
+ print_exception_response(e)
119
+ assert e.related_http_code != "200", "Invalid parameters"
120
+
121
+ if __name__ == "__main__":
122
+ sus_guid = "f9b78b26-6025-43fa-9299-a905cc6d1575"
123
+ parser = argparse.ArgumentParser()
124
+ parser.add_argument("--server", help="Name of the server to display status for")
125
+ parser.add_argument("--url", help="URL Platform to connect to")
126
+ parser.add_argument("--userid", help="User Id")
127
+ parser.add_argument("--guid", help="GUID of glossary to search")
128
+ parser.add_argument("--sustainability", help="Set True for Sustainability Glossary")
129
+ args = parser.parse_args()
130
+
131
+ server = args.server if args.server is not None else "view-server"
132
+ url = args.url if args.url is not None else "https://localhost:9443"
133
+ userid = args.userid if args.userid is not None else 'garygeeke'
134
+ guid = args.guid if args.guid is not None else None
135
+ guid = sus_guid if args.sustainability else None
136
+
137
+ search_string = Prompt.ask("Enter the asset you are searching for:", default="*")
138
+ display_assets(search_string, guid,server, url, userid)
@@ -10,41 +10,27 @@ Unit tests for the Utils helper functions using the Pytest framework.
10
10
  A simple display for glossary terms
11
11
  """
12
12
 
13
- import time
14
- import json
15
13
  import argparse
14
+ import json
15
+ import time
16
+
17
+ from rich import box
18
+ from rich import print
19
+ from rich.console import Console
20
+ from rich.prompt import Prompt
21
+ from rich.table import Table
22
+
16
23
  from pyegeria import (
17
24
  InvalidParameterException,
18
25
  PropertyServerException,
19
26
  UserNotAuthorizedException,
20
27
  print_exception_response,
21
28
  )
22
- from rich.table import Table
23
- from rich.live import Live
24
- from rich import box
25
- from rich.prompt import Prompt
26
- from rich.tree import Tree
27
- from rich import print
28
- from rich.console import Console
29
- from pyegeria import ValidMetadataManager, ProjectManager
30
-
31
- disable_ssl_warnings = True
32
-
33
- good_platform1_url = "https://127.0.0.1:9443"
34
-
35
-
36
- # good_platform1_url = "https://127.0.0.1:30080"
37
- # good_platform2_url = "https://127.0.0.1:30081"
38
- # bad_platform1_url = "https://localhost:9443"
39
-
40
- good_user_1 = "garygeeke"
41
- good_user_2 = "erinoverview"
42
- good_server_3 = "view-server"
43
-
29
+ from pyegeria import ProjectManager
44
30
 
45
31
 
46
- def display_list(project_name: str, server: str = good_server_3, url: str = good_platform1_url,
47
- username: str = good_user_2, save_output: bool = False):
32
+ def display_list(project_name: str, server: str, url: str,
33
+ username: str, save_output: bool):
48
34
 
49
35
  p_client = ProjectManager(server, url, user_id=username)
50
36
  token = p_client.create_egeria_bearer_token(username, "secret")
@@ -148,6 +134,6 @@ if __name__ == "__main__":
148
134
  url = args.url if args.url is not None else "https://localhost:9443"
149
135
  userid = args.userid if args.userid is not None else 'erinoverview'
150
136
  save_output = args.save_output if args.save_output is not None else False
151
- project_name = Prompt.ask("Enter the Property to retrieve:", default="*")
137
+ project_name = Prompt.ask("Enter the Project to retrieve:", default="*")
152
138
 
153
139
  display_list(project_name, server, url, userid, save_output)
@@ -0,0 +1,135 @@
1
+ #!python
2
+ """
3
+ SPDX-License-Identifier: Apache-2.0
4
+ Copyright Contributors to the ODPi Egeria project.
5
+
6
+ A simple widget to retrieve the registered services.
7
+
8
+ """
9
+
10
+ import argparse
11
+ import sys
12
+ import time
13
+
14
+ from rich import box
15
+ from rich.console import Console
16
+ from rich.prompt import Prompt
17
+ from rich.table import Table
18
+
19
+ from pyegeria import (
20
+ InvalidParameterException,
21
+ PropertyServerException,
22
+ UserNotAuthorizedException,
23
+ RegisteredInfo,
24
+ )
25
+
26
+
27
+ def display_registered_svcs(service: str, server: str , url: str,
28
+ username: str, password: str ):
29
+ """ Display the registered services list
30
+ Parameters
31
+ ----------
32
+ service : str, optional
33
+ The type of service to display information for. Default is "help".
34
+
35
+ server : str, optional
36
+ The server to connect to. Default is `default_server`.
37
+
38
+ url : str, optional
39
+ The platform URL. Default is `default_platform`.
40
+
41
+ username : str, optional
42
+ The username for authentication. Default is `default_user`.
43
+
44
+ password : str, optional
45
+ The password for authentication. Default is `default_password`.
46
+ """
47
+ def generate_table(svc_list) -> Table:
48
+ """Make a new table."""
49
+ table = Table(
50
+ title=f"Technology Types for: {url} @ {time.asctime()}",
51
+ # style = "black on grey66",
52
+ header_style="white on dark_blue",
53
+ show_lines=True,
54
+ box=box.ROUNDED,
55
+ caption=f"Registered Services from Server '{server}' @ Platform - {url}",
56
+ expand=True
57
+ )
58
+ table.add_column("Service Id")
59
+ table.add_column("Service Name")
60
+ table.add_column("Service Development Status")
61
+ table.add_column("URL Marker")
62
+ table.add_column("Description")
63
+ table.add_column("Wiki")
64
+ table.add_column("Server Type")
65
+ table.add_column("Partner Service Name")
66
+ table.add_column("Partner Service Type")
67
+
68
+ if type(svc_list) is list:
69
+ for svc in svc_list:
70
+ svc_id = str(svc.get("serviceId", " "))
71
+ svc_name = svc.get("serviceName", "b")
72
+ svc_dev_status = svc.get("serviceDevelopmentStatus", " ")
73
+ svc_url_marker = svc.get("serviceUrlMarker", " ")
74
+ svc_description = svc.get("serviceDescription", " ")
75
+ svc_wiki = svc.get("serviceWiki", " ")
76
+ svc_partner_svc_name = svc.get("partnerServiceName", " ")
77
+ svc_partner_svc_type = svc.get("partnerServiceType", " ")
78
+
79
+ table.add_row(
80
+ svc_id, svc_name, svc_dev_status, svc_url_marker, svc_description, svc_wiki,
81
+ svc_partner_svc_name, svc_partner_svc_type
82
+ )
83
+ return table
84
+ elif type(svc_list) is str:
85
+ help = """
86
+ The kinds of services that you can get more information include:
87
+ all.....................lists all registered services
88
+ access-services.........lists all registered access services
89
+ common-services.........lists all registered common services
90
+ engine-services.........lists all registered engine services
91
+ governance-services.....lists all registered governance services
92
+ integration-services....lists all registered integration services
93
+ view-services...........lists all registered view services
94
+
95
+ Pass in a parameter from the left-hand column into the function to
96
+ get more details on the specified service category.
97
+ """
98
+ console.print(help)
99
+
100
+ else:
101
+ print("Unknown service type")
102
+ sys.exit(1)
103
+
104
+ console = Console()
105
+ try:
106
+ a_client = RegisteredInfo(server, url, username)
107
+ # token = a_client.create_egeria_bearer_token(username, password)
108
+ svc_list = a_client.list_registered_svcs(service)
109
+
110
+ with console.pager():
111
+ console.print(generate_table(svc_list))
112
+
113
+ except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
114
+ console.print_exception(show_locals=True)
115
+ finally:
116
+ a_client.close_session()
117
+
118
+
119
+ if __name__ == "__main__":
120
+ parser = argparse.ArgumentParser()
121
+ parser.add_argument("--server", help="Name of the server to display status for")
122
+ parser.add_argument("--url", help="URL Platform to connect to")
123
+ parser.add_argument("--userid", help="User Id")
124
+ parser.add_argument("--password", help="Password")
125
+
126
+ args = parser.parse_args()
127
+
128
+ server = args.server if args.server is not None else "active-metadata-store"
129
+ url = args.url if args.url is not None else "https://localhost:9443"
130
+ userid = args.userid if args.userid is not None else 'garygeeke'
131
+ password = args.password if args.password is not None else 'secret'
132
+
133
+ svc_kind = Prompt.ask("Enter the service type you are searching for:", default="all")
134
+
135
+ display_registered_svcs(svc_kind, server, url, userid, password=password)