pyegeria 0.7.45.1__py3-none-any.whl → 0.8.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. examples/widgets/cat/list_cert_types.py +61 -43
  2. examples/widgets/cat/list_projects.py +1 -1
  3. examples/widgets/my/my_profile_actions.py +51 -32
  4. examples/widgets/ops/engine_actions.py +35 -23
  5. examples/widgets/ops/integration_daemon_actions.py +51 -32
  6. examples/widgets/tech/get_element_info.py +63 -38
  7. examples/widgets/tech/get_guid_info.py +50 -27
  8. examples/widgets/tech/list_asset_types.py +33 -23
  9. examples/widgets/tech/list_elements.py +44 -34
  10. examples/widgets/tech/list_elements_x.py +69 -49
  11. examples/widgets/tech/list_registered_services.py +44 -24
  12. examples/widgets/tech/list_related_specification.py +70 -45
  13. examples/widgets/tech/list_relationship_types.py +50 -31
  14. examples/widgets/tech/list_valid_metadata_values.py +57 -28
  15. examples/widgets/tech/x_list_related_elements.py +54 -34
  16. pyegeria/Xloaded_resources_omvs.py +43 -41
  17. pyegeria/__init__.py +5 -1
  18. pyegeria/_client.py +142 -102
  19. pyegeria/_deprecated_gov_engine.py +218 -167
  20. pyegeria/action_author_omvs.py +107 -88
  21. pyegeria/asset_catalog_omvs.py +467 -395
  22. pyegeria/automated_curation_omvs.py +2 -2
  23. pyegeria/classification_manager_omvs.py +3 -9
  24. pyegeria/collection_manager_omvs.py +1957 -1519
  25. pyegeria/core_omag_server_config.py +310 -192
  26. pyegeria/egeria_cat_client.py +88 -0
  27. pyegeria/egeria_config_client.py +37 -0
  28. pyegeria/egeria_my_client.py +47 -0
  29. pyegeria/egeria_ops_client.py +67 -0
  30. pyegeria/egeria_tech_client.py +77 -0
  31. pyegeria/feedback_manager_omvs.py +633 -631
  32. pyegeria/full_omag_server_config.py +330 -158
  33. pyegeria/glossary_browser_omvs.py +927 -474
  34. pyegeria/glossary_manager_omvs.py +1033 -543
  35. pyegeria/my_profile_omvs.py +714 -574
  36. pyegeria/platform_services.py +228 -176
  37. pyegeria/project_manager_omvs.py +1158 -903
  38. pyegeria/registered_info.py +76 -74
  39. pyegeria/runtime_manager_omvs.py +749 -670
  40. pyegeria/server_operations.py +123 -85
  41. pyegeria/valid_metadata_omvs.py +268 -168
  42. {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/METADATA +1 -1
  43. {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/RECORD +46 -42
  44. pyegeria/tech_guids_31-08-2024 14:33.py +0 -79
  45. {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/LICENSE +0 -0
  46. {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/WHEEL +0 -0
  47. {pyegeria-0.7.45.1.dist-info → pyegeria-0.8.0.dist-info}/entry_points.txt +0 -0
@@ -10,8 +10,13 @@ import time
10
10
 
11
11
  # import json
12
12
  from pyegeria._client import Client
13
- from pyegeria._exceptions import (InvalidParameterException, )
14
- from pyegeria._validators import (validate_guid, validate_search_string, )
13
+ from pyegeria._exceptions import (
14
+ InvalidParameterException,
15
+ )
16
+ from pyegeria._validators import (
17
+ validate_guid,
18
+ validate_search_string,
19
+ )
15
20
  from pyegeria.utils import body_slimmer
16
21
 
17
22
 
@@ -32,20 +37,34 @@ class CollectionManager(Client):
32
37
  when the user doesn't pass the user_id on a method call.
33
38
  user_pwd: str
34
39
  The password associated with the user_id. Defaults to None
40
+ token: str
41
+ An optional bearer token
35
42
 
36
- """
43
+ """
37
44
 
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):
45
+ def __init__(
46
+ self,
47
+ server_name: str,
48
+ platform_url: str,
49
+ token: str = None,
50
+ user_id: str = None,
51
+ user_pwd: str = None,
52
+ sync_mode: bool = True,
53
+ ):
40
54
  self.command_base: str = f"/api/open-metadata/collection-manager/collections"
41
- Client.__init__(self, server_name, platform_url, user_id=user_id, token=token, async_mode=sync_mode)
55
+ Client.__init__(self, server_name, platform_url, user_id=user_id, token=token)
42
56
 
43
57
  #
44
58
  # Retrieving Collections - https://egeria-project.org/concepts/collection
45
59
  #
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:
48
- """ Returns the list of collections that are linked off of the supplied element. Async version.
60
+ async def _async_get_linked_collections(
61
+ self,
62
+ parent_guid: str,
63
+ server_name: str = None,
64
+ start_from: int = 0,
65
+ page_size: int = None,
66
+ ) -> list:
67
+ """Returns the list of collections that are linked off of the supplied element. Async version.
49
68
 
50
69
  Parameters
51
70
  ----------
@@ -81,19 +100,24 @@ class CollectionManager(Client):
81
100
  if page_size is None:
82
101
  page_size = self.page_size
83
102
 
84
- body = {
85
-
86
- }
103
+ body = {}
87
104
 
88
- url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/"
89
- f"metadata-elements/{parent_guid}/collections?startFrom={start_from}&pageSize={page_size}")
105
+ url = (
106
+ f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/"
107
+ f"metadata-elements/{parent_guid}/collections?startFrom={start_from}&pageSize={page_size}"
108
+ )
90
109
 
91
110
  resp = await self._async_make_request("POST", url, body)
92
111
  return resp.json()
93
112
 
94
- def get_linked_collections(self, parent_guid: str, server_name: str = None, start_from: int = 0,
95
- page_size: int = None) -> list:
96
- """ Returns the list of collections that are linked off of the supplied element.
113
+ def get_linked_collections(
114
+ self,
115
+ parent_guid: str,
116
+ server_name: str = None,
117
+ start_from: int = 0,
118
+ page_size: int = None,
119
+ ) -> list:
120
+ """Returns the list of collections that are linked off of the supplied element.
97
121
 
98
122
  Parameters
99
123
  ----------
@@ -126,12 +150,20 @@ class CollectionManager(Client):
126
150
  """
127
151
  loop = asyncio.get_event_loop()
128
152
  resp = loop.run_until_complete(
129
- self._async_get_linked_collections(parent_guid, server_name, start_from, page_size))
153
+ self._async_get_linked_collections(
154
+ parent_guid, server_name, start_from, page_size
155
+ )
156
+ )
130
157
  return resp
131
158
 
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:
134
- """ Returns the list of collections with a particular classification. These classifications
159
+ async def _async_get_classified_collections(
160
+ self,
161
+ classification: str,
162
+ server_name: str = None,
163
+ start_from: int = 0,
164
+ page_size: int = None,
165
+ ) -> list | str:
166
+ """Returns the list of collections with a particular classification. These classifications
135
167
  are typically "RootCollection", "Folder" or "DigitalProduct". Async version.
136
168
 
137
169
  Parameters
@@ -170,17 +202,24 @@ class CollectionManager(Client):
170
202
 
171
203
  body = {"filter": classification}
172
204
 
173
- url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/by-classifications?"
174
- f"startFrom={start_from}&pageSize={page_size}")
205
+ url = (
206
+ f"{self.platform_url}/servers/{server_name}{self.command_base}/by-classifications?"
207
+ f"startFrom={start_from}&pageSize={page_size}"
208
+ )
175
209
 
176
210
  resp = await self._async_make_request("POST", url, body)
177
211
  # result = resp.json().get("elements","No elements found")
178
212
  result = resp.json().get("elements", "No Elements to return")
179
213
  return result
180
214
 
181
- def get_classified_collections(self, classification: str, server_name: str = None, start_from: int = 0,
182
- page_size: int = None) -> list | str:
183
- """ Returns the list of collections with a particular classification. These classifications
215
+ def get_classified_collections(
216
+ self,
217
+ classification: str,
218
+ server_name: str = None,
219
+ start_from: int = 0,
220
+ page_size: int = None,
221
+ ) -> list | str:
222
+ """Returns the list of collections with a particular classification. These classifications
184
223
  are typically "RootCollection", "Folder" or "DigitalProduct".
185
224
 
186
225
  Parameters
@@ -214,13 +253,24 @@ class CollectionManager(Client):
214
253
  """
215
254
  loop = asyncio.get_event_loop()
216
255
  resp = loop.run_until_complete(
217
- self._async_get_classified_collections(classification, server_name, start_from, page_size))
256
+ self._async_get_classified_collections(
257
+ classification, server_name, start_from, page_size
258
+ )
259
+ )
218
260
  return resp
219
261
 
220
- async def _async_find_collections(self, search_string: str, effective_time: str = None, starts_with: bool = False,
221
- ends_with: bool = False, ignore_case: bool = False, server_name: str = None,
222
- start_from: int = 0, page_size: int = None) -> list | str:
223
- """ Returns the list of collections matching the search string.
262
+ async def _async_find_collections(
263
+ self,
264
+ search_string: str,
265
+ effective_time: str = None,
266
+ starts_with: bool = False,
267
+ ends_with: bool = False,
268
+ ignore_case: bool = False,
269
+ server_name: str = None,
270
+ start_from: int = 0,
271
+ page_size: int = None,
272
+ ) -> list | str:
273
+ """Returns the list of collections matching the search string.
224
274
  The search string is located in the request body and is interpreted as a plain string.
225
275
  The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
226
276
 
@@ -271,23 +321,33 @@ class CollectionManager(Client):
271
321
 
272
322
  validate_search_string(search_string)
273
323
 
274
- if search_string == '*':
324
+ if search_string == "*":
275
325
  search_string = None
276
326
 
277
327
  body = {"filter": search_string, "effective_time": effective_time}
278
328
 
279
329
  body_s = body_slimmer(body)
280
- url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/"
281
- f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
282
- f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}")
330
+ url = (
331
+ f"{self.platform_url}/servers/{server_name}{self.command_base}/"
332
+ f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
333
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}"
334
+ )
283
335
 
284
336
  resp = await self._async_make_request("POST", url, body_s)
285
337
  return resp.json().get("elements", "No elements found")
286
338
 
287
- def find_collections(self, search_string: str, effective_time: str = None, starts_with: bool = False,
288
- ends_with: bool = False, ignore_case: bool = False, server_name: str = None,
289
- start_from: int = 0, page_size: int = None) -> list | str:
290
- """ Returns the list of collections matching the search string. Async version.
339
+ def find_collections(
340
+ self,
341
+ search_string: str,
342
+ effective_time: str = None,
343
+ starts_with: bool = False,
344
+ ends_with: bool = False,
345
+ ignore_case: bool = False,
346
+ server_name: str = None,
347
+ start_from: int = 0,
348
+ page_size: int = None,
349
+ ) -> list | str:
350
+ """Returns the list of collections matching the search string. Async version.
291
351
  The search string is located in the request body and is interpreted as a plain string.
292
352
  The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
293
353
 
@@ -330,14 +390,29 @@ class CollectionManager(Client):
330
390
  """
331
391
  loop = asyncio.get_event_loop()
332
392
  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))
393
+ self._async_find_collections(
394
+ search_string,
395
+ effective_time,
396
+ starts_with,
397
+ ends_with,
398
+ ignore_case,
399
+ server_name,
400
+ start_from,
401
+ page_size,
402
+ )
403
+ )
335
404
 
336
405
  return resp
337
406
 
338
- async def _async_get_collections_by_name(self, name: str, effective_time: str = None, server_name: str = None,
339
- start_from: int = 0, page_size: int = None) -> list | str:
340
- """ Returns the list of collections with a particular name.
407
+ async def _async_get_collections_by_name(
408
+ self,
409
+ name: str,
410
+ effective_time: str = None,
411
+ server_name: str = None,
412
+ start_from: int = 0,
413
+ page_size: int = None,
414
+ ) -> list | str:
415
+ """Returns the list of collections with a particular name.
341
416
 
342
417
  Parameters
343
418
  ----------
@@ -377,17 +452,28 @@ class CollectionManager(Client):
377
452
 
378
453
  validate_search_string(name)
379
454
 
380
- body = {"filter": name, effective_time: effective_time, }
455
+ body = {
456
+ "filter": name,
457
+ effective_time: effective_time,
458
+ }
381
459
  body_s = body_slimmer(body)
382
- url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/"
383
- f"by-name?startFrom={start_from}&pageSize={page_size}")
460
+ url = (
461
+ f"{self.platform_url}/servers/{server_name}{self.command_base}/"
462
+ f"by-name?startFrom={start_from}&pageSize={page_size}"
463
+ )
384
464
 
385
465
  resp = await self._async_make_request("POST", url, body_s)
386
466
  return resp.json().get("elements", "No elements found")
387
467
 
388
- def get_collections_by_name(self, name: str, effective_time: str = None, server_name: str = None,
389
- start_from: int = 0, page_size: int = None) -> list | str:
390
- """ Returns the list of collections matching the search string. Async version.
468
+ def get_collections_by_name(
469
+ self,
470
+ name: str,
471
+ effective_time: str = None,
472
+ server_name: str = None,
473
+ start_from: int = 0,
474
+ page_size: int = None,
475
+ ) -> list | str:
476
+ """Returns the list of collections matching the search string. Async version.
391
477
  The search string is located in the request body and is interpreted as a plain string.
392
478
  The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
393
479
 
@@ -425,14 +511,22 @@ class CollectionManager(Client):
425
511
  """
426
512
  loop = asyncio.get_event_loop()
427
513
  resp = loop.run_until_complete(
428
- self._async_get_collections_by_name(name, effective_time, server_name, start_from, page_size))
514
+ self._async_get_collections_by_name(
515
+ name, effective_time, server_name, start_from, page_size
516
+ )
517
+ )
429
518
 
430
519
  return resp
431
520
 
432
- async def _async_get_collections_by_type(self, collection_type: str, effective_time: str = None,
433
- server_name: str = None, start_from: int = 0,
434
- page_size: int = None) -> list | str:
435
- """ Returns the list of collections with a particular collectionType. This is an optional text field in the
521
+ async def _async_get_collections_by_type(
522
+ self,
523
+ collection_type: str,
524
+ effective_time: str = None,
525
+ server_name: str = None,
526
+ start_from: int = 0,
527
+ page_size: int = None,
528
+ ) -> list | str:
529
+ """Returns the list of collections with a particular collectionType. This is an optional text field in the
436
530
  collection element.
437
531
 
438
532
  Parameters
@@ -474,18 +568,29 @@ class CollectionManager(Client):
474
568
 
475
569
  validate_search_string(collection_type)
476
570
 
477
- body = {"filter": collection_type, effective_time: effective_time, }
571
+ body = {
572
+ "filter": collection_type,
573
+ effective_time: effective_time,
574
+ }
478
575
  body_s = body_slimmer(body)
479
576
 
480
- url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/"
481
- f"by-collection-type?startFrom={start_from}&pageSize={page_size}")
577
+ url = (
578
+ f"{self.platform_url}/servers/{server_name}{self.command_base}/"
579
+ f"by-collection-type?startFrom={start_from}&pageSize={page_size}"
580
+ )
482
581
 
483
582
  resp = await self._async_make_request("POST", url, body_s)
484
583
  return resp.json().get("elements", "No elements found")
485
584
 
486
- def get_collections_by_type(self, collection_type: str, effective_time: str = None, server_name: str = None,
487
- start_from: int = 0, page_size: int = None) -> list | str:
488
- """ Returns the list of collections matching the search string. Async version.
585
+ def get_collections_by_type(
586
+ self,
587
+ collection_type: str,
588
+ effective_time: str = None,
589
+ server_name: str = None,
590
+ start_from: int = 0,
591
+ page_size: int = None,
592
+ ) -> list | str:
593
+ """Returns the list of collections matching the search string. Async version.
489
594
  The search string is located in the request body and is interpreted as a plain string.
490
595
  The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
491
596
 
@@ -523,13 +628,17 @@ class CollectionManager(Client):
523
628
  """
524
629
  loop = asyncio.get_event_loop()
525
630
  resp = loop.run_until_complete(
526
- self._async_get_collections_by_type(collection_type, effective_time, server_name, start_from, page_size))
631
+ self._async_get_collections_by_type(
632
+ collection_type, effective_time, server_name, start_from, page_size
633
+ )
634
+ )
527
635
 
528
636
  return resp
529
637
 
530
- async def _async_get_collection(self, collection_guid: str, effective_time: str = None,
531
- server_name: str = None) -> dict | str:
532
- """ Return the properties of a specific collection. Async version.
638
+ async def _async_get_collection(
639
+ self, collection_guid: str, effective_time: str = None, server_name: str = None
640
+ ) -> dict | str:
641
+ """Return the properties of a specific collection. Async version.
533
642
 
534
643
  Parameters
535
644
  ----------
@@ -564,12 +673,16 @@ class CollectionManager(Client):
564
673
  validate_guid(collection_guid)
565
674
 
566
675
  url = f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}"
567
- body = {"effective_time": effective_time, }
676
+ body = {
677
+ "effective_time": effective_time,
678
+ }
568
679
  resp = await self._async_make_request("GET", url, body)
569
680
  return resp.json()
570
681
 
571
- def get_collection(self, collection_guid: str, effective_time: str = None, server_name: str = None) -> dict | str:
572
- """ Return the properties of a specific collection.
682
+ def get_collection(
683
+ self, collection_guid: str, effective_time: str = None, server_name: str = None
684
+ ) -> dict | str:
685
+ """Return the properties of a specific collection.
573
686
 
574
687
  Parameters
575
688
  ----------
@@ -599,420 +712,212 @@ class CollectionManager(Client):
599
712
 
600
713
  """
601
714
  loop = asyncio.get_event_loop()
