pyegeria 0.3.5__py3-none-any.whl → 0.3.7__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.
- pyegeria/automated_curation_omvs.py +73 -20
- pyegeria/core_omag_server_config.py +4 -1
- pyegeria-0.3.7.data/scripts/collection_viewer.py +98 -0
- {pyegeria-0.3.5.data → pyegeria-0.3.7.data}/scripts/engine_action_status.py +8 -10
- pyegeria-0.3.7.data/scripts/get_relationship_types.py +141 -0
- pyegeria-0.3.7.data/scripts/get_tech_details.py +147 -0
- pyegeria-0.3.7.data/scripts/get_tech_types.py +124 -0
- {pyegeria-0.3.5.data → pyegeria-0.3.7.data}/scripts/list_asset_types.py +2 -3
- pyegeria-0.3.7.data/scripts/project_list_viewer.py +153 -0
- {pyegeria-0.3.5.dist-info → pyegeria-0.3.7.dist-info}/METADATA +1 -1
- {pyegeria-0.3.5.dist-info → pyegeria-0.3.7.dist-info}/RECORD +24 -19
- {pyegeria-0.3.5.data → pyegeria-0.3.7.data}/scripts/find_todos.py +0 -0
- {pyegeria-0.3.5.data → pyegeria-0.3.7.data}/scripts/glossary_view.py +0 -0
- {pyegeria-0.3.5.data → pyegeria-0.3.7.data}/scripts/gov_engine_status.py +0 -0
- {pyegeria-0.3.5.data → pyegeria-0.3.7.data}/scripts/integration_daemon_status.py +0 -0
- {pyegeria-0.3.5.data → pyegeria-0.3.7.data}/scripts/multi-server_status.py +0 -0
- {pyegeria-0.3.5.data → pyegeria-0.3.7.data}/scripts/my_todos.py +0 -0
- {pyegeria-0.3.5.data → pyegeria-0.3.7.data}/scripts/open_todos.py +0 -0
- {pyegeria-0.3.5.data → pyegeria-0.3.7.data}/scripts/server_status.py +0 -0
- {pyegeria-0.3.5.data → pyegeria-0.3.7.data}/scripts/server_status_widget.py +0 -0
- {pyegeria-0.3.5.data → pyegeria-0.3.7.data}/scripts/view_my_profile.py +0 -0
- {pyegeria-0.3.5.dist-info → pyegeria-0.3.7.dist-info}/LICENSE +0 -0
- {pyegeria-0.3.5.dist-info → pyegeria-0.3.7.dist-info}/WHEEL +0 -0
- {pyegeria-0.3.5.dist-info → pyegeria-0.3.7.dist-info}/top_level.txt +0 -0
@@ -47,6 +47,7 @@ class AutomatedCuration(Client):
|
|
47
47
|
Client.__init__(self, server_name, platform_url, user_id, user_pwd, verify_flag)
|
48
48
|
self.cur_command_root = f"{platform_url}/servers/"
|
49
49
|
|
50
|
+
|
50
51
|
async def _async_create_element_from_template(self, body: dict, server: str = None) -> str:
|
51
52
|
""" Create a new metadata element from a template. Async version.
|
52
53
|
Parameters
|
@@ -596,7 +597,7 @@ class AutomatedCuration(Client):
|
|
596
597
|
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/engine-actions/by-name?"
|
597
598
|
f"startFrom={start_from}&pageSize={page_size}")
|
598
599
|
body = {
|
599
|
-
"
|
600
|
+
"filter": name
|
600
601
|
}
|
601
602
|
response = await self._async_make_request("POST", url, body)
|
602
603
|
return response.json().get("elements", "no actions")
|
@@ -816,7 +817,7 @@ class AutomatedCuration(Client):
|
|
816
817
|
)
|
817
818
|
return response
|
818
819
|
|
819
|
-
async def
|
820
|
+
async def _async_get_gov_action_process_graph(self, process_guid: str, server: str = None) -> dict | str:
|
820
821
|
""" Retrieve the governance action process metadata element with the supplied unique
|
821
822
|
identifier along with the flow definition describing its implementation. Async Version.
|
822
823
|
Parameters
|
@@ -848,7 +849,7 @@ class AutomatedCuration(Client):
|
|
848
849
|
response = await self._async_make_request("GET", url)
|
849
850
|
return response.json().get("element", "no actions")
|
850
851
|
|
851
|
-
def
|
852
|
+
def get_gov_action_process_graph(self, process_guid: str, server: str = None) -> dict | str:
|
852
853
|
""" Retrieve the governance action process metadata element with the supplied unique
|
853
854
|
identifier along with the flow definition describing its implementation.
|
854
855
|
Parameters
|
@@ -915,7 +916,7 @@ class AutomatedCuration(Client):
|
|
915
916
|
"class": "NameRequestBody",
|
916
917
|
"name": name
|
917
918
|
}
|
918
|
-
response = await self._async_make_request("
|
919
|
+
response = await self._async_make_request("POST", url, body)
|
919
920
|
return response.json().get("elements", "no actions")
|
920
921
|
|
921
922
|
def get_gov_action_processes_by_name(self, name: str, server: str = None, start_from: int = 0,
|
@@ -1009,7 +1010,7 @@ class AutomatedCuration(Client):
|
|
1009
1010
|
"class": "SearchStringRequestBody",
|
1010
1011
|
"name": search_string
|
1011
1012
|
}
|
1012
|
-
response = await self._async_make_request("
|
1013
|
+
response = await self._async_make_request("POST", url, body)
|
1013
1014
|
return response.json().get("elements", "no actions")
|
1014
1015
|
|
1015
1016
|
def find_gov_action_processes(self, search_string: str = "*", server: str = None, starts_with: bool = False,
|
@@ -1110,7 +1111,7 @@ class AutomatedCuration(Client):
|
|
1110
1111
|
response = await self._async_make_request("POST", url, new_body)
|
1111
1112
|
return response.json().get("guid", "Action not initiated")
|
1112
1113
|
|
1113
|
-
def
|
1114
|
+
def initiate_gov_action_process(self, action_type_qualified_name: str, request_source_guids: [str],
|
1114
1115
|
action_targets: [str], start_time: datetime, request_parameters: dict,
|
1115
1116
|
orig_service_name: str, orig_engine_name: str, server: str = None) -> str:
|
1116
1117
|
""" Using the named governance action process as a template, initiate a chain of engine actions.
|
@@ -1153,7 +1154,7 @@ class AutomatedCuration(Client):
|
|
1153
1154
|
)
|
1154
1155
|
return response
|
1155
1156
|
|
1156
|
-
async def
|
1157
|
+
async def _async_get_gov_action_types_by_guid(self, gov_action_type_guid: str, server: str = None) -> dict | str:
|
1157
1158
|
""" Retrieve the governance action type metadata element with the supplied unique identifier. Async version.
|
1158
1159
|
|
1159
1160
|
Parameters:
|
@@ -1182,7 +1183,7 @@ class AutomatedCuration(Client):
|
|
1182
1183
|
response = await self._async_make_request("GET", url)
|
1183
1184
|
return response.json().get("element", "no actions")
|
1184
1185
|
|
1185
|
-
def
|
1186
|
+
def get_gov_action_types_by_guid(self, gov_action_type_guid: str, server: str = None) -> dict | str:
|
1186
1187
|
""" Retrieve the governance action type metadata element with the supplied unique identifier.
|
1187
1188
|
|
1188
1189
|
Parameters:
|
@@ -1276,7 +1277,7 @@ class AutomatedCuration(Client):
|
|
1276
1277
|
|
1277
1278
|
async def _async_find_gov_action_types(self, search_string: str = "*", server: str = None,
|
1278
1279
|
starts_with: bool = False,
|
1279
|
-
ends_with: bool = False, ignore_case: bool =
|
1280
|
+
ends_with: bool = False, ignore_case: bool = True, start_from: int = 0,
|
1280
1281
|
page_size: int = max_paging_size) -> list | str:
|
1281
1282
|
""" Retrieve the list of governance action type metadata elements that contain the search string.
|
1282
1283
|
Async Version.
|
@@ -1334,7 +1335,7 @@ class AutomatedCuration(Client):
|
|
1334
1335
|
"class": "SearchStringRequestBody",
|
1335
1336
|
"name": search_string
|
1336
1337
|
}
|
1337
|
-
response = await self._async_make_request("
|
1338
|
+
response = await self._async_make_request("POST", url, body)
|
1338
1339
|
return response.json().get("elements", "no action types")
|
1339
1340
|
|
1340
1341
|
def find_gov_action_types(self, search_string: str = "*", server: str = None, starts_with: bool = False,
|
@@ -1481,6 +1482,30 @@ class AutomatedCuration(Client):
|
|
1481
1482
|
)
|
1482
1483
|
return response
|
1483
1484
|
|
1485
|
+
async def _async_initiate_postgres_database_survey(self, postgres_database_guid: str, server: str = None) -> str:
|
1486
|
+
server = self.server_name if server is None else server
|
1487
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-action-types/"
|
1488
|
+
f"initiate")
|
1489
|
+
|
1490
|
+
body = {
|
1491
|
+
"class": "InitiateGovernanceActionTypeRequestBody",
|
1492
|
+
"governanceActionTypeQualifiedName": "Egeria:GovernanceActionType:2adeb8f1-0f59-4970-b6f2-6cc25d4d2402survey-postgres-database",
|
1493
|
+
"actionTargets": [{
|
1494
|
+
"class": "NewActionTarget",
|
1495
|
+
"actionTargetName": "serverToSurvey",
|
1496
|
+
"actionTargetGUID": postgres_database_guid
|
1497
|
+
}]
|
1498
|
+
}
|
1499
|
+
response = await self._async_make_request("POST", url, body)
|
1500
|
+
return response.json().get("guid", "Action not initiated")
|
1501
|
+
|
1502
|
+
def initiate_postgres_database_survey(self, postgres_database_guid: str, server: str = None) -> str:
|
1503
|
+
loop = asyncio.get_event_loop()
|
1504
|
+
response = loop.run_until_complete(
|
1505
|
+
self._async_initiate_postgres_server_survey(postgres_database_guid, server)
|
1506
|
+
)
|
1507
|
+
return response
|
1508
|
+
|
1484
1509
|
async def _async_initiate_postgres_server_survey(self, postgres_server_guid: str, server: str = None) -> str:
|
1485
1510
|
server = self.server_name if server is None else server
|
1486
1511
|
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-action-types/"
|
@@ -1508,6 +1533,8 @@ class AutomatedCuration(Client):
|
|
1508
1533
|
)
|
1509
1534
|
return response
|
1510
1535
|
|
1536
|
+
|
1537
|
+
|
1511
1538
|
async def _async_initiate_file_folder_survey(self, file_folder_guid: str,
|
1512
1539
|
server: str = None) -> str:
|
1513
1540
|
server = self.server_name if server is None else server
|
@@ -1527,13 +1554,39 @@ class AutomatedCuration(Client):
|
|
1527
1554
|
response = await self._async_make_request("POST", url, body)
|
1528
1555
|
return response.json().get("guid", "Action not initiated")
|
1529
1556
|
|
1530
|
-
def initiate_file_folder_survey(self, file_folder_guid:
|
1557
|
+
def initiate_file_folder_survey(self, file_folder_guid:str, server: str = None) -> str:
|
1531
1558
|
loop = asyncio.get_event_loop()
|
1532
1559
|
response = loop.run_until_complete(
|
1533
1560
|
self._async_initiate_file_folder_survey(file_folder_guid, server)
|
1534
1561
|
)
|
1535
1562
|
return response
|
1536
1563
|
|
1564
|
+
async def _async_initiate_file_survey(self, file_guid: str,
|
1565
|
+
server: str = None) -> str:
|
1566
|
+
server = self.server_name if server is None else server
|
1567
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-action-types/"
|
1568
|
+
f"initiate")
|
1569
|
+
|
1570
|
+
body = {
|
1571
|
+
"class": "InitiateGovernanceActionTypeRequestBody",
|
1572
|
+
"governanceActionTypeQualifiedName":
|
1573
|
+
"Egeria:GovernanceActionType:2adeb8f1-0f59-4970-b6f2-6cc25d4d2402survey-folder",
|
1574
|
+
"actionTargets": [{
|
1575
|
+
"class": "NewActionTarget",
|
1576
|
+
"actionTargetName": "fileToSurvey",
|
1577
|
+
"actionTargetGUID": file_guid
|
1578
|
+
}]
|
1579
|
+
}
|
1580
|
+
response = await self._async_make_request("POST", url, body)
|
1581
|
+
return response.json().get("guid", "Action not initiated")
|
1582
|
+
|
1583
|
+
def initiate_file_survey(self, file_guid:str, server: str = None) -> str:
|
1584
|
+
loop = asyncio.get_event_loop()
|
1585
|
+
response = loop.run_until_complete(
|
1586
|
+
self._async_initiate_file_survey(file_guid, server)
|
1587
|
+
)
|
1588
|
+
return response
|
1589
|
+
|
1537
1590
|
async def _async_initiate_kafka_server_survey(self, kafka_server_guid: str, server: str = None) -> str:
|
1538
1591
|
server = self.server_name if server is None else server
|
1539
1592
|
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/governance-action-types/"
|
@@ -1810,7 +1863,7 @@ class AutomatedCuration(Client):
|
|
1810
1863
|
return response
|
1811
1864
|
|
1812
1865
|
async def _async_add_catalog_target(self, integ_connector_guid: str, metadata_element_guid: str,
|
1813
|
-
catalog_target_name: str, metadata_src_qual_name: str, config_properties: dict
|
1866
|
+
catalog_target_name: str, metadata_src_qual_name: str = None, config_properties: dict = None
|
1814
1867
|
, server: str = None) -> None:
|
1815
1868
|
""" Add a catalog target to an integration connector.
|
1816
1869
|
Async version.
|
@@ -1855,7 +1908,7 @@ class AutomatedCuration(Client):
|
|
1855
1908
|
return
|
1856
1909
|
|
1857
1910
|
def add_catalog_target(self, integ_connector_guid: str, metadata_element_guid: str, catalog_target_name: str,
|
1858
|
-
metadata_src_qual_name: str, config_properties: dict, server: str = None) -> None:
|
1911
|
+
metadata_src_qual_name: str = None, config_properties: dict = None, server: str = None) -> None:
|
1859
1912
|
""" Add a catalog target to an integration connector.
|
1860
1913
|
|
1861
1914
|
Parameters:
|
@@ -1892,7 +1945,7 @@ class AutomatedCuration(Client):
|
|
1892
1945
|
return
|
1893
1946
|
|
1894
1947
|
async def _async_remove_catalog_target(self, integ_connector_guid: str, metadata_element_guid: str,
|
1895
|
-
|
1948
|
+
server: str = None) -> None:
|
1896
1949
|
""" Remove a catalog target to an integration connector. Async version.
|
1897
1950
|
|
1898
1951
|
Parameters:
|
@@ -1925,7 +1978,7 @@ class AutomatedCuration(Client):
|
|
1925
1978
|
return
|
1926
1979
|
|
1927
1980
|
def remove_catalog_target(self, integ_connector_guid: str, metadata_element_guid: str,
|
1928
|
-
|
1981
|
+
server: str = None) -> None:
|
1929
1982
|
""" Remove a catalog target to an integration connector.
|
1930
1983
|
|
1931
1984
|
Parameters:
|
@@ -1993,7 +2046,7 @@ class AutomatedCuration(Client):
|
|
1993
2046
|
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/open-metadata-types/"
|
1994
2047
|
f"{type_name}/technology-types?startFrom={start_from}&pageSize={page_size}")
|
1995
2048
|
body = {
|
1996
|
-
"
|
2049
|
+
"filter": tech_name
|
1997
2050
|
}
|
1998
2051
|
|
1999
2052
|
response = await self._async_make_request("GET", url, body)
|
@@ -2064,7 +2117,7 @@ class AutomatedCuration(Client):
|
|
2064
2117
|
validate_name(type_name)
|
2065
2118
|
url = f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/technology-types/by-name"
|
2066
2119
|
|
2067
|
-
body = {"
|
2120
|
+
body = {"filter": type_name}
|
2068
2121
|
|
2069
2122
|
response = await self._async_make_request("POST", url, body)
|
2070
2123
|
return response.json().get("element", "no type found")
|
@@ -2155,12 +2208,12 @@ class AutomatedCuration(Client):
|
|
2155
2208
|
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/automated-curation/technology-types/"
|
2156
2209
|
f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
2157
2210
|
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}")
|
2158
|
-
body = {"
|
2211
|
+
body = {"filter": search_string}
|
2159
2212
|
|
2160
2213
|
response = await self._async_make_request("POST", url, body)
|
2161
2214
|
return response.json().get("elements", "no tech found")
|
2162
2215
|
|
2163
|
-
def find_technology_types(self,
|
2216
|
+
def find_technology_types(self, search_string: str = "*", server: str = None, start_from: int = 0,
|
2164
2217
|
page_size: int = max_paging_size, starts_with: bool = False,
|
2165
2218
|
ends_with: bool = False, ignore_case: bool = True) -> list | str:
|
2166
2219
|
""" Retrieve the list of technology types that contain the search string. Async version.
|
@@ -2189,7 +2242,7 @@ class AutomatedCuration(Client):
|
|
2189
2242
|
|
2190
2243
|
loop = asyncio.get_event_loop()
|
2191
2244
|
response = loop.run_until_complete(
|
2192
|
-
self._async_find_technology_types(
|
2245
|
+
self._async_find_technology_types(search_string, server, start_from,
|
2193
2246
|
page_size, starts_with, ends_with, ignore_case)
|
2194
2247
|
)
|
2195
2248
|
return response
|
@@ -754,7 +754,8 @@ class CoreServerConfig(Client):
|
|
754
754
|
f"{topic_name}")
|
755
755
|
self.make_request("POST", url, severities)
|
756
756
|
|
757
|
-
def add_file_log_destinations(self, directory_name: str, severities
|
757
|
+
def add_file_log_destinations(self, directory_name: str, severities=None,
|
758
|
+
server_name: str = None) -> None:
|
758
759
|
""" Adds a file log destination to a server. Each message is a separate file in the directory
|
759
760
|
indicated by the directory name.
|
760
761
|
|
@@ -785,6 +786,8 @@ class CoreServerConfig(Client):
|
|
785
786
|
invalid or make the new call invalid.
|
786
787
|
|
787
788
|
"""
|
789
|
+
if severities is None:
|
790
|
+
severities = ["Error", "Exception"]
|
788
791
|
if server_name is None:
|
789
792
|
server_name = self.server_name
|
790
793
|
|
@@ -0,0 +1,98 @@
|
|
1
|
+
#!python
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
A simple viewer for collections - provide the root and we display the hierarchy
|
7
|
+
|
8
|
+
"""
|
9
|
+
|
10
|
+
import time
|
11
|
+
import argparse
|
12
|
+
|
13
|
+
from rich.box import Box
|
14
|
+
from rich.markdown import Markdown
|
15
|
+
from rich.prompt import Prompt
|
16
|
+
|
17
|
+
from pyegeria._exceptions import (
|
18
|
+
InvalidParameterException,
|
19
|
+
PropertyServerException,
|
20
|
+
UserNotAuthorizedException,
|
21
|
+
print_exception_response,
|
22
|
+
)
|
23
|
+
from rich.table import Table
|
24
|
+
from rich.live import Live
|
25
|
+
from rich.text import Text
|
26
|
+
from rich.tree import Tree
|
27
|
+
from rich.markdown import Markdown
|
28
|
+
|
29
|
+
from rich import print
|
30
|
+
from rich.console import Group
|
31
|
+
from rich.panel import Panel
|
32
|
+
from rich import box, align
|
33
|
+
from rich.layout import Layout
|
34
|
+
import rich
|
35
|
+
from pyegeria import CollectionManager, UserNotAuthorizedException, PropertyServerException, InvalidParameterException
|
36
|
+
|
37
|
+
disable_ssl_warnings = True
|
38
|
+
|
39
|
+
platform = "https://127.0.0.1:9443"
|
40
|
+
user = "erinoverview"
|
41
|
+
view_server = "view-server"
|
42
|
+
|
43
|
+
|
44
|
+
def collection_viewer(root: str, server_name:str, platform_url:str, user:str):
|
45
|
+
|
46
|
+
def walk_collection_hierarchy(collection_client: CollectionManager, root_collection_name: str, tree: Tree) -> Tree:
|
47
|
+
"""Recursively build a Tree with collection contents."""
|
48
|
+
members = collection_client.get_member_list(root_collection_name)
|
49
|
+
if members:
|
50
|
+
for member in members:
|
51
|
+
|
52
|
+
style = ""
|
53
|
+
text_collection_name = Text(f"[bold white] Name: {member['name']}", "")
|
54
|
+
text_qualified_name = Text(f"* QualifiedName: {member['qualifiedName']}""yellow")
|
55
|
+
text_guid = Text(f"* GUID: {member['guid']}", "green")
|
56
|
+
text_collection_type = Text(f"* Collection Type: {member['collectionType']}", "cyan")
|
57
|
+
text_description = Text(f"* Description: {member['description']}", "cyan")
|
58
|
+
p = Panel.fit(f"[white]{text_collection_name}[green]\n{text_qualified_name}\n{text_guid}\n"
|
59
|
+
f"{text_collection_type}\n{text_description}")
|
60
|
+
tt = tree.add(p, style=style)
|
61
|
+
|
62
|
+
children = collection_client.get_collection_members(member['guid'])
|
63
|
+
if type(children) is list:
|
64
|
+
branch = tt.add(f"[bold magenta]Members", style=style, guide_style=style)
|
65
|
+
walk_collection_hierarchy(collection_client, member['qualifiedName'], branch),
|
66
|
+
|
67
|
+
|
68
|
+
try:
|
69
|
+
tree = Tree(f"[bold bright green]{root}", guide_style="bold bright_blue")
|
70
|
+
c_client = CollectionManager(view_server, platform,
|
71
|
+
user_id=user)
|
72
|
+
|
73
|
+
token = c_client.create_egeria_bearer_token(user, "secret")
|
74
|
+
walk_collection_hierarchy(c_client,root,tree)
|
75
|
+
print(tree)
|
76
|
+
|
77
|
+
except (
|
78
|
+
InvalidParameterException,
|
79
|
+
PropertyServerException,
|
80
|
+
UserNotAuthorizedException
|
81
|
+
) as e:
|
82
|
+
print_exception_response(e)
|
83
|
+
|
84
|
+
|
85
|
+
if __name__ == "__main__":
|
86
|
+
parser = argparse.ArgumentParser()
|
87
|
+
|
88
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
89
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
90
|
+
parser.add_argument("--userid", help="User Id")
|
91
|
+
args = parser.parse_args()
|
92
|
+
|
93
|
+
server = args.server if args.server is not None else "view-server"
|
94
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
95
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
96
|
+
|
97
|
+
root_collection = Prompt.ask("Enter the Root Collection to start from:", default="Digital Products Root")
|
98
|
+
collection_viewer(root_collection,server, url, userid)
|
@@ -16,7 +16,7 @@ import time
|
|
16
16
|
from rich import box
|
17
17
|
from rich.live import Live
|
18
18
|
from rich.table import Table
|
19
|
-
from rich import
|
19
|
+
from rich.console import Console
|
20
20
|
|
21
21
|
from pyegeria import (
|
22
22
|
InvalidParameterException,
|
@@ -65,7 +65,7 @@ def display_status_engine_actions(server: str = good_server_3, url: str = good_p
|
|
65
65
|
)
|
66
66
|
table.add_column("Requested Time")
|
67
67
|
table.add_column("Start Time")
|
68
|
-
|
68
|
+
table.add_column("Action GUID", no_wrap=True)
|
69
69
|
table.add_column("Engine Name")
|
70
70
|
table.add_column("Request Type")
|
71
71
|
table.add_column("Action Status")
|
@@ -76,7 +76,7 @@ def display_status_engine_actions(server: str = good_server_3, url: str = good_p
|
|
76
76
|
|
77
77
|
token = g_client.create_egeria_bearer_token()
|
78
78
|
action_status = g_client.get_engine_actions()
|
79
|
-
if
|
79
|
+
if "No Elements" in action_status:
|
80
80
|
requested_time = " "
|
81
81
|
start_time = " "
|
82
82
|
completion_time = " "
|
@@ -94,7 +94,7 @@ def display_status_engine_actions(server: str = good_server_3, url: str = good_p
|
|
94
94
|
|
95
95
|
engine_name = action["governanceEngineName"]
|
96
96
|
request_type = action["requestType"]
|
97
|
-
|
97
|
+
action_guid = action["elementHeader"]["guid"]
|
98
98
|
if action["actionStatus"] in ("REQUESTED", "APPROVED", "WAITING", "ACTIVATING"):
|
99
99
|
action_status = f"[yellow]{action['actionStatus']}"
|
100
100
|
elif action["actionStatus"] in ("IN_PROGRESS", "ACTIONED"):
|
@@ -112,7 +112,7 @@ def display_status_engine_actions(server: str = good_server_3, url: str = good_p
|
|
112
112
|
completion_message = action.get("completionMessage", " ")
|
113
113
|
|
114
114
|
table.add_row(
|
115
|
-
requested_time, start_time, engine_name, request_type,
|
115
|
+
requested_time, start_time, action_guid,engine_name, request_type,
|
116
116
|
action_status, target_element, completion_time, process_name, completion_message
|
117
117
|
)
|
118
118
|
|
@@ -120,11 +120,9 @@ def display_status_engine_actions(server: str = good_server_3, url: str = good_p
|
|
120
120
|
return table
|
121
121
|
|
122
122
|
try:
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
live.update(generate_table())
|
127
|
-
live.console.pager()
|
123
|
+
console = Console()
|
124
|
+
with console.pager():
|
125
|
+
console.print(generate_table())
|
128
126
|
|
129
127
|
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
130
128
|
print_exception_response(e)
|
@@ -0,0 +1,141 @@
|
|
1
|
+
#!python
|
2
|
+
"""
|
3
|
+
SPDX-Lic
|
4
|
+
ense-Identifier: Apache-2.0
|
5
|
+
Copyright Contributors to the ODPi Egeria project.
|
6
|
+
|
7
|
+
|
8
|
+
Get valid relationship types.
|
9
|
+
"""
|
10
|
+
|
11
|
+
import time
|
12
|
+
import json
|
13
|
+
import argparse
|
14
|
+
from pyegeria import (
|
15
|
+
InvalidParameterException,
|
16
|
+
PropertyServerException,
|
17
|
+
UserNotAuthorizedException,
|
18
|
+
print_exception_response,
|
19
|
+
)
|
20
|
+
from rich.table import Table
|
21
|
+
from rich.live import Live
|
22
|
+
from rich import box
|
23
|
+
from rich.prompt import Prompt
|
24
|
+
from rich.tree import Tree
|
25
|
+
from rich import print
|
26
|
+
from rich.console import Console
|
27
|
+
from pyegeria import ValidMetadataManager, ProjectManager
|
28
|
+
|
29
|
+
disable_ssl_warnings = True
|
30
|
+
|
31
|
+
good_platform1_url = "https://127.0.0.1:9443"
|
32
|
+
|
33
|
+
|
34
|
+
# good_platform1_url = "https://127.0.0.1:30080"
|
35
|
+
# good_platform2_url = "https://127.0.0.1:30081"
|
36
|
+
# bad_platform1_url = "https://localhost:9443"
|
37
|
+
|
38
|
+
good_user_1 = "garygeeke"
|
39
|
+
good_user_2 = "erinoverview"
|
40
|
+
good_server_3 = "view-server"
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
def display_list(type_name:str, server: str = good_server_3, url: str = good_platform1_url,
|
45
|
+
username: str = good_user_2, save_output: bool = False):
|
46
|
+
|
47
|
+
p_client = ValidMetadataManager(server, url, user_id=username)
|
48
|
+
token = p_client.create_egeria_bearer_token(username, "secret")
|
49
|
+
|
50
|
+
def generate_table(type_name: str) -> Table:
|
51
|
+
"""Make a new table."""
|
52
|
+
table = Table(
|
53
|
+
title=f"Relationship types for: {type_name} @ {time.asctime()}",
|
54
|
+
header_style="white on dark_blue",
|
55
|
+
show_lines=True,
|
56
|
+
box=box.ROUNDED,
|
57
|
+
caption=f"list for Server '{server}' @ Platform - {url}",
|
58
|
+
expand=True
|
59
|
+
)
|
60
|
+
|
61
|
+
|
62
|
+
table.add_column("Name")
|
63
|
+
# table.add_column("GUID", no_wrap=True,)
|
64
|
+
table.add_column("Status")
|
65
|
+
table.add_column("Description")
|
66
|
+
table.add_column("Description Wiki")
|
67
|
+
table.add_column("Attribute Name")
|
68
|
+
table.add_column("Attribute Status")
|
69
|
+
table.add_column("Attribute Type")
|
70
|
+
# table.add_column("Attribute Type")
|
71
|
+
table.add_column("Attribute Description")
|
72
|
+
|
73
|
+
types_list = p_client.get_valid_relationship_types(type_name)
|
74
|
+
# print(json.dumps(types_list, indent=4))
|
75
|
+
print(type(types_list))
|
76
|
+
if types_list is None:
|
77
|
+
name = " "
|
78
|
+
guid = " "
|
79
|
+
status = " "
|
80
|
+
|
81
|
+
elif type(types_list) == str:
|
82
|
+
print(types_list)
|
83
|
+
raise ValueError("-->This is not a known Type")
|
84
|
+
else:
|
85
|
+
for types in types_list:
|
86
|
+
|
87
|
+
name = types['name']
|
88
|
+
# guid = types['guid']
|
89
|
+
status = types['initialStatus']
|
90
|
+
description = types['description']
|
91
|
+
description_wiki = types.get("descriptionWiki"," ")
|
92
|
+
attribute_defs = types.get("attributeDefinitions")
|
93
|
+
if attribute_defs:
|
94
|
+
for attr in attribute_defs:
|
95
|
+
attr_name = attr['attributeName']
|
96
|
+
attr_desc = attr['attributeDescription']
|
97
|
+
attr_status = attr['attributeStatus']
|
98
|
+
attr_type = attr['attributeType']["name"]
|
99
|
+
table.add_row(
|
100
|
+
name, status, description, description_wiki, attr_name, attr_status, attr_type, attr_desc
|
101
|
+
)
|
102
|
+
else:
|
103
|
+
table.add_row(name,status,description,description_wiki," ", " ", " "," " )
|
104
|
+
|
105
|
+
p_client.close_session()
|
106
|
+
return table
|
107
|
+
|
108
|
+
try:
|
109
|
+
# with Live(generate_table(), refresh_per_second=4, screen=True) as live:
|
110
|
+
# while True:
|
111
|
+
# time.sleep(2)
|
112
|
+
# live.update(generate_table())
|
113
|
+
console = Console(record=True)
|
114
|
+
with console.pager():
|
115
|
+
console.print(generate_table(type_name))
|
116
|
+
if save_output:
|
117
|
+
console.save_html("projects.html")
|
118
|
+
|
119
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ValueError) as e:
|
120
|
+
if type(e) is str:
|
121
|
+
print(e)
|
122
|
+
else:
|
123
|
+
print_exception_response(e)
|
124
|
+
|
125
|
+
if __name__ == "__main__":
|
126
|
+
|
127
|
+
parser = argparse.ArgumentParser()
|
128
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
129
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
130
|
+
parser.add_argument("--userid", help="User Id")
|
131
|
+
parser.add_argument("--save-output", help="Save output to file?")
|
132
|
+
# parser.add_argument("--sponsor", help="Name of sponsor to search")
|
133
|
+
args = parser.parse_args()
|
134
|
+
|
135
|
+
server = args.server if args.server is not None else "view-server"
|
136
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
137
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
138
|
+
save_output = args.save_output if args.save_output is not None else False
|
139
|
+
type_name = Prompt.ask("Enter the Type Name to retrieve:", default="*")
|
140
|
+
|
141
|
+
display_list(type_name, server, url, userid, save_output)
|
@@ -0,0 +1,147 @@
|
|
1
|
+
#!python
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
A simple viewer for collections - provide the root and we display the hierarchy
|
7
|
+
|
8
|
+
"""
|
9
|
+
|
10
|
+
import time
|
11
|
+
import argparse
|
12
|
+
|
13
|
+
from rich.box import Box
|
14
|
+
from rich.markdown import Markdown
|
15
|
+
from rich.prompt import Prompt
|
16
|
+
|
17
|
+
from pyegeria._exceptions import (
|
18
|
+
InvalidParameterException,
|
19
|
+
PropertyServerException,
|
20
|
+
UserNotAuthorizedException,
|
21
|
+
print_exception_response,
|
22
|
+
)
|
23
|
+
from rich.table import Table
|
24
|
+
from rich.live import Live
|
25
|
+
from rich.text import Text
|
26
|
+
from rich.tree import Tree
|
27
|
+
from rich.markdown import Markdown
|
28
|
+
|
29
|
+
from rich import print
|
30
|
+
from rich.console import Group
|
31
|
+
from rich.panel import Panel
|
32
|
+
from rich import box, align
|
33
|
+
from rich.layout import Layout
|
34
|
+
import rich
|
35
|
+
from pyegeria import (CollectionManager, UserNotAuthorizedException, PropertyServerException,
|
36
|
+
InvalidParameterException, AutomatedCuration)
|
37
|
+
|
38
|
+
disable_ssl_warnings = True
|
39
|
+
|
40
|
+
platform = "https://127.0.0.1:9443"
|
41
|
+
user = "erinoverview"
|
42
|
+
view_server = "view-server"
|
43
|
+
|
44
|
+
|
45
|
+
def tech_viewer(tech: str, server_name:str, platform_url:str, user:str):
|
46
|
+
|
47
|
+
def view_tech_details(a_client: AutomatedCuration, root_collection_name: str, tree: Tree) -> Tree:
|
48
|
+
l2: Tree = None
|
49
|
+
tech_details = a_client.get_technology_type_detail(tech)
|
50
|
+
if type(tech_details) is dict:
|
51
|
+
style = ""
|
52
|
+
l2 = tree.add(Text(f"Name: {tech_details['name']}", "bold red"))
|
53
|
+
l2 = tree.add(Text(f"* QualifiedName: {tech_details['qualifiedName']}","bold white"))
|
54
|
+
l2 = tree.add(Text(f"* Category: {tech_details['category']}", "bold white"))
|
55
|
+
l2 = tree.add(Text(f"* Technology Description: {tech_details['description']}", "bold white"))
|
56
|
+
ext_ref = tech_details.get('externalReferences', None)
|
57
|
+
if ext_ref is not None:
|
58
|
+
l2 = tree.add(Text(f'* URI: {ext_ref[0]["properties"]["uri"]}', "bold white"))
|
59
|
+
|
60
|
+
# catalog_temp = tech_details.get("catalogTemplates", None)
|
61
|
+
# if catalog_temp is not None:
|
62
|
+
# l2 = tree.add("Catalog Templates")
|
63
|
+
# for catalog in catalog_temp:
|
64
|
+
# cat_name = catalog["relatedElement"].get("name", None)
|
65
|
+
# if cat_name is None:
|
66
|
+
# continue
|
67
|
+
# l3 = l2.add(f'[white] Template Name: {cat_name}, style=style)')
|
68
|
+
# l3 = l2.add(f'[white] Template GUID: {catalog["relatedElement"].get("guid", None)}, style=style)')
|
69
|
+
# classifications = catalog["relatedElement"].get("classifications", None)
|
70
|
+
# if classifications is not None:
|
71
|
+
# l4 = l3.add(f"[red]Classifications")
|
72
|
+
# for classification in classifications:
|
73
|
+
# props = classification['classificationProperties']
|
74
|
+
# c_name = Text(f'[white] Name: {props.get("name", None)}[white]')
|
75
|
+
# c_ver = Text(f'[white] Version: {props.get("versionIdentifier", None)}')
|
76
|
+
# c_desc = Text(f'[white] Description: {props.get("description", None)}')
|
77
|
+
# class_text = (f"[bold red]Classification \n"
|
78
|
+
# f"[white] Name: {c_name} \n"
|
79
|
+
# f"[white] Version: {c_ver} \n"
|
80
|
+
# f"[white] Description: {c_desc}")
|
81
|
+
# c = Panel.fit(class_text)
|
82
|
+
# l4 = l3.add(c, style = style)
|
83
|
+
#
|
84
|
+
# placeholders = catalog.get("specification", None)
|
85
|
+
# if placeholders is not None:
|
86
|
+
# specs = placeholders.get("placeholderProperty", None)
|
87
|
+
# if specs is not None:
|
88
|
+
# l4 = l3.add(f"[red]Placeholder Properties")
|
89
|
+
# for spec in specs:
|
90
|
+
# l5 = l4.add(f'[white] Placeholder Name: {spec.get("placeholderName", None)})')
|
91
|
+
# l5 = l4.add(f'[white] Data Type: {spec["dataType"]}')
|
92
|
+
# l5 = l4.add(f'[white] Placeholder Name: {str(spec["required"])})')
|
93
|
+
# l5 = l4.add(f'[white] Example: {spec.get("example", None)})')
|
94
|
+
# l5 = l4.add(f'[white] Description: {spec.get("description", None)}[white])')
|
95
|
+
|
96
|
+
|
97
|
+
resource_list = tech_details.get('resourceList',None)
|
98
|
+
if resource_list:
|
99
|
+
t_r = tree.add("Resource List[bold red]")
|
100
|
+
for resource in resource_list:
|
101
|
+
resource_use = Text(f"[bold white]{resource['resourceUse']}", "")
|
102
|
+
resource_use_description = Text(f"[bold white]{resource['resourceUseDescription']}", "")
|
103
|
+
type_name = Text(f"[bold white]{resource['relatedElement']['type']['typeName']}", "")
|
104
|
+
unique_name = Text(f"[bold white]{resource['relatedElement']['uniqueName']}", "")
|
105
|
+
related_guid = Text(f"[bold white]{resource['relatedElement']['guid']}", "")
|
106
|
+
resource_text = (f"[bold red]Resource\n"
|
107
|
+
f"[white]Resource use: {resource_use}[white]\nDescription: "
|
108
|
+
f"{resource_use_description}\nType Name: {type_name}\n"
|
109
|
+
f"[white]Unique Name: {unique_name}\n[white]Related GUID: {related_guid}\n")
|
110
|
+
p = Panel.fit(resource_text)
|
111
|
+
tt = t_r.add(p, style=style)
|
112
|
+
|
113
|
+
|
114
|
+
return tt
|
115
|
+
|
116
|
+
|
117
|
+
try:
|
118
|
+
tree = Tree(f"[bold bright green]{tech}", guide_style="bold bright_blue")
|
119
|
+
a_client = AutomatedCuration(view_server, platform,
|
120
|
+
user_id=user)
|
121
|
+
|
122
|
+
token = a_client.create_egeria_bearer_token(user, "secret")
|
123
|
+
view_tech_details(a_client,tech,tree)
|
124
|
+
print(tree)
|
125
|
+
|
126
|
+
except (
|
127
|
+
InvalidParameterException,
|
128
|
+
PropertyServerException,
|
129
|
+
UserNotAuthorizedException
|
130
|
+
) as e:
|
131
|
+
print_exception_response(e)
|
132
|
+
|
133
|
+
|
134
|
+
if __name__ == "__main__":
|
135
|
+
parser = argparse.ArgumentParser()
|
136
|
+
|
137
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
138
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
139
|
+
parser.add_argument("--userid", help="User Id")
|
140
|
+
args = parser.parse_args()
|
141
|
+
|
142
|
+
server = args.server if args.server is not None else "view-server"
|
143
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
144
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
145
|
+
|
146
|
+
tech = Prompt.ask("Enter the Technology to start from:", default="PostgreSQL Server")
|
147
|
+
tech_viewer(tech,server, url, userid)
|
@@ -0,0 +1,124 @@
|
|
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 my profile
|
10
|
+
"""
|
11
|
+
|
12
|
+
import argparse
|
13
|
+
import sys
|
14
|
+
import time
|
15
|
+
|
16
|
+
from rich import box
|
17
|
+
from rich.console import Console
|
18
|
+
from rich.prompt import Prompt
|
19
|
+
from rich.table import Table
|
20
|
+
|
21
|
+
from pyegeria import (
|
22
|
+
InvalidParameterException,
|
23
|
+
PropertyServerException,
|
24
|
+
UserNotAuthorizedException,
|
25
|
+
print_exception_response,
|
26
|
+
RegisteredInfo,
|
27
|
+
AutomatedCuration
|
28
|
+
)
|
29
|
+
|
30
|
+
disable_ssl_warnings = True
|
31
|
+
|
32
|
+
good_platform1_url = "https://127.0.0.1:9443"
|
33
|
+
good_platform2_url = "https://egeria.pdr-associates.com:7443"
|
34
|
+
bad_platform1_url = "https://localhost:9443"
|
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
|
+
bad_user_1 = "eviledna"
|
43
|
+
bad_user_2 = ""
|
44
|
+
|
45
|
+
good_server_1 = "active-metadata-store"
|
46
|
+
good_server_2 = "simple-metadata-store"
|
47
|
+
good_server_3 = "view-server"
|
48
|
+
good_server_4 = "engine-host"
|
49
|
+
bad_server_1 = "coco"
|
50
|
+
bad_server_2 = ""
|
51
|
+
|
52
|
+
|
53
|
+
def display_tech_types(search_string:str = "*", server: str = good_server_3, url: str = good_platform1_url, username: str = good_user_2):
|
54
|
+
a_client = AutomatedCuration(server, url, username)
|
55
|
+
token = a_client.create_egeria_bearer_token(good_user_2, "secret")
|
56
|
+
tech_list = a_client.find_technology_types(search_string, page_size=0)
|
57
|
+
|
58
|
+
def generate_table() -> Table:
|
59
|
+
"""Make a new table."""
|
60
|
+
table = Table(
|
61
|
+
title=f"Technology Types for: {good_platform1_url} @ {time.asctime()}",
|
62
|
+
# style = "black on grey66",
|
63
|
+
header_style="white on dark_blue",
|
64
|
+
show_lines=True,
|
65
|
+
box=box.ROUNDED,
|
66
|
+
caption=f"Technology Types from Server '{server}' @ Platform - {url}",
|
67
|
+
expand=True
|
68
|
+
)
|
69
|
+
|
70
|
+
table.add_column("Name")
|
71
|
+
table.add_column("Qualified Name")
|
72
|
+
table.add_column("Category")
|
73
|
+
table.add_column("Description")
|
74
|
+
|
75
|
+
|
76
|
+
name = " "
|
77
|
+
description = " "
|
78
|
+
version = " "
|
79
|
+
super_type = " "
|
80
|
+
if type(tech_list) is list:
|
81
|
+
for item in tech_list:
|
82
|
+
if 'deployedImplementationType' not in item['qualifiedName']:
|
83
|
+
continue
|
84
|
+
qualified_name = item.get("qualifiedName", " ")
|
85
|
+
name = item.get("name", "none")
|
86
|
+
category = item.get("category", "none")
|
87
|
+
description = item.get("description", "none")
|
88
|
+
|
89
|
+
table.add_row(
|
90
|
+
name, qualified_name, category, description
|
91
|
+
)
|
92
|
+
return table
|
93
|
+
else:
|
94
|
+
print("Unknown technology type")
|
95
|
+
sys.exit(1)
|
96
|
+
|
97
|
+
try:
|
98
|
+
console = Console()
|
99
|
+
with console.pager():
|
100
|
+
console.print(generate_table())
|
101
|
+
|
102
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException) as e:
|
103
|
+
print_exception_response(e)
|
104
|
+
assert e.related_http_code != "200", "Invalid parameters"
|
105
|
+
finally:
|
106
|
+
a_client.close_session()
|
107
|
+
|
108
|
+
|
109
|
+
if __name__ == "__main__":
|
110
|
+
parser = argparse.ArgumentParser()
|
111
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
112
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
113
|
+
parser.add_argument("--userid", help="User Id")
|
114
|
+
|
115
|
+
args = parser.parse_args()
|
116
|
+
|
117
|
+
server = args.server if args.server is not None else "view-server"
|
118
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
119
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
120
|
+
# guid = args.guid if args.guid is not None else None
|
121
|
+
guid = None
|
122
|
+
search_string = Prompt.ask("Enter the technology you are searching for:", default="*")
|
123
|
+
|
124
|
+
display_tech_types(search_string, server, url, userid)
|
@@ -48,8 +48,7 @@ bad_server_2 = ""
|
|
48
48
|
|
49
49
|
|
50
50
|
def display_asset_types(server: str = good_server_3, url: str = good_platform1_url, username: str = good_user_2):
|
51
|
-
r_client = RegisteredInfo(
|
52
|
-
server_name=good_server_3, )
|
51
|
+
r_client = RegisteredInfo(server, url, username)
|
53
52
|
token = r_client.create_egeria_bearer_token(good_user_2, "secret")
|
54
53
|
asset_types = r_client.list_asset_types()
|
55
54
|
|
@@ -81,7 +80,7 @@ def display_asset_types(server: str = good_server_3, url: str = good_platform1_u
|
|
81
80
|
version = a_type.get("version", " ")
|
82
81
|
super_type = a_type.get("superType", "none")
|
83
82
|
table.add_row(
|
84
|
-
name, description, str(version)
|
83
|
+
name, description, super_type, str(version)
|
85
84
|
)
|
86
85
|
return table
|
87
86
|
|
@@ -0,0 +1,153 @@
|
|
1
|
+
#!python
|
2
|
+
"""
|
3
|
+
SPDX-Lic
|
4
|
+
ense-Identifier: Apache-2.0
|
5
|
+
Copyright Contributors to the ODPi Egeria project.
|
6
|
+
|
7
|
+
Unit tests for the Utils helper functions using the Pytest framework.
|
8
|
+
|
9
|
+
|
10
|
+
A simple display for glossary terms
|
11
|
+
"""
|
12
|
+
|
13
|
+
import time
|
14
|
+
import json
|
15
|
+
import argparse
|
16
|
+
from pyegeria import (
|
17
|
+
InvalidParameterException,
|
18
|
+
PropertyServerException,
|
19
|
+
UserNotAuthorizedException,
|
20
|
+
print_exception_response,
|
21
|
+
)
|
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
|
+
|
44
|
+
|
45
|
+
|
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):
|
48
|
+
|
49
|
+
p_client = ProjectManager(server, url, user_id=username)
|
50
|
+
token = p_client.create_egeria_bearer_token(username, "secret")
|
51
|
+
|
52
|
+
def generate_table(project_name: str) -> Table:
|
53
|
+
"""Make a new table."""
|
54
|
+
table = Table(
|
55
|
+
title=f"Project List: {project_name} @ {time.asctime()}",
|
56
|
+
header_style="white on dark_blue",
|
57
|
+
show_lines=True,
|
58
|
+
box=box.ROUNDED,
|
59
|
+
caption=f"Project list for Server '{server}' @ Platform - {url}",
|
60
|
+
expand=True
|
61
|
+
)
|
62
|
+
|
63
|
+
|
64
|
+
table.add_column("Display Name")
|
65
|
+
table.add_column("Project GUID", no_wrap=True,)
|
66
|
+
table.add_column("Classifications")
|
67
|
+
table.add_column("Qualified Name")
|
68
|
+
table.add_column("Identifier")
|
69
|
+
table.add_column("Phase")
|
70
|
+
table.add_column("Health")
|
71
|
+
table.add_column("Status")
|
72
|
+
table.add_column("Start Date")
|
73
|
+
table.add_column("End Date")
|
74
|
+
table.add_column("Description")
|
75
|
+
|
76
|
+
projects = p_client.find_projects(project_name)
|
77
|
+
|
78
|
+
if projects is None:
|
79
|
+
name = " "
|
80
|
+
guid = " "
|
81
|
+
classification = " "
|
82
|
+
qualified_name = " "
|
83
|
+
identifier = " "
|
84
|
+
phase= " "
|
85
|
+
health = " "
|
86
|
+
status = " "
|
87
|
+
start = " "
|
88
|
+
end = " "
|
89
|
+
description = " "
|
90
|
+
elif type(projects) == str:
|
91
|
+
raise ValueError("-->This is not a known project")
|
92
|
+
else:
|
93
|
+
for project in projects:
|
94
|
+
classification = ""
|
95
|
+
guid = project['elementHeader']['guid']
|
96
|
+
props = project["properties"]
|
97
|
+
name = props.get("name","None")
|
98
|
+
p_class = project['elementHeader'].get("classifications")
|
99
|
+
if p_class:
|
100
|
+
for classif in p_class:
|
101
|
+
classification = f"{classif.get('classificationName')}, {classification}"
|
102
|
+
qualified_name = props.get("qualifiedName"," ")
|
103
|
+
identifier = props.get("identifier", " ")
|
104
|
+
phase = props.get("projectPhase", " ")
|
105
|
+
health = props.get("projectHealth", " ")
|
106
|
+
status = props.get("projectStatus", " ")
|
107
|
+
description = props.get("description", " ")
|
108
|
+
start = props.get("startDate"," ")
|
109
|
+
end = props.get("plannedEndDate", " ")
|
110
|
+
additional_properties = project.get('additionalProperties')
|
111
|
+
if additional_properties is not None:
|
112
|
+
props = json.dumps(additional_properties)
|
113
|
+
table.add_row(
|
114
|
+
name, guid, classification, qualified_name, identifier, phase, health, status, start,
|
115
|
+
end,description)
|
116
|
+
|
117
|
+
p_client.close_session()
|
118
|
+
return table
|
119
|
+
|
120
|
+
try:
|
121
|
+
# with Live(generate_table(), refresh_per_second=4, screen=True) as live:
|
122
|
+
# while True:
|
123
|
+
# time.sleep(2)
|
124
|
+
# live.update(generate_table())
|
125
|
+
console = Console(record=True)
|
126
|
+
with console.pager():
|
127
|
+
console.print(generate_table(project_name))
|
128
|
+
if save_output:
|
129
|
+
console.save_html("projects.html")
|
130
|
+
|
131
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ValueError) as e:
|
132
|
+
if type(e) is str:
|
133
|
+
print(e)
|
134
|
+
else:
|
135
|
+
print_exception_response(e)
|
136
|
+
|
137
|
+
if __name__ == "__main__":
|
138
|
+
|
139
|
+
parser = argparse.ArgumentParser()
|
140
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
141
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
142
|
+
parser.add_argument("--userid", help="User Id")
|
143
|
+
parser.add_argument("--save-output", help="Save output to file?")
|
144
|
+
# parser.add_argument("--sponsor", help="Name of sponsor to search")
|
145
|
+
args = parser.parse_args()
|
146
|
+
|
147
|
+
server = args.server if args.server is not None else "view-server"
|
148
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
149
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
150
|
+
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="*")
|
152
|
+
|
153
|
+
display_list(project_name, server, url, userid, save_output)
|
@@ -3,9 +3,9 @@ pyegeria/_client.py,sha256=8-8r1-_fACDEGgmfJdkeODlPmftcdiKwb-bmrSA3ac4,23606
|
|
3
3
|
pyegeria/_exceptions.py,sha256=LImJPHy7MVgoH17LfqEL4ytLKcOhV7oCe66wZiDBzec,18399
|
4
4
|
pyegeria/_globals.py,sha256=WgJ6O7_ACiAG8CUUHT_AbGgahLhO0APU8Y4rCwv9DRw,558
|
5
5
|
pyegeria/_validators.py,sha256=DQuMsATRGxGSBtOrVtXlCgWXGhj6Nh-uqPtCsrUGLxk,12703
|
6
|
-
pyegeria/automated_curation_omvs.py,sha256=
|
6
|
+
pyegeria/automated_curation_omvs.py,sha256=jaYA1H9r6vCldExPBXEkWYcbppfk9i2TrefnPopZUGQ,102487
|
7
7
|
pyegeria/collection_manager_omvs.py,sha256=iTKN_MJFj2s1M8LyXDkSy8KUBS2uaPAikCz3ncE_3sE,114200
|
8
|
-
pyegeria/core_omag_server_config.py,sha256=
|
8
|
+
pyegeria/core_omag_server_config.py,sha256=jhtSlGx43X0x7-UGuWHZA0i6HT4_6MAF-wviMRekrWQ,93244
|
9
9
|
pyegeria/full_omag_server_config.py,sha256=sVBeG40Hp6ZG7dsz2BZqzO3bluPeu-j0fGTuinQ-SsY,46146
|
10
10
|
pyegeria/glossary_omvs.py,sha256=KcKRMNgm53suqbFLqsnThln5-zzAEJ8OseexiJ8BSsk,36500
|
11
11
|
pyegeria/gov_engine.py,sha256=3SBSZlbUTVG4x8OhlEIqipe8mB8_KEYOacHmxk7loSM,19697
|
@@ -17,20 +17,25 @@ pyegeria/registered_info.py,sha256=H7mgH83JKtMeDZ1vVOWoFM9iARD38Rnb6igvfEM46AA,8
|
|
17
17
|
pyegeria/server_operations.py,sha256=iMBfIgPGqFM1TkABqFFJDt8tVUSY2qwSrRURrmWuma0,16323
|
18
18
|
pyegeria/utils.py,sha256=H0mew9IRcbsEi-pZfaT9HGuPO9CMOwnhOgIltyNvqTY,5240
|
19
19
|
pyegeria/valid_metadata_omvs.py,sha256=Li_XLLIXJTN9gUqB_H1WbVpnDMSgc7ne6yuzKoBW7sU,29710
|
20
|
-
pyegeria-0.3.
|
21
|
-
pyegeria-0.3.
|
22
|
-
pyegeria-0.3.
|
23
|
-
pyegeria-0.3.
|
24
|
-
pyegeria-0.3.
|
25
|
-
pyegeria-0.3.
|
26
|
-
pyegeria-0.3.
|
27
|
-
pyegeria-0.3.
|
28
|
-
pyegeria-0.3.
|
29
|
-
pyegeria-0.3.
|
30
|
-
pyegeria-0.3.
|
31
|
-
pyegeria-0.3.
|
32
|
-
pyegeria-0.3.
|
33
|
-
pyegeria-0.3.
|
34
|
-
pyegeria-0.3.
|
35
|
-
pyegeria-0.3.
|
36
|
-
pyegeria-0.3.
|
20
|
+
pyegeria-0.3.7.data/scripts/collection_viewer.py,sha256=KWyOt4XeJ5ZaPrzNeMIH-qA3BeV9G7P64kAPceMsRmk,3628
|
21
|
+
pyegeria-0.3.7.data/scripts/engine_action_status.py,sha256=vtZhXTGsZS3_xui7QLSX7aj2IWHT5TJ5Fje7CSOA6Co,5220
|
22
|
+
pyegeria-0.3.7.data/scripts/find_todos.py,sha256=A75s7cwtXVukMCbVYFlbJoDYFg1A8fHU3dCTK2s6JtM,5171
|
23
|
+
pyegeria-0.3.7.data/scripts/get_relationship_types.py,sha256=STySVwdbSo_nMcpYlBRqmF0DNxKwrb3621GU688jhXM,4933
|
24
|
+
pyegeria-0.3.7.data/scripts/get_tech_details.py,sha256=Tg4UCazeEh7He9-l7yQbCuJso7ZcpaLhdmMUT866RzU,6843
|
25
|
+
pyegeria-0.3.7.data/scripts/get_tech_types.py,sha256=xZoCrnmBXa-_WXDW3tBG6dt6IxH-aeQfg07pXM2IrsA,3924
|
26
|
+
pyegeria-0.3.7.data/scripts/glossary_view.py,sha256=tZvdX9Sc7Q2rL9oiEjRIFFt-saqwMs8PQ3BCgp-v710,4594
|
27
|
+
pyegeria-0.3.7.data/scripts/gov_engine_status.py,sha256=ZTVbhrvGsfzmN4j9Xz95rEMTjqTNvKi9Ojvy43Z5sI8,4000
|
28
|
+
pyegeria-0.3.7.data/scripts/integration_daemon_status.py,sha256=9XRQKdjmYqwfxwNoo4EUhX8vrplR0etS-5Yq89lXGMw,4575
|
29
|
+
pyegeria-0.3.7.data/scripts/list_asset_types.py,sha256=09xmGyEoScq4OeSflElhI-ThJL2RUPV6mb9zRA7UzEA,3485
|
30
|
+
pyegeria-0.3.7.data/scripts/multi-server_status.py,sha256=XlBaIERVqYXjHO2x18WY64Oo0fUZS1onpOLAJcIlJk0,3690
|
31
|
+
pyegeria-0.3.7.data/scripts/my_todos.py,sha256=wzGKekUAT-DfzE-R8O1_byvh0trB_FMd0YvdNkTw10Q,5660
|
32
|
+
pyegeria-0.3.7.data/scripts/open_todos.py,sha256=f02BXZ-LgqjUOe5QiK1SKA9RDSH9m6-u_x0HTCQAD8E,4649
|
33
|
+
pyegeria-0.3.7.data/scripts/project_list_viewer.py,sha256=yTZR0KS-PTCxDjbjkIRniWk7DR1qvUzuTGQ3eN37-7o,5434
|
34
|
+
pyegeria-0.3.7.data/scripts/server_status.py,sha256=BgBLjYeMDN41zk9ADyPWZFBaQX0TqiCZ9pjesnByUhM,3346
|
35
|
+
pyegeria-0.3.7.data/scripts/server_status_widget.py,sha256=tyx1I7olr6e5kJF22ou9rqsztrRDdrPCq5uVa3hhPBU,3088
|
36
|
+
pyegeria-0.3.7.data/scripts/view_my_profile.py,sha256=KFeGAkR-DHX01jcOPOP7HMCTrAyY3i4mQKhq1dG86vE,4605
|
37
|
+
pyegeria-0.3.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
38
|
+
pyegeria-0.3.7.dist-info/METADATA,sha256=rf_0Bd7zF0K5gOXRsgMxN8OmFSuY4OALk66qVbok1pM,2398
|
39
|
+
pyegeria-0.3.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
40
|
+
pyegeria-0.3.7.dist-info/top_level.txt,sha256=tHowU8jow7WJGmbr4QdIk7gJWdslRgbWBiF2lMeduLQ,9
|
41
|
+
pyegeria-0.3.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|