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.
- pyegeria/Xfeedback_manager_omvs.py +238 -0
- pyegeria/Xloaded_resources_omvs.py +91 -0
- pyegeria/__init__.py +15 -12
- pyegeria/_client.py +4 -6
- pyegeria/{gov_engine.py → _deprecated_gov_engine.py} +2 -59
- pyegeria/_exceptions.py +5 -6
- pyegeria/_globals.py +3 -1
- pyegeria/asset_catalog_omvs.py +672 -0
- pyegeria/automated_curation_omvs.py +627 -359
- pyegeria/collection_manager_omvs.py +187 -248
- pyegeria/core_guids.py +128 -0
- pyegeria/core_omag_server_config.py +1 -5
- pyegeria/full_omag_server_config.py +53 -83
- pyegeria/glossary_browser_omvs.py +2208 -0
- pyegeria/glossary_manager_omvs.py +3002 -0
- pyegeria/my_profile_omvs.py +2 -7
- pyegeria/platform_services.py +0 -3
- pyegeria/project_manager_omvs.py +9 -15
- pyegeria/registered_info.py +12 -52
- pyegeria/runtime_manager_omvs.py +967 -0
- pyegeria/server_operations.py +1 -5
- pyegeria/valid_metadata_omvs.py +204 -43
- pyegeria-0.4.0.data/scripts/Create_Collection_Sample.py +292 -0
- pyegeria-0.4.0.data/scripts/Create_Sustainability_Collection_Sample.py +115 -0
- pyegeria-0.4.0.data/scripts/get_guid_info.py +86 -0
- pyegeria-0.3.8.data/scripts/view_my_profile.py → pyegeria-0.4.0.data/scripts/get_my_profile.py +8 -34
- {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/get_tech_details.py +1 -37
- pyegeria-0.4.0.data/scripts/get_tech_type_elements.py +137 -0
- pyegeria-0.4.0.data/scripts/get_tech_type_template.py +137 -0
- {pyegeria-0.3.8.data → pyegeria-0.4.0.data}/scripts/list_asset_types.py +3 -25
- pyegeria-0.4.0.data/scripts/list_assets.py +138 -0
- pyegeria-0.3.8.data/scripts/project_list_viewer.py → pyegeria-0.4.0.data/scripts/list_projects.py +13 -27
- pyegeria-0.4.0.data/scripts/list_registered_services.py +135 -0
- pyegeria-0.3.8.data/scripts/get_relationship_types.py → pyegeria-0.4.0.data/scripts/list_relationship_types.py +25 -43
- pyegeria-0.4.0.data/scripts/list_tech_templates.py +134 -0
- pyegeria-0.3.8.data/scripts/find_todos.py → pyegeria-0.4.0.data/scripts/list_todos.py +11 -39
- pyegeria-0.4.0.data/scripts/list_valid_metadata_values.py +144 -0
- pyegeria-0.4.0.data/scripts/view_asset_graph.py +236 -0
- pyegeria-0.3.8.data/scripts/multi-server_status.py → pyegeria-0.4.0.data/scripts/view_coco_status.py +17 -39
- pyegeria-0.3.8.data/scripts/collection_viewer.py → pyegeria-0.4.0.data/scripts/view_collection.py +12 -31
- pyegeria-0.3.8.data/scripts/engine_action_status.py → pyegeria-0.4.0.data/scripts/view_eng_action_status.py +17 -31
- pyegeria-0.3.8.data/scripts/glossary_view.py → pyegeria-0.4.0.data/scripts/view_glossary.py +2 -2
- pyegeria-0.3.8.data/scripts/gov_engine_status.py → pyegeria-0.4.0.data/scripts/view_gov_eng_status.py +0 -1
- pyegeria-0.3.8.data/scripts/integration_daemon_status.py → pyegeria-0.4.0.data/scripts/view_integ_daemon_status.py +30 -42
- pyegeria-0.3.8.data/scripts/my_todos.py → pyegeria-0.4.0.data/scripts/view_my_todos.py +1 -1
- pyegeria-0.3.8.data/scripts/open_todos.py → pyegeria-0.4.0.data/scripts/view_open_todos.py +3 -24
- pyegeria-0.4.0.data/scripts/view_platform_status.py +123 -0
- pyegeria-0.3.8.data/scripts/server_status.py → pyegeria-0.4.0.data/scripts/view_server_status.py +1 -20
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/METADATA +5 -4
- pyegeria-0.4.0.dist-info/RECORD +58 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/WHEEL +1 -1
- pyegeria/glossary_omvs.py +0 -789
- pyegeria/loaded_resources_omvs.py +0 -159
- pyegeria-0.3.8.dist-info/RECORD +0 -42
- /pyegeria/{governance_author.py → action_author_omvs.py} +0 -0
- /pyegeria-0.3.8.data/scripts/get_tech_types.py → /pyegeria-0.4.0.data/scripts/list_tech_types.py +0 -0
- /pyegeria-0.3.8.data/scripts/server_status_widget.py → /pyegeria-0.4.0.data/scripts/view_server_list.py +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/LICENSE +0 -0
- {pyegeria-0.3.8.dist-info → pyegeria-0.4.0.dist-info}/top_level.txt +0 -0
@@ -10,14 +10,8 @@ import time
|
|
10
10
|
|
11
11
|
# import json
|
12
12
|
from pyegeria._client import Client
|
13
|
-
from pyegeria._exceptions import (
|
14
|
-
|
15
|
-
)
|
16
|
-
from pyegeria._globals import enable_ssl_check
|
17
|
-
from pyegeria._validators import (
|
18
|
-
validate_guid,
|
19
|
-
validate_search_string,
|
20
|
-
)
|
13
|
+
from pyegeria._exceptions import (InvalidParameterException, )
|
14
|
+
from pyegeria._validators import (validate_guid, validate_search_string, )
|
21
15
|
from pyegeria.utils import body_slimmer
|
22
16
|
|
23
17
|
|
@@ -38,30 +32,19 @@ class CollectionManager(Client):
|
|
38
32
|
when the user doesn't pass the user_id on a method call.
|
39
33
|
user_pwd: str
|
40
34
|
The password associated with the user_id. Defaults to None
|
41
|
-
verify_flag: bool
|
42
|
-
Flag to indicate if SSL Certificates should be verified in the HTTP requests.
|
43
|
-
Defaults to False.
|
44
35
|
|
45
36
|
"""
|
46
37
|
|
47
|
-
def __init__(
|
48
|
-
|
49
|
-
server_name: str,
|
50
|
-
platform_url: str,
|
51
|
-
token: str = None,
|
52
|
-
user_id: str = None,
|
53
|
-
user_pwd: str = None,
|
54
|
-
verify_flag: bool = enable_ssl_check,
|
55
|
-
sync_mode: bool = True
|
56
|
-
):
|
38
|
+
def __init__(self, server_name: str, platform_url: str, token: str = None, user_id: str = None,
|
39
|
+
user_pwd: str = None, sync_mode: bool = True):
|
57
40
|
self.command_base: str = f"/api/open-metadata/collection-manager/collections"
|
58
41
|
Client.__init__(self, server_name, platform_url, user_id=user_id, token=token, async_mode=sync_mode)
|
59
42
|
|
60
43
|
#
|
61
44
|
# Retrieving Collections - https://egeria-project.org/concepts/collection
|
62
45
|
#
|
63
|
-
async def _async_get_linked_collections(self, parent_guid: str, server_name: str = None,
|
64
|
-
|
46
|
+
async def _async_get_linked_collections(self, parent_guid: str, server_name: str = None, start_from: int = 0,
|
47
|
+
page_size: int = None) -> list:
|
65
48
|
""" Returns the list of collections that are linked off of the supplied element. Async version.
|
66
49
|
|
67
50
|
Parameters
|
@@ -78,7 +61,7 @@ class CollectionManager(Client):
|
|
78
61
|
the class instance.
|
79
62
|
Returns
|
80
63
|
-------
|
81
|
-
List
|
64
|
+
List
|
82
65
|
|
83
66
|
A list of collections linked off of the supplied element.
|
84
67
|
|
@@ -108,8 +91,8 @@ class CollectionManager(Client):
|
|
108
91
|
resp = await self._async_make_request("POST", url, body)
|
109
92
|
return resp.json()
|
110
93
|
|
111
|
-
def get_linked_collections(self, parent_guid: str, server_name: str = None,
|
112
|
-
|
94
|
+
def get_linked_collections(self, parent_guid: str, server_name: str = None, start_from: int = 0,
|
95
|
+
page_size: int = None) -> list:
|
113
96
|
""" Returns the list of collections that are linked off of the supplied element.
|
114
97
|
|
115
98
|
Parameters
|
@@ -126,7 +109,7 @@ class CollectionManager(Client):
|
|
126
109
|
the class instance.
|
127
110
|
Returns
|
128
111
|
-------
|
129
|
-
List
|
112
|
+
List
|
130
113
|
|
131
114
|
A list of collections linked off of the supplied element.
|
132
115
|
|
@@ -142,12 +125,12 @@ class CollectionManager(Client):
|
|
142
125
|
|
143
126
|
"""
|
144
127
|
loop = asyncio.get_event_loop()
|
145
|
-
resp = loop.run_until_complete(
|
146
|
-
|
128
|
+
resp = loop.run_until_complete(
|
129
|
+
self._async_get_linked_collections(parent_guid, server_name, start_from, page_size))
|
147
130
|
return resp
|
148
131
|
|
149
|
-
async def _async_get_classified_collections(self, classification: str, server_name: str = None,
|
150
|
-
|
132
|
+
async def _async_get_classified_collections(self, classification: str, server_name: str = None, start_from: int = 0,
|
133
|
+
page_size: int = None) -> list | str:
|
151
134
|
""" Returns the list of collections with a particular classification. These classifications
|
152
135
|
are typically "RootCollection", "Folder" or "DigitalProduct". Async version.
|
153
136
|
|
@@ -185,9 +168,7 @@ class CollectionManager(Client):
|
|
185
168
|
if page_size is None:
|
186
169
|
page_size = self.page_size
|
187
170
|
|
188
|
-
body = {
|
189
|
-
"filter": classification
|
190
|
-
}
|
171
|
+
body = {"filter": classification}
|
191
172
|
|
192
173
|
url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/by-classifications?"
|
193
174
|
f"startFrom={start_from}&pageSize={page_size}")
|
@@ -197,8 +178,8 @@ class CollectionManager(Client):
|
|
197
178
|
result = resp.json().get("elements", "No Elements to return")
|
198
179
|
return result
|
199
180
|
|
200
|
-
def get_classified_collections(self, classification: str, server_name: str = None,
|
201
|
-
|
181
|
+
def get_classified_collections(self, classification: str, server_name: str = None, start_from: int = 0,
|
182
|
+
page_size: int = None) -> list | str:
|
202
183
|
""" Returns the list of collections with a particular classification. These classifications
|
203
184
|
are typically "RootCollection", "Folder" or "DigitalProduct".
|
204
185
|
|
@@ -232,13 +213,12 @@ class CollectionManager(Client):
|
|
232
213
|
|
233
214
|
"""
|
234
215
|
loop = asyncio.get_event_loop()
|
235
|
-
resp = loop.run_until_complete(
|
236
|
-
|
216
|
+
resp = loop.run_until_complete(
|
217
|
+
self._async_get_classified_collections(classification, server_name, start_from, page_size))
|
237
218
|
return resp
|
238
219
|
|
239
220
|
async def _async_find_collections(self, search_string: str, effective_time: str = None, starts_with: bool = False,
|
240
|
-
ends_with: bool = False, ignore_case: bool = False,
|
241
|
-
server_name: str = None,
|
221
|
+
ends_with: bool = False, ignore_case: bool = False, server_name: str = None,
|
242
222
|
start_from: int = 0, page_size: int = None) -> list | str:
|
243
223
|
""" Returns the list of collections matching the search string.
|
244
224
|
The search string is located in the request body and is interpreted as a plain string.
|
@@ -294,10 +274,7 @@ class CollectionManager(Client):
|
|
294
274
|
if search_string == '*':
|
295
275
|
search_string = None
|
296
276
|
|
297
|
-
body = {
|
298
|
-
"filter": search_string,
|
299
|
-
"effective_time": effective_time
|
300
|
-
}
|
277
|
+
body = {"filter": search_string, "effective_time": effective_time}
|
301
278
|
|
302
279
|
body_s = body_slimmer(body)
|
303
280
|
url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/"
|
@@ -352,14 +329,13 @@ class CollectionManager(Client):
|
|
352
329
|
|
353
330
|
"""
|
354
331
|
loop = asyncio.get_event_loop()
|
355
|
-
resp = loop.run_until_complete(
|
356
|
-
|
357
|
-
|
332
|
+
resp = loop.run_until_complete(
|
333
|
+
self._async_find_collections(search_string, effective_time, starts_with, ends_with, ignore_case,
|
334
|
+
server_name, start_from, page_size))
|
358
335
|
|
359
336
|
return resp
|
360
337
|
|
361
|
-
async def _async_get_collections_by_name(self, name: str, effective_time: str = None,
|
362
|
-
server_name: str = None,
|
338
|
+
async def _async_get_collections_by_name(self, name: str, effective_time: str = None, server_name: str = None,
|
363
339
|
start_from: int = 0, page_size: int = None) -> list | str:
|
364
340
|
""" Returns the list of collections with a particular name.
|
365
341
|
|
@@ -401,10 +377,7 @@ class CollectionManager(Client):
|
|
401
377
|
|
402
378
|
validate_search_string(name)
|
403
379
|
|
404
|
-
body = {
|
405
|
-
"filter": name,
|
406
|
-
effective_time: effective_time,
|
407
|
-
}
|
380
|
+
body = {"filter": name, effective_time: effective_time, }
|
408
381
|
body_s = body_slimmer(body)
|
409
382
|
url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/"
|
410
383
|
f"by-name?startFrom={start_from}&pageSize={page_size}")
|
@@ -451,14 +424,14 @@ class CollectionManager(Client):
|
|
451
424
|
|
452
425
|
"""
|
453
426
|
loop = asyncio.get_event_loop()
|
454
|
-
resp = loop.run_until_complete(
|
455
|
-
|
427
|
+
resp = loop.run_until_complete(
|
428
|
+
self._async_get_collections_by_name(name, effective_time, server_name, start_from, page_size))
|
456
429
|
|
457
430
|
return resp
|
458
431
|
|
459
432
|
async def _async_get_collections_by_type(self, collection_type: str, effective_time: str = None,
|
460
|
-
server_name: str = None,
|
461
|
-
|
433
|
+
server_name: str = None, start_from: int = 0,
|
434
|
+
page_size: int = None) -> list | str:
|
462
435
|
""" Returns the list of collections with a particular collectionType. This is an optional text field in the
|
463
436
|
collection element.
|
464
437
|
|
@@ -501,10 +474,7 @@ class CollectionManager(Client):
|
|
501
474
|
|
502
475
|
validate_search_string(collection_type)
|
503
476
|
|
504
|
-
body = {
|
505
|
-
"filter": collection_type,
|
506
|
-
effective_time: effective_time,
|
507
|
-
}
|
477
|
+
body = {"filter": collection_type, effective_time: effective_time, }
|
508
478
|
body_s = body_slimmer(body)
|
509
479
|
|
510
480
|
url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/"
|
@@ -552,8 +522,8 @@ class CollectionManager(Client):
|
|
552
522
|
|
553
523
|
"""
|
554
524
|
loop = asyncio.get_event_loop()
|
555
|
-
resp = loop.run_until_complete(
|
556
|
-
|
525
|
+
resp = loop.run_until_complete(
|
526
|
+
self._async_get_collections_by_type(collection_type, effective_time, server_name, start_from, page_size))
|
557
527
|
|
558
528
|
return resp
|
559
529
|
|
@@ -594,9 +564,7 @@ class CollectionManager(Client):
|
|
594
564
|
validate_guid(collection_guid)
|
595
565
|
|
596
566
|
url = f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}"
|
597
|
-
body = {
|
598
|
-
"effective_time": effective_time,
|
599
|
-
}
|
567
|
+
body = {"effective_time": effective_time, }
|
600
568
|
resp = await self._async_make_request("GET", url, body)
|
601
569
|
return resp.json()
|
602
570
|
|
@@ -631,8 +599,7 @@ class CollectionManager(Client):
|
|
631
599
|
|
632
600
|
"""
|
633
601
|
loop = asyncio.get_event_loop()
|
634
|
-
resp = loop.run_until_complete(self._async_get_collection(collection_guid, effective_time,
|
635
|
-
server_name))
|
602
|
+
resp = loop.run_until_complete(self._async_get_collection(collection_guid, effective_time, server_name))
|
636
603
|
|
637
604
|
return resp
|
638
605
|
|
@@ -714,8 +681,8 @@ class CollectionManager(Client):
|
|
714
681
|
async def _async_create_collection(self, classification_name: str, anchor_guid: str, parent_guid: str,
|
715
682
|
parent_relationship_type_name: str, parent_at_end1: bool, display_name: str,
|
716
683
|
description: str, collection_type: str, is_own_anchor: bool = False,
|
717
|
-
collection_ordering: str = None,
|
718
|
-
|
684
|
+
collection_ordering: str = None, order_property_name: str = None,
|
685
|
+
server_name: str = None) -> str:
|
719
686
|
""" Create Collections: https://egeria-project.org/concepts/collection Async version.
|
720
687
|
|
721
688
|
Parameters
|
@@ -776,32 +743,22 @@ class CollectionManager(Client):
|
|
776
743
|
url = (f"{self.platform_url}/servers/{server_name}{self.command_base}?"
|
777
744
|
f"classificationName={classification_name}")
|
778
745
|
|
779
|
-
body = {
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
788
|
-
"name": display_name,
|
789
|
-
"description": description,
|
790
|
-
"collectionType": collection_type,
|
791
|
-
"collectionOrdering": collection_ordering,
|
792
|
-
"orderPropertyName": order_property_name
|
793
|
-
}
|
794
|
-
}
|
746
|
+
body = {"anchorGUID": anchor_guid, "isOwnAnchor": is_own_anchor_s, "parentGUID": parent_guid,
|
747
|
+
"parentRelationshipTypeName": parent_relationship_type_name, "parentAtEnd1": parent_at_end1,
|
748
|
+
"collectionProperties": {"class": "CollectionProperties",
|
749
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
750
|
+
"name": display_name,
|
751
|
+
"description": description, "collectionType": collection_type,
|
752
|
+
"collectionOrdering": collection_ordering,
|
753
|
+
"orderPropertyName": order_property_name}}
|
795
754
|
|
796
755
|
resp = await self._async_make_request("POST", url, body)
|
797
756
|
return resp.json().get("guid", "No GUID returned")
|
798
757
|
|
799
758
|
def create_collection(self, classification_name: str, anchor_guid: str, parent_guid: str,
|
800
|
-
parent_relationship_type_name: str, parent_at_end1: bool, display_name: str,
|
801
|
-
|
802
|
-
|
803
|
-
server_name: str = None) \
|
804
|
-
-> str:
|
759
|
+
parent_relationship_type_name: str, parent_at_end1: bool, display_name: str, description: str,
|
760
|
+
collection_type: str, is_own_anchor: bool = False, collection_ordering: str = "OTHER",
|
761
|
+
order_property_name: str = "Something", server_name: str = None) -> str:
|
805
762
|
""" Create Collections: https://egeria-project.org/concepts/collection
|
806
763
|
|
807
764
|
Parameters
|
@@ -853,12 +810,10 @@ class CollectionManager(Client):
|
|
853
810
|
|
854
811
|
"""
|
855
812
|
loop = asyncio.get_event_loop()
|
856
|
-
resp = loop.run_until_complete(
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
collection_ordering,
|
861
|
-
order_property_name, server_name))
|
813
|
+
resp = loop.run_until_complete(
|
814
|
+
self._async_create_collection(classification_name, anchor_guid, parent_guid, parent_relationship_type_name,
|
815
|
+
parent_at_end1, display_name, description, collection_type, is_own_anchor,
|
816
|
+
collection_ordering, order_property_name, server_name))
|
862
817
|
return resp
|
863
818
|
|
864
819
|
async def _async_create_root_collection(self, anchor_guid: str, parent_guid: str,
|
@@ -913,30 +868,21 @@ class CollectionManager(Client):
|
|
913
868
|
is_own_anchor_s = str(is_own_anchor).lower()
|
914
869
|
url = f"{self.platform_url}/servers/{server_name}{self.command_base}/root-collection"
|
915
870
|
|
916
|
-
body = {
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
"collectionProperties": {
|
923
|
-
"class": "CollectionProperties",
|
924
|
-
"qualifiedName": f"root-collection-{display_name}-{time.asctime()}",
|
925
|
-
"name": display_name,
|
926
|
-
"description": description,
|
927
|
-
"collectionType": collection_type,
|
871
|
+
body = {"anchorGUID": anchor_guid, "isOwnAnchor": is_own_anchor_s, "parentGUID": parent_guid,
|
872
|
+
"parentRelationshipTypeName": parent_relationship_type_name, "parentAtEnd1": parent_at_end1,
|
873
|
+
"collectionProperties": {"class": "CollectionProperties",
|
874
|
+
"qualifiedName": f"root-collection-{display_name}-{time.asctime()}",
|
875
|
+
"name": display_name,
|
876
|
+
"description": description, "collectionType": collection_type,
|
928
877
|
|
929
|
-
|
930
|
-
}
|
878
|
+
}}
|
931
879
|
|
932
880
|
resp = await self._async_make_request("POST", url, body)
|
933
881
|
return resp.json().get("guid", "No GUID Returned")
|
934
882
|
|
935
|
-
def create_root_collection(self, anchor_guid: str, parent_guid: str,
|
936
|
-
|
937
|
-
|
938
|
-
server_name: str = None) \
|
939
|
-
-> str:
|
883
|
+
def create_root_collection(self, anchor_guid: str, parent_guid: str, parent_relationship_type_name: str,
|
884
|
+
parent_at_end1: bool, display_name: str, description: str, collection_type: str,
|
885
|
+
is_own_anchor: bool = False, server_name: str = None) -> str:
|
940
886
|
""" Create a new collection with the RootCollection classification. Used to identify the top of a
|
941
887
|
collection hierarchy.
|
942
888
|
|
@@ -982,18 +928,15 @@ class CollectionManager(Client):
|
|
982
928
|
|
983
929
|
"""
|
984
930
|
loop = asyncio.get_event_loop()
|
985
|
-
resp = loop.run_until_complete(
|
986
|
-
|
987
|
-
|
988
|
-
collection_type, is_own_anchor,
|
989
|
-
server_name))
|
931
|
+
resp = loop.run_until_complete(
|
932
|
+
self._async_create_root_collection(anchor_guid, parent_guid, parent_relationship_type_name, parent_at_end1,
|
933
|
+
display_name, description, collection_type, is_own_anchor, server_name))
|
990
934
|
return resp
|
991
935
|
|
992
936
|
async def _async_create_data_spec_collection(self, anchor_guid: str, parent_guid: str,
|
993
937
|
parent_relationship_type_name: str, parent_at_end1: bool,
|
994
|
-
display_name: str,
|
995
|
-
|
996
|
-
collection_ordering: str = "OTHER",
|
938
|
+
display_name: str, description: str, collection_type: str,
|
939
|
+
is_own_anchor: bool = True, collection_ordering: str = "OTHER",
|
997
940
|
order_property_name: str = "Something",
|
998
941
|
server_name: str = None) -> str:
|
999
942
|
""" Create a new collection with the DataSpec classification. Used to identify a collection of data fields
|
@@ -1049,30 +992,21 @@ class CollectionManager(Client):
|
|
1049
992
|
is_own_anchor_s = str(is_own_anchor).lower()
|
1050
993
|
url = f"{self.platform_url}/servers/{server_name}{self.command_base}/data-spec-collection"
|
1051
994
|
|
1052
|
-
body = {
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
"qualifiedName": f"data-spec-collection-{display_name}-{time.asctime()}",
|
1061
|
-
"name": display_name,
|
1062
|
-
"description": description,
|
1063
|
-
"collectionType": collection_type,
|
1064
|
-
"collectionOrdering": collection_ordering,
|
1065
|
-
"orderPropertyName": order_property_name
|
1066
|
-
}
|
1067
|
-
}
|
995
|
+
body = {"anchorGUID": anchor_guid, "isOwnAnchor": is_own_anchor_s, "parentGUID": parent_guid,
|
996
|
+
"parentRelationshipTypeName": parent_relationship_type_name, "parentAtEnd1": parent_at_end1,
|
997
|
+
"collectionProperties": {"class": "CollectionProperties",
|
998
|
+
"qualifiedName": f"data-spec-collection-{display_name}-{time.asctime()}",
|
999
|
+
"name": display_name,
|
1000
|
+
"description": description, "collectionType": collection_type,
|
1001
|
+
"collectionOrdering": collection_ordering,
|
1002
|
+
"orderPropertyName": order_property_name}}
|
1068
1003
|
|
1069
1004
|
resp = await self._async_make_request("POST", url, body)
|
1070
1005
|
return resp.json().get("guid", "No GUID Returned")
|
1071
1006
|
|
1072
|
-
def create_data_spec_collection(self, anchor_guid: str, parent_guid: str,
|
1073
|
-
|
1074
|
-
|
1075
|
-
collection_ordering: str = "OTHER",
|
1007
|
+
def create_data_spec_collection(self, anchor_guid: str, parent_guid: str, parent_relationship_type_name: str,
|
1008
|
+
parent_at_end1: bool, display_name: str, description: str, collection_type: str,
|
1009
|
+
is_own_anchor: bool, collection_ordering: str = "OTHER",
|
1076
1010
|
order_property_name: str = "Something", server_name: str = None) -> str:
|
1077
1011
|
""" Create a new collection with the DataSpec classification. Used to identify a collection of data fields
|
1078
1012
|
and schema types.
|
@@ -1122,20 +1056,17 @@ class CollectionManager(Client):
|
|
1122
1056
|
|
1123
1057
|
"""
|
1124
1058
|
loop = asyncio.get_event_loop()
|
1125
|
-
resp = loop.run_until_complete(
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
collection_ordering,
|
1131
|
-
order_property_name, server_name))
|
1059
|
+
resp = loop.run_until_complete(
|
1060
|
+
self._async_create_data_spec_collection(anchor_guid, parent_guid, parent_relationship_type_name,
|
1061
|
+
parent_at_end1, display_name, description, collection_type,
|
1062
|
+
is_own_anchor, collection_ordering, order_property_name,
|
1063
|
+
server_name))
|
1132
1064
|
return resp
|
1133
1065
|
|
1134
1066
|
async def _async_create_folder_collection(self, anchor_guid: str, parent_guid: str,
|
1135
1067
|
parent_relationship_type_name: str, parent_at_end1: bool,
|
1136
|
-
display_name: str,
|
1137
|
-
|
1138
|
-
collection_ordering: str = "OTHER",
|
1068
|
+
display_name: str, description: str, collection_type: str,
|
1069
|
+
is_own_anchor: bool = True, collection_ordering: str = "OTHER",
|
1139
1070
|
order_property_name: str = "Something", server_name: str = None) -> str:
|
1140
1071
|
""" Create a new collection with the Folder classification. This is used to identify the organizing
|
1141
1072
|
collections in a collection hierarchy. Async version.
|
@@ -1191,30 +1122,21 @@ class CollectionManager(Client):
|
|
1191
1122
|
|
1192
1123
|
url = f"{self.platform_url}/servers/{server_name}{self.command_base}/folder"
|
1193
1124
|
|
1194
|
-
body = {
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
"qualifiedName": f"folder-collection-{display_name}-{time.asctime()}",
|
1203
|
-
"name": display_name,
|
1204
|
-
"description": description,
|
1205
|
-
"collectionType": collection_type,
|
1206
|
-
"collectionOrdering": collection_ordering,
|
1207
|
-
"orderPropertyName": order_property_name
|
1208
|
-
}
|
1209
|
-
}
|
1125
|
+
body = {"anchorGUID": anchor_guid, "isOwnAnchor": is_own_anchor_s, "parentGUID": parent_guid,
|
1126
|
+
"parentRelationshipTypeName": parent_relationship_type_name, "parentAtEnd1": parent_at_end1,
|
1127
|
+
"collectionProperties": {"class": "CollectionProperties",
|
1128
|
+
"qualifiedName": f"folder-collection-{display_name}-{time.asctime()}",
|
1129
|
+
"name": display_name,
|
1130
|
+
"description": description, "collectionType": collection_type,
|
1131
|
+
"collectionOrdering": collection_ordering,
|
1132
|
+
"orderPropertyName": order_property_name}}
|
1210
1133
|
|
1211
1134
|
resp = await self._async_make_request("POST", url, body)
|
1212
1135
|
return resp.json().get("guid", "No GUID returned")
|
1213
1136
|
|
1214
|
-
def create_folder_collection(self, anchor_guid: str, parent_guid: str,
|
1215
|
-
|
1216
|
-
|
1217
|
-
collection_ordering: str = "OTHER",
|
1137
|
+
def create_folder_collection(self, anchor_guid: str, parent_guid: str, parent_relationship_type_name: str,
|
1138
|
+
parent_at_end1: bool, display_name: str, description: str, collection_type: str,
|
1139
|
+
is_own_anchor: bool, collection_ordering: str = "OTHER",
|
1218
1140
|
order_property_name: str = "Something", server_name: str = None) -> str:
|
1219
1141
|
""" Create a new collection with the Folder classification. This is used to identify the organizing
|
1220
1142
|
collections in a collection hierarchy.
|
@@ -1265,13 +1187,10 @@ class CollectionManager(Client):
|
|
1265
1187
|
|
1266
1188
|
"""
|
1267
1189
|
loop = asyncio.get_event_loop()
|
1268
|
-
resp = loop.run_until_complete(
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
collection_type, is_own_anchor,
|
1273
|
-
collection_ordering,
|
1274
|
-
order_property_name, server_name))
|
1190
|
+
resp = loop.run_until_complete(
|
1191
|
+
self._async_create_folder_collection(anchor_guid, parent_guid, parent_relationship_type_name,
|
1192
|
+
parent_at_end1, display_name, description, collection_type,
|
1193
|
+
is_own_anchor, collection_ordering, order_property_name, server_name))
|
1275
1194
|
return resp
|
1276
1195
|
|
1277
1196
|
async def _async_create_collection_from_template(self, body: dict, server_name: str = None) -> str:
|
@@ -1582,15 +1501,10 @@ class CollectionManager(Client):
|
|
1582
1501
|
url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/update?"
|
1583
1502
|
f"replaceAllProperties={replace_all_props_s}")
|
1584
1503
|
|
1585
|
-
body = {
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
"description": description,
|
1590
|
-
"collectionType": collection_type,
|
1591
|
-
"collectionOrdering": collection_ordering,
|
1592
|
-
"orderPropertyName": order_property_name
|
1593
|
-
}
|
1504
|
+
body = {"class": "CollectionProperties", "qualifiedName": qualified_name, "name": display_name,
|
1505
|
+
"description": description, "collectionType": collection_type,
|
1506
|
+
"collectionOrdering": collection_ordering,
|
1507
|
+
"orderPropertyName": order_property_name}
|
1594
1508
|
body_s = body_slimmer(body)
|
1595
1509
|
await self._async_make_request("POST", url, body_s)
|
1596
1510
|
return
|
@@ -1638,10 +1552,9 @@ class CollectionManager(Client):
|
|
1638
1552
|
The principle specified by the user_id does not have authorization for the requested action
|
1639
1553
|
"""
|
1640
1554
|
loop = asyncio.get_event_loop()
|
1641
|
-
loop.run_until_complete(
|
1642
|
-
|
1643
|
-
|
1644
|
-
replace_all_props, server_name))
|
1555
|
+
loop.run_until_complete(
|
1556
|
+
self._async_update_collection(collection_guid, qualified_name, display_name, description, collection_type,
|
1557
|
+
collection_ordering, order_property_name, replace_all_props, server_name))
|
1645
1558
|
return
|
1646
1559
|
|
1647
1560
|
async def _async_update_digital_product(self, collection_guid: str, body: dict, replace_all_props: bool = False,
|
@@ -1755,7 +1668,8 @@ class CollectionManager(Client):
|
|
1755
1668
|
}
|
1756
1669
|
"""
|
1757
1670
|
loop = asyncio.get_event_loop()
|
1758
|
-
loop.run_until_complete(
|
1671
|
+
loop.run_until_complete(
|
1672
|
+
self._async_update_digital_product(collection_guid, body, replace_all_props, server_name))
|
1759
1673
|
return
|
1760
1674
|
|
1761
1675
|
async def _async_attach_collection(self, collection_guid: str, element_guid: str, resource_use: str,
|
@@ -1805,20 +1719,15 @@ class CollectionManager(Client):
|
|
1805
1719
|
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/metadata-elements/"
|
1806
1720
|
f"{element_guid}/collections/{collection_guid}/attach?makeAnchor={make_anchor_s}")
|
1807
1721
|
|
1808
|
-
body = {
|
1809
|
-
|
1810
|
-
|
1811
|
-
"resourceUseDescription": resource_use_description,
|
1812
|
-
"watchResource": watch_resources_s,
|
1813
|
-
"resourceUseProperties": resource_use_props
|
1814
|
-
}
|
1722
|
+
body = {"class": "ResourceListProperties", "resourceUse": resource_use,
|
1723
|
+
"resourceUseDescription": resource_use_description, "watchResource": watch_resources_s,
|
1724
|
+
"resourceUseProperties": resource_use_props}
|
1815
1725
|
await self._async_make_request("POST", url, body)
|
1816
1726
|
return
|
1817
1727
|
|
1818
1728
|
def attach_collection(self, collection_guid: str, element_guid: str, resource_use: str,
|
1819
|
-
resource_use_description: str, resource_use_props: dict = None,
|
1820
|
-
|
1821
|
-
server_name: str = None) -> None:
|
1729
|
+
resource_use_description: str, resource_use_props: dict = None, watch_resources: bool = False,
|
1730
|
+
make_anchor: bool = False, server_name: str = None) -> None:
|
1822
1731
|
""" Connect an existing collection to an element using the ResourceList relationship (0019).
|
1823
1732
|
Parameters
|
1824
1733
|
----------
|
@@ -1855,14 +1764,12 @@ class CollectionManager(Client):
|
|
1855
1764
|
|
1856
1765
|
"""
|
1857
1766
|
loop = asyncio.get_event_loop()
|
1858
|
-
loop.run_until_complete(
|
1859
|
-
|
1860
|
-
|
1861
|
-
make_anchor, server_name))
|
1767
|
+
loop.run_until_complete(
|
1768
|
+
self._async_attach_collection(collection_guid, element_guid, resource_use, resource_use_description,
|
1769
|
+
resource_use_props, watch_resources, make_anchor, server_name))
|
1862
1770
|
return
|
1863
1771
|
|
1864
|
-
async def _async_detach_collection(self, collection_guid: str, element_guid: str,
|
1865
|
-
server_name: str = None) -> None:
|
1772
|
+
async def _async_detach_collection(self, collection_guid: str, element_guid: str, server_name: str = None) -> None:
|
1866
1773
|
""" Detach an existing collection from an element. If the collection is anchored to the element, it is deleted.
|
1867
1774
|
Async version.
|
1868
1775
|
|
@@ -1895,15 +1802,12 @@ class CollectionManager(Client):
|
|
1895
1802
|
url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/metadata-elements/"
|
1896
1803
|
f"{element_guid}/collections/{collection_guid}/detach")
|
1897
1804
|
|
1898
|
-
body = {
|
1899
|
-
"class": "NullRequestBody"
|
1900
|
-
}
|
1805
|
+
body = {"class": "NullRequestBody"}
|
1901
1806
|
|
1902
1807
|
await self._async_make_request("POST", url, body)
|
1903
1808
|
return
|
1904
1809
|
|
1905
|
-
def detach_collection(self, collection_guid: str, element_guid: str,
|
1906
|
-
server_name: str = None) -> None:
|
1810
|
+
def detach_collection(self, collection_guid: str, element_guid: str, server_name: str = None) -> None:
|
1907
1811
|
""" Connect an existing collection to an element using the ResourceList relationship (0019).
|
1908
1812
|
Parameters
|
1909
1813
|
----------
|
@@ -1930,8 +1834,7 @@ class CollectionManager(Client):
|
|
1930
1834
|
|
1931
1835
|
"""
|
1932
1836
|
loop = asyncio.get_event_loop()
|
1933
|
-
loop.run_until_complete(self._async_detach_collection(collection_guid, element_guid,
|
1934
|
-
server_name))
|
1837
|
+
loop.run_until_complete(self._async_detach_collection(collection_guid, element_guid, server_name))
|
1935
1838
|
return
|
1936
1839
|
|
1937
1840
|
async def _async_delete_collection(self, collection_guid: str, server_name: str = None) -> None:
|
@@ -1964,9 +1867,7 @@ class CollectionManager(Client):
|
|
1964
1867
|
if server_name is None:
|
1965
1868
|
server_name = self.server_name
|
1966
1869
|
url = f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/delete"
|
1967
|
-
body = {
|
1968
|
-
"class": "NullRequestBody"
|
1969
|
-
}
|
1870
|
+
body = {"class": "NullRequestBody"}
|
1970
1871
|
|
1971
1872
|
await self._async_make_request("POST", url, body)
|
1972
1873
|
return
|
@@ -1999,8 +1900,7 @@ class CollectionManager(Client):
|
|
1999
1900
|
|
2000
1901
|
"""
|
2001
1902
|
loop = asyncio.get_event_loop()
|
2002
|
-
loop.run_until_complete(self._async_delete_collection(collection_guid,
|
2003
|
-
server_name))
|
1903
|
+
loop.run_until_complete(self._async_delete_collection(collection_guid, server_name))
|
2004
1904
|
return
|
2005
1905
|
|
2006
1906
|
async def _async_get_collection_members(self, collection_guid: str, effective_time: str = None,
|
@@ -2050,9 +1950,8 @@ class CollectionManager(Client):
|
|
2050
1950
|
resp = await self._async_make_request("GET", url)
|
2051
1951
|
return resp.json().get("elements", "No elements found")
|
2052
1952
|
|
2053
|
-
def get_collection_members(self, collection_guid: str, effective_time: str = None,
|
2054
|
-
|
2055
|
-
page_size: int = None) -> list | str:
|
1953
|
+
def get_collection_members(self, collection_guid: str, effective_time: str = None, server_name: str = None,
|
1954
|
+
start_from: int = 0, page_size: int = None) -> list | str:
|
2056
1955
|
""" Return a list of elements that are a member of a collection.
|
2057
1956
|
|
2058
1957
|
Parameters
|
@@ -2087,8 +1986,8 @@ class CollectionManager(Client):
|
|
2087
1986
|
|
2088
1987
|
"""
|
2089
1988
|
loop = asyncio.get_event_loop()
|
2090
|
-
resp = loop.run_until_complete(
|
2091
|
-
|
1989
|
+
resp = loop.run_until_complete(
|
1990
|
+
self._async_get_collection_members(collection_guid, effective_time, server_name, start_from, page_size))
|
2092
1991
|
|
2093
1992
|
return resp
|
2094
1993
|
|
@@ -2200,8 +2099,7 @@ class CollectionManager(Client):
|
|
2200
2099
|
|
2201
2100
|
"""
|
2202
2101
|
loop = asyncio.get_event_loop()
|
2203
|
-
loop.run_until_complete(self._async_add_to_collection(collection_guid, element_guid,
|
2204
|
-
body, server_name))
|
2102
|
+
loop.run_until_complete(self._async_add_to_collection(collection_guid, element_guid, body, server_name))
|
2205
2103
|
return
|
2206
2104
|
|
2207
2105
|
async def _async_update_collection_membership(self, collection_guid: str, element_guid: str, body: dict = None,
|
@@ -2316,8 +2214,9 @@ class CollectionManager(Client):
|
|
2316
2214
|
|
2317
2215
|
"""
|
2318
2216
|
loop = asyncio.get_event_loop()
|
2319
|
-
loop.run_until_complete(
|
2320
|
-
|
2217
|
+
loop.run_until_complete(
|
2218
|
+
self._async_update_collection_membership(collection_guid, element_guid, body, replace_all_props,
|
2219
|
+
server_name))
|
2321
2220
|
return
|
2322
2221
|
|
2323
2222
|
async def _async_remove_from_collection(self, collection_guid: str, element_guid: str,
|
@@ -2354,9 +2253,7 @@ class CollectionManager(Client):
|
|
2354
2253
|
|
2355
2254
|
url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/members/"
|
2356
2255
|
f"{element_guid}/detach")
|
2357
|
-
body = {
|
2358
|
-
"class": "NullRequestBody"
|
2359
|
-
}
|
2256
|
+
body = {"class": "NullRequestBody"}
|
2360
2257
|
await self._async_make_request("POST", url, body)
|
2361
2258
|
return
|
2362
2259
|
|
@@ -2389,15 +2286,34 @@ class CollectionManager(Client):
|
|
2389
2286
|
|
2390
2287
|
"""
|
2391
2288
|
loop = asyncio.get_event_loop()
|
2392
|
-
loop.run_until_complete(self._async_remove_from_collection(collection_guid, element_guid,
|
2393
|
-
server_name))
|
2289
|
+
loop.run_until_complete(self._async_remove_from_collection(collection_guid, element_guid, server_name))
|
2394
2290
|
return
|
2395
2291
|
|
2396
|
-
def
|
2292
|
+
async def _async_get_member_list(self, root_collection_name: str, server_name: str = None) -> list | bool:
|
2293
|
+
""" Get the member list for the collection - async version.
|
2294
|
+
Parameters
|
2295
|
+
----------
|
2296
|
+
root_collection_name : str
|
2297
|
+
The name of the root collection.
|
2298
|
+
|
2299
|
+
server_name : str, optional
|
2300
|
+
The name of the server. If not provided, the default server name will be used.
|
2301
|
+
|
2302
|
+
Returns
|
2303
|
+
-------
|
2304
|
+
list | bool
|
2305
|
+
The list of member information if successful, otherwise False.
|
2306
|
+
|
2307
|
+
Raises
|
2308
|
+
------
|
2309
|
+
InvalidParameterException
|
2310
|
+
If the root_collection_name does not have exactly one root collection.
|
2311
|
+
|
2312
|
+
"""
|
2397
2313
|
if server_name is None:
|
2398
2314
|
server_name = self.server_name
|
2399
2315
|
# first find the guid for the collection we are using as root
|
2400
|
-
root_guids = self.
|
2316
|
+
root_guids = await self._async_get_collections_by_name(root_collection_name)
|
2401
2317
|
if type(root_guids) is str:
|
2402
2318
|
return False
|
2403
2319
|
if len(root_guids) != 1:
|
@@ -2407,22 +2323,45 @@ class CollectionManager(Client):
|
|
2407
2323
|
|
2408
2324
|
# now find the members of the collection
|
2409
2325
|
member_list = []
|
2410
|
-
members = self.
|
2326
|
+
members = await self._async_get_collection_members(root)
|
2411
2327
|
if type(members) is str:
|
2412
2328
|
return False
|
2413
2329
|
# finally, construct a list of member information
|
2414
2330
|
for member_rel in members:
|
2415
2331
|
member_guid = member_rel['member']['guid']
|
2416
|
-
member_resp = self.
|
2332
|
+
member_resp = await self._async_get_collection(member_guid)
|
2417
2333
|
member = member_resp['element']
|
2418
2334
|
# print(json.dumps(member, indent = 4))
|
2419
|
-
member_instance = {
|
2420
|
-
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
"collectionType": member['properties']['collectionType'],
|
2425
|
-
}
|
2335
|
+
member_instance = {"name": member['properties']['name'],
|
2336
|
+
"qualifiedName": member['properties']['qualifiedName'],
|
2337
|
+
"guid": member['elementHeader']['guid'],
|
2338
|
+
"description": member['properties']['description'],
|
2339
|
+
"collectionType": member['properties']['collectionType'], }
|
2426
2340
|
member_list.append(member_instance)
|
2427
2341
|
|
2428
2342
|
return member_list
|
2343
|
+
|
2344
|
+
def get_member_list(self, root_collection_name: str, server_name: str = None) -> list | bool:
|
2345
|
+
""" Get the member list for the collection.
|
2346
|
+
Parameters
|
2347
|
+
----------
|
2348
|
+
root_collection_name : str
|
2349
|
+
The name of the root collection.
|
2350
|
+
|
2351
|
+
server_name : str, optional
|
2352
|
+
The name of the server. If not provided, the default server name will be used.
|
2353
|
+
|
2354
|
+
Returns
|
2355
|
+
-------
|
2356
|
+
list | bool
|
2357
|
+
The list of member information if successful, otherwise False.
|
2358
|
+
|
2359
|
+
Raises
|
2360
|
+
------
|
2361
|
+
InvalidParameterException
|
2362
|
+
If the root_collection_name does not have exactly one root collection.
|
2363
|
+
|
2364
|
+
"""
|
2365
|
+
loop = asyncio.get_event_loop()
|
2366
|
+
resp = loop.run_until_complete(self._async_get_member_list(root_collection_name, server_name))
|
2367
|
+
return resp
|