602
- resp = loop.run_until_complete(self._async_get_collection(collection_guid, effective_time, server_name))
715
+ resp = loop.run_until_complete(
716
+ self._async_get_collection(collection_guid, effective_time, server_name)
717
+ )
603
718
 
604
719
  return resp
605
720
 
606
721
  #
607
722
  # Create collection methods
608
723
  #
609
- async def _async_create_collection_w_body(self, classification_name: str, body: dict,
610
- server_name: str = None) -> str:
611
- """ Create Collections: https://egeria-project.org/concepts/collection Async version.
612
-
613
- Parameters
614
- ----------
615
- classification_name: str
616
- Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
617
- body: dict
618
- A dict representing the details of the collection to create.
619
- server_name: str, optional, defaults to None
620
- The name of the server to configure. If not provided, the server name associated with the
621
- instance is used.
622
-
623
- Returns
624
- -------
625
- str - the guid of the created collection
626
-
627
- A JSON dict representing the specified collection. Returns a string if none found.
628
-
629
- Raises
630
- ------
631
- InvalidParameterException
632
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
633
- PropertyServerException
634
- Raised by the server when an issue arises in processing a valid request
635
- NotAuthorizedException
636
- The principle specified by the user_id does not have authorization for the requested action
724
+ async def _async_create_collection_w_body(
725
+ self, classification_name: str, body: dict, server_name: str = None
726
+ ) -> str:
727
+ """Create Collections: https://egeria-project.org/concepts/collection Async version.
637
728
 
638
- """
639
- if server_name is None:
640
- server_name = self.server_name
729
+ Parameters
730
+ ----------
731
+ classification_name: str
732
+ Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
733
+ body: dict
734
+ A dict representing the details of the collection to create.
735
+ server_name: str, optional, defaults to None
736
+ The name of the server to configure. If not provided, the server name associated with the
737
+ instance is used.
641
738
 
642
- url = (f"{self.platform_url}/servers/{server_name}{self.command_base}?"
643
- f"classificationName={classification_name}")
739
+ Returns
740
+ -------
741
+ str - the guid of the created collection
644
742
 
645
- resp = await self._async_make_request("POST", url, body)
646
- return resp.json().get("guid", "No GUID returned")
743
+ A JSON dict representing the specified collection. Returns a string if none found.
647
744
 
648
- def create_collection_w_body(self, classification_name: str, body: dict, server_name: str = None) -> str:
649
- """ Create Collections: https://egeria-project.org/concepts/collection
650
-
651
- Parameters
652
- ----------
653
- classification_name: str
654
- Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
655
- body: dict
656
- A dict representing the details of the collection to create.
657
- server_name: str, optional, defaults to None
658
- The name of the server to configure. If not provided, the server name associated with the instance is
659
- used.
660
-
661
- Returns
662
- -------
663
- str - the guid of the created collection
664
-
665
- A JSON dict representing the specified collection. Returns a string if none found.
666
-
667
- Raises
668
- ------
669
- InvalidParameterException
670
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
671
- PropertyServerException
672
- Raised by the server when an issue arises in processing a valid request
673
- NotAuthorizedException
674
- The principle specified by the user_id does not have authorization for the requested action
745
+ Raises
746
+ ------
747
+ InvalidParameterException
748
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
749
+ PropertyServerException
750
+ Raised by the server when an issue arises in processing a valid request
751
+ NotAuthorizedException
752
+ The principle specified by the user_id does not have authorization for the requested action
675
753
 
676
754
  """
677
- loop = asyncio.get_event_loop()
678
- resp = loop.run_until_complete(self._async_create_collection_w_body(classification_name, body, server_name))
679
- return resp
680
-
681
- async def _async_create_collection(self, classification_name: str, anchor_guid: str, parent_guid: str,
682
- parent_relationship_type_name: str, parent_at_end1: bool, display_name: str,
683
- description: str, collection_type: str, is_own_anchor: bool = False,
684
- collection_ordering: str = None, order_property_name: str = None,
685
- server_name: str = None) -> str:
686
- """ Create Collections: https://egeria-project.org/concepts/collection Async version.
687
-
688
- Parameters
689
- ----------
690
- classification_name: str
691
- Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
692
- anchor_guid: str
693
- The unique identifier of the element that should be the anchor for the new element. Set to null if no
694
- anchor, or if this collection is to be its own anchor.
695
- parent_guid: str
696
- The optional unique identifier for an element that should be connected to the newly created element.
697
- If this property is specified, parentRelationshipTypeName must also be specified
698
- parent_relationship_type_name: str
699
- The name of the relationship, if any, that should be established between the new element and the parent
700
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
701
- parent_at_end1: bool
702
- Identifies which end any parent entity sits on the relationship.
703
- display_name: str
704
- The display name of the element. Will also be used as the basis of the qualified_name.
705
- description: str
706
- A description of the collection.
707
- collection_type: str
708
- Add appropriate valid value for the collection type.
709
- is_own_anchor: bool, optional, defaults to False
710
- Indicates if the collection should classified as its own anchor or not.
711
- collection_ordering: str, optional, defaults to "OTHER"
712
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED",
713
- "OTHER"
714
- order_property_name: str, optional, defaults to "Something"
715
- Property to use for sequencing if collection_ordering is "OTHER"
716
- server_name: str, optional, defaults to None
717
- The name of the server to configure. If not provided, the server name associated with the instance is
718
- used.
719
-
720
- Returns
721
- -------
722
- str - the guid of the created collection
723
-
724
- A JSON dict representing the specified collection. Returns a string if none found.
725
-
726
- Raises
727
- ------
728
- InvalidParameterException
729
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
730
- PropertyServerException
731
- Raised by the server when an issue arises in processing a valid request
732
- NotAuthorizedException
733
- The principle specified by the user_id does not have authorization for the requested action
734
-
735
- """
736
755
  if server_name is None:
737
756
  server_name = self.server_name
738
757
 
739
- if parent_guid is None:
740
- is_own_anchor = False
741
- is_own_anchor_s = str(is_own_anchor).lower()
742
-
743
- url = (f"{self.platform_url}/servers/{server_name}{self.command_base}?"
744
- f"classificationName={classification_name}")
745
-
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}}
758
+ url = (
759
+ f"{self.platform_url}/servers/{server_name}{self.command_base}?"
760
+ f"classificationName={classification_name}"
761
+ )
754
762
 
755
763
  resp = await self._async_make_request("POST", url, body)
756
764
  return resp.json().get("guid", "No GUID returned")
757
765
 
758
- def create_collection(self, classification_name: str, anchor_guid: str, parent_guid: 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:
762
- """ Create Collections: https://egeria-project.org/concepts/collection
763
-
764
- Parameters
765
- ----------
766
- classification_name: str
767
- Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
768
- anchor_guid: str
769
- The unique identifier of the element that should be the anchor for the new element.
770
- Set to null if no anchor, or if this collection is to be its own anchor.
771
- parent_guid: str
772
- The optional unique identifier for an element that should be connected to the newly created element.
773
- If this property is specified, parentRelationshipTypeName must also be specified
774
- parent_relationship_type_name: str
775
- The name of the relationship, if any, that should be established between the new element and the parent
776
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
777
- parent_at_end1: bool
778
- Identifies which end any parent entity sits on the relationship.
779
- display_name: str
780
- The display name of the element. Will also be used as the basis of the qualified_name.
781
- description: str
782
- A description of the collection.
783
- collection_type: str
784
- Add appropriate valid value for the collection type.
785
- is_own_anchor: bool, optional, defaults to False
786
- Indicates if the collection should classified as its own anchor or not.
787
- collection_ordering: str, optional, defaults to "OTHER"
788
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
789
- "DATE_CREATED", "OTHER"
790
- order_property_name: str, optional, defaults to "Something"
791
- Property to use for sequencing if collection_ordering is "OTHER"
792
- server_name: str, optional, defaults to None
793
- The name of the server to configure. If not provided, the server name associated with the
794
- instance is used.
795
-
796
- Returns
797
- -------
798
- str - the guid of the created collection
799
-
800
- A JSON dict representing the specified collection. Returns a string if none found.
801
-
802
- Raises
803
- ------
804
- InvalidParameterException
805
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
806
- PropertyServerException
807
- Raised by the server when an issue arises in processing a valid request
808
- NotAuthorizedException
809
- The principle specified by the user_id does not have authorization for the requested action
810
-
811
- """
812
- loop = asyncio.get_event_loop()
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))
817
- return resp
766
+ def create_collection_w_body(
767
+ self, classification_name: str, body: dict, server_name: str = None
768
+ ) -> str:
769
+ """Create Collections: https://egeria-project.org/concepts/collection
818
770
 
819
- async def _async_create_root_collection(self, anchor_guid: str, parent_guid: str,
820
- parent_relationship_type_name: str, parent_at_end1: bool, display_name: str,
821
- description: str, collection_type: str, is_own_anchor: bool = False,
822
- server_name: str = None) -> str:
823
- """ Create a new collection with the RootCollection classification. Used to identify the top of a
824
- collection hierarchy. Async version.
825
-
826
- Parameters
827
- ----------
828
- anchor_guid: str
829
- The unique identifier of the element that should be the anchor for the new element.
830
- Set to null if no anchor, or if this collection is to be its own anchor.
831
- parent_guid: str
832
- The optional unique identifier for an element that should be connected to the newly created element.
833
- If this property is specified, parentRelationshipTypeName must also be specified
834
- parent_relationship_type_name: str
835
- The name of the relationship, if any, that should be established between the new element and the parent
836
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
837
- parent_at_end1: bool
838
- Identifies which end any parent entity sits on the relationship.
839
- display_name: str
840
- The display name of the element. Will also be used as the basis of the qualified_name.
841
- description: str
842
- A description of the collection.
843
- collection_type: str
844
- Add appropriate valid value for the collection type.
845
- is_own_anchor: bool, optional, defaults to False
846
- Indicates if the collection should classified as its own anchor or not.
847
- server_name: str, optional, defaults to None
848
- The name of the server to configure. If none, the server name associated with the instance is used.
849
-
850
- Returns
851
- -------
852
- str - the guid of the created collection
853
-
854
- A JSON dict representing the specified collection. Returns a string if none found.
855
-
856
- Raises
857
- ------
858
- InvalidParameterException
859
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
860
- PropertyServerException
861
- Raised by the server when an issue arises in processing a valid request
862
- NotAuthorizedException
863
- The principle specified by the user_id does not have authorization for the requested action
864
-
865
- """
866
- if server_name is None:
867
- server_name = self.server_name
868
- is_own_anchor_s = str(is_own_anchor).lower()
869
- url = f"{self.platform_url}/servers/{server_name}{self.command_base}/root-collection"
771
+ Parameters
772
+ ----------
773
+ classification_name: str
774
+ Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
775
+ body: dict
776
+ A dict representing the details of the collection to create.
777
+ server_name: str, optional, defaults to None
778
+ The name of the server to configure. If not provided, the server name associated with the instance is
779
+ used.
870
780
 
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,
781
+ Returns
782
+ -------
783
+ str - the guid of the created collection
877
784
 
878
- }}
785
+ A JSON dict representing the specified collection. Returns a string if none found.
879
786
 
880
- resp = await self._async_make_request("POST", url, body)
881
- return resp.json().get("guid", "No GUID Returned")
787
+ Raises
788
+ ------
789
+ InvalidParameterException
790
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
791
+ PropertyServerException
792
+ Raised by the server when an issue arises in processing a valid request
793
+ NotAuthorizedException
794
+ The principle specified by the user_id does not have authorization for the requested action
882
795
 
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:
886
- """ Create a new collection with the RootCollection classification. Used to identify the top of a
887
- collection hierarchy.
888
-
889
- Parameters
890
- ----------
891
- anchor_guid: str
892
- The unique identifier of the element that should be the anchor for the new element.
893
- Set to null if no anchor,
894
- or if this collection is to be its own anchor.
895
- parent_guid: str
896
- The optional unique identifier for an element that should be connected to the newly created element.
897
- If this property is specified, parentRelationshipTypeName must also be specified
898
- parent_relationship_type_name: str
899
- The name of the relationship, if any, that should be established between the new element and the parent
900
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
901
- parent_at_end1: bool
902
- Identifies which end any parent entity sits on the relationship.
903
- display_name: str
904
- The display name of the element. Will also be used as the basis of the qualified_name.
905
- description: str
906
- A description of the collection.
907
- collection_type: str
908
- Add appropriate valid value for the collection type.
909
- is_own_anchor: bool, optional, defaults to False
910
- Indicates if the collection should classified as its own anchor or not.
911
- server_name: str, optional, defaults to None
912
- The name of the server to configure. If None, the server name associated with the instance is used.
913
-
914
- Returns
915
- -------
916
- str - the guid of the created collection
917
-
918
- A JSON dict representing the specified collection. Returns a string if none found.
919
-
920
- Raises
921
- ------
922
- InvalidParameterException
923
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
924
- PropertyServerException
925
- Raised by the server when an issue arises in processing a valid request
926
- NotAuthorizedException
927
- The principle specified by the user_id does not have authorization for the requested action
928
-
929
- """
796
+ """
930
797
  loop = asyncio.get_event_loop()
931
798
  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))
799
+ self._async_create_collection_w_body(classification_name, body, server_name)
800
+ )
934
801
  return resp
935
802
 
936
- async def _async_create_data_spec_collection(self, anchor_guid: str, parent_guid: str,
937
- parent_relationship_type_name: str, parent_at_end1: bool,
938
- display_name: str, description: str, collection_type: str,
939
- is_own_anchor: bool = True, collection_ordering: str = "OTHER",
940
- order_property_name: str = "Something",
941
- server_name: str = None) -> str:
942
- """ Create a new collection with the DataSpec classification. Used to identify a collection of data fields
943
- and schema types. Async version.
944
-
945
- Parameters
946
- ----------
947
- anchor_guid: str
948
- The unique identifier of the element that should be the anchor for the new element.
949
- Set to null if no anchor, or if this collection is to be its own anchor.
950
- parent_guid: str
951
- The optional unique identifier for an element that should be connected to the newly created element.
952
- If this property is specified, parentRelationshipTypeName must also be specified
953
- parent_relationship_type_name: str
954
- The name of the relationship, if any, that should be established between the new element and the parent
955
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
956
- parent_at_end1: bool
957
- Identifies which end any parent entity sits on the relationship.
958
- display_name: str
959
- The display name of the element. Will also be used as the basis of the qualified_name.
960
- description: str
961
- A description of the collection.
962
- collection_type: str
963
- Add appropriate valid value for the collection type.
964
- is_own_anchor: bool, optional, defaults to False
965
- Indicates if the collection should classified as its own anchor or not.
966
- collection_ordering: str, optional, defaults to "OTHER"
967
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
968
- "DATE_CREATED", "OTHER"
969
- order_property_name: str, optional, defaults to "Something"
970
- Property to use for sequencing if collection_ordering is "OTHER"
971
- server_name: str, optional, defaults to None
972
- The name of the server to configure. If None, the server name associated with the instance is used.
973
-
974
- Returns
975
- -------
976
- str - the guid of the created collection
977
-
978
- A JSON dict representing the specified collection. Returns a string if none found.
979
-
980
- Raises
981
- ------
982
- InvalidParameterException
983
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
984
- PropertyServerException
985
- Raised by the server when an issue arises in processing a valid request
986
- NotAuthorizedException
987
- The principle specified by the user_id does not have authorization for the requested action
988
- """
803
+ async def _async_create_collection(
804
+ self,
805
+ classification_name: str,
806
+ anchor_guid: str,
807
+ parent_guid: str,
808
+ parent_relationship_type_name: str,
809
+ parent_at_end1: bool,
810
+ display_name: str,
811
+ description: str,
812
+ collection_type: str,
813
+ is_own_anchor: bool = False,
814
+ collection_ordering: str = None,
815
+ order_property_name: str = None,
816
+ server_name: str = None,
817
+ ) -> str:
818
+ """Create Collections: https://egeria-project.org/concepts/collection Async version.
819
+
820
+ Parameters
821
+ ----------
822
+ classification_name: str
823
+ Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
824
+ anchor_guid: str
825
+ The unique identifier of the element that should be the anchor for the new element. Set to null if no
826
+ anchor, or if this collection is to be its own anchor.
827
+ parent_guid: str
828
+ The optional unique identifier for an element that should be connected to the newly created element.
829
+ If this property is specified, parentRelationshipTypeName must also be specified
830
+ parent_relationship_type_name: str
831
+ The name of the relationship, if any, that should be established between the new element and the parent
832
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
833
+ parent_at_end1: bool
834
+ Identifies which end any parent entity sits on the relationship.
835
+ display_name: str
836
+ The display name of the element. Will also be used as the basis of the qualified_name.
837
+ description: str
838
+ A description of the collection.
839
+ collection_type: str
840
+ Add appropriate valid value for the collection type.
841
+ is_own_anchor: bool, optional, defaults to False
842
+ Indicates if the collection should classified as its own anchor or not.
843
+ collection_ordering: str, optional, defaults to "OTHER"
844
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED",
845
+ "OTHER"
846
+ order_property_name: str, optional, defaults to "Something"
847
+ Property to use for sequencing if collection_ordering is "OTHER"
848
+ server_name: str, optional, defaults to None
849
+ The name of the server to configure. If not provided, the server name associated with the instance is
850
+ used.
989
851
 
