pyegeria 0.3.9__py3-none-any.whl → 0.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyegeria/Xfeedback_manager_omvs.py +2 -15
- pyegeria/__init__.py +11 -4
- pyegeria/_globals.py +3 -1
- pyegeria/{Xasset_catalog_omvs.py → asset_catalog_omvs.py} +242 -109
- pyegeria/automated_curation_omvs.py +324 -61
- pyegeria/core_guids.py +128 -0
- pyegeria/core_omag_server_config.py +1 -1
- pyegeria/{Xglossary_manager_omvs.py → glossary_manager_omvs.py} +70 -69
- pyegeria/runtime_manager_omvs.py +967 -0
- pyegeria/valid_metadata_omvs.py +193 -20
- pyegeria-0.4.1.data/scripts/get_guid_info.py +86 -0
- {pyegeria-0.3.9.data → pyegeria-0.4.1.data}/scripts/get_tech_details.py +1 -37
- pyegeria-0.4.1.data/scripts/get_tech_type_elements.py +137 -0
- pyegeria-0.4.1.data/scripts/get_tech_type_template.py +137 -0
- pyegeria-0.4.1.data/scripts/list_assets.py +138 -0
- pyegeria-0.3.9.data/scripts/project_list_viewer.py → pyegeria-0.4.1.data/scripts/list_projects.py +1 -1
- pyegeria-0.3.9.data/scripts/get_relationship_types.py → pyegeria-0.4.1.data/scripts/list_relationship_types.py +9 -8
- pyegeria-0.4.1.data/scripts/list_tech_templates.py +134 -0
- pyegeria-0.3.9.data/scripts/find_todos.py → pyegeria-0.4.1.data/scripts/list_todos.py +2 -1
- pyegeria-0.4.1.data/scripts/list_valid_metadata_values.py +144 -0
- pyegeria-0.4.1.data/scripts/view_asset_graph.py +245 -0
- pyegeria-0.3.9.data/scripts/coco_status.py → pyegeria-0.4.1.data/scripts/view_coco_status.py +10 -9
- pyegeria-0.3.9.data/scripts/engine_action_status.py → pyegeria-0.4.1.data/scripts/view_eng_action_status.py +8 -3
- pyegeria-0.4.1.data/scripts/view_integ_daemon_status.py +140 -0
- pyegeria-0.4.1.data/scripts/view_platform_status.py +123 -0
- {pyegeria-0.3.9.dist-info → pyegeria-0.4.1.dist-info}/METADATA +5 -2
- pyegeria-0.4.1.dist-info/RECORD +58 -0
- {pyegeria-0.3.9.dist-info → pyegeria-0.4.1.dist-info}/WHEEL +1 -1
- pyegeria-0.3.9.data/scripts/integration_daemon_status.py +0 -130
- pyegeria-0.3.9.data/scripts/multi-server_status.py +0 -120
- pyegeria-0.3.9.dist-info/RECORD +0 -49
- /pyegeria/{Xaction_author_omvs.py → action_author_omvs.py} +0 -0
- {pyegeria-0.3.9.data → pyegeria-0.4.1.data}/scripts/Create_Collection_Sample.py +0 -0
- {pyegeria-0.3.9.data → pyegeria-0.4.1.data}/scripts/Create_Sustainability_Collection_Sample.py +0 -0
- /pyegeria-0.3.9.data/scripts/view_my_profile.py → /pyegeria-0.4.1.data/scripts/get_my_profile.py +0 -0
- {pyegeria-0.3.9.data → pyegeria-0.4.1.data}/scripts/list_asset_types.py +0 -0
- /pyegeria-0.3.9.data/scripts/get_registered_services.py → /pyegeria-0.4.1.data/scripts/list_registered_services.py +0 -0
- /pyegeria-0.3.9.data/scripts/get_tech_types.py → /pyegeria-0.4.1.data/scripts/list_tech_types.py +0 -0
- /pyegeria-0.3.9.data/scripts/collection_viewer.py → /pyegeria-0.4.1.data/scripts/view_collection.py +0 -0
- /pyegeria-0.3.9.data/scripts/glossary_view.py → /pyegeria-0.4.1.data/scripts/view_glossary.py +0 -0
- /pyegeria-0.3.9.data/scripts/gov_engine_status.py → /pyegeria-0.4.1.data/scripts/view_gov_eng_status.py +0 -0
- /pyegeria-0.3.9.data/scripts/my_todos.py → /pyegeria-0.4.1.data/scripts/view_my_todos.py +0 -0
- /pyegeria-0.3.9.data/scripts/open_todos.py → /pyegeria-0.4.1.data/scripts/view_open_todos.py +0 -0
- /pyegeria-0.3.9.data/scripts/server_status_widget.py → /pyegeria-0.4.1.data/scripts/view_server_list.py +0 -0
- /pyegeria-0.3.9.data/scripts/server_status.py → /pyegeria-0.4.1.data/scripts/view_server_status.py +0 -0
- {pyegeria-0.3.9.dist-info → pyegeria-0.4.1.dist-info}/LICENSE +0 -0
- {pyegeria-0.3.9.dist-info → pyegeria-0.4.1.dist-info}/top_level.txt +0 -0
pyegeria/valid_metadata_omvs.py
CHANGED
@@ -43,9 +43,185 @@ class ValidMetadataManager(Client):
|
|
43
43
|
self.page_size = max_paging_size
|
44
44
|
Client.__init__(self, server_name, platform_url, user_id=user_id, token=token)
|
45
45
|
|
46
|
+
async def _async_setup_valid_metadata_value(self, property_name: str, type_name: str, body: dict,
|
47
|
+
server: str = None):
|
48
|
+
""" Create or update the valid value for a particular open metadata property name. If the typeName is null,
|
49
|
+
this valid value applies to properties of this name from all types. The valid value is stored in the
|
50
|
+
preferredValue property. If a valid value is already set up for this property (with overlapping effective dates)
|
51
|
+
then the valid value is updated. Async Version.
|
52
|
+
|
53
|
+
Parameters
|
54
|
+
----------
|
55
|
+
property_name : str
|
56
|
+
The name of the property for which the valid metadata value is being set up.
|
57
|
+
type_name : str
|
58
|
+
The name of the type for the valid metadata value.
|
59
|
+
body : dict
|
60
|
+
The body of the request containing the details of the valid metadata value.
|
61
|
+
server : str, optional
|
62
|
+
The name of the server where the valid metadata value is being set up.
|
63
|
+
If not provided, the default server name will be used.
|
64
|
+
|
65
|
+
Returns
|
66
|
+
-------
|
67
|
+
|
68
|
+
Notes
|
69
|
+
-----
|
70
|
+
|
71
|
+
Payload structure similar to:
|
72
|
+
{
|
73
|
+
"displayName": "",
|
74
|
+
"description": "",
|
75
|
+
"preferredValue": "",
|
76
|
+
"dataType": "",
|
77
|
+
"isCaseSensitive": false,
|
78
|
+
"isDeprecated" : false
|
79
|
+
}
|
80
|
+
"""
|
81
|
+
server = self.server_name if server is None else server
|
82
|
+
|
83
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/valid-metadata/setup-value/{property_name}?"
|
84
|
+
f"typeName={type_name}")
|
85
|
+
|
86
|
+
await self._async_make_request("POST", url, body)
|
87
|
+
return
|
88
|
+
|
89
|
+
def setup_valid_metadata_value(self, property_name: str, type_name: str, body: dict,
|
90
|
+
server: str = None):
|
91
|
+
""" Create or update the valid value for a particular open metadata property name. If the typeName is null,
|
92
|
+
this valid value applies to properties of this name from all types. The valid value is stored in the
|
93
|
+
preferredValue property. If a valid value is already set up for this property (with overlapping effective dates)
|
94
|
+
then the valid value is updated.
|
95
|
+
|
96
|
+
Parameters
|
97
|
+
----------
|
98
|
+
property_name : str
|
99
|
+
The name of the property for which the valid metadata value is being set up.
|
100
|
+
type_name : str
|
101
|
+
The name of the type for the valid metadata value.
|
102
|
+
body : dict
|
103
|
+
The body of the request containing the details of the valid metadata value.
|
104
|
+
server : str, optional
|
105
|
+
The name of the server where the valid metadata value is being set up.
|
106
|
+
If not provided, the default server name will be used.
|
107
|
+
|
108
|
+
Returns
|
109
|
+
-------
|
110
|
+
str
|
111
|
+
The GUID of the valid metadata value if it was successfully set up, or "GUID failed to be returned"
|
112
|
+
if the GUID was not returned in the response.
|
113
|
+
|
114
|
+
Notes
|
115
|
+
-----
|
116
|
+
|
117
|
+
Payload structure similar to:
|
118
|
+
{
|
119
|
+
"displayName": "",
|
120
|
+
"description": "",
|
121
|
+
"preferredValue": "",
|
122
|
+
"dataType": "",
|
123
|
+
"isCaseSensitive": false,
|
124
|
+
"isDeprecated" : false,
|
125
|
+
"additionalProperties": {
|
126
|
+
"colour": "purple"
|
127
|
+
}
|
128
|
+
}
|
129
|
+
"""
|
130
|
+
loop = asyncio.get_event_loop()
|
131
|
+
loop.run_until_complete(self._async_setup_valid_metadata_value(property_name, type_name,
|
132
|
+
body, server))
|
133
|
+
return
|
134
|
+
|
135
|
+
async def _async_setup_valid_metadata_map_name(self, property_name: str, type_name: str, body: dict,
|
136
|
+
server: str = None):
|
137
|
+
""" Create or update the valid value for a name that can be stored in a particular open metadata property name.
|
138
|
+
This property is of type map from name to string. The mapName is stored in the preferredValue property of
|
139
|
+
validMetadataValue. If the typeName is null, this valid value applies to properties of this name from any
|
140
|
+
open metadata type. If a valid value is already set up for this property (with overlapping effective dates)
|
141
|
+
then the valid value is updated. Async Version.
|
142
|
+
|
143
|
+
Parameters
|
144
|
+
----------
|
145
|
+
property_name : str
|
146
|
+
The name of the property to setup metadata map.
|
147
|
+
type_name : str
|
148
|
+
The type name of the property.
|
149
|
+
body : dict
|
150
|
+
The metadata map setup data.
|
151
|
+
server : str, optional
|
152
|
+
The name of the server to setup the metadata map. If not provided, the default server name will be used.
|
153
|
+
|
154
|
+
Returns
|
155
|
+
-------
|
156
|
+
None
|
157
|
+
This method does not return any value.
|
158
|
+
|
159
|
+
Notes
|
160
|
+
-----
|
161
|
+
|
162
|
+
Body strycture similar to:
|
163
|
+
|
164
|
+
{
|
165
|
+
"displayName": "",
|
166
|
+
"description": "",
|
167
|
+
"preferredValue": "put mapName value here",
|
168
|
+
"dataType": "",
|
169
|
+
"isCaseSensitive": false,
|
170
|
+
"isDeprecated" : false
|
171
|
+
}
|
172
|
+
|
173
|
+
"""
|
174
|
+
server = self.server_name if server is None else server
|
175
|
+
|
176
|
+
url = (f"{self.platform_url}/servers/{server}/api/open-metadata/valid-metadata/setup-map-name/{property_name}?"
|
177
|
+
f"typeName={type_name}")
|
178
|
+
|
179
|
+
await self._async_make_request("POST", url, body)
|
180
|
+
return
|
181
|
+
|
182
|
+
async def _async_setup_valid_metadata_type_value(self, property_name: str, type_name: str, map_name: str,
|
183
|
+
server: str = None):
|
184
|
+
pass
|
185
|
+
|
186
|
+
async def _async_clear_valid_metadata_value(self, property_name: str, type_name: str, map_name: str,
|
187
|
+
server: str = None):
|
188
|
+
pass
|
189
|
+
|
190
|
+
async def _async_clear_valid_metadata_map_value(self, property_name: str, type_name: str, map_name: str,
|
191
|
+
preferred_value: str, server: str = None):
|
192
|
+
pass
|
193
|
+
|
194
|
+
async def _async_validate_metadata_value(self, property_name: str, type_name: str, actual_value: str,
|
195
|
+
server: str = None):
|
196
|
+
pass
|
197
|
+
|
198
|
+
async def _async_validate_metadata_map_name(self, property_name: str, type_name: str, map_name: str,
|
199
|
+
server: str = None):
|
200
|
+
pass
|
201
|
+
|
202
|
+
async def _async_validate_metadata_map_value(self, property_name: str, type_name: str, actual_value: str,
|
203
|
+
server: str = None):
|
204
|
+
pass
|
205
|
+
|
206
|
+
async def _async_validate_metadata_map_name(self, property_name: str, type_name: str, map_name: str,
|
207
|
+
server: str = None):
|
208
|
+
pass
|
209
|
+
|
210
|
+
async def _async_get_valid_metadata_value(self, property_name: str, type_name: str, preferred_value: str,
|
211
|
+
server: str = None):
|
212
|
+
pass
|
213
|
+
|
214
|
+
async def _async_get_valid_metadata_map_name(self, property_name: str, type_name: str, map_name: str,
|
215
|
+
server: str = None):
|
216
|
+
pass
|
217
|
+
|
218
|
+
async def _async_get_valid_metadata_map_value(self, property_name: str, type_name: str, map_name: str,
|
219
|
+
preferred_value: str, server: str = None):
|
220
|
+
pass
|
221
|
+
|
46
222
|
async def _async_get_valid_metadata_values(self, property_name: str, type_name: str = None,
|
47
223
|
server_name: str = None,
|
48
|
-
start_value: int = 0,page_size: int = None) -> list | str:
|
224
|
+
start_value: int = 0, page_size: int = None) -> list | str:
|
49
225
|
""" Retrieve list of values for the property. Async version.
|
50
226
|
|
51
227
|
Parameters
|
@@ -81,15 +257,14 @@ class ValidMetadataManager(Client):
|
|
81
257
|
if page_size is None:
|
82
258
|
page_size = self.page_size
|
83
259
|
|
84
|
-
|
85
260
|
url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/get-valid-metadata-values/{property_name}"
|
86
261
|
f"?typeName={type_name}&startFrom={start_value}&pageSize={page_size}")
|
87
262
|
|
88
263
|
resp = await self._async_make_request("GET", url)
|
89
|
-
return
|
264
|
+
return resp.json().get("elementList", "No elements found")
|
90
265
|
|
91
266
|
def get_valid_metadata_values(self, property_name: str, type_name: str = None,
|
92
|
-
|
267
|
+
server_name: str = None) -> list | str:
|
93
268
|
""" Retrieve list of values for the property.
|
94
269
|
|
95
270
|
Parameters
|
@@ -130,7 +305,6 @@ class ValidMetadataManager(Client):
|
|
130
305
|
if server_name is None:
|
131
306
|
server_name = self.server_name
|
132
307
|
|
133
|
-
|
134
308
|
url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/get-value/{property_name}"
|
135
309
|
f"?typeName={type_name}&preferredValue={preferred_value}")
|
136
310
|
|
@@ -175,8 +349,7 @@ class ValidMetadataManager(Client):
|
|
175
349
|
preferred_value, server_name)),
|
176
350
|
return resp
|
177
351
|
|
178
|
-
|
179
|
-
async def _async_get_consistent_metadata_values(self, property_name:str, type_name:str, map_name: str,
|
352
|
+
async def _async_get_consistent_metadata_values(self, property_name: str, type_name: str, map_name: str,
|
180
353
|
preferred_value: str, server_name: str = None,
|
181
354
|
start_from: int = 0, page_size: int = None) -> list | str:
|
182
355
|
""" Retrieve all the consistent valid values for the requested property. Async version.
|
@@ -228,7 +401,7 @@ class ValidMetadataManager(Client):
|
|
228
401
|
resp = await self._async_make_request("GET", url)
|
229
402
|
return resp.json()
|
230
403
|
|
231
|
-
def get_consistent_metadata_values(self, property_name:str, type_name:str, map_name: str,
|
404
|
+
def get_consistent_metadata_values(self, property_name: str, type_name: str, map_name: str,
|
232
405
|
preferred_value: str, server_name: str = None,
|
233
406
|
start_from: int = 0, page_size: int = None) -> list | str:
|
234
407
|
""" Retrieve all the consistent valid values for the requested property.
|
@@ -270,11 +443,12 @@ class ValidMetadataManager(Client):
|
|
270
443
|
"""
|
271
444
|
loop = asyncio.get_event_loop()
|
272
445
|
resp = loop.run_until_complete(
|
273
|
-
self._async_get_consistent_metadata_values(property_name,type_name,
|
274
|
-
|
275
|
-
|
446
|
+
self._async_get_consistent_metadata_values(property_name, type_name,
|
447
|
+
map_name, preferred_value,
|
448
|
+
server_name, start_from, page_size)
|
276
449
|
)
|
277
450
|
return resp
|
451
|
+
|
278
452
|
#
|
279
453
|
# Get all ...
|
280
454
|
#
|
@@ -547,7 +721,7 @@ class ValidMetadataManager(Client):
|
|
547
721
|
#
|
548
722
|
# Get valid ...
|
549
723
|
#
|
550
|
-
async def _async_get_valid_relationship_types(self, entity_type:str, server_name: str = None) -> list | str:
|
724
|
+
async def _async_get_valid_relationship_types(self, entity_type: str, server_name: str = None) -> list | str:
|
551
725
|
""" Returns all the TypeDefs for relationships that can be attached to the requested entity type.
|
552
726
|
Async version.
|
553
727
|
|
@@ -585,7 +759,7 @@ class ValidMetadataManager(Client):
|
|
585
759
|
resp = await self._async_make_request("GET", url)
|
586
760
|
return resp.json().get("typeDefs", "No TypeDefs Found")
|
587
761
|
|
588
|
-
def get_valid_relationship_types(self, entity_type:str, server_name: str = None) -> list | str:
|
762
|
+
def get_valid_relationship_types(self, entity_type: str, server_name: str = None) -> list | str:
|
589
763
|
""" Returns all the TypeDefs for relationships that can be attached to the requested entity type.
|
590
764
|
Async version.
|
591
765
|
|
@@ -617,11 +791,11 @@ class ValidMetadataManager(Client):
|
|
617
791
|
loop = asyncio.get_event_loop()
|
618
792
|
resp = loop.run_until_complete(
|
619
793
|
self._async_get_valid_relationship_types(entity_type,
|
620
|
-
|
794
|
+
server_name)
|
621
795
|
)
|
622
796
|
return resp
|
623
797
|
|
624
|
-
async def _async_get_valid_classification_types(self, entity_type:str, server_name: str = None) -> list | str:
|
798
|
+
async def _async_get_valid_classification_types(self, entity_type: str, server_name: str = None) -> list | str:
|
625
799
|
""" Returns all the TypeDefs for classifications that can be attached to the requested entity type.
|
626
800
|
Async version.
|
627
801
|
|
@@ -659,7 +833,7 @@ class ValidMetadataManager(Client):
|
|
659
833
|
resp = await self._async_make_request("GET", url)
|
660
834
|
return resp.json().get("typeDefs", "No TypeDefs Found")
|
661
835
|
|
662
|
-
def get_valid_classification_types(self, entity_type:str, server_name: str = None) -> list | str:
|
836
|
+
def get_valid_classification_types(self, entity_type: str, server_name: str = None) -> list | str:
|
663
837
|
""" Returns all the TypeDefs for relationships that can be attached to the requested entity type.
|
664
838
|
Async version.
|
665
839
|
|
@@ -691,11 +865,11 @@ class ValidMetadataManager(Client):
|
|
691
865
|
loop = asyncio.get_event_loop()
|
692
866
|
resp = loop.run_until_complete(
|
693
867
|
self._async_get_valid_classification_types(entity_type,
|
694
|
-
|
868
|
+
server_name)
|
695
869
|
)
|
696
870
|
return resp
|
697
871
|
|
698
|
-
async def _async_get_typedef_by_name(self, entity_type:str, server_name: str = None) -> dict | str:
|
872
|
+
async def _async_get_typedef_by_name(self, entity_type: str, server_name: str = None) -> dict | str:
|
699
873
|
""" Return the TypeDef identified by the unique name.
|
700
874
|
Async version.
|
701
875
|
|
@@ -732,7 +906,7 @@ class ValidMetadataManager(Client):
|
|
732
906
|
resp = await self._async_make_request("GET", url)
|
733
907
|
return resp.json().get("typeDef", "No TypeDefs Found")
|
734
908
|
|
735
|
-
def get_typedef_by_name(self, entity_type:str, server_name: str = None) -> dict | str:
|
909
|
+
def get_typedef_by_name(self, entity_type: str, server_name: str = None) -> dict | str:
|
736
910
|
""" Return the TypeDef identified by the unique name.
|
737
911
|
|
738
912
|
Parameters
|
@@ -764,4 +938,3 @@ class ValidMetadataManager(Client):
|
|
764
938
|
resp = loop.run_until_complete(
|
765
939
|
self._async_get_typedef_by_name(entity_type, server_name))
|
766
940
|
return resp
|
767
|
-
|
@@ -0,0 +1,86 @@
|
|
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 argparse
|
14
|
+
import httpx
|
15
|
+
import json
|
16
|
+
import time
|
17
|
+
|
18
|
+
from rich import box
|
19
|
+
from rich import print
|
20
|
+
from rich.console import Console
|
21
|
+
from rich.prompt import Prompt
|
22
|
+
from rich.text import Text
|
23
|
+
from rich.tree import Tree
|
24
|
+
from rich.json import JSON
|
25
|
+
|
26
|
+
from pyegeria import (
|
27
|
+
InvalidParameterException,
|
28
|
+
PropertyServerException,
|
29
|
+
UserNotAuthorizedException,
|
30
|
+
print_exception_response,
|
31
|
+
Client
|
32
|
+
)
|
33
|
+
from pyegeria import ProjectManager
|
34
|
+
|
35
|
+
|
36
|
+
def display_guid(guid: str, server: str, url: str, username: str):
|
37
|
+
|
38
|
+
c = Client(server, url, user_id=username)
|
39
|
+
url = (f"{url}/servers/{server}/open-metadata/repository-services/users/{username}/"
|
40
|
+
f"instances/entity/{guid}")
|
41
|
+
|
42
|
+
|
43
|
+
try:
|
44
|
+
console = Console(width = 180)
|
45
|
+
r = c.make_request("GET", url)
|
46
|
+
e = r.json()['entity']
|
47
|
+
p = e['properties']['instanceProperties']
|
48
|
+
|
49
|
+
type_name = Text(f"Type is: {e['type']['typeDefName']}")
|
50
|
+
metadataCollection = Text(f"Metadadata Collection: {e['metadataCollectionName']}")
|
51
|
+
created = Text(f"Created at: {e['createTime']}")
|
52
|
+
details = Text(f"Details: {json.dumps(p, indent=2)}")
|
53
|
+
|
54
|
+
tree = Tree(f"[bold bright green]{guid}", guide_style="bold bright_blue")
|
55
|
+
|
56
|
+
tree = tree.add(type_name)
|
57
|
+
tree.add(metadataCollection)
|
58
|
+
tree.add(created)
|
59
|
+
tree.add(details)
|
60
|
+
print(tree)
|
61
|
+
|
62
|
+
c.close_session()
|
63
|
+
|
64
|
+
except (InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ValueError) as e:
|
65
|
+
if type(e) is str:
|
66
|
+
print(e)
|
67
|
+
else:
|
68
|
+
print_exception_response(e)
|
69
|
+
|
70
|
+
if __name__ == "__main__":
|
71
|
+
|
72
|
+
parser = argparse.ArgumentParser()
|
73
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
74
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
75
|
+
parser.add_argument("--userid", help="User Id")
|
76
|
+
|
77
|
+
# parser.add_argument("--sponsor", help="Name of sponsor to search")
|
78
|
+
args = parser.parse_args()
|
79
|
+
|
80
|
+
server = args.server if args.server is not None else "active-metadata-store"
|
81
|
+
url = args.url if args.url is not None else "https://localhost:9443"
|
82
|
+
userid = args.userid if args.userid is not None else 'erinoverview'
|
83
|
+
|
84
|
+
guid = Prompt.ask("Enter the GUID to retrieve:", default=None)
|
85
|
+
|
86
|
+
display_guid(guid, server, url, userid)
|
@@ -49,7 +49,7 @@ def tech_viewer(tech: str, server_name:str, platform_url:str, user:str):
|
|
49
49
|
tech_details = a_client.get_technology_type_detail(tech)
|
50
50
|
if type(tech_details) is dict:
|
51
51
|
style = ""
|
52
|
-
l2 = tree.add(Text(f"Name: {tech_details
|
52
|
+
l2 = tree.add(Text(f"Name: {tech_details.get('name',' ')}", "bold red"))
|
53
53
|
l2 = tree.add(Text(f"* QualifiedName: {tech_details['qualifiedName']}","bold white"))
|
54
54
|
l2 = tree.add(Text(f"* Category: {tech_details['category']}", "bold white"))
|
55
55
|
l2 = tree.add(Text(f"* Technology Description: {tech_details['description']}", "bold white"))
|
@@ -57,42 +57,6 @@ def tech_viewer(tech: str, server_name:str, platform_url:str, user:str):
|
|
57
57
|
if ext_ref is not None:
|
58
58
|
l2 = tree.add(Text(f'* URI: {ext_ref[0]["properties"]["uri"]}', "bold white"))
|
59
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
60
|
|
97
61
|
resource_list = tech_details.get('resourceList',None)
|
98
62
|
if resource_list:
|
@@ -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)
|