852
+ Returns
853
+ -------
854
+ str - the guid of the created collection
855
+
856
+ A JSON dict representing the specified collection. Returns a string if none found.
857
+
858
+ Raises
859
+ ------
860
+ InvalidParameterException
861
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
862
+ PropertyServerException
863
+ Raised by the server when an issue arises in processing a valid request
864
+ NotAuthorizedException
865
+ The principle specified by the user_id does not have authorization for the requested action
866
+
867
+ """
990
868
  if server_name is None:
991
869
  server_name = self.server_name
870
+
871
+ if parent_guid is None:
872
+ is_own_anchor = False
992
873
  is_own_anchor_s = str(is_own_anchor).lower()
993
- url = f"{self.platform_url}/servers/{server_name}{self.command_base}/data-spec-collection"
994
874
 
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}}
875
+ url = (
876
+ f"{self.platform_url}/servers/{server_name}{self.command_base}?"
877
+ f"classificationName={classification_name}"
878
+ )
879
+
880
+ body = {
881
+ "anchorGUID": anchor_guid,
882
+ "isOwnAnchor": is_own_anchor_s,
883
+ "parentGUID": parent_guid,
884
+ "parentRelationshipTypeName": parent_relationship_type_name,
885
+ "parentAtEnd1": parent_at_end1,
886
+ "collectionProperties": {
887
+ "class": "CollectionProperties",
888
+ "qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
889
+ "name": display_name,
890
+ "description": description,
891
+ "collectionType": collection_type,
892
+ "collectionOrdering": collection_ordering,
893
+ "orderPropertyName": order_property_name,
894
+ },
895
+ }
1003
896
 
1004
897
  resp = await self._async_make_request("POST", url, body)
1005
- return resp.json().get("guid", "No GUID Returned")
898
+ return resp.json().get("guid", "No GUID returned")
1006
899
 
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",
1010
- order_property_name: str = "Something", server_name: str = None) -> str:
1011
- """ Create a new collection with the DataSpec classification. Used to identify a collection of data fields
1012
- and schema types.
900
+ def create_collection(
901
+ self,
902
+ classification_name: str,
903
+ anchor_guid: str,
904
+ parent_guid: str,
905
+ parent_relationship_type_name: str,
906
+ parent_at_end1: bool,
907
+ display_name: str,
908
+ description: str,
909
+ collection_type: str,
910
+ is_own_anchor: bool = False,
911
+ collection_ordering: str = "OTHER",
912
+ order_property_name: str = "Something",
913
+ server_name: str = None,
914
+ ) -> str:
915
+ """Create Collections: https://egeria-project.org/concepts/collection
1013
916
 
1014
917
  Parameters
1015
918
  ----------
919
+ classification_name: str
920
+ Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
1016
921
  anchor_guid: str
1017
922
  The unique identifier of the element that should be the anchor for the new element.
1018
923
  Set to null if no anchor, or if this collection is to be its own anchor.
@@ -1033,11 +938,13 @@ class CollectionManager(Client):
1033
938
  is_own_anchor: bool, optional, defaults to False
1034
939
  Indicates if the collection should classified as its own anchor or not.
1035
940
  collection_ordering: str, optional, defaults to "OTHER"
1036
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED", "OTHER"
941
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
942
+ "DATE_CREATED", "OTHER"
1037
943
  order_property_name: str, optional, defaults to "Something"
1038
944
  Property to use for sequencing if collection_ordering is "OTHER"
1039
945
  server_name: str, optional, defaults to None
1040
- The name of the server to configure. If not provided, the server name associated with the instance is used.
946
+ The name of the server to configure. If not provided, the server name associated with the
947
+ instance is used.
1041
948
 
1042
949
  Returns
1043
950
  -------
@@ -1057,658 +964,1088 @@ class CollectionManager(Client):
1057
964
  """
1058
965
  loop = asyncio.get_event_loop()
1059
966
  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))
967
+ self._async_create_collection(
968
+ classification_name,
969
+ anchor_guid,
970
+ parent_guid,
971
+ parent_relationship_type_name,
972
+ parent_at_end1,
973
+ display_name,
974
+ description,
975
+ collection_type,
976
+ is_own_anchor,
977
+ collection_ordering,
978
+ order_property_name,
979
+ server_name,
980
+ )
981
+ )
1064
982
  return resp
1065
983
 
1066
- async def _async_create_folder_collection(self, anchor_guid: str, parent_guid: str,
1067
- parent_relationship_type_name: str, parent_at_end1: bool,
1068
- display_name: str, description: str, collection_type: str,
1069
- is_own_anchor: bool = True, collection_ordering: str = "OTHER",
1070
- order_property_name: str = "Something", server_name: str = None) -> str:
1071
- """ Create a new collection with the Folder classification. This is used to identify the organizing
1072
- collections in a collection hierarchy. Async version.
1073
-
1074
- Parameters
1075
- ----------
1076
- anchor_guid: str
1077
- The unique identifier of the element that should be the anchor for the new element.
1078
- Set to null if no anchor, or if this collection is to be its own anchor.
1079
- parent_guid: str
1080
- The optional unique identifier for an element that should be connected to the newly created element.
1081
- If this property is specified, parentRelationshipTypeName must also be specified
1082
- parent_relationship_type_name: str
1083
- The name of the relationship, if any, that should be established between the new element and the parent
1084
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
1085
- parent_at_end1: bool
1086
- Identifies which end any parent entity sits on the relationship.
1087
- display_name: str
1088
- The display name of the element. Will also be used as the basis of the qualified_name.
1089
- description: str
1090
- A description of the collection.
1091
- collection_type: str
1092
- Add appropriate valid value for the collection type.
1093
- is_own_anchor: bool, optional, defaults to False
1094
- Indicates if the collection should classified as its own anchor or not.
1095
- collection_ordering: str, optional, defaults to "OTHER"
1096
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1097
- "DATE_CREATED", "OTHER"
1098
- order_property_name: str, optional, defaults to "Something"
1099
- Property to use for sequencing if collection_ordering is "OTHER"
1100
- server_name: str, optional, defaults to None
1101
- The name of the server to configure. If None, the server name associated with the instance is used.
1102
-
1103
- Returns
1104
- -------
1105
- str - the guid of the created collection
1106
-
1107
- A JSON dict representing the specified collection. Returns a string if none found.
1108
-
1109
- Raises
1110
- ------
1111
- InvalidParameterException
1112
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1113
- PropertyServerException
1114
- Raised by the server when an issue arises in processing a valid request
1115
- NotAuthorizedException
1116
- The principle specified by the user_id does not have authorization for the requested action
1117
-
1118
- """
1119
- if server_name is None:
1120
- server_name = self.server_name
1121
- is_own_anchor_s = str(is_own_anchor).lower()
1122
-
1123
- url = f"{self.platform_url}/servers/{server_name}{self.command_base}/folder"
984
+ async def _async_create_root_collection(
985
+ self,
986
+ anchor_guid: str,
987
+ parent_guid: str,
988
+ parent_relationship_type_name: str,
989
+ parent_at_end1: bool,
990
+ display_name: str,
991
+ description: str,
992
+ collection_type: str,
993
+ is_own_anchor: bool = False,
994
+ server_name: str = None,
995
+ ) -> str:
996
+ """Create a new collection with the RootCollection classification. Used to identify the top of a
997
+ collection hierarchy. Async version.
1124
998
 
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}}
999
+ Parameters
1000
+ ----------
1001
+ anchor_guid: str
1002
+ The unique identifier of the element that should be the anchor for the new element.
1003
+ Set to null if no anchor, or if this collection is to be its own anchor.
1004
+ parent_guid: str
1005
+ The optional unique identifier for an element that should be connected to the newly created element.
1006
+ If this property is specified, parentRelationshipTypeName must also be specified
1007
+ parent_relationship_type_name: str
1008
+ The name of the relationship, if any, that should be established between the new element and the parent
1009
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
1010
+ parent_at_end1: bool
1011
+ Identifies which end any parent entity sits on the relationship.
1012
+ display_name: str
1013
+ The display name of the element. Will also be used as the basis of the qualified_name.
1014
+ description: str
1015
+ A description of the collection.
1016
+ collection_type: str
1017
+ Add appropriate valid value for the collection type.
1018
+ is_own_anchor: bool, optional, defaults to False
1019
+ Indicates if the collection should classified as its own anchor or not.
1020
+ server_name: str, optional, defaults to None
1021
+ The name of the server to configure. If none, the server name associated with the instance is used.
1133
1022
 
1134
- resp = await self._async_make_request("POST", url, body)
1135
- return resp.json().get("guid", "No GUID returned")
1023
+ Returns
1024
+ -------
1025
+ str - the guid of the created collection
1136
1026
 
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",
1140
- order_property_name: str = "Something", server_name: str = None) -> str:
1141
- """ Create a new collection with the Folder classification. This is used to identify the organizing
1142
- collections in a collection hierarchy.
1143
-
1144
- Parameters
1145
- ----------
1146
- anchor_guid: str
1147
- The unique identifier of the element that should be the anchor for the new element.
1148
- Set to null if no anchor, or if this collection is to be its own anchor.
1149
- parent_guid: str
1150
- The optional unique identifier for an element that should be connected to the newly created element.
1151
- If this property is specified, parentRelationshipTypeName must also be specified
1152
- parent_relationship_type_name: str
1153
- The name of the relationship, if any, that should be established between the new element and the parent
1154
- element. Examples could be "ResourceList" or "DigitalServiceProduct".
1155
- parent_at_end1: bool
1156
- Identifies which end any parent entity sits on the relationship.
1157
- display_name: str
1158
- The display name of the element. Will also be used as the basis of the qualified_name.
1159
- description: str
1160
- A description of the collection.
1161
- collection_type: str
1162
- Add appropriate valid value for the collection type.
1163
- is_own_anchor: bool, optional, defaults to False
1164
- Indicates if the collection should classified as its own anchor or not.
1165
- collection_ordering: str, optional, defaults to "OTHER"
1166
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED",
1167
- "OTHER"
1168
- order_property_name: str, optional, defaults to "Something"
1169
- Property to use for sequencing if collection_ordering is "OTHER"
1170
- server_name: str, optional, defaults to None
1171
- The name of the server to configure. If None, the server name associated with the instance is used.
1172
-
1173
- Returns
1174
- -------
1175
- str - the guid of the created collection
1176
-
1177
- A JSON dict representing the specified collection. Returns a string if none found.
1178
-
1179
- Raises
1180
- ------
1181
- InvalidParameterException
1182
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1183
- PropertyServerException
1184
- Raised by the server when an issue arises in processing a valid request
1185
- NotAuthorizedException
1186
- The principle specified by the user_id does not have authorization for the requested action
1187
-
1188
- """
1189
- loop = asyncio.get_event_loop()
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))
1194
- return resp
1027
+ A JSON dict representing the specified collection. Returns a string if none found.
1195
1028
 
1196
- async def _async_create_collection_from_template(self, body: dict, server_name: str = None) -> str:
1197
- """ Create a new metadata element to represent a collection using an existing metadata element as a template.
1198
- The template defines additional classifications and relationships that are added to the new collection.
1199
- Async version.
1200
-
1201
- Parameters
1202
- ----------
1203
-
1204
- body: dict
1205
- A dict representing the details of the collection to create.
1206
- server_name: str, optional, defaults to None
1207
- The name of the server to configure. If None, the server name associated with the instance is used.
1208
-
1209
- Returns
1210
- -------
1211
- str - the guid of the created collection
1212
-
1213
- Raises
1214
- ------
1215
- InvalidParameterException
1216
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1217
- PropertyServerException
1218
- Raised by the server when an issue arises in processing a valid request
1219
- NotAuthorizedException
1220
- The principle specified by the user_id does not have authorization for the requested action
1221
-
1222
- Notes
1223
- -----
1224
- JSON Structure looks like:
1225
-
1226
- {
1227
- "class": "TemplateRequestBody",
1228
- "anchorGUID": "anchor GUID, if set then isOwnAnchor=false",
1229
- "isOwnAnchor": false,
1230
- "parentGUID": "parent GUID, if set, set all parameters beginning 'parent'",
1231
- "parentRelationshipTypeName": "open metadata type name",
1232
- "parentAtEnd1": true,
1233
- "templateGUID": "template GUID",
1234
- "replacementProperties": {
1235
- "class": "ElementProperties",
1236
- "propertyValueMap" : {
1237
- "propertyName" : {
1238
- "class": "PrimitiveTypePropertyValue",
1239
- "typeName": "string",
1240
- "primitiveTypeCategory" : "OM_PRIMITIVE_TYPE_STRING",
1241
- "primitiveValue" : "value of property"
1242
- }
1243
- }
1244
- },
1245
- "placeholderPropertyValues" : {
1246
- "placeholderProperty1Name" : "property1Value",
1247
- "placeholderProperty2Name" : "property2Value"
1248
- }
1249
- }
1029
+ Raises
1030
+ ------
1031
+ InvalidParameterException
1032
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1033
+ PropertyServerException
1034
+ Raised by the server when an issue arises in processing a valid request
1035
+ NotAuthorizedException
1036
+ The principle specified by the user_id does not have authorization for the requested action
1250
1037
 
1251
- """
1038
+ """
1252
1039
  if server_name is None:
1253
1040
  server_name = self.server_name
1041
+ is_own_anchor_s = str(is_own_anchor).lower()
1042
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/root-collection"
1254
1043
 
1255
- url = f"{self.platform_url}/servers/{server_name}{self.command_base}/from-template"
1044
+ body = {
1045
+ "anchorGUID": anchor_guid,
1046
+ "isOwnAnchor": is_own_anchor_s,
1047
+ "parentGUID": parent_guid,
1048
+ "parentRelationshipTypeName": parent_relationship_type_name,
1049
+ "parentAtEnd1": parent_at_end1,
1050
+ "collectionProperties": {
1051
+ "class": "CollectionProperties",
1052
+ "qualifiedName": f"root-collection-{display_name}-{time.asctime()}",
1053
+ "name": display_name,
1054
+ "description": description,
1055
+ "collectionType": collection_type,
1056
+ },
1057
+ }
1256
1058
 
1257
1059
  resp = await self._async_make_request("POST", url, body)
1258
1060
  return resp.json().get("guid", "No GUID Returned")
1259
1061
 
1260
- def create_collection_from_template(self, body: dict, server_name: str = None) -> str:
1261
- """ Create a new metadata element to represent a collection using an existing metadata element as a template.
1262
- The template defines additional classifications and relationships that are added to the new collection.
1263
-
1264
- Parameters
1265
- ----------
1266
- body: dict
1267
- A dict representing the details of the collection to create.
1268
- server_name: str, optional, defaults to None
1269
- The name of the server to configure. If None, the server name associated with the instance is used.
1270
-
1271
- Returns
1272
- -------
1273
- str - the guid of the created collection
1274
-
1275
- Raises
1276
- ------
1277
- InvalidParameterException
1278
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1279
- PropertyServerException
1280
- Raised by the server when an issue arises in processing a valid request
1281
- NotAuthorizedException
1282
- The principle specified by the user_id does not have authorization for the requested action
1283
-
1284
- Notes
1285
- -----
1286
- JSON Structure looks like:
1287
-
1288
- {
1289
- "class": "TemplateRequestBody",
1290
- "anchorGUID": "anchor GUID, if set then isOwnAnchor=false",
1291
- "isOwnAnchor": false,
1292
- "parentGUID": "parent GUID, if set, set all parameters beginning 'parent'",
1293
- "parentRelationshipTypeName": "open metadata type name",
1294
- "parentAtEnd1": true,
1295
- "templateGUID": "template GUID",
1296
- "replacementProperties": {
1297
- "class": "ElementProperties",
1298
- "propertyValueMap" : {
1299
- "propertyName" : {
1300
- "class": "PrimitiveTypePropertyValue",
1301
- "typeName": "string",
1302
- "primitiveTypeCategory" : "OM_PRIMITIVE_TYPE_STRING",
1303
- "primitiveValue" : "value of property"
1304
- }
1305
- }
1306
- },
1307
- "placeholderPropertyValues" : {
1308
- "placeholderProperty1Name" : "property1Value",
1309
- "placeholderProperty2Name" : "property2Value"
1310
- }
1311
- }
1312
- """
1313
- loop = asyncio.get_event_loop()
1314
- resp = loop.run_until_complete(self._async_create_collection_from_template(body, server_name))
1315
- return resp
1316
-
1317
- async def _async_create_digital_product(self, body: dict, server_name: str = None) -> str:
1318
- """ Create a new collection that represents a digital product. Async version.
1319
-
1320
- Parameters
1321
- ----------
1322
- body: dict
1323
- A dict representing the details of the collection to create.
1324
- server_name: str, optional, defaults to None
1325
- The name of the server to configure. If not provided, the server name associated
1326
- with the instance is used.
1327
-
1328
- Returns
1329
- -------
1330
- str - the guid of the created collection
1331
-
1332
- Raises
1333
- ------
1334
- InvalidParameterException
1335
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1336
- PropertyServerException
1337
- Raised by the server when an issue arises in processing a valid request
1338
- NotAuthorizedException
1339
- The principle specified by the user_id does not have authorization for the requested action
1340
-
1341
- Notes
1342
- -----
1343
- JSON Structure looks like:
1344
- {
1345
- "class" : "NewDigitalProductRequestBody",
1346
- "anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
1347
- "isOwnAnchor" : false,
1348
- "parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
1349
- "parentRelationshipTypeName" : "open metadata type name",
1350
- "parentAtEnd1": true,
1351
- "collectionProperties": {
1352
- "class" : "CollectionProperties",
1353
- "qualifiedName": "Must provide a unique name here",
1354
- "name" : "Add display name here",
1355
- "description" : "Add description of the collection here",
1356
- "collectionType": "Add appropriate valid value for type",
1357
- "collectionOrdering" : "OTHER",
1358
- "orderPropertyName" : "Add property name if 'collectionOrdering' is OTHER"
1359
- },
1360
- "digitalProductProperties" : {
1361
- "class" : "DigitalProductProperties",
1362
- "productStatus" : "ACTIVE",
1363
- "productName" : "Add name here",
1364
- "productType" : "Add valid value here",
1365
- "description" : "Add description here",
1366
- "introductionDate" : "date",
1367
- "maturity" : "Add valid value here",
1368
- "serviceLife" : "Add the estimated lifetime of the product",
1369
- "currentVersion": "V1.0",
1370
- "nextVersion": "V1.1",
1371
- "withdrawDate": "date",
1372
- "additionalProperties": {
1373
- "property1Name" : "property1Value",
1374
- "property2Name" : "property2Value"
1375
- }
1376
- }
1377
- }
1378
- """
1379
- if server_name is None:
1380
- server_name = self.server_name
1381
-
1382
- url = f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/digital-products"
1062
+ def create_root_collection(
1063
+ self,
1064
+ anchor_guid: str,
1065
+ parent_guid: str,
1066
+ parent_relationship_type_name: str,
1067
+ parent_at_end1: bool,
1068
+ display_name: str,
1069
+ description: str,
1070
+ collection_type: str,
1071
+ is_own_anchor: bool = False,
1072
+ server_name: str = None,
1073
+ ) -> str:
1074
+ """Create a new collection with the RootCollection classification. Used to identify the top of a
1075
+ collection hierarchy.
1383
1076
 
1384
- resp = await self._async_make_request("POST", url, body)
1385
- return resp.json().get("guid", "No GUID returned")
1077
+ Parameters
1078
+ ----------
1079
+ anchor_guid: str
1080
+ The unique identifier of the element that should be the anchor for the new element.
1081
+ Set to null if no anchor,
1082
+ or if this collection is to be its own anchor.
1083
+ parent_guid: str
1084
+ The optional unique identifier for an element that should be connected to the newly created element.
1085
+ If this property is specified, parentRelationshipTypeName must also be specified
1086
+ parent_relationship_type_name: str
1087
+ The name of the relationship, if any, that should be established between the new element and the parent
1088
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
1089
+ parent_at_end1: bool
1090
+ Identifies which end any parent entity sits on the relationship.
1091
+ display_name: str
1092
+ The display name of the element. Will also be used as the basis of the qualified_name.
1093
+ description: str
1094
+ A description of the collection.
1095
+ collection_type: str
1096
+ Add appropriate valid value for the collection type.
1097
+ is_own_anchor: bool, optional, defaults to False
1098
+ Indicates if the collection should classified as its own anchor or not.
1099
+ server_name: str, optional, defaults to None
1100
+ The name of the server to configure. If None, the server name associated with the instance is used.
1386
1101
 
1387
- def create_digital_product(self, body: dict, server_name: str = None) -> str:
1388
- """ Create a new collection that represents a digital product. Async version.
1389
-
1390
- Parameters
1391
- ----------
1392
- body: dict
1393
- A dict representing the details of the collection to create.
1394
- server_name: str, optional, defaults to None
1395
- The name of the server to configure. If not provided, the server name associated
1396
- with the instance is used.
1397
-
1398
- Returns
1399
- -------
1400
- str - the guid of the created collection
1401
-
1402
- Raises
1403
- ------
1404
- InvalidParameterException
1405
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1406
- PropertyServerException
1407
- Raised by the server when an issue arises in processing a valid request
1408
- NotAuthorizedException
1409
- The principle specified by the user_id does not have authorization for the requested action
1410
-
1411
- Notes
1412
- -----
1413
- JSON Structure looks like:
1414
- {
1415
- "class" : "NewDigitalProductRequestBody",
1416
- "anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
1417
- "isOwnAnchor" : false,
1418
- "parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
1419
- "parentRelationshipTypeName" : "open metadata type name",
1420
- "parentAtEnd1": true,
1421
- "collectionProperties": {
1422
- "class" : "CollectionProperties",
1423
- "qualifiedName": "Must provide a unique name here",
1424
- "name" : "Add display name here",
1425
- "description" : "Add description of the collection here",
1426
- "collectionType": "Add appropriate valid value for type",
1427
- "collectionOrdering" : "OTHER",
1428
- "orderPropertyName" : "Add property name if 'collectionOrdering' is OTHER"
1429
- },
1430
- "digitalProductProperties" : {
1431
- "class" : "DigitalProductProperties",
1432
- "productStatus" : "ACTIVE",
1433
- "productName" : "Add name here",
1434
- "productType" : "Add valid value here",
1435
- "description" : "Add description here",
1436
- "introductionDate" : "date",
1437
- "maturity" : "Add valid value here",
1438
- "serviceLife" : "Add the estimated lifetime of the product",
1439
- "currentVersion": "V1.0",
1440
- "nextVersion": "V1.1",
1441
- "withdrawDate": "date",
1442
- "additionalProperties": {
1443
- "property1Name" : "property1Value",
1444
- "property2Name" : "property2Value"
1445
- }
1446
- }
1447
- }
1448
- """
1449
- loop = asyncio.get_event_loop()
1450
- resp = loop.run_until_complete(self._async_create_digital_product(body, server_name))
1451
- return resp
1102
+ Returns
1103
+ -------
1104
+ str - the guid of the created collection
1452
1105
 
1453
- #
1454
- # Manage collections
1455
- #
1456
- async def _async_update_collection(self, collection_guid: str, qualified_name: str = None, display_name: str = None,
1457
- description: str = None, collection_type: str = None,
1458
- collection_ordering: str = None, order_property_name: str = None,
1459
- replace_all_props: bool = False, server_name: str = None) -> None:
1460
- """ Update the properties of a collection. Async version.
1461
-
1462
- Parameters
1463
- ----------
1464
- collection_guid: str
1465
- The guid of the collection to update.
1466
- qualified_name: str, optional, defaults to None
1467
- The qualified name of the collection to update.
1468
- display_name: str, optional, defaults to None
1469
- The display name of the element. Will also be used as the basis of the qualified_name.
1470
- description: str, optional, defaults to None
1471
- A description of the collection.
1472
- collection_type: str, optional, defaults to None
1473
- Add appropriate valid value for the collection type.
1474
- collection_ordering: str, optional, defaults to None
1475
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1476
- "DATE_CREATED", "OTHER"
1477
- order_property_name: str, optional, defaults to None
1478
- Property to use for sequencing if collection_ordering is "OTHER"
1479
- replace_all_props: bool, optional, defaults to False
1480
- Whether to replace all properties in the collection.
1481
- server_name: str, optional, defaults to None
1482
- The name of the server to configure. If not provided, the server name associated
1483
- with the instance is used.
1484
-
1485
- Returns
1486
- -------
1487
- Nothing
1488
-
1489
- Raises
1490
- ------
1491
- InvalidParameterException
1492
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1493
- PropertyServerException
1494
- Raised by the server when an issue arises in processing a valid request
1495
- NotAuthorizedException
1496
- The principle specified by the user_id does not have authorization for the requested action
1497
- """
1498
- if server_name is None:
1499
- server_name = self.server_name
1500
- replace_all_props_s = str(replace_all_props).lower()
1501
- url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/update?"
1502
- f"replaceAllProperties={replace_all_props_s}")
1106
+ A JSON dict representing the specified collection. Returns a string if none found.
1503
1107
 
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}
1508
- body_s = body_slimmer(body)
1509
- await self._async_make_request("POST", url, body_s)
1510
- return
1108
+ Raises
1109
+ ------
1110
+ InvalidParameterException
1111
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1112
+ PropertyServerException
1113
+ Raised by the server when an issue arises in processing a valid request
1114
+ NotAuthorizedException
1115
+ The principle specified by the user_id does not have authorization for the requested action
1511
1116
 
1512
- def update_collection(self, collection_guid, qualified_name: str = None, display_name: str = None,
1513
- description: str = None, collection_type: str = None, collection_ordering: str = None,
1514
- order_property_name: str = None, replace_all_props: bool = False,
1515
- server_name: str = None) -> None:
1516
- """ Update the properties of a collection.
1517
-
1518
- Parameters
1519
- ----------
1520
- collection_guid: str
1521
- The guid of the collection to update.
1522
- qualified_name: str
1523
- The qualified name of the collection to update.
1524
- display_name: str
1525
- The display name of the element. Will also be used as the basis of the qualified_name.
1526
- description: str
1527
- A description of the collection.
1528
- collection_type: str
1529
- Add appropriate valid value for the collection type.
1530
- collection_ordering: str, optional, defaults to "OTHER"
1531
- Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1532
- "DATE_CREATED", "OTHER"
1533
- order_property_name: str, optional, defaults to "Something"
1534
- Property to use for sequencing if collection_ordering is "OTHER"
1535
- replace_all_props: bool, optional, defaults to False
1536
- Whether to replace all properties in the collection.
1537
- server_name: str, optional, defaults to None
1538
- The name of the server to configure. If not provided, the server name associated
1539
- with the instance is used.
1540
-
1541
- Returns
1542
- -------
1543
- Nothing
1544
-
1545
- Raises
1546
- ------
1547
- InvalidParameterException
1548
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1549
- PropertyServerException
1550
- Raised by the server when an issue arises in processing a valid request
1551
- NotAuthorizedException
1552
- The principle specified by the user_id does not have authorization for the requested action
1553
1117
  """
1554
1118
  loop = asyncio.get_event_loop()
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))
1558
- return
1119
+ resp = loop.run_until_complete(
1120
+ self._async_create_root_collection(
1121
+ anchor_guid,
1122
+ parent_guid,
1123
+ parent_relationship_type_name,
1124
+ parent_at_end1,
1125
+ display_name,
1126
+ description,
1127
+ collection_type,
1128
+ is_own_anchor,
1129
+ server_name,
1130
+ )
1131
+ )
1132
+ return resp
1559
1133
 
1560
- async def _async_update_digital_product(self, collection_guid: str, body: dict, replace_all_props: bool = False,
1561
- server_name: str = None):
1562
- """ Update the properties of the DigitalProduct classification attached to a collection. Async version.
1563
-
1564
- Parameters
1565
- ----------
1566
- collection_guid: str
1567
- The guid of the collection to update.
1568
- body: dict
1569
- A dict representing the details of the collection to create.
1570
- replace_all_props: bool, optional, defaults to False
1571
- Whether to replace all properties in the collection.
1572
- server_name: str, optional, defaults to None
1573
- The name of the server to configure. If not provided, the server name associated with the
1574
- instance is used.
1575
-
1576
- Returns
1577
- -------
1578
- Nothing
1579
-
1580
- Raises
1581
- ------
1582
- InvalidParameterException
1583
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1584
- PropertyServerException
1585
- Raised by the server when an issue arises in processing a valid request
1586
- NotAuthorizedException
1587
- The principle specified by the user_id does not have authorization for the requested action
1588
-
1589
- Notes
1590
- -----
1591
- JSON Structure looks like:
1592
- {
1593
- "class" : "DigitalProductProperties",
1594
- "productStatus" : "ACTIVE",
1595
- "productName" : "Add name here",
1596
- "productType" : "Add valid value here",
1597
- "description" : "Add description here",
1598
- "introductionDate" : "date",
1599
- "maturity" : "Add valid value here",
1600
- "serviceLife" : "Add the estimated lifetime of the product",
1601
- "currentVersion": "V1.0",
1602
- "nextVersion": "V1.1",
1603
- "withdrawDate": "date",
1604
- "additionalProperties": {
1605
- "property1Name" : "property1Value",
1606
- "property2Name" : "property2Value"
1607
- }
1608
- }
1609
- """
1610
- if server_name is None:
1611
- server_name = self.server_name
1134
+ async def _async_create_data_spec_collection(
1135
+ self,
1136
+ anchor_guid: str,
1137
+ parent_guid: str,
1138
+ parent_relationship_type_name: str,
1139
+ parent_at_end1: bool,
1140
+ display_name: str,
1141
+ description: str,
1142
+ collection_type: str,
1143
+ is_own_anchor: bool = True,
1144
+ collection_ordering: str = "OTHER",
1145
+ order_property_name: str = "Something",
1146
+ server_name: str = None,
1147
+ ) -> str:
1148
+ """Create a new collection with the DataSpec classification. Used to identify a collection of data fields
1149
+ and schema types. Async version.
1150
+
1151
+ Parameters
1152
+ ----------
1153
+ anchor_guid: str
1154
+ The unique identifier of the element that should be the anchor for the new element.
1155
+ Set to null if no anchor, or if this collection is to be its own anchor.
1156
+ parent_guid: str
1157
+ The optional unique identifier for an element that should be connected to the newly created element.
1158
+ If this property is specified, parentRelationshipTypeName must also be specified
1159
+ parent_relationship_type_name: str
1160
+ The name of the relationship, if any, that should be established between the new element and the parent
1161
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
1162
+ parent_at_end1: bool
1163
+ Identifies which end any parent entity sits on the relationship.
1164
+ display_name: str
1165
+ The display name of the element. Will also be used as the basis of the qualified_name.
1166
+ description: str
1167
+ A description of the collection.
1168
+ collection_type: str
1169
+ Add appropriate valid value for the collection type.
1170
+ is_own_anchor: bool, optional, defaults to False
1171
+ Indicates if the collection should classified as its own anchor or not.
1172
+ collection_ordering: str, optional, defaults to "OTHER"
1173
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1174
+ "DATE_CREATED", "OTHER"
1175
+ order_property_name: str, optional, defaults to "Something"
1176
+ Property to use for sequencing if collection_ordering is "OTHER"
1177
+ server_name: str, optional, defaults to None
1178
+ The name of the server to configure. If None, the server name associated with the instance is used.
1179
+
1180
+ Returns
1181
+ -------
1182
+ str - the guid of the created collection
1183
+
1184
+ A JSON dict representing the specified collection. Returns a string if none found.
1185
+
1186
+ Raises
1187
+ ------
1188
+ InvalidParameterException
1189
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1190
+ PropertyServerException
1191
+ Raised by the server when an issue arises in processing a valid request
1192
+ NotAuthorizedException
1193
+ The principle specified by the user_id does not have authorization for the requested action
1194
+ """
1195
+
1196
+ if server_name is None:
1197
+ server_name = self.server_name
1198
+ is_own_anchor_s = str(is_own_anchor).lower()
1199
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/data-spec-collection"
1200
+
1201
+ body = {
1202
+ "anchorGUID": anchor_guid,
1203
+ "isOwnAnchor": is_own_anchor_s,
1204
+ "parentGUID": parent_guid,
1205
+ "parentRelationshipTypeName": parent_relationship_type_name,
1206
+ "parentAtEnd1": parent_at_end1,
1207
+ "collectionProperties": {
1208
+ "class": "CollectionProperties",
1209
+ "qualifiedName": f"data-spec-collection-{display_name}-{time.asctime()}",
1210
+ "name": display_name,
1211
+ "description": description,
1212
+ "collectionType": collection_type,
1213
+ "collectionOrdering": collection_ordering,
1214
+ "orderPropertyName": order_property_name,
1215
+ },
1216
+ }
1217
+
1218
+ resp = await self._async_make_request("POST", url, body)
1219
+ return resp.json().get("guid", "No GUID Returned")
1220
+
1221
+ def create_data_spec_collection(
1222
+ self,
1223
+ anchor_guid: str,
1224
+ parent_guid: str,
1225
+ parent_relationship_type_name: str,
1226
+ parent_at_end1: bool,
1227
+ display_name: str,
1228
+ description: str,
1229
+ collection_type: str,
1230
+ is_own_anchor: bool,
1231
+ collection_ordering: str = "OTHER",
1232
+ order_property_name: str = "Something",
1233
+ server_name: str = None,
1234
+ ) -> str:
1235
+ """Create a new collection with the DataSpec classification. Used to identify a collection of data fields
1236
+ and schema types.
1237
+
1238
+ Parameters
1239
+ ----------
1240
+ anchor_guid: str
1241
+ The unique identifier of the element that should be the anchor for the new element.
1242
+ Set to null if no anchor, or if this collection is to be its own anchor.
1243
+ parent_guid: str
1244
+ The optional unique identifier for an element that should be connected to the newly created element.
1245
+ If this property is specified, parentRelationshipTypeName must also be specified
1246
+ parent_relationship_type_name: str
1247
+ The name of the relationship, if any, that should be established between the new element and the parent
1248
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
1249
+ parent_at_end1: bool
1250
+ Identifies which end any parent entity sits on the relationship.
1251
+ display_name: str
1252
+ The display name of the element. Will also be used as the basis of the qualified_name.
1253
+ description: str
1254
+ A description of the collection.
1255
+ collection_type: str
1256
+ Add appropriate valid value for the collection type.
1257
+ is_own_anchor: bool, optional, defaults to False
1258
+ Indicates if the collection should classified as its own anchor or not.
1259
+ collection_ordering: str, optional, defaults to "OTHER"
1260
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED", "OTHER"
1261
+ order_property_name: str, optional, defaults to "Something"
1262
+ Property to use for sequencing if collection_ordering is "OTHER"
1263
+ server_name: str, optional, defaults to None
1264
+ The name of the server to configure. If not provided, the server name associated with the instance is used.
1265
+
1266
+ Returns
1267
+ -------
1268
+ str - the guid of the created collection
1269
+
1270
+ A JSON dict representing the specified collection. Returns a string if none found.
1271
+
1272
+ Raises
1273
+ ------
1274
+ InvalidParameterException
1275
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1276
+ PropertyServerException
1277
+ Raised by the server when an issue arises in processing a valid request
1278
+ NotAuthorizedException
1279
+ The principle specified by the user_id does not have authorization for the requested action
1280
+
1281
+ """
1282
+ loop = asyncio.get_event_loop()
1283
+ resp = loop.run_until_complete(
1284
+ self._async_create_data_spec_collection(
1285
+ anchor_guid,
1286
+ parent_guid,
1287
+ parent_relationship_type_name,
1288
+ parent_at_end1,
1289
+ display_name,
1290
+ description,
1291
+ collection_type,
1292
+ is_own_anchor,
1293
+ collection_ordering,
1294
+ order_property_name,
1295
+ server_name,
1296
+ )
1297
+ )
1298
+ return resp
1299
+
1300
+ async def _async_create_folder_collection(
1301
+ self,
1302
+ anchor_guid: str,
1303
+ parent_guid: str,
1304
+ parent_relationship_type_name: str,
1305
+ parent_at_end1: bool,
1306
+ display_name: str,
1307
+ description: str,
1308
+ collection_type: str,
1309
+ is_own_anchor: bool = True,
1310
+ collection_ordering: str = "OTHER",
1311
+ order_property_name: str = "Something",
1312
+ server_name: str = None,
1313
+ ) -> str:
1314
+ """Create a new collection with the Folder classification. This is used to identify the organizing
1315
+ collections in a collection hierarchy. Async version.
1316
+
1317
+ Parameters
1318
+ ----------
1319
+ anchor_guid: str
1320
+ The unique identifier of the element that should be the anchor for the new element.
1321
+ Set to null if no anchor, or if this collection is to be its own anchor.
1322
+ parent_guid: str
1323
+ The optional unique identifier for an element that should be connected to the newly created element.
1324
+ If this property is specified, parentRelationshipTypeName must also be specified
1325
+ parent_relationship_type_name: str
1326
+ The name of the relationship, if any, that should be established between the new element and the parent
1327
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
1328
+ parent_at_end1: bool
1329
+ Identifies which end any parent entity sits on the relationship.
1330
+ display_name: str
1331
+ The display name of the element. Will also be used as the basis of the qualified_name.
1332
+ description: str
1333
+ A description of the collection.
1334
+ collection_type: str
1335
+ Add appropriate valid value for the collection type.
1336
+ is_own_anchor: bool, optional, defaults to False
1337
+ Indicates if the collection should classified as its own anchor or not.
1338
+ collection_ordering: str, optional, defaults to "OTHER"
1339
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1340
+ "DATE_CREATED", "OTHER"
1341
+ order_property_name: str, optional, defaults to "Something"
1342
+ Property to use for sequencing if collection_ordering is "OTHER"
1343
+ server_name: str, optional, defaults to None
1344
+ The name of the server to configure. If None, the server name associated with the instance is used.
1345
+
1346
+ Returns
1347
+ -------
1348
+ str - the guid of the created collection
1349
+
1350
+ A JSON dict representing the specified collection. Returns a string if none found.
1351
+
1352
+ Raises
1353
+ ------
1354
+ InvalidParameterException
1355
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1356
+ PropertyServerException
1357
+ Raised by the server when an issue arises in processing a valid request
1358
+ NotAuthorizedException
1359
+ The principle specified by the user_id does not have authorization for the requested action
1360
+
1361
+ """
1362
+ if server_name is None:
1363
+ server_name = self.server_name
1364
+ is_own_anchor_s = str(is_own_anchor).lower()
1365
+
1366
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/folder"
1367
+
1368
+ body = {
1369
+ "anchorGUID": anchor_guid,
1370
+ "isOwnAnchor": is_own_anchor_s,
1371
+ "parentGUID": parent_guid,
1372
+ "parentRelationshipTypeName": parent_relationship_type_name,
1373
+ "parentAtEnd1": parent_at_end1,
1374
+ "collectionProperties": {
1375
+ "class": "CollectionProperties",
1376
+ "qualifiedName": f"folder-collection-{display_name}-{time.asctime()}",
1377
+ "name": display_name,
1378
+ "description": description,
1379
+ "collectionType": collection_type,
1380
+ "collectionOrdering": collection_ordering,
1381
+ "orderPropertyName": order_property_name,
1382
+ },
1383
+ }
1384
+
1385
+ resp = await self._async_make_request("POST", url, body)
1386
+ return resp.json().get("guid", "No GUID returned")
1387
+
1388
+ def create_folder_collection(
1389
+ self,
1390
+ anchor_guid: str,
1391
+ parent_guid: str,
1392
+ parent_relationship_type_name: str,
1393
+ parent_at_end1: bool,
1394
+ display_name: str,
1395
+ description: str,
1396
+ collection_type: str,
1397
+ is_own_anchor: bool,
1398
+ collection_ordering: str = "OTHER",
1399
+ order_property_name: str = "Something",
1400
+ server_name: str = None,
1401
+ ) -> str:
1402
+ """Create a new collection with the Folder classification. This is used to identify the organizing
1403
+ collections in a collection hierarchy.
1404
+
1405
+ Parameters
1406
+ ----------
1407
+ anchor_guid: str
1408
+ The unique identifier of the element that should be the anchor for the new element.
1409
+ Set to null if no anchor, or if this collection is to be its own anchor.
1410
+ parent_guid: str
1411
+ The optional unique identifier for an element that should be connected to the newly created element.
1412
+ If this property is specified, parentRelationshipTypeName must also be specified
1413
+ parent_relationship_type_name: str
1414
+ The name of the relationship, if any, that should be established between the new element and the parent
1415
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
1416
+ parent_at_end1: bool
1417
+ Identifies which end any parent entity sits on the relationship.
1418
+ display_name: str
1419
+ The display name of the element. Will also be used as the basis of the qualified_name.
1420
+ description: str
1421
+ A description of the collection.
1422
+ collection_type: str
1423
+ Add appropriate valid value for the collection type.
1424
+ is_own_anchor: bool, optional, defaults to False
1425
+ Indicates if the collection should classified as its own anchor or not.
1426
+ collection_ordering: str, optional, defaults to "OTHER"
1427
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED",
1428
+ "OTHER"
1429
+ order_property_name: str, optional, defaults to "Something"
1430
+ Property to use for sequencing if collection_ordering is "OTHER"
1431
+ server_name: str, optional, defaults to None
1432
+ The name of the server to configure. If None, the server name associated with the instance is used.
1433
+
1434
+ Returns
1435
+ -------
1436
+ str - the guid of the created collection
1437
+
1438
+ A JSON dict representing the specified collection. Returns a string if none found.
1439
+
1440
+ Raises
1441
+ ------
1442
+ InvalidParameterException
1443
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1444
+ PropertyServerException
1445
+ Raised by the server when an issue arises in processing a valid request
1446
+ NotAuthorizedException
1447
+ The principle specified by the user_id does not have authorization for the requested action
1448
+
1449
+ """
1450
+ loop = asyncio.get_event_loop()
1451
+ resp = loop.run_until_complete(
1452
+ self._async_create_folder_collection(
1453
+ anchor_guid,
1454
+ parent_guid,
1455
+ parent_relationship_type_name,
1456
+ parent_at_end1,
1457
+ display_name,
1458
+ description,
1459
+ collection_type,
1460
+ is_own_anchor,
1461
+ collection_ordering,
1462
+ order_property_name,
1463
+ server_name,
1464
+ )
1465
+ )
1466
+ return resp
1467
+
1468
+ async def _async_create_collection_from_template(
1469
+ self, body: dict, server_name: str = None
1470
+ ) -> str:
1471
+ """Create a new metadata element to represent a collection using an existing metadata element as a template.
1472
+ The template defines additional classifications and relationships that are added to the new collection.
1473
+ Async version.
1474
+
1475
+ Parameters
1476
+ ----------
1477
+
1478
+ body: dict
1479
+ A dict representing the details of the collection to create.
1480
+ server_name: str, optional, defaults to None
1481
+ The name of the server to configure. If None, the server name associated with the instance is used.
1482
+
1483
+ Returns
1484
+ -------
1485
+ str - the guid of the created collection
1486
+
1487
+ Raises
1488
+ ------
1489
+ InvalidParameterException
1490
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1491
+ PropertyServerException
1492
+ Raised by the server when an issue arises in processing a valid request
1493
+ NotAuthorizedException
1494
+ The principle specified by the user_id does not have authorization for the requested action
1495
+
1496
+ Notes
1497
+ -----
1498
+ JSON Structure looks like:
1499
+
1500
+ {
1501
+ "class": "TemplateRequestBody",
1502
+ "anchorGUID": "anchor GUID, if set then isOwnAnchor=false",
1503
+ "isOwnAnchor": false,
1504
+ "parentGUID": "parent GUID, if set, set all parameters beginning 'parent'",
1505
+ "parentRelationshipTypeName": "open metadata type name",
1506
+ "parentAtEnd1": true,
1507
+ "templateGUID": "template GUID",
1508
+ "replacementProperties": {
1509
+ "class": "ElementProperties",
1510
+ "propertyValueMap" : {
1511
+ "propertyName" : {
1512
+ "class": "PrimitiveTypePropertyValue",
1513
+ "typeName": "string",
1514
+ "primitiveTypeCategory" : "OM_PRIMITIVE_TYPE_STRING",
1515
+ "primitiveValue" : "value of property"
1516
+ }
1517
+ }
1518
+ },
1519
+ "placeholderPropertyValues" : {
1520
+ "placeholderProperty1Name" : "property1Value",
1521
+ "placeholderProperty2Name" : "property2Value"
1522
+ }
1523
+ }
1524
+
1525
+ """
1526
+ if server_name is None:
1527
+ server_name = self.server_name
1528
+
1529
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/from-template"
1530
+
1531
+ resp = await self._async_make_request("POST", url, body)
1532
+ return resp.json().get("guid", "No GUID Returned")
1533
+
1534
+ def create_collection_from_template(
1535
+ self, body: dict, server_name: str = None
1536
+ ) -> str:
1537
+ """Create a new metadata element to represent a collection using an existing metadata element as a template.
1538
+ The template defines additional classifications and relationships that are added to the new collection.
1539
+
1540
+ Parameters
1541
+ ----------
1542
+ body: dict
1543
+ A dict representing the details of the collection to create.
1544
+ server_name: str, optional, defaults to None
1545
+ The name of the server to configure. If None, the server name associated with the instance is used.
1546
+
1547
+ Returns
1548
+ -------
1549
+ str - the guid of the created collection
1550
+
1551
+ Raises
1552
+ ------
1553
+ InvalidParameterException
1554
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1555
+ PropertyServerException
1556
+ Raised by the server when an issue arises in processing a valid request
1557
+ NotAuthorizedException
1558
+ The principle specified by the user_id does not have authorization for the requested action
1559
+
1560
+ Notes
1561
+ -----
1562
+ JSON Structure looks like:
1563
+
1564
+ {
1565
+ "class": "TemplateRequestBody",
1566
+ "anchorGUID": "anchor GUID, if set then isOwnAnchor=false",
1567
+ "isOwnAnchor": false,
1568
+ "parentGUID": "parent GUID, if set, set all parameters beginning 'parent'",
1569
+ "parentRelationshipTypeName": "open metadata type name",
1570
+ "parentAtEnd1": true,
1571
+ "templateGUID": "template GUID",
1572
+ "replacementProperties": {
1573
+ "class": "ElementProperties",
1574
+ "propertyValueMap" : {
1575
+ "propertyName" : {
1576
+ "class": "PrimitiveTypePropertyValue",
1577
+ "typeName": "string",
1578
+ "primitiveTypeCategory" : "OM_PRIMITIVE_TYPE_STRING",
1579
+ "primitiveValue" : "value of property"
1580
+ }
1581
+ }
1582
+ },
1583
+ "placeholderPropertyValues" : {
1584
+ "placeholderProperty1Name" : "property1Value",
1585
+ "placeholderProperty2Name" : "property2Value"
1586
+ }
1587
+ }
1588
+ """
1589
+ loop = asyncio.get_event_loop()
1590
+ resp = loop.run_until_complete(
1591
+ self._async_create_collection_from_template(body, server_name)
1592
+ )
1593
+ return resp
1594
+
1595
+ async def _async_create_digital_product(
1596
+ self, body: dict, server_name: str = None
1597
+ ) -> str:
1598
+ """Create a new collection that represents a digital product. Async version.
1599
+
1600
+ Parameters
1601
+ ----------
1602
+ body: dict
1603
+ A dict representing the details of the collection to create.
1604
+ server_name: str, optional, defaults to None
1605
+ The name of the server to configure. If not provided, the server name associated
1606
+ with the instance is used.
1607
+
1608
+ Returns
1609
+ -------
1610
+ str - the guid of the created collection
1611
+
1612
+ Raises
1613
+ ------
1614
+ InvalidParameterException
1615
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1616
+ PropertyServerException
1617
+ Raised by the server when an issue arises in processing a valid request
1618
+ NotAuthorizedException
1619
+ The principle specified by the user_id does not have authorization for the requested action
1620
+
1621
+ Notes
1622
+ -----
1623
+ JSON Structure looks like:
1624
+ {
1625
+ "class" : "NewDigitalProductRequestBody",
1626
+ "anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
1627
+ "isOwnAnchor" : false,
1628
+ "parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
1629
+ "parentRelationshipTypeName" : "open metadata type name",
1630
+ "parentAtEnd1": true,
1631
+ "collectionProperties": {
1632
+ "class" : "CollectionProperties",
1633
+ "qualifiedName": "Must provide a unique name here",
1634
+ "name" : "Add display name here",
1635
+ "description" : "Add description of the collection here",
1636
+ "collectionType": "Add appropriate valid value for type",
1637
+ "collectionOrdering" : "OTHER",
1638
+ "orderPropertyName" : "Add property name if 'collectionOrdering' is OTHER"
1639
+ },
1640
+ "digitalProductProperties" : {
1641
+ "class" : "DigitalProductProperties",
1642
+ "productStatus" : "ACTIVE",
1643
+ "productName" : "Add name here",
1644
+ "productType" : "Add valid value here",
1645
+ "description" : "Add description here",
1646
+ "introductionDate" : "date",
1647
+ "maturity" : "Add valid value here",
1648
+ "serviceLife" : "Add the estimated lifetime of the product",
1649
+ "currentVersion": "V1.0",
1650
+ "nextVersion": "V1.1",
1651
+ "withdrawDate": "date",
1652
+ "additionalProperties": {
1653
+ "property1Name" : "property1Value",
1654
+ "property2Name" : "property2Value"
1655
+ }
1656
+ }
1657
+ }
1658
+ """
1659
+ if server_name is None:
1660
+ server_name = self.server_name
1661
+
1662
+ url = f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/digital-products"
1663
+
1664
+ resp = await self._async_make_request("POST", url, body)
1665
+ return resp.json().get("guid", "No GUID returned")
1666
+
1667
+ def create_digital_product(self, body: dict, server_name: str = None) -> str:
1668
+ """Create a new collection that represents a digital product. Async version.
1669
+
1670
+ Parameters
1671
+ ----------
1672
+ body: dict
1673
+ A dict representing the details of the collection to create.
1674
+ server_name: str, optional, defaults to None
1675
+ The name of the server to configure. If not provided, the server name associated
1676
+ with the instance is used.
1677
+
1678
+ Returns
1679
+ -------
1680
+ str - the guid of the created collection
1681
+
1682
+ Raises
1683
+ ------
1684
+ InvalidParameterException
1685
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1686
+ PropertyServerException
1687
+ Raised by the server when an issue arises in processing a valid request
1688
+ NotAuthorizedException
1689
+ The principle specified by the user_id does not have authorization for the requested action
1690
+
1691
+ Notes
1692
+ -----
1693
+ JSON Structure looks like:
1694
+ {
1695
+ "class" : "NewDigitalProductRequestBody",
1696
+ "anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
1697
+ "isOwnAnchor" : false,
1698
+ "parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
1699
+ "parentRelationshipTypeName" : "open metadata type name",
1700
+ "parentAtEnd1": true,
1701
+ "collectionProperties": {
1702
+ "class" : "CollectionProperties",
1703
+ "qualifiedName": "Must provide a unique name here",
1704
+ "name" : "Add display name here",
1705
+ "description" : "Add description of the collection here",
1706
+ "collectionType": "Add appropriate valid value for type",
1707
+ "collectionOrdering" : "OTHER",
1708
+ "orderPropertyName" : "Add property name if 'collectionOrdering' is OTHER"
1709
+ },
1710
+ "digitalProductProperties" : {
1711
+ "class" : "DigitalProductProperties",
1712
+ "productStatus" : "ACTIVE",
1713
+ "productName" : "Add name here",
1714
+ "productType" : "Add valid value here",
1715
+ "description" : "Add description here",
1716
+ "introductionDate" : "date",
1717
+ "maturity" : "Add valid value here",
1718
+ "serviceLife" : "Add the estimated lifetime of the product",
1719
+ "currentVersion": "V1.0",
1720
+ "nextVersion": "V1.1",
1721
+ "withdrawDate": "date",
1722
+ "additionalProperties": {
1723
+ "property1Name" : "property1Value",
1724
+ "property2Name" : "property2Value"
1725
+ }
1726
+ }
1727
+ }
1728
+ """
1729
+ loop = asyncio.get_event_loop()
1730
+ resp = loop.run_until_complete(
1731
+ self._async_create_digital_product(body, server_name)
1732
+ )
1733
+ return resp
1734
+
1735
+ #
1736
+ # Manage collections
1737
+ #
1738
+ async def _async_update_collection(
1739
+ self,
1740
+ collection_guid: str,
1741
+ qualified_name: str = None,
1742
+ display_name: str = None,
1743
+ description: str = None,
1744
+ collection_type: str = None,
1745
+ collection_ordering: str = None,
1746
+ order_property_name: str = None,
1747
+ replace_all_props: bool = False,
1748
+ server_name: str = None,
1749
+ ) -> None:
1750
+ """Update the properties of a collection. Async version.
1751
+
1752
+ Parameters
1753
+ ----------
1754
+ collection_guid: str
1755
+ The guid of the collection to update.
1756
+ qualified_name: str, optional, defaults to None
1757
+ The qualified name of the collection to update.
1758
+ display_name: str, optional, defaults to None
1759
+ The display name of the element. Will also be used as the basis of the qualified_name.
1760
+ description: str, optional, defaults to None
1761
+ A description of the collection.
1762
+ collection_type: str, optional, defaults to None
1763
+ Add appropriate valid value for the collection type.
1764
+ collection_ordering: str, optional, defaults to None
1765
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1766
+ "DATE_CREATED", "OTHER"
1767
+ order_property_name: str, optional, defaults to None
1768
+ Property to use for sequencing if collection_ordering is "OTHER"
1769
+ replace_all_props: bool, optional, defaults to False
1770
+ Whether to replace all properties in the collection.
1771
+ server_name: str, optional, defaults to None
1772
+ The name of the server to configure. If not provided, the server name associated
1773
+ with the instance is used.
1774
+
1775
+ Returns
1776
+ -------
1777
+ Nothing
1778
+
1779
+ Raises
1780
+ ------
1781
+ InvalidParameterException
1782
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1783
+ PropertyServerException
1784
+ Raised by the server when an issue arises in processing a valid request
1785
+ NotAuthorizedException
1786
+ The principle specified by the user_id does not have authorization for the requested action
1787
+ """
1788
+ if server_name is None:
1789
+ server_name = self.server_name
1790
+ replace_all_props_s = str(replace_all_props).lower()
1791
+ url = (
1792
+ f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/update?"
1793
+ f"replaceAllProperties={replace_all_props_s}"
1794
+ )
1795
+
1796
+ body = {
1797
+ "class": "CollectionProperties",
1798
+ "qualifiedName": qualified_name,
1799
+ "name": display_name,
1800
+ "description": description,
1801
+ "collectionType": collection_type,
1802
+ "collectionOrdering": collection_ordering,
1803
+ "orderPropertyName": order_property_name,
1804
+ }
1805
+ body_s = body_slimmer(body)
1806
+ await self._async_make_request("POST", url, body_s)
1807
+ return
1808
+
1809
+ def update_collection(
1810
+ self,
1811
+ collection_guid,
1812
+ qualified_name: str = None,
1813
+ display_name: str = None,
1814
+ description: str = None,
1815
+ collection_type: str = None,
1816
+ collection_ordering: str = None,
1817
+ order_property_name: str = None,
1818
+ replace_all_props: bool = False,
1819
+ server_name: str = None,
1820
+ ) -> None:
1821
+ """Update the properties of a collection.
1822
+
1823
+ Parameters
1824
+ ----------
1825
+ collection_guid: str
1826
+ The guid of the collection to update.
1827
+ qualified_name: str
1828
+ The qualified name of the collection to update.
1829
+ display_name: str
1830
+ The display name of the element. Will also be used as the basis of the qualified_name.
1831
+ description: str
1832
+ A description of the collection.
1833
+ collection_type: str
1834
+ Add appropriate valid value for the collection type.
1835
+ collection_ordering: str, optional, defaults to "OTHER"
1836
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1837
+ "DATE_CREATED", "OTHER"
1838
+ order_property_name: str, optional, defaults to "Something"
1839
+ Property to use for sequencing if collection_ordering is "OTHER"
1840
+ replace_all_props: bool, optional, defaults to False
1841
+ Whether to replace all properties in the collection.
1842
+ server_name: str, optional, defaults to None
1843
+ The name of the server to configure. If not provided, the server name associated
1844
+ with the instance is used.
1845
+
1846
+ Returns
1847
+ -------
1848
+ Nothing
1849
+
1850
+ Raises
1851
+ ------
1852
+ InvalidParameterException
1853
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1854
+ PropertyServerException
1855
+ Raised by the server when an issue arises in processing a valid request
1856
+ NotAuthorizedException
1857
+ The principle specified by the user_id does not have authorization for the requested action
1858
+ """
1859
+ loop = asyncio.get_event_loop()
1860
+ loop.run_until_complete(
1861
+ self._async_update_collection(
1862
+ collection_guid,
1863
+ qualified_name,
1864
+ display_name,
1865
+ description,
1866
+ collection_type,
1867
+ collection_ordering,
1868
+ order_property_name,
1869
+ replace_all_props,
1870
+ server_name,
1871
+ )
1872
+ )
1873
+ return
1874
+
1875
+ async def _async_update_digital_product(
1876
+ self,
1877
+ collection_guid: str,
1878
+ body: dict,
1879
+ replace_all_props: bool = False,
1880
+ server_name: str = None,
1881
+ ):
1882
+ """Update the properties of the DigitalProduct classification attached to a collection. Async version.
1883
+
1884
+ Parameters
1885
+ ----------
1886
+ collection_guid: str
1887
+ The guid of the collection to update.
1888
+ body: dict
1889
+ A dict representing the details of the collection to create.
1890
+ replace_all_props: bool, optional, defaults to False
1891
+ Whether to replace all properties in the collection.
1892
+ server_name: str, optional, defaults to None
1893
+ The name of the server to configure. If not provided, the server name associated with the
1894
+ instance is used.
1895
+
1896
+ Returns
1897
+ -------
1898
+ Nothing
1899
+
1900
+ Raises
1901
+ ------
1902
+ InvalidParameterException
1903
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1904
+ PropertyServerException
1905
+ Raised by the server when an issue arises in processing a valid request
1906
+ NotAuthorizedException
1907
+ The principle specified by the user_id does not have authorization for the requested action
1908
+
1909
+ Notes
1910
+ -----
1911
+ JSON Structure looks like:
1912
+ {
1913
+ "class" : "DigitalProductProperties",
1914
+ "productStatus" : "ACTIVE",
1915
+ "productName" : "Add name here",
1916
+ "productType" : "Add valid value here",
1917
+ "description" : "Add description here",
1918
+ "introductionDate" : "date",
1919
+ "maturity" : "Add valid value here",
1920
+ "serviceLife" : "Add the estimated lifetime of the product",
1921
+ "currentVersion": "V1.0",
1922
+ "nextVersion": "V1.1",
1923
+ "withdrawDate": "date",
1924
+ "additionalProperties": {
1925
+ "property1Name" : "property1Value",
1926
+ "property2Name" : "property2Value"
1927
+ }
1928
+ }
1929
+ """
1930
+ if server_name is None:
1931
+ server_name = self.server_name
1612
1932
 
1613
1933
  replace_all_props_s = str(replace_all_props).lower()
1614
- url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/digital-products/"
1615
- f"{collection_guid}/update?replaceAllProperties={replace_all_props_s}")
1934
+ url = (
1935
+ f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/digital-products/"
1936
+ f"{collection_guid}/update?replaceAllProperties={replace_all_props_s}"
1937
+ )
1616
1938
 
1617
1939
  await self._async_make_request("POST", url, body)
1618
1940
  return
1619
1941
 
1620
- def update_digital_product(self, collection_guid: str, body: dict, replace_all_props: bool = False,
1621
- server_name: str = None):
1622
- """ Update the properties of the DigitalProduct classification attached to a collection.
1623
-
1624
- Parameters
1625
- ----------
1626
- collection_guid: str
1627
- The guid of the collection to update.
1628
- body: dict
1629
- A dict representing the details of the collection to create.
1630
- replace_all_props: bool, optional, defaults to False
1631
- Whether to replace all properties in the collection.
1632
- server_name: str, optional, defaults to None
1633
- The name of the server to configure. If not provided, the server name associated with the
1634
- instance is used.
1635
-
1636
- Returns
1637
- -------
1638
- Nothing
1639
-
1640
- Raises
1641
- ------
1642
- InvalidParameterException
1643
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1644
- PropertyServerException
1645
- Raised by the server when an issue arises in processing a valid request
1646
- NotAuthorizedException
1647
- The principle specified by the user_id does not have authorization for the requested action
1648
-
1649
- Notes
1650
- -----
1651
- JSON Structure looks like:
1652
- {
1653
- "class" : "DigitalProductProperties",
1654
- "productStatus" : "ACTIVE",
1655
- "productName" : "Add name here",
1656
- "productType" : "Add valid value here",
1657
- "description" : "Add description here",
1658
- "introductionDate" : "date",
1659
- "maturity" : "Add valid value here",
1660
- "serviceLife" : "Add the estimated lifetime of the product",
1661
- "currentVersion": "V1.0",
1662
- "nextVersion": "V1.1",
1663
- "withdrawDate": "date",
1664
- "additionalProperties": {
1665
- "property1Name" : "property1Value",
1666
- "property2Name" : "property2Value"
1667
- }
1668
- }
1942
+ def update_digital_product(
1943
+ self,
1944
+ collection_guid: str,
1945
+ body: dict,
1946
+ replace_all_props: bool = False,
1947
+ server_name: str = None,
1948
+ ):
1949
+ """Update the properties of the DigitalProduct classification attached to a collection.
1950
+
1951
+ Parameters
1952
+ ----------
1953
+ collection_guid: str
1954
+ The guid of the collection to update.
1955
+ body: dict
1956
+ A dict representing the details of the collection to create.
1957
+ replace_all_props: bool, optional, defaults to False
1958
+ Whether to replace all properties in the collection.
1959
+ server_name: str, optional, defaults to None
1960
+ The name of the server to configure. If not provided, the server name associated with the
1961
+ instance is used.
1962
+
1963
+ Returns
1964
+ -------
1965
+ Nothing
1966
+
1967
+ Raises
1968
+ ------
1969
+ InvalidParameterException
1970
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1971
+ PropertyServerException
1972
+ Raised by the server when an issue arises in processing a valid request
1973
+ NotAuthorizedException
1974
+ The principle specified by the user_id does not have authorization for the requested action
1975
+
1976
+ Notes
1977
+ -----
1978
+ JSON Structure looks like:
1979
+ {
1980
+ "class" : "DigitalProductProperties",
1981
+ "productStatus" : "ACTIVE",
1982
+ "productName" : "Add name here",
1983
+ "productType" : "Add valid value here",
1984
+ "description" : "Add description here",
1985
+ "introductionDate" : "date",
1986
+ "maturity" : "Add valid value here",
1987
+ "serviceLife" : "Add the estimated lifetime of the product",
1988
+ "currentVersion": "V1.0",
1989
+ "nextVersion": "V1.1",
1990
+ "withdrawDate": "date",
1991
+ "additionalProperties": {
1992
+ "property1Name" : "property1Value",
1993
+ "property2Name" : "property2Value"
1994
+ }
1995
+ }
1669
1996
  """
1670
1997
  loop = asyncio.get_event_loop()
1671
1998
  loop.run_until_complete(
1672
- self._async_update_digital_product(collection_guid, body, replace_all_props, server_name))
1999
+ self._async_update_digital_product(
2000
+ collection_guid, body, replace_all_props, server_name
2001
+ )
2002
+ )
1673
2003
  return
1674
2004
 
1675
- async def _async_attach_collection(self, collection_guid: str, element_guid: str, resource_use: str,
1676
- resource_use_description: str = None, resource_use_props: dict = None,
1677
- watch_resources: bool = False, make_anchor: bool = False,
1678
- server_name: str = None) -> None:
1679
- """ Connect an existing collection to an element using the ResourceList relationship (0019). Async version.
1680
- Parameters
1681
- ----------
1682
- collection_guid: str
1683
- The guid of the collection to update.
1684
- element_guid: str
1685
- The guid of the element to attach.
1686
- resource_use: str,
1687
- How the resource is being used.
1688
- resource_use_description: str
1689
- Describe how the resource is being used.
1690
- resource_use_props: dict, optional, defaults to None
1691
- The properties of the resource to be used.
1692
- watch_resources, bool, optional, defaults to False
1693
- Whether to watch for the resources to be updated.
1694
- make_anchor, bool, optional, defaults to False
1695
- Whether to make the this an anchor.
1696
- server_name: str, optional, defaults to None
1697
- The name of the server to configure. If not provided, the server name associated with the
1698
- instance is used.
1699
-
1700
- Returns
1701
- -------
1702
- Nothing
1703
-
1704
- Raises
1705
- ------
1706
- InvalidParameterException
1707
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1708
- PropertyServerException
1709
- Raised by the server when an issue arises in processing a valid request
1710
- NotAuthorizedException
1711
- The principle specified by the user_id does not have authorization for the requested action
2005
+ async def _async_attach_collection(
2006
+ self,
2007
+ collection_guid: str,
2008
+ element_guid: str,
2009
+ resource_use: str,
2010
+ resource_use_description: str = None,
2011
+ resource_use_props: dict = None,
2012
+ watch_resources: bool = False,
2013
+ make_anchor: bool = False,
2014
+ server_name: str = None,
2015
+ ) -> None:
2016
+ """Connect an existing collection to an element using the ResourceList relationship (0019). Async version.
2017
+ Parameters
2018
+ ----------
2019
+ collection_guid: str
2020
+ The guid of the collection to update.
2021
+ element_guid: str
2022
+ The guid of the element to attach.
2023
+ resource_use: str,
2024
+ How the resource is being used.
2025
+ resource_use_description: str
2026
+ Describe how the resource is being used.
2027
+ resource_use_props: dict, optional, defaults to None
2028
+ The properties of the resource to be used.
2029
+ watch_resources, bool, optional, defaults to False
2030
+ Whether to watch for the resources to be updated.
2031
+ make_anchor, bool, optional, defaults to False
2032
+ Whether to make the this an anchor.
2033
+ server_name: str, optional, defaults to None
2034
+ The name of the server to configure. If not provided, the server name associated with the
2035
+ instance is used.
2036
+
2037
+ Returns
2038
+ -------
2039
+ Nothing
2040
+
2041
+ Raises
2042
+ ------
2043
+ InvalidParameterException
2044
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2045
+ PropertyServerException
2046
+ Raised by the server when an issue arises in processing a valid request
2047
+ NotAuthorizedException
2048
+ The principle specified by the user_id does not have authorization for the requested action
1712
2049
 
1713
2050
  """
1714
2051
  if server_name is None:
@@ -1716,152 +2053,185 @@ class CollectionManager(Client):
1716
2053
  watch_resources_s = str(watch_resources).lower()
1717
2054
  make_anchor_s = str(make_anchor).lower()
1718
2055
 
1719
- url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/metadata-elements/"
1720
- f"{element_guid}/collections/{collection_guid}/attach?makeAnchor={make_anchor_s}")
2056
+ url = (
2057
+ f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/metadata-elements/"
2058
+ f"{element_guid}/collections/{collection_guid}/attach?makeAnchor={make_anchor_s}"
2059
+ )
2060
+
2061
+ body = {
2062
+ "class": "ResourceListProperties",
2063
+ "resourceUse": resource_use,
2064
+ "resourceUseDescription": resource_use_description,
2065
+ "watchResource": watch_resources_s,
2066
+ "resourceUseProperties": resource_use_props,
2067
+ }
2068
+ await self._async_make_request("POST", url, body)
2069
+ return
2070
+
2071
+ def attach_collection(
2072
+ self,
2073
+ collection_guid: str,
2074
+ element_guid: str,
2075
+ resource_use: str,
2076
+ resource_use_description: str,
2077
+ resource_use_props: dict = None,
2078
+ watch_resources: bool = False,
2079
+ make_anchor: bool = False,
2080
+ server_name: str = None,
2081
+ ) -> None:
2082
+ """Connect an existing collection to an element using the ResourceList relationship (0019).
2083
+ Parameters
2084
+ ----------
2085
+ collection_guid: str
2086
+ The guid of the collection to update.
2087
+ element_guid: str
2088
+ The guid of the element to attach.
2089
+ resource_use: str,
2090
+ How the resource is being used.
2091
+ resource_use_description: str
2092
+ Describe how the resource is being used.
2093
+ resource_use_props: dict, optional, defaults to None
2094
+ The properties of the resource to be used.
2095
+ watch_resources: bool, optional, defaults to False
2096
+ Whether to watch for the resources to be updated.
2097
+ make_anchor: bool, optional, defaults to False
2098
+ Whether to make the this an anchor.
2099
+ server_name: str, optional, defaults to None
2100
+ The name of the server to configure. If not provided, the server name associated
2101
+ with the instance is used.
1721
2102
 
1722
- body = {"class": "ResourceListProperties", "resourceUse": resource_use,
1723
- "resourceUseDescription": resource_use_description, "watchResource": watch_resources_s,
1724
- "resourceUseProperties": resource_use_props}
1725
- await self._async_make_request("POST", url, body)
1726
- return
2103
+ Returns
2104
+ -------
2105
+ Nothing
1727
2106
 
1728
- def attach_collection(self, collection_guid: str, element_guid: str, resource_use: str,
1729
- resource_use_description: str, resource_use_props: dict = None, watch_resources: bool = False,
1730
- make_anchor: bool = False, server_name: str = None) -> None:
1731
- """ Connect an existing collection to an element using the ResourceList relationship (0019).
1732
- Parameters
1733
- ----------
1734
- collection_guid: str
1735
- The guid of the collection to update.
1736
- element_guid: str
1737
- The guid of the element to attach.
1738
- resource_use: str,
1739
- How the resource is being used.
1740
- resource_use_description: str
1741
- Describe how the resource is being used.
1742
- resource_use_props: dict, optional, defaults to None
1743
- The properties of the resource to be used.
1744
- watch_resources: bool, optional, defaults to False
1745
- Whether to watch for the resources to be updated.
1746
- make_anchor: bool, optional, defaults to False
1747
- Whether to make the this an anchor.
1748
- server_name: str, optional, defaults to None
1749
- The name of the server to configure. If not provided, the server name associated
1750
- with the instance is used.
1751
-
1752
- Returns
1753
- -------
1754
- Nothing
1755
-
1756
- Raises
1757
- ------
1758
- InvalidParameterException
1759
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1760
- PropertyServerException
1761
- Raised by the server when an issue arises in processing a valid request
1762
- NotAuthorizedException
1763
- The principle specified by the user_id does not have authorization for the requested action
2107
+ Raises
2108
+ ------
2109
+ InvalidParameterException
2110
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2111
+ PropertyServerException
2112
+ Raised by the server when an issue arises in processing a valid request
2113
+ NotAuthorizedException
2114
+ The principle specified by the user_id does not have authorization for the requested action
1764
2115
 
1765
2116
  """
1766
2117
  loop = asyncio.get_event_loop()
1767
2118
  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))
2119
+ self._async_attach_collection(
2120
+ collection_guid,
2121
+ element_guid,
2122
+ resource_use,
2123
+ resource_use_description,
2124
+ resource_use_props,
2125
+ watch_resources,
2126
+ make_anchor,
2127
+ server_name,
2128
+ )
2129
+ )
1770
2130
  return
1771
2131
 
1772
- async def _async_detach_collection(self, collection_guid: str, element_guid: str, server_name: str = None) -> None:
1773
- """ Detach an existing collection from an element. If the collection is anchored to the element, it is deleted.
1774
- Async version.
1775
-
1776
- Parameters
1777
- ----------
1778
- collection_guid: str
1779
- The guid of the collection to update.
1780
- element_guid: str
1781
- The guid of the element to attach.
1782
- server_name: str, optional, defaults to None
1783
- The name of the server to configure. If not provided, the server name associated
1784
- with the instance is used.
1785
-
1786
- Returns
1787
- -------
1788
- Nothing
1789
-
1790
- Raises
1791
- ------
1792
- InvalidParameterException
1793
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1794
- PropertyServerException
1795
- Raised by the server when an issue arises in processing a valid request
1796
- NotAuthorizedException
1797
- The principle specified by the user_id does not have authorization for the requested action
2132
+ async def _async_detach_collection(
2133
+ self, collection_guid: str, element_guid: str, server_name: str = None
2134
+ ) -> None:
2135
+ """Detach an existing collection from an element. If the collection is anchored to the element, it is deleted.
2136
+ Async version.
2137
+
2138
+ Parameters
2139
+ ----------
2140
+ collection_guid: str
2141
+ The guid of the collection to update.
2142
+ element_guid: str
2143
+ The guid of the element to attach.
2144
+ server_name: str, optional, defaults to None
2145
+ The name of the server to configure. If not provided, the server name associated
2146
+ with the instance is used.
2147
+
2148
+ Returns
2149
+ -------
2150
+ Nothing
2151
+
2152
+ Raises
2153
+ ------
2154
+ InvalidParameterException
2155
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2156
+ PropertyServerException
2157
+ Raised by the server when an issue arises in processing a valid request
2158
+ NotAuthorizedException
2159
+ The principle specified by the user_id does not have authorization for the requested action
1798
2160
 
1799
2161
  """
1800
2162
  if server_name is None:
1801
2163
  server_name = self.server_name
1802
- url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/metadata-elements/"
1803
- f"{element_guid}/collections/{collection_guid}/detach")
2164
+ url = (
2165
+ f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/metadata-elements/"
2166
+ f"{element_guid}/collections/{collection_guid}/detach"
2167
+ )
1804
2168
 
1805
2169
  body = {"class": "NullRequestBody"}
1806
2170
 
1807
2171
  await self._async_make_request("POST", url, body)
1808
2172
  return
1809
2173
 
1810
- def detach_collection(self, collection_guid: str, element_guid: str, server_name: str = None) -> None:
1811
- """ Connect an existing collection to an element using the ResourceList relationship (0019).
1812
- Parameters
1813
- ----------
1814
- collection_guid: str
1815
- The guid of the collection to update.
1816
- element_guid: str
1817
- The guid of the element to attach.
1818
- server_name: str, optional, defaults to None
1819
- The name of the server to configure. If not provided, the server name associated
1820
- with the instance is used.
1821
-
1822
- Returns
1823
- -------
1824
- Nothing
1825
-
1826
- Raises
1827
- ------
1828
- InvalidParameterException
1829
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1830
- PropertyServerException
1831
- Raised by the server when an issue arises in processing a valid request
1832
- NotAuthorizedException
1833
- The principle specified by the user_id does not have authorization for the requested action
2174
+ def detach_collection(
2175
+ self, collection_guid: str, element_guid: str, server_name: str = None
2176
+ ) -> None:
2177
+ """Connect an existing collection to an element using the ResourceList relationship (0019).
2178
+ Parameters
2179
+ ----------
2180
+ collection_guid: str
2181
+ The guid of the collection to update.
2182
+ element_guid: str
2183
+ The guid of the element to attach.
2184
+ server_name: str, optional, defaults to None
2185
+ The name of the server to configure. If not provided, the server name associated
2186
+ with the instance is used.
2187
+
2188
+ Returns
2189
+ -------
2190
+ Nothing
2191
+
2192
+ Raises
2193
+ ------
2194
+ InvalidParameterException
2195
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2196
+ PropertyServerException
2197
+ Raised by the server when an issue arises in processing a valid request
2198
+ NotAuthorizedException
2199
+ The principle specified by the user_id does not have authorization for the requested action
1834
2200
 
1835
2201
  """
1836
2202
  loop = asyncio.get_event_loop()
1837
- loop.run_until_complete(self._async_detach_collection(collection_guid, element_guid, server_name))
2203
+ loop.run_until_complete(
2204
+ self._async_detach_collection(collection_guid, element_guid, server_name)
2205
+ )
1838
2206
  return
1839
2207
 
1840
- async def _async_delete_collection(self, collection_guid: str, server_name: str = None) -> None:
1841
- """ Delete a collection. It is detected from all parent elements. If members are anchored to the collection
1842
- then they are also deleted. Async version
2208
+ async def _async_delete_collection(
2209
+ self, collection_guid: str, server_name: str = None
2210
+ ) -> None:
2211
+ """Delete a collection. It is detected from all parent elements. If members are anchored to the collection
2212
+ then they are also deleted. Async version
1843
2213
 
1844
2214
 
1845
- Parameters
1846
- ----------
1847
- collection_guid: str
1848
- The guid of the collection to update.
1849
- server_name: str, optional, defaults to None
1850
- The name of the server to configure. If not provided, the server name associated
1851
- with the instance is used.
2215
+ Parameters
2216
+ ----------
2217
+ collection_guid: str
2218
+ The guid of the collection to update.
2219
+ server_name: str, optional, defaults to None
2220
+ The name of the server to configure. If not provided, the server name associated
2221
+ with the instance is used.
1852
2222
 
1853
- Returns
1854
- -------
1855
- Nothing
2223
+ Returns
2224
+ -------
2225
+ Nothing
1856
2226
 
1857
- Raises
1858
- ------
1859
- InvalidParameterException
1860
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1861
- PropertyServerException
1862
- Raised by the server when an issue arises in processing a valid request
1863
- NotAuthorizedException
1864
- The principle specified by the user_id does not have authorization for the requested action
2227
+ Raises
2228
+ ------
2229
+ InvalidParameterException
2230
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2231
+ PropertyServerException
2232
+ Raised by the server when an issue arises in processing a valid request
2233
+ NotAuthorizedException
2234
+ The principle specified by the user_id does not have authorization for the requested action
1865
2235
 
1866
2236
  """
1867
2237
  if server_name is None:
@@ -1873,40 +2243,47 @@ class CollectionManager(Client):
1873
2243
  return
1874
2244
 
1875
2245
  def delete_collection(self, collection_guid: str, server_name: str = None) -> None:
1876
- """ Delete a collection. It is detected from all parent elements. If members are anchored to the collection
1877
- then they are also deleted.
1878
-
1879
- Parameters
1880
- ----------
1881
- collection_guid: str
1882
- The guid of the collection to update.
1883
- server_name: str, optional, defaults to None
1884
- The name of the server to configure. If not provided, the server name associated
1885
- with the instance is used.
1886
-
1887
- Returns
1888
- -------
1889
- Nothing
1890
-
1891
- Raises
1892
- ------
1893
-
1894
- InvalidParameterException
1895
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1896
- PropertyServerException
1897
- Raised by the server when an issue arises in processing a valid request
1898
- NotAuthorizedException
1899
- The principle specified by the user_id does not have authorization for the requested action
2246
+ """Delete a collection. It is detected from all parent elements. If members are anchored to the collection
2247
+ then they are also deleted.
2248
+
2249
+ Parameters
2250
+ ----------
2251
+ collection_guid: str
2252
+ The guid of the collection to update.
2253
+ server_name: str, optional, defaults to None
2254
+ The name of the server to configure. If not provided, the server name associated
2255
+ with the instance is used.
2256
+
2257
+ Returns
2258
+ -------
2259
+ Nothing
2260
+
2261
+ Raises
2262
+ ------
2263
+
2264
+ InvalidParameterException
2265
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2266
+ PropertyServerException
2267
+ Raised by the server when an issue arises in processing a valid request
2268
+ NotAuthorizedException
2269
+ The principle specified by the user_id does not have authorization for the requested action
1900
2270
 
1901
2271
  """
1902
2272
  loop = asyncio.get_event_loop()
1903
- loop.run_until_complete(self._async_delete_collection(collection_guid, server_name))
2273
+ loop.run_until_complete(
2274
+ self._async_delete_collection(collection_guid, server_name)
2275
+ )
1904
2276
  return
1905
2277
 
1906
- async def _async_get_collection_members(self, collection_guid: str, effective_time: str = None,
1907
- server_name: str = None, start_from: int = 0,
1908
- page_size: int = None) -> list | str:
1909
- """ Return a list of elements that are a member of a collection. Async version.
2278
+ async def _async_get_collection_members(
2279
+ self,
2280
+ collection_guid: str,
2281
+ effective_time: str = None,
2282
+ server_name: str = None,
2283
+ start_from: int = 0,
2284
+ page_size: int = None,
2285
+ ) -> list | str:
2286
+ """Return a list of elements that are a member of a collection. Async version.
1910
2287
 
1911
2288
  Parameters
1912
2289
  ----------
@@ -1944,353 +2321,407 @@ class CollectionManager(Client):
1944
2321
  if page_size is None:
1945
2322
  page_size = self.page_size
1946
2323
 
1947
- url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/"
1948
- f"members?startFrom={start_from}&pageSize={page_size}")
2324
+ url = (
2325
+ f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/"
2326
+ f"members?startFrom={start_from}&pageSize={page_size}"
2327
+ )
1949
2328
 
1950
2329
  resp = await self._async_make_request("GET", url)
1951
2330
  return resp.json().get("elements", "No elements found")
1952
2331
 
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:
1955
- """ Return a list of elements that are a member of a collection.
1956
-
1957
- Parameters
1958
- ----------
1959
- collection_guid: str,
1960
- identity of the collection to return members for.
1961
- effective_time: str, [default=None], optional
1962
- Effective time of the query. If not specified will default to any time.
1963
- server_name : str, optional
1964
- The name of the server to configure.
1965
- If not provided, the server name associated with the instance is used.
1966
- start_from: int, [default=0], optional
1967
- When multiple pages of results are available, the page number to start from.
1968
- page_size: int, [default=None]
1969
- The number of items to return in a single page. If not specified, the default will be taken from
1970
- the class instance.
1971
- Returns
1972
- -------
1973
- List | str
1974
-
1975
- A list of collection members in the collection.
1976
-
1977
- Raises
1978
- ------
1979
-
1980
- InvalidParameterException
1981
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1982
- PropertyServerException
1983
- Raised by the server when an issue arises in processing a valid request
1984
- NotAuthorizedException
1985
- The principle specified by the user_id does not have authorization for the requested action
1986
-
1987
- """
2332
+ def get_collection_members(
2333
+ self,
2334
+ collection_guid: str,
2335
+ effective_time: str = None,
2336
+ server_name: str = None,
2337
+ start_from: int = 0,
2338
+ page_size: int = None,
2339
+ ) -> list | str:
2340
+ """Return a list of elements that are a member of a collection.
2341
+
2342
+ Parameters
2343
+ ----------
2344
+ collection_guid: str,
2345
+ identity of the collection to return members for.
2346
+ effective_time: str, [default=None], optional
2347
+ Effective time of the query. If not specified will default to any time.
2348
+ server_name : str, optional
2349
+ The name of the server to configure.
2350
+ If not provided, the server name associated with the instance is used.
2351
+ start_from: int, [default=0], optional
2352
+ When multiple pages of results are available, the page number to start from.
2353
+ page_size: int, [default=None]
2354
+ The number of items to return in a single page. If not specified, the default will be taken from
2355
+ the class instance.
2356
+ Returns
2357
+ -------
2358
+ List | str
2359
+
2360
+ A list of collection members in the collection.
2361
+
2362
+ Raises
2363
+ ------
2364
+
2365
+ InvalidParameterException
2366
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2367
+ PropertyServerException
2368
+ Raised by the server when an issue arises in processing a valid request
2369
+ NotAuthorizedException
2370
+ The principle specified by the user_id does not have authorization for the requested action
2371
+
2372
+ """
1988
2373
  loop = asyncio.get_event_loop()
1989
2374
  resp = loop.run_until_complete(
1990
- self._async_get_collection_members(collection_guid, effective_time, server_name, start_from, page_size))
2375
+ self._async_get_collection_members(
2376
+ collection_guid, effective_time, server_name, start_from, page_size
2377
+ )
2378
+ )
1991
2379
 
1992
2380
  return resp
1993
2381
 
1994
- async def _async_add_to_collection(self, collection_guid: str, element_guid: str, body: dict = None,
1995
- server_name: str = None) -> None:
1996
- """ Add an element to a collection. The request body is optional. Async version.
1997
-
1998
- Parameters
1999
- ----------
2000
- collection_guid: str
2001
- identity of the collection to return members for.
2002
- element_guid: str
2003
- Effective time of the query. If not specified will default to any time.
2004
- body: dict, optional, defaults to None
2005
- The body of the request to add to the collection. See notes.
2006
- server_name : str, optional
2007
- The name of the server to use.
2008
- If not provided, the server name associated with the instance is used.
2009
-
2010
- Returns
2011
- -------
2012
- None
2013
-
2014
- Raises
2015
- ------
2016
-
2017
- InvalidParameterException
2018
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2019
- PropertyServerException
2020
- Raised by the server when an issue arises in processing a valid request
2021
- NotAuthorizedException
2022
- The principle specified by the user_id does not have authorization for the requested action
2023
-
2024
- Notes
2025
- -----
2026
- Example body:
2027
- {
2028
- "class" : "CollectionMembershipProperties",
2029
- "membershipRationale": "xxx",
2030
- "createdBy": "user id here",
2031
- "expression": "expression that described why the element is a part of this collection",
2032
- "confidence": 100,
2033
- "status": "PROPOSED",
2034
- "userDefinedStatus": "Add valid value here",
2035
- "steward": "identifier of steward that validated this member",
2036
- "stewardTypeName": "type name of element identifying the steward",
2037
- "stewardPropertyName": "property name if the steward's identifier",
2038
- "source": "source of the member",
2039
- "notes": "Add notes here"
2040
- }
2382
+ async def _async_add_to_collection(
2383
+ self,
2384
+ collection_guid: str,
2385
+ element_guid: str,
2386
+ body: dict = None,
2387
+ server_name: str = None,
2388
+ ) -> None:
2389
+ """Add an element to a collection. The request body is optional. Async version.
2390
+
2391
+ Parameters
2392
+ ----------
2393
+ collection_guid: str
2394
+ identity of the collection to return members for.
2395
+ element_guid: str
2396
+ Effective time of the query. If not specified will default to any time.
2397
+ body: dict, optional, defaults to None
2398
+ The body of the request to add to the collection. See notes.
2399
+ server_name : str, optional
2400
+ The name of the server to use.
2401
+ If not provided, the server name associated with the instance is used.
2402
+
2403
+ Returns
2404
+ -------
2405
+ None
2406
+
2407
+ Raises
2408
+ ------
2409
+
2410
+ InvalidParameterException
2411
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2412
+ PropertyServerException
2413
+ Raised by the server when an issue arises in processing a valid request
2414
+ NotAuthorizedException
2415
+ The principle specified by the user_id does not have authorization for the requested action
2416
+
2417
+ Notes
2418
+ -----
2419
+ Example body:
2420
+ {
2421
+ "class" : "CollectionMembershipProperties",
2422
+ "membershipRationale": "xxx",
2423
+ "createdBy": "user id here",
2424
+ "expression": "expression that described why the element is a part of this collection",
2425
+ "confidence": 100,
2426
+ "status": "PROPOSED",
2427
+ "userDefinedStatus": "Add valid value here",
2428
+ "steward": "identifier of steward that validated this member",
2429
+ "stewardTypeName": "type name of element identifying the steward",
2430
+ "stewardPropertyName": "property name if the steward's identifier",
2431
+ "source": "source of the member",
2432
+ "notes": "Add notes here"
2433
+ }
2041
2434
 
2042
2435
  """
2043
2436
  if server_name is None:
2044
2437
  server_name = self.server_name
2045
2438
 
2046
- url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/members/"
2047
- f"{element_guid}/attach")
2439
+ url = (
2440
+ f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/members/"
2441
+ f"{element_guid}/attach"
2442
+ )
2048
2443
  body_s = body_slimmer(body)
2049
2444
  await self._async_make_request("POST", url, body_s)
2050
2445
  return
2051
2446
 
2052
- def add_to_collection(self, collection_guid: str, element_guid: str, body: dict = None,
2053
- server_name: str = None) -> None:
2054
- """ Add an element to a collection. The request body is optional.
2055
-
2056
- Parameters
2057
- ----------
2058
- collection_guid: str
2059
- identity of the collection to return members for.
2060
- element_guid: str
2061
- Effective time of the query. If not specified will default to any time.
2062
- body: dict, optional, defaults to None
2063
- The body of the request to add to the collection. See notes.
2064
- server_name : str, optional
2065
- The name of the server to use.
2066
- If not provided, the server name associated with the instance is used.
2067
-
2068
- Returns
2069
- -------
2070
- None
2071
-
2072
- Raises
2073
- ------
2074
-
2075
- InvalidParameterException
2076
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2077
- PropertyServerException
2078
- Raised by the server when an issue arises in processing a valid request
2079
- NotAuthorizedException
2080
- The principle specified by the user_id does not have authorization for the requested action
2081
-
2082
- Notes
2083
- -----
2084
- Example body:
2085
- {
2086
- "class" : "CollectionMembershipProperties",
2087
- "membershipRationale": "xxx",
2088
- "createdBy": "user id here",
2089
- "expression": "expression that described why the element is a part of this collection",
2090
- "confidence": 100,
2091
- "status": "PROPOSED",
2092
- "userDefinedStatus": "Add valid value here",
2093
- "steward": "identifier of steward that validated this member",
2094
- "stewardTypeName": "type name of element identifying the steward",
2095
- "stewardPropertyName": "property name if the steward's identifier",
2096
- "source": "source of the member",
2097
- "notes": "Add notes here"
2098
- }
2447
+ def add_to_collection(
2448
+ self,
2449
+ collection_guid: str,
2450
+ element_guid: str,
2451
+ body: dict = None,
2452
+ server_name: str = None,
2453
+ ) -> None:
2454
+ """Add an element to a collection. The request body is optional.
2455
+
2456
+ Parameters
2457
+ ----------
2458
+ collection_guid: str
2459
+ identity of the collection to return members for.
2460
+ element_guid: str
2461
+ Effective time of the query. If not specified will default to any time.
2462
+ body: dict, optional, defaults to None
2463
+ The body of the request to add to the collection. See notes.
2464
+ server_name : str, optional
2465
+ The name of the server to use.
2466
+ If not provided, the server name associated with the instance is used.
2467
+
2468
+ Returns
2469
+ -------
2470
+ None
2471
+
2472
+ Raises
2473
+ ------
2474
+
2475
+ InvalidParameterException
2476
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2477
+ PropertyServerException
2478
+ Raised by the server when an issue arises in processing a valid request
2479
+ NotAuthorizedException
2480
+ The principle specified by the user_id does not have authorization for the requested action
2481
+
2482
+ Notes
2483
+ -----
2484
+ Example body:
2485
+ {
2486
+ "class" : "CollectionMembershipProperties",
2487
+ "membershipRationale": "xxx",
2488
+ "createdBy": "user id here",
2489
+ "expression": "expression that described why the element is a part of this collection",
2490
+ "confidence": 100,
2491
+ "status": "PROPOSED",
2492
+ "userDefinedStatus": "Add valid value here",
2493
+ "steward": "identifier of steward that validated this member",
2494
+ "stewardTypeName": "type name of element identifying the steward",
2495
+ "stewardPropertyName": "property name if the steward's identifier",
2496
+ "source": "source of the member",
2497
+ "notes": "Add notes here"
2498
+ }
2099
2499
 
2100
2500
  """
2101
2501
  loop = asyncio.get_event_loop()
2102
- loop.run_until_complete(self._async_add_to_collection(collection_guid, element_guid, body, server_name))
2502
+ loop.run_until_complete(
2503
+ self._async_add_to_collection(
2504
+ collection_guid, element_guid, body, server_name
2505
+ )
2506
+ )
2103
2507
  return
2104
2508
 
2105
- async def _async_update_collection_membership(self, collection_guid: str, element_guid: str, body: dict = None,
2106
- replace_all_props: bool = False, server_name: str = None) -> None:
2107
- """ Update an element's membership to a collection. Async version.
2108
-
2109
- Parameters
2110
- ----------
2111
- collection_guid: str
2112
- identity of the collection to return members for.
2113
- element_guid: str
2114
- Effective time of the query. If not specified will default to any time.
2115
- body: dict, optional, defaults to None
2116
- The body of the request to add to the collection. See notes.
2117
- replace_all_props: bool, optional, defaults to False
2118
- Replace all properties or just update ones specified in body.
2119
- server_name : str, optional
2120
- The name of the server to use.
2121
- If not provided, the server name associated with the instance is used.
2122
-
2123
- Returns
2124
- -------
2125
- None
2126
-
2127
- Raises
2128
- ------
2129
-
2130
- InvalidParameterException
2131
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2132
- PropertyServerException
2133
- Raised by the server when an issue arises in processing a valid request
2134
- NotAuthorizedException
2135
- The principle specified by the user_id does not have authorization for the requested action
2136
-
2137
- Notes
2138
- -----
2139
- Example body:
2140
- {
2141
- "class" : "CollectionMembershipProperties",
2142
- "membershipRationale": "xxx",
2143
- "createdBy": "user id here",
2144
- "expression": "expression that described why the element is a part of this collection",
2145
- "confidence": 100,
2146
- "status": "PROPOSED",
2147
- "userDefinedStatus": "Add valid value here",
2148
- "steward": "identifier of steward that validated this member",
2149
- "stewardTypeName": "type name of element identifying the steward",
2150
- "stewardPropertyName": "property name if the steward's identifier",
2151
- "source": "source of the member",
2152
- "notes": "Add notes here"
2153
- }
2509
+ async def _async_update_collection_membership(
2510
+ self,
2511
+ collection_guid: str,
2512
+ element_guid: str,
2513
+ body: dict = None,
2514
+ replace_all_props: bool = False,
2515
+ server_name: str = None,
2516
+ ) -> None:
2517
+ """Update an element's membership to a collection. Async version.
2518
+
2519
+ Parameters
2520
+ ----------
2521
+ collection_guid: str
2522
+ identity of the collection to return members for.
2523
+ element_guid: str
2524
+ Effective time of the query. If not specified will default to any time.
2525
+ body: dict, optional, defaults to None
2526
+ The body of the request to add to the collection. See notes.
2527
+ replace_all_props: bool, optional, defaults to False
2528
+ Replace all properties or just update ones specified in body.
2529
+ server_name : str, optional
2530
+ The name of the server to use.
2531
+ If not provided, the server name associated with the instance is used.
2532
+
2533
+ Returns
2534
+ -------
2535
+ None
2536
+
2537
+ Raises
2538
+ ------
2539
+
2540
+ InvalidParameterException
2541
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2542
+ PropertyServerException
2543
+ Raised by the server when an issue arises in processing a valid request
2544
+ NotAuthorizedException
2545
+ The principle specified by the user_id does not have authorization for the requested action
2546
+
2547
+ Notes
2548
+ -----
2549
+ Example body:
2550
+ {
2551
+ "class" : "CollectionMembershipProperties",
2552
+ "membershipRationale": "xxx",
2553
+ "createdBy": "user id here",
2554
+ "expression": "expression that described why the element is a part of this collection",
2555
+ "confidence": 100,
2556
+ "status": "PROPOSED",
2557
+ "userDefinedStatus": "Add valid value here",
2558
+ "steward": "identifier of steward that validated this member",
2559
+ "stewardTypeName": "type name of element identifying the steward",
2560
+ "stewardPropertyName": "property name if the steward's identifier",
2561
+ "source": "source of the member",
2562
+ "notes": "Add notes here"
2563
+ }
2154
2564
 
2155
2565
  """
2156
2566
  if server_name is None:
2157
2567
  server_name = self.server_name
2158
2568
  replace_all_props_s = str(replace_all_props).lower()
2159
- url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/members/"
2160
- f"{element_guid}/update?replaceAllProperties={replace_all_props_s}")
2569
+ url = (
2570
+ f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/members/"
2571
+ f"{element_guid}/update?replaceAllProperties={replace_all_props_s}"
2572
+ )
2161
2573
  body_s = body_slimmer(body)
2162
2574
  await self._async_make_request("POST", url, body_s)
2163
2575
  return
2164
2576
 
2165
- def update_collection_membership(self, collection_guid: str, element_guid: str, body: dict = None,
2166
- replace_all_props: bool = False, server_name: str = None) -> None:
2167
- """ Update an element's membership to a collection.
2168
-
2169
- Parameters
2170
- ----------
2171
- collection_guid: str
2172
- identity of the collection to update members for.
2173
- element_guid: str
2174
- Effective time of the query. If not specified will default to any time.
2175
- body: dict, optional, defaults to None
2176
- The body of the request to add to the collection. See notes.
2177
- replace_all_props: bool, optional, defaults to False
2178
- Replace all properties or just update ones specified in body.
2179
- server_name : str, optional
2180
- The name of the server to use.
2181
- If not provided, the server name associated with the instance is used.
2182
-
2183
- Returns
2184
- -------
2185
- None
2186
-
2187
- Raises
2188
- ------
2189
-
2190
- InvalidParameterException
2191
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2192
- PropertyServerException
2193
- Raised by the server when an issue arises in processing a valid request
2194
- NotAuthorizedException
2195
- The principle specified by the user_id does not have authorization for the requested action
2196
-
2197
- Notes
2198
- -----
2199
- Example body:
2200
- {
2201
- "class" : "CollectionMembershipProperties",
2202
- "membershipRationale": "xxx",
2203
- "createdBy": "user id here",
2204
- "expression": "expression that described why the element is a part of this collection",
2205
- "confidence": 100,
2206
- "status": "PROPOSED",
2207
- "userDefinedStatus": "Add valid value here",
2208
- "steward": "identifier of steward that validated this member",
2209
- "stewardTypeName": "type name of element identifying the steward",
2210
- "stewardPropertyName": "property name if the steward's identifier",
2211
- "source": "source of the member",
2212
- "notes": "Add notes here"
2213
- }
2577
+ def update_collection_membership(
2578
+ self,
2579
+ collection_guid: str,
2580
+ element_guid: str,
2581
+ body: dict = None,
2582
+ replace_all_props: bool = False,
2583
+ server_name: str = None,
2584
+ ) -> None:
2585
+ """Update an element's membership to a collection.
2586
+
2587
+ Parameters
2588
+ ----------
2589
+ collection_guid: str
2590
+ identity of the collection to update members for.
2591
+ element_guid: str
2592
+ Effective time of the query. If not specified will default to any time.
2593
+ body: dict, optional, defaults to None
2594
+ The body of the request to add to the collection. See notes.
2595
+ replace_all_props: bool, optional, defaults to False
2596
+ Replace all properties or just update ones specified in body.
2597
+ server_name : str, optional
2598
+ The name of the server to use.
2599
+ If not provided, the server name associated with the instance is used.
2600
+
2601
+ Returns
2602
+ -------
2603
+ None
2604
+
2605
+ Raises
2606
+ ------
2607
+
2608
+ InvalidParameterException
2609
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2610
+ PropertyServerException
2611
+ Raised by the server when an issue arises in processing a valid request
2612
+ NotAuthorizedException
2613
+ The principle specified by the user_id does not have authorization for the requested action
2614
+
2615
+ Notes
2616
+ -----
2617
+ Example body:
2618
+ {
2619
+ "class" : "CollectionMembershipProperties",
2620
+ "membershipRationale": "xxx",
2621
+ "createdBy": "user id here",
2622
+ "expression": "expression that described why the element is a part of this collection",
2623
+ "confidence": 100,
2624
+ "status": "PROPOSED",
2625
+ "userDefinedStatus": "Add valid value here",
2626
+ "steward": "identifier of steward that validated this member",
2627
+ "stewardTypeName": "type name of element identifying the steward",
2628
+ "stewardPropertyName": "property name if the steward's identifier",
2629
+ "source": "source of the member",
2630
+ "notes": "Add notes here"
2631
+ }
2214
2632
 
2215
2633
  """
2216
2634
  loop = asyncio.get_event_loop()
2217
2635
  loop.run_until_complete(
2218
- self._async_update_collection_membership(collection_guid, element_guid, body, replace_all_props,
2219
- server_name))
2636
+ self._async_update_collection_membership(
2637
+ collection_guid, element_guid, body, replace_all_props, server_name
2638
+ )
2639
+ )
2220
2640
  return
2221
2641
 
2222
- async def _async_remove_from_collection(self, collection_guid: str, element_guid: str,
2223
- server_name: str = None) -> None:
2224
- """ Remove an element from a collection. Async version.
2225
-
2226
- Parameters
2227
- ----------
2228
- collection_guid: str
2229
- identity of the collection to return members for.
2230
- element_guid: str
2231
- Effective time of the query. If not specified will default to any time.
2232
- server_name : str, optional
2233
- The name of the server to use.
2234
- If not provided, the server name associated with the instance is used.
2235
-
2236
- Returns
2237
- -------
2238
- None
2239
-
2240
- Raises
2241
- ------
2242
-
2243
- InvalidParameterException
2244
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2245
- PropertyServerException
2246
- Raised by the server when an issue arises in processing a valid request
2247
- NotAuthorizedException
2248
- The principle specified by the user_id does not have authorization for the requested action
2642
+ async def _async_remove_from_collection(
2643
+ self, collection_guid: str, element_guid: str, server_name: str = None
2644
+ ) -> None:
2645
+ """Remove an element from a collection. Async version.
2646
+
2647
+ Parameters
2648
+ ----------
2649
+ collection_guid: str
2650
+ identity of the collection to return members for.
2651
+ element_guid: str
2652
+ Effective time of the query. If not specified will default to any time.
2653
+ server_name : str, optional
2654
+ The name of the server to use.
2655
+ If not provided, the server name associated with the instance is used.
2656
+
2657
+ Returns
2658
+ -------
2659
+ None
2660
+
2661
+ Raises
2662
+ ------
2663
+
2664
+ InvalidParameterException
2665
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2666
+ PropertyServerException
2667
+ Raised by the server when an issue arises in processing a valid request
2668
+ NotAuthorizedException
2669
+ The principle specified by the user_id does not have authorization for the requested action
2249
2670
 
2250
2671
  """
2251
2672
  if server_name is None:
2252
2673
  server_name = self.server_name
2253
2674
 
2254
- url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/members/"
2255
- f"{element_guid}/detach")
2675
+ url = (
2676
+ f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/members/"
2677
+ f"{element_guid}/detach"
2678
+ )
2256
2679
  body = {"class": "NullRequestBody"}
2257
2680
  await self._async_make_request("POST", url, body)
2258
2681
  return
2259
2682
 
2260
- def remove_from_collection(self, collection_guid: str, element_guid: str, server_name: str = None) -> None:
2261
- """ Remove an element from a collection.
2262
-
2263
- Parameters
2264
- ----------
2265
- collection_guid: str
2266
- identity of the collection to return members for.
2267
- element_guid: str
2268
- Effective time of the query. If not specified will default to any time.
2269
- server_name : str, optional
2270
- The name of the server to use.
2271
- If not provided, the server name associated with the instance is used.
2272
-
2273
- Returns
2274
- -------
2275
- None
2276
-
2277
- Raises
2278
- ------
2279
-
2280
- InvalidParameterException
2281
- If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2282
- PropertyServerException
2283
- Raised by the server when an issue arises in processing a valid request
2284
- NotAuthorizedException
2285
- The principle specified by the user_id does not have authorization for the requested action
2683
+ def remove_from_collection(
2684
+ self, collection_guid: str, element_guid: str, server_name: str = None
2685
+ ) -> None:
2686
+ """Remove an element from a collection.
2687
+
2688
+ Parameters
2689
+ ----------
2690
+ collection_guid: str
2691
+ identity of the collection to return members for.
2692
+ element_guid: str
2693
+ Effective time of the query. If not specified will default to any time.
2694
+ server_name : str, optional
2695
+ The name of the server to use.
2696
+ If not provided, the server name associated with the instance is used.
2697
+
2698
+ Returns
2699
+ -------
2700
+ None
2701
+
2702
+ Raises
2703
+ ------
2704
+
2705
+ InvalidParameterException
2706
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2707
+ PropertyServerException
2708
+ Raised by the server when an issue arises in processing a valid request
2709
+ NotAuthorizedException
2710
+ The principle specified by the user_id does not have authorization for the requested action
2286
2711
 
2287
2712
  """
2288
2713
  loop = asyncio.get_event_loop()
2289
- loop.run_until_complete(self._async_remove_from_collection(collection_guid, element_guid, server_name))
2714
+ loop.run_until_complete(
2715
+ self._async_remove_from_collection(
2716
+ collection_guid, element_guid, server_name
2717
+ )
2718
+ )
2290
2719
  return
2291
2720
 
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.
2721
+ async def _async_get_member_list(
2722
+ self, root_collection_name: str, server_name: str = None
2723
+ ) -> list | bool:
2724
+ """Get the member list for the collection - async version.
2294
2725
  Parameters
2295
2726
  ----------
2296
2727
  root_collection_name : str
@@ -2318,8 +2749,9 @@ class CollectionManager(Client):
2318
2749
  return False
2319
2750
  if len(root_guids) != 1:
2320
2751
  raise InvalidParameterException(
2321
- "root_collection_name must have exactly one root collection for this method")
2322
- root = root_guids[0]['elementHeader']['guid']
2752
+ "root_collection_name must have exactly one root collection for this method"
2753
+ )
2754
+ root = root_guids[0]["elementHeader"]["guid"]
2323
2755
 
2324
2756
  # now find the members of the collection
2325
2757
  member_list = []
@@ -2328,21 +2760,25 @@ class CollectionManager(Client):
2328
2760
  return False
2329
2761
  # finally, construct a list of member information
2330
2762
  for member_rel in members:
2331
- member_guid = member_rel['elementHeader']['guid']
2763
+ member_guid = member_rel["elementHeader"]["guid"]
2332
2764
  member_resp = await self._async_get_collection(member_guid)
2333
- member = member_resp['element']
2765
+ member = member_resp["element"]
2334
2766
  # print(json.dumps(member, indent = 4))
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'], }
2767
+ member_instance = {
2768
+ "name": member["properties"]["name"],
2769
+ "qualifiedName": member["properties"]["qualifiedName"],
2770
+ "guid": member["elementHeader"]["guid"],
2771
+ "description": member["properties"]["description"],
2772
+ "collectionType": member["properties"]["collectionType"],
2773
+ }
2340
2774
  member_list.append(member_instance)
2341
2775
 
2342
2776
  return member_list
2343
2777
 
2344
- def get_member_list(self, root_collection_name: str, server_name: str = None) -> list | bool:
2345
- """ Get the member list for the collection.
2778
+ def get_member_list(
2779
+ self, root_collection_name: str, server_name: str = None
2780
+ ) -> list | bool:
2781
+ """Get the member list for the collection.
2346
2782
  Parameters
2347
2783
  ----------
2348
2784
  root_collection_name : str
@@ -2363,5 +2799,7 @@ class CollectionManager(Client):
2363
2799
 
2364
2800
  """
2365
2801
  loop = asyncio.get_event_loop()
2366
- resp = loop.run_until_complete(self._async_get_member_list(root_collection_name, server_name))
2802
+ resp = loop.run_until_complete(
2803
+ self._async_get_member_list(root_collection_name, server_name)
2804
+ )
2367
2805
  return resp