pyegeria 0.3.4__py3-none-any.whl → 0.3.5__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 (23) hide show
  1. pyegeria/__init__.py +3 -1
  2. pyegeria/collection_manager_omvs.py +2428 -0
  3. pyegeria/core_omag_server_config.py +1 -1
  4. pyegeria/project_manager_omvs.py +1689 -0
  5. pyegeria/valid_metadata_omvs.py +779 -0
  6. {pyegeria-0.3.4.data → pyegeria-0.3.5.data}/scripts/multi-server_status.py +1 -4
  7. {pyegeria-0.3.4.data → pyegeria-0.3.5.data}/scripts/view_my_profile.py +1 -1
  8. {pyegeria-0.3.4.dist-info → pyegeria-0.3.5.dist-info}/METADATA +1 -1
  9. {pyegeria-0.3.4.dist-info → pyegeria-0.3.5.dist-info}/RECORD +22 -20
  10. pyegeria/exceptions.py +0 -382
  11. {pyegeria-0.3.4.data → pyegeria-0.3.5.data}/scripts/engine_action_status.py +0 -0
  12. {pyegeria-0.3.4.data → pyegeria-0.3.5.data}/scripts/find_todos.py +0 -0
  13. {pyegeria-0.3.4.data → pyegeria-0.3.5.data}/scripts/glossary_view.py +0 -0
  14. {pyegeria-0.3.4.data → pyegeria-0.3.5.data}/scripts/gov_engine_status.py +0 -0
  15. {pyegeria-0.3.4.data → pyegeria-0.3.5.data}/scripts/integration_daemon_status.py +0 -0
  16. {pyegeria-0.3.4.data → pyegeria-0.3.5.data}/scripts/list_asset_types.py +0 -0
  17. {pyegeria-0.3.4.data → pyegeria-0.3.5.data}/scripts/my_todos.py +0 -0
  18. {pyegeria-0.3.4.data → pyegeria-0.3.5.data}/scripts/open_todos.py +0 -0
  19. {pyegeria-0.3.4.data → pyegeria-0.3.5.data}/scripts/server_status.py +0 -0
  20. {pyegeria-0.3.4.data → pyegeria-0.3.5.data}/scripts/server_status_widget.py +0 -0
  21. {pyegeria-0.3.4.dist-info → pyegeria-0.3.5.dist-info}/LICENSE +0 -0
  22. {pyegeria-0.3.4.dist-info → pyegeria-0.3.5.dist-info}/WHEEL +0 -0
  23. {pyegeria-0.3.4.dist-info → pyegeria-0.3.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,2428 @@
1
+ """
2
+ PDX-License-Identifier: Apache-2.0
3
+ Copyright Contributors to the ODPi Egeria project.
4
+
5
+ Maintain and explore the contents of nested collections.
6
+
7
+ """
8
+ import asyncio
9
+ import time
10
+
11
+ # import json
12
+ from pyegeria._client import Client
13
+ from pyegeria._exceptions import (
14
+ InvalidParameterException,
15
+ )
16
+ from pyegeria._globals import enable_ssl_check
17
+ from pyegeria._validators import (
18
+ validate_guid,
19
+ validate_search_string,
20
+ )
21
+ from pyegeria.utils import body_slimmer
22
+
23
+
24
+ class CollectionManager(Client):
25
+ """
26
+ Maintain and explore the contents of nested collections. These collections can be used to represent digital
27
+ products, or collections of resources for a particular project or team. They can be used to organize assets and
28
+ other resources into logical groups.
29
+
30
+ Attributes:
31
+
32
+ server_name: str
33
+ The name of the View Server to connect to.
34
+ platform_url : str
35
+ URL of the server platform to connect to
36
+ user_id : str
37
+ The identity of the user calling the method - this sets a default optionally used by the methods
38
+ when the user doesn't pass the user_id on a method call.
39
+ user_pwd: str
40
+ The password associated with the user_id. Defaults to None
41
+ verify_flag: bool
42
+ Flag to indicate if SSL Certificates should be verified in the HTTP requests.
43
+ Defaults to False.
44
+
45
+ """
46
+
47
+ def __init__(
48
+ self,
49
+ server_name: str,
50
+ platform_url: str,
51
+ token: str = None,
52
+ user_id: str = None,
53
+ user_pwd: str = None,
54
+ verify_flag: bool = enable_ssl_check,
55
+ sync_mode: bool = True
56
+ ):
57
+ self.command_base: str = f"/api/open-metadata/collection-manager/collections"
58
+ Client.__init__(self, server_name, platform_url, user_id=user_id, token=token, async_mode=sync_mode)
59
+
60
+ #
61
+ # Retrieving Collections - https://egeria-project.org/concepts/collection
62
+ #
63
+ async def _async_get_linked_collections(self, parent_guid: str, server_name: str = None,
64
+ start_from: int = 0, page_size: int = None) -> list | str:
65
+ """ Returns the list of collections that are linked off of the supplied element. Async version.
66
+
67
+ Parameters
68
+ ----------
69
+ parent_guid: str
70
+ The identity of the parent to find linked collections from.
71
+ server_name : str, optional
72
+ The name of the server to configure.
73
+ If not provided, the server name associated with the instance is used.
74
+ start_from: int, [default=0], optional
75
+ When multiple pages of results are available, the page number to start from.
76
+ page_size: int, [default=None]
77
+ The number of items to return in a single page. If not specified, the default will be taken from
78
+ the class instance.
79
+ Returns
80
+ -------
81
+ List | str
82
+
83
+ A list of collections linked off of the supplied element.
84
+
85
+ Raises
86
+ ------
87
+
88
+ InvalidParameterException
89
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
90
+ PropertyServerException
91
+ Raised by the server when an issue arises in processing a valid request
92
+ NotAuthorizedException
93
+ The principle specified by the user_id does not have authorization for the requested action
94
+
95
+ """
96
+ if server_name is None:
97
+ server_name = self.server_name
98
+ if page_size is None:
99
+ page_size = self.page_size
100
+
101
+ body = {
102
+
103
+ }
104
+
105
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/"
106
+ f"metadata-elements/{parent_guid}/collections?startFrom={start_from}&pageSize={page_size}")
107
+
108
+ resp = await self._async_make_request("POST", url, body)
109
+ return resp.json()
110
+
111
+ def get_linked_collections(self, parent_guid: str, server_name: str = None,
112
+ start_from: int = 0, page_size: int = None) -> list | str:
113
+ """ Returns the list of collections that are linked off of the supplied element.
114
+
115
+ Parameters
116
+ ----------
117
+ parent_guid: str
118
+ The identity of the parent to find linked collections from.
119
+ server_name : str, optional
120
+ The name of the server to configure.
121
+ If not provided, the server name associated with the instance is used.
122
+ start_from: int, [default=0], optional
123
+ When multiple pages of results are available, the page number to start from.
124
+ page_size: int, [default=None]
125
+ The number of items to return in a single page. If not specified, the default will be taken from
126
+ the class instance.
127
+ Returns
128
+ -------
129
+ List | str
130
+
131
+ A list of collections linked off of the supplied element.
132
+
133
+ Raises
134
+ ------
135
+
136
+ InvalidParameterException
137
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
138
+ PropertyServerException
139
+ Raised by the server when an issue arises in processing a valid request
140
+ NotAuthorizedException
141
+ The principle specified by the user_id does not have authorization for the requested action
142
+
143
+ """
144
+ loop = asyncio.get_event_loop()
145
+ resp = loop.run_until_complete(self._async_get_linked_collections(parent_guid, server_name,
146
+ start_from, page_size)),
147
+ return resp
148
+
149
+ async def _async_get_classified_collections(self, classification: str, server_name: str = None,
150
+ start_from: int = 0, page_size: int = None) -> list | str:
151
+ """ Returns the list of collections with a particular classification. These classifications
152
+ are typically "RootCollection", "Folder" or "DigitalProduct". Async version.
153
+
154
+ Parameters
155
+ ----------
156
+ classification: str
157
+ The classification of the collection to inspect.
158
+ server_name : str, optional
159
+ The name of the server to configure.
160
+ If not provided, the server name associated with the instance is used.
161
+ start_from: int, [default=0], optional
162
+ When multiple pages of results are available, the page number to start from.
163
+ page_size: int, [default=None]
164
+ The number of items to return in a single page. If not specified, the default will be taken from
165
+ the class instance.
166
+
167
+ Returns
168
+ -------
169
+ list | str
170
+ The list of collections (if found) with the specified classification. Returns a string if none found.
171
+
172
+ Raises
173
+ ------
174
+ InvalidParameterException
175
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
176
+ PropertyServerException
177
+ Raised by the server when an issue arises in processing a valid request.
178
+ NotAuthorizedException
179
+ The principle specified by the user_id does not have authorization for the requested action.
180
+ Notes
181
+ -----
182
+ """
183
+ if server_name is None:
184
+ server_name = self.server_name
185
+ if page_size is None:
186
+ page_size = self.page_size
187
+
188
+ body = {
189
+ "filter": classification
190
+ }
191
+
192
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/by-classifications?"
193
+ f"startFrom={start_from}&pageSize={page_size}")
194
+
195
+ resp = await self._async_make_request("POST", url, body)
196
+ # result = resp.json().get("elements","No elements found")
197
+ result = resp.json().get("elements", "No Elements to return")
198
+ return result
199
+
200
+ def get_classified_collections(self, classification: str, server_name: str = None,
201
+ start_from: int = 0, page_size: int = None) -> list | str:
202
+ """ Returns the list of collections with a particular classification. These classifications
203
+ are typically "RootCollection", "Folder" or "DigitalProduct".
204
+
205
+ Parameters
206
+ ----------
207
+ classification: str
208
+ The classification of the collection to inspect.
209
+ server_name : str, optional
210
+ The name of the server to configure.
211
+ If not provided, the server name associated with the instance is used.
212
+ start_from: int, [default=0], optional
213
+ When multiple pages of results are available, the page number to start from.
214
+ page_size: int, [default=None]
215
+ The number of items to return in a single page. If not specified, the default will be taken from
216
+ the class instance.
217
+ Returns
218
+ -------
219
+ List | str
220
+
221
+ A list of collections linked off of the supplied element.
222
+
223
+ Raises
224
+ ------
225
+
226
+ InvalidParameterException
227
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
228
+ PropertyServerException
229
+ Raised by the server when an issue arises in processing a valid request
230
+ NotAuthorizedException
231
+ The principle specified by the user_id does not have authorization for the requested action
232
+
233
+ """
234
+ loop = asyncio.get_event_loop()
235
+ resp = loop.run_until_complete(self._async_get_classified_collections(classification, server_name,
236
+ start_from, page_size)),
237
+ return resp
238
+
239
+ async def _async_find_collections(self, search_string: str, effective_time: str = None, starts_with: bool = False,
240
+ ends_with: bool = False, ignore_case: bool = False,
241
+ server_name: str = None,
242
+ start_from: int = 0, page_size: int = None) -> list | str:
243
+ """ Returns the list of collections matching the search string.
244
+ The search string is located in the request body and is interpreted as a plain string.
245
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
246
+
247
+ Parameters
248
+ ----------
249
+ search_string: str,
250
+ Search string to use to find matching collections. If the search string is '*' then all glossaries returned.
251
+ effective_time: str, [default=None], optional
252
+ Effective time of the query. If not specified will default to any time. ISO8601 format is assumed.
253
+ server_name : str, optional
254
+ The name of the server to configure.
255
+ If not provided, the server name associated with the instance is used.
256
+ starts_with : bool, [default=False], optional
257
+ Starts with the supplied string.
258
+ ends_with : bool, [default=False], optional
259
+ Ends with the supplied string
260
+ ignore_case : bool, [default=False], optional
261
+ Ignore case when searching
262
+ start_from: int, [default=0], optional
263
+ When multiple pages of results are available, the page number to start from.
264
+ page_size: int, [default=None]
265
+ The number of items to return in a single page. If not specified, the default will be taken from
266
+ the class instance.
267
+ Returns
268
+ -------
269
+ List | str
270
+
271
+ A list of collections match matching the search string. Returns a string if none found.
272
+
273
+ Raises
274
+ ------
275
+
276
+ InvalidParameterException
277
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
278
+ PropertyServerException
279
+ Raised by the server when an issue arises in processing a valid request
280
+ NotAuthorizedException
281
+ The principle specified by the user_id does not have authorization for the requested action
282
+
283
+ """
284
+ if server_name is None:
285
+ server_name = self.server_name
286
+ if page_size is None:
287
+ page_size = self.page_size
288
+ starts_with_s = str(starts_with).lower()
289
+ ends_with_s = str(ends_with).lower()
290
+ ignore_case_s = str(ignore_case).lower()
291
+
292
+ validate_search_string(search_string)
293
+
294
+ if search_string == '*':
295
+ search_string = None
296
+
297
+ body = {
298
+ "filter": search_string,
299
+ "effective_time": effective_time
300
+ }
301
+
302
+ body_s = body_slimmer(body)
303
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/"
304
+ f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
305
+ f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}")
306
+
307
+ resp = await self._async_make_request("POST", url, body_s)
308
+ return resp.json().get("elements", "No elements found")
309
+
310
+ def find_collections(self, search_string: str, effective_time: str = None, starts_with: bool = False,
311
+ ends_with: bool = False, ignore_case: bool = False, server_name: str = None,
312
+ start_from: int = 0, page_size: int = None) -> list | str:
313
+ """ Returns the list of collections matching the search string. Async version.
314
+ The search string is located in the request body and is interpreted as a plain string.
315
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
316
+
317
+ Parameters
318
+ ----------
319
+ search_string: str,
320
+ Search string to use to find matching collections. If the search string is '*' then all glossaries returned.
321
+ effective_time: str, [default=None], optional
322
+ Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
323
+ server_name : str, optional
324
+ The name of the server to configure.
325
+ If not provided, the server name associated with the instance is used.
326
+ starts_with : bool, [default=False], optional
327
+ Starts with the supplied string.
328
+ ends_with : bool, [default=False], optional
329
+ Ends with the supplied string
330
+ ignore_case : bool, [default=False], optional
331
+ Ignore case when searching
332
+ start_from: int, [default=0], optional
333
+ When multiple pages of results are available, the page number to start from.
334
+ page_size: int, [default=None]
335
+ The number of items to return in a single page. If not specified, the default will be taken from
336
+ the class instance.
337
+ Returns
338
+ -------
339
+ List | str
340
+
341
+ A list of collections match matching the search string. Returns a string if none found.
342
+
343
+ Raises
344
+ ------
345
+
346
+ InvalidParameterException
347
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
348
+ PropertyServerException
349
+ Raised by the server when an issue arises in processing a valid request
350
+ NotAuthorizedException
351
+ The principle specified by the user_id does not have authorization for the requested action
352
+
353
+ """
354
+ loop = asyncio.get_event_loop()
355
+ resp = loop.run_until_complete(self._async_find_collections(search_string, effective_time, starts_with,
356
+ ends_with, ignore_case,
357
+ server_name, start_from, page_size))
358
+
359
+ return resp
360
+
361
+ async def _async_get_collections_by_name(self, name: str, effective_time: str = None,
362
+ server_name: str = None,
363
+ start_from: int = 0, page_size: int = None) -> list | str:
364
+ """ Returns the list of collections with a particular name.
365
+
366
+ Parameters
367
+ ----------
368
+ name: str,
369
+ name to use to find matching collections.
370
+ effective_time: str, [default=None], optional
371
+ Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
372
+ server_name : str, optional
373
+ The name of the server to configure.
374
+ If not provided, the server name associated with the instance is used.
375
+ start_from: int, [default=0], optional
376
+ When multiple pages of results are available, the page number to start from.
377
+ page_size: int, [default=None]
378
+ The number of items to return in a single page. If not specified, the default will be taken from
379
+ the class instance.
380
+ Returns
381
+ -------
382
+ List | str
383
+
384
+ A list of collections match matching the name. Returns a string if none found.
385
+
386
+ Raises
387
+ ------
388
+
389
+ InvalidParameterException
390
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
391
+ PropertyServerException
392
+ Raised by the server when an issue arises in processing a valid request
393
+ NotAuthorizedException
394
+ The principle specified by the user_id does not have authorization for the requested action
395
+
396
+ """
397
+ if server_name is None:
398
+ server_name = self.server_name
399
+ if page_size is None:
400
+ page_size = self.page_size
401
+
402
+ validate_search_string(name)
403
+
404
+ body = {
405
+ "filter": name,
406
+ effective_time: effective_time,
407
+ }
408
+ body_s = body_slimmer(body)
409
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/"
410
+ f"by-name?startFrom={start_from}&pageSize={page_size}")
411
+
412
+ resp = await self._async_make_request("POST", url, body_s)
413
+ return resp.json().get("elements", "No elements found")
414
+
415
+ def get_collections_by_name(self, name: str, effective_time: str = None, server_name: str = None,
416
+ start_from: int = 0, page_size: int = None) -> list | str:
417
+ """ Returns the list of collections matching the search string. Async version.
418
+ The search string is located in the request body and is interpreted as a plain string.
419
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
420
+
421
+ Parameters
422
+ ----------
423
+ name: str,
424
+ name to use to find matching collections.
425
+ effective_time: str, [default=None], optional
426
+ Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
427
+ server_name : str, optional
428
+ The name of the server to configure.
429
+ If not provided, the server name associated with the instance is used.
430
+ start_from: int, [default=0], optional
431
+ When multiple pages of results are available, the page number to start from.
432
+ page_size: int, [default=None]
433
+ The number of items to return in a single page. If not specified, the default will be taken from
434
+ the class instance.
435
+
436
+ Returns
437
+ -------
438
+ List | str
439
+
440
+ A list of collections match matching the search string. Returns a string if none found.
441
+
442
+ Raises
443
+ ------
444
+
445
+ InvalidParameterException
446
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
447
+ PropertyServerException
448
+ Raised by the server when an issue arises in processing a valid request
449
+ NotAuthorizedException
450
+ The principle specified by the user_id does not have authorization for the requested action
451
+
452
+ """
453
+ loop = asyncio.get_event_loop()
454
+ resp = loop.run_until_complete(self._async_get_collections_by_name(name, effective_time,
455
+ server_name, start_from, page_size))
456
+
457
+ return resp
458
+
459
+ async def _async_get_collections_by_type(self, collection_type: str, effective_time: str = None,
460
+ server_name: str = None,
461
+ start_from: int = 0, page_size: int = None) -> list | str:
462
+ """ Returns the list of collections with a particular collectionType. This is an optional text field in the
463
+ collection element.
464
+
465
+ Parameters
466
+ ----------
467
+ collection_type: str,
468
+ collection_type to use to find matching collections.
469
+ effective_time: str, [default=None], optional
470
+ Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
471
+ server_name : str, optional
472
+ The name of the server to configure.
473
+ If not provided, the server name associated with the instance is used.
474
+ start_from: int, [default=0], optional
475
+ When multiple pages of results are available, the page number to start from.
476
+ page_size: int, [default=None]
477
+ The number of items to return in a single page. If not specified, the default will be taken from
478
+ the class instance.
479
+
480
+ Returns
481
+ -------
482
+ List | str
483
+
484
+ A list of collections match matching the name. Returns a string if none found.
485
+
486
+ Raises
487
+ ------
488
+
489
+ InvalidParameterException
490
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
491
+ PropertyServerException
492
+ Raised by the server when an issue arises in processing a valid request
493
+ NotAuthorizedException
494
+ The principle specified by the user_id does not have authorization for the requested action
495
+
496
+ """
497
+ if server_name is None:
498
+ server_name = self.server_name
499
+ if page_size is None:
500
+ page_size = self.page_size
501
+
502
+ validate_search_string(collection_type)
503
+
504
+ body = {
505
+ "filter": collection_type,
506
+ effective_time: effective_time,
507
+ }
508
+ body_s = body_slimmer(body)
509
+
510
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/"
511
+ f"by-collection-type?startFrom={start_from}&pageSize={page_size}")
512
+
513
+ resp = await self._async_make_request("POST", url, body_s)
514
+ return resp.json().get("elements", "No elements found")
515
+
516
+ def get_collections_by_type(self, collection_type: str, effective_time: str = None, server_name: str = None,
517
+ start_from: int = 0, page_size: int = None) -> list | str:
518
+ """ Returns the list of collections matching the search string. Async version.
519
+ The search string is located in the request body and is interpreted as a plain string.
520
+ The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
521
+
522
+ Parameters
523
+ ----------
524
+ collection_type: str,
525
+ collection type to find.
526
+ effective_time: str, [default=None], optional
527
+ Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
528
+ server_name : str, optional
529
+ The name of the server to configure.
530
+ If not provided, the server name associated with the instance is used.
531
+ start_from: int, [default=0], optional
532
+ When multiple pages of results are available, the page number to start from.
533
+ page_size: int, [default=None]
534
+ The number of items to return in a single page. If not specified, the default will be taken from
535
+ the class instance.
536
+
537
+ Returns
538
+ -------
539
+ List | str
540
+
541
+ A list of collections match matching the search string. Returns a string if none found.
542
+
543
+ Raises
544
+ ------
545
+
546
+ InvalidParameterException
547
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
548
+ PropertyServerException
549
+ Raised by the server when an issue arises in processing a valid request
550
+ NotAuthorizedException
551
+ The principle specified by the user_id does not have authorization for the requested action
552
+
553
+ """
554
+ loop = asyncio.get_event_loop()
555
+ resp = loop.run_until_complete(self._async_get_collections_by_type(collection_type, effective_time,
556
+ server_name, start_from, page_size))
557
+
558
+ return resp
559
+
560
+ async def _async_get_collection(self, collection_guid: str, effective_time: str = None,
561
+ server_name: str = None) -> dict | str:
562
+ """ Return the properties of a specific collection. Async version.
563
+
564
+ Parameters
565
+ ----------
566
+ collection_guid: str,
567
+ unique identifier of the collection.
568
+ effective_time: str, [default=None], optional
569
+ Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
570
+ server_name : str, optional
571
+ The name of the server to configure.
572
+ If not provided, the server name associated with the instance is used.
573
+
574
+ Returns
575
+ -------
576
+ dict | str
577
+
578
+ A JSON dict representing the specified collection. Returns a string if none found.
579
+
580
+ Raises
581
+ ------
582
+
583
+ InvalidParameterException
584
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
585
+ PropertyServerException
586
+ Raised by the server when an issue arises in processing a valid request
587
+ NotAuthorizedException
588
+ The principle specified by the user_id does not have authorization for the requested action
589
+
590
+ """
591
+ if server_name is None:
592
+ server_name = self.server_name
593
+
594
+ validate_guid(collection_guid)
595
+
596
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}"
597
+ body = {
598
+ "effective_time": effective_time,
599
+ }
600
+ resp = await self._async_make_request("GET", url, body)
601
+ return resp.json()
602
+
603
+ def get_collection(self, collection_guid: str, effective_time: str = None, server_name: str = None) -> dict | str:
604
+ """ Return the properties of a specific collection.
605
+
606
+ Parameters
607
+ ----------
608
+ collection_guid: str,
609
+ unique identifier of the collection.
610
+ effective_time: str, [default=None], optional
611
+ Effective time of the query. If not specified will default to any time.
612
+ server_name : str, optional
613
+ The name of the server to configure.
614
+ If not provided, the server name associated with the instance is used.
615
+
616
+ Returns
617
+ -------
618
+ dict | str
619
+
620
+ A JSON dict representing the specified collection. Returns a string if none found.
621
+
622
+ Raises
623
+ ------
624
+
625
+ InvalidParameterException
626
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
627
+ PropertyServerException
628
+ Raised by the server when an issue arises in processing a valid request
629
+ NotAuthorizedException
630
+ The principle specified by the user_id does not have authorization for the requested action
631
+
632
+ """
633
+ loop = asyncio.get_event_loop()
634
+ resp = loop.run_until_complete(self._async_get_collection(collection_guid, effective_time,
635
+ server_name))
636
+
637
+ return resp
638
+
639
+ #
640
+ # Create collection methods
641
+ #
642
+ async def _async_create_collection_w_body(self, classification_name: str, body: dict,
643
+ server_name: str = None) -> str:
644
+ """ Create Collections: https://egeria-project.org/concepts/collection Async version.
645
+
646
+ Parameters
647
+ ----------
648
+ classification_name: str
649
+ Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
650
+ body: dict
651
+ A dict representing the details of the collection to create.
652
+ server_name: str, optional, defaults to None
653
+ The name of the server to configure. If not provided, the server name associated with the
654
+ instance is used.
655
+
656
+ Returns
657
+ -------
658
+ str - the guid of the created collection
659
+
660
+ A JSON dict representing the specified collection. Returns a string if none found.
661
+
662
+ Raises
663
+ ------
664
+ InvalidParameterException
665
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
666
+ PropertyServerException
667
+ Raised by the server when an issue arises in processing a valid request
668
+ NotAuthorizedException
669
+ The principle specified by the user_id does not have authorization for the requested action
670
+
671
+ """
672
+ if server_name is None:
673
+ server_name = self.server_name
674
+
675
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}?"
676
+ f"classificationName={classification_name}")
677
+
678
+ resp = await self._async_make_request("POST", url, body)
679
+ return resp.json().get("guid", "No GUID returned")
680
+
681
+ def create_collection_w_body(self, classification_name: str, body: dict, server_name: str = None) -> str:
682
+ """ Create Collections: https://egeria-project.org/concepts/collection
683
+
684
+ Parameters
685
+ ----------
686
+ classification_name: str
687
+ Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
688
+ body: dict
689
+ A dict representing the details of the collection to create.
690
+ server_name: str, optional, defaults to None
691
+ The name of the server to configure. If not provided, the server name associated with the instance is
692
+ used.
693
+
694
+ Returns
695
+ -------
696
+ str - the guid of the created collection
697
+
698
+ A JSON dict representing the specified collection. Returns a string if none found.
699
+
700
+ Raises
701
+ ------
702
+ InvalidParameterException
703
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
704
+ PropertyServerException
705
+ Raised by the server when an issue arises in processing a valid request
706
+ NotAuthorizedException
707
+ The principle specified by the user_id does not have authorization for the requested action
708
+
709
+ """
710
+ loop = asyncio.get_event_loop()
711
+ resp = loop.run_until_complete(self._async_create_collection_w_body(classification_name, body, server_name))
712
+ return resp
713
+
714
+ async def _async_create_collection(self, classification_name: str, anchor_guid: str, parent_guid: str,
715
+ parent_relationship_type_name: str, parent_at_end1: bool, display_name: str,
716
+ description: str, collection_type: str, is_own_anchor: bool = False,
717
+ collection_ordering: str = None,
718
+ order_property_name: str = None, server_name: str = None) -> str:
719
+ """ Create Collections: https://egeria-project.org/concepts/collection Async version.
720
+
721
+ Parameters
722
+ ----------
723
+ classification_name: str
724
+ Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
725
+ anchor_guid: str
726
+ The unique identifier of the element that should be the anchor for the new element. Set to null if no
727
+ anchor, or if this collection is to be its own anchor.
728
+ parent_guid: str
729
+ The optional unique identifier for an element that should be connected to the newly created element.
730
+ If this property is specified, parentRelationshipTypeName must also be specified
731
+ parent_relationship_type_name: str
732
+ The name of the relationship, if any, that should be established between the new element and the parent
733
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
734
+ parent_at_end1: bool
735
+ Identifies which end any parent entity sits on the relationship.
736
+ display_name: str
737
+ The display name of the element. Will also be used as the basis of the qualified_name.
738
+ description: str
739
+ A description of the collection.
740
+ collection_type: str
741
+ Add appropriate valid value for the collection type.
742
+ is_own_anchor: bool, optional, defaults to False
743
+ Indicates if the collection should classified as its own anchor or not.
744
+ collection_ordering: str, optional, defaults to "OTHER"
745
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED",
746
+ "OTHER"
747
+ order_property_name: str, optional, defaults to "Something"
748
+ Property to use for sequencing if collection_ordering is "OTHER"
749
+ server_name: str, optional, defaults to None
750
+ The name of the server to configure. If not provided, the server name associated with the instance is
751
+ used.
752
+
753
+ Returns
754
+ -------
755
+ str - the guid of the created collection
756
+
757
+ A JSON dict representing the specified collection. Returns a string if none found.
758
+
759
+ Raises
760
+ ------
761
+ InvalidParameterException
762
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
763
+ PropertyServerException
764
+ Raised by the server when an issue arises in processing a valid request
765
+ NotAuthorizedException
766
+ The principle specified by the user_id does not have authorization for the requested action
767
+
768
+ """
769
+ if server_name is None:
770
+ server_name = self.server_name
771
+
772
+ if parent_guid is None:
773
+ is_own_anchor = False
774
+ is_own_anchor_s = str(is_own_anchor).lower()
775
+
776
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}?"
777
+ f"classificationName={classification_name}")
778
+
779
+ body = {
780
+ "anchorGUID": anchor_guid,
781
+ "isOwnAnchor": is_own_anchor_s,
782
+ "parentGUID": parent_guid,
783
+ "parentRelationshipTypeName": parent_relationship_type_name,
784
+ "parentAtEnd1": parent_at_end1,
785
+ "collectionProperties": {
786
+ "class": "CollectionProperties",
787
+ "qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
788
+ "name": display_name,
789
+ "description": description,
790
+ "collectionType": collection_type,
791
+ "collectionOrdering": collection_ordering,
792
+ "orderPropertyName": order_property_name
793
+ }
794
+ }
795
+
796
+ resp = await self._async_make_request("POST", url, body)
797
+ return resp.json().get("guid", "No GUID returned")
798
+
799
+ def create_collection(self, classification_name: str, anchor_guid: str, parent_guid: str,
800
+ parent_relationship_type_name: str, parent_at_end1: bool, display_name: str,
801
+ description: str, collection_type: str, is_own_anchor: bool = False,
802
+ collection_ordering: str = "OTHER", order_property_name: str = "Something",
803
+ server_name: str = None) \
804
+ -> str:
805
+ """ Create Collections: https://egeria-project.org/concepts/collection
806
+
807
+ Parameters
808
+ ----------
809
+ classification_name: str
810
+ Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
811
+ anchor_guid: str
812
+ The unique identifier of the element that should be the anchor for the new element.
813
+ Set to null if no anchor, or if this collection is to be its own anchor.
814
+ parent_guid: str
815
+ The optional unique identifier for an element that should be connected to the newly created element.
816
+ If this property is specified, parentRelationshipTypeName must also be specified
817
+ parent_relationship_type_name: str
818
+ The name of the relationship, if any, that should be established between the new element and the parent
819
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
820
+ parent_at_end1: bool
821
+ Identifies which end any parent entity sits on the relationship.
822
+ display_name: str
823
+ The display name of the element. Will also be used as the basis of the qualified_name.
824
+ description: str
825
+ A description of the collection.
826
+ collection_type: str
827
+ Add appropriate valid value for the collection type.
828
+ is_own_anchor: bool, optional, defaults to False
829
+ Indicates if the collection should classified as its own anchor or not.
830
+ collection_ordering: str, optional, defaults to "OTHER"
831
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
832
+ "DATE_CREATED", "OTHER"
833
+ order_property_name: str, optional, defaults to "Something"
834
+ Property to use for sequencing if collection_ordering is "OTHER"
835
+ server_name: str, optional, defaults to None
836
+ The name of the server to configure. If not provided, the server name associated with the
837
+ instance is used.
838
+
839
+ Returns
840
+ -------
841
+ str - the guid of the created collection
842
+
843
+ A JSON dict representing the specified collection. Returns a string if none found.
844
+
845
+ Raises
846
+ ------
847
+ InvalidParameterException
848
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
849
+ PropertyServerException
850
+ Raised by the server when an issue arises in processing a valid request
851
+ NotAuthorizedException
852
+ The principle specified by the user_id does not have authorization for the requested action
853
+
854
+ """
855
+ loop = asyncio.get_event_loop()
856
+ resp = loop.run_until_complete(self._async_create_collection(classification_name, anchor_guid, parent_guid,
857
+ parent_relationship_type_name, parent_at_end1,
858
+ display_name, description,
859
+ collection_type, is_own_anchor,
860
+ collection_ordering,
861
+ order_property_name, server_name))
862
+ return resp
863
+
864
+ async def _async_create_root_collection(self, anchor_guid: str, parent_guid: str,
865
+ parent_relationship_type_name: str, parent_at_end1: bool, display_name: str,
866
+ description: str, collection_type: str, is_own_anchor: bool = False,
867
+ server_name: str = None) -> str:
868
+ """ Create a new collection with the RootCollection classification. Used to identify the top of a
869
+ collection hierarchy. Async version.
870
+
871
+ Parameters
872
+ ----------
873
+ anchor_guid: str
874
+ The unique identifier of the element that should be the anchor for the new element.
875
+ Set to null if no anchor, or if this collection is to be its own anchor.
876
+ parent_guid: str
877
+ The optional unique identifier for an element that should be connected to the newly created element.
878
+ If this property is specified, parentRelationshipTypeName must also be specified
879
+ parent_relationship_type_name: str
880
+ The name of the relationship, if any, that should be established between the new element and the parent
881
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
882
+ parent_at_end1: bool
883
+ Identifies which end any parent entity sits on the relationship.
884
+ display_name: str
885
+ The display name of the element. Will also be used as the basis of the qualified_name.
886
+ description: str
887
+ A description of the collection.
888
+ collection_type: str
889
+ Add appropriate valid value for the collection type.
890
+ is_own_anchor: bool, optional, defaults to False
891
+ Indicates if the collection should classified as its own anchor or not.
892
+ server_name: str, optional, defaults to None
893
+ The name of the server to configure. If none, the server name associated with the instance is used.
894
+
895
+ Returns
896
+ -------
897
+ str - the guid of the created collection
898
+
899
+ A JSON dict representing the specified collection. Returns a string if none found.
900
+
901
+ Raises
902
+ ------
903
+ InvalidParameterException
904
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
905
+ PropertyServerException
906
+ Raised by the server when an issue arises in processing a valid request
907
+ NotAuthorizedException
908
+ The principle specified by the user_id does not have authorization for the requested action
909
+
910
+ """
911
+ if server_name is None:
912
+ server_name = self.server_name
913
+ is_own_anchor_s = str(is_own_anchor).lower()
914
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/root-collection"
915
+
916
+ body = {
917
+ "anchorGUID": anchor_guid,
918
+ "isOwnAnchor": is_own_anchor_s,
919
+ "parentGUID": parent_guid,
920
+ "parentRelationshipTypeName": parent_relationship_type_name,
921
+ "parentAtEnd1": parent_at_end1,
922
+ "collectionProperties": {
923
+ "class": "CollectionProperties",
924
+ "qualifiedName": f"root-collection-{display_name}-{time.asctime()}",
925
+ "name": display_name,
926
+ "description": description,
927
+ "collectionType": collection_type,
928
+
929
+ }
930
+ }
931
+
932
+ resp = await self._async_make_request("POST", url, body)
933
+ return resp.json().get("guid", "No GUID Returned")
934
+
935
+ def create_root_collection(self, anchor_guid: str, parent_guid: str,
936
+ parent_relationship_type_name: str, parent_at_end1: bool, display_name: str,
937
+ description: str, collection_type: str, is_own_anchor: bool = False,
938
+ server_name: str = None) \
939
+ -> str:
940
+ """ Create a new collection with the RootCollection classification. Used to identify the top of a
941
+ collection hierarchy.
942
+
943
+ Parameters
944
+ ----------
945
+ anchor_guid: str
946
+ The unique identifier of the element that should be the anchor for the new element.
947
+ Set to null if no anchor,
948
+ or if this collection is to be its own anchor.
949
+ parent_guid: str
950
+ The optional unique identifier for an element that should be connected to the newly created element.
951
+ If this property is specified, parentRelationshipTypeName must also be specified
952
+ parent_relationship_type_name: str
953
+ The name of the relationship, if any, that should be established between the new element and the parent
954
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
955
+ parent_at_end1: bool
956
+ Identifies which end any parent entity sits on the relationship.
957
+ display_name: str
958
+ The display name of the element. Will also be used as the basis of the qualified_name.
959
+ description: str
960
+ A description of the collection.
961
+ collection_type: str
962
+ Add appropriate valid value for the collection type.
963
+ is_own_anchor: bool, optional, defaults to False
964
+ Indicates if the collection should classified as its own anchor or not.
965
+ server_name: str, optional, defaults to None
966
+ The name of the server to configure. If None, the server name associated with the instance is used.
967
+
968
+ Returns
969
+ -------
970
+ str - the guid of the created collection
971
+
972
+ A JSON dict representing the specified collection. Returns a string if none found.
973
+
974
+ Raises
975
+ ------
976
+ InvalidParameterException
977
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
978
+ PropertyServerException
979
+ Raised by the server when an issue arises in processing a valid request
980
+ NotAuthorizedException
981
+ The principle specified by the user_id does not have authorization for the requested action
982
+
983
+ """
984
+ loop = asyncio.get_event_loop()
985
+ resp = loop.run_until_complete(self._async_create_root_collection(anchor_guid, parent_guid,
986
+ parent_relationship_type_name, parent_at_end1,
987
+ display_name, description,
988
+ collection_type, is_own_anchor,
989
+ server_name))
990
+ return resp
991
+
992
+ async def _async_create_data_spec_collection(self, anchor_guid: str, parent_guid: str,
993
+ parent_relationship_type_name: str, parent_at_end1: bool,
994
+ display_name: str,
995
+ description: str, collection_type: str, is_own_anchor: bool = True,
996
+ collection_ordering: str = "OTHER",
997
+ order_property_name: str = "Something",
998
+ server_name: str = None) -> str:
999
+ """ Create a new collection with the DataSpec classification. Used to identify a collection of data fields
1000
+ and schema types. Async version.
1001
+
1002
+ Parameters
1003
+ ----------
1004
+ anchor_guid: str
1005
+ The unique identifier of the element that should be the anchor for the new element.
1006
+ Set to null if no anchor, or if this collection is to be its own anchor.
1007
+ parent_guid: str
1008
+ The optional unique identifier for an element that should be connected to the newly created element.
1009
+ If this property is specified, parentRelationshipTypeName must also be specified
1010
+ parent_relationship_type_name: str
1011
+ The name of the relationship, if any, that should be established between the new element and the parent
1012
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
1013
+ parent_at_end1: bool
1014
+ Identifies which end any parent entity sits on the relationship.
1015
+ display_name: str
1016
+ The display name of the element. Will also be used as the basis of the qualified_name.
1017
+ description: str
1018
+ A description of the collection.
1019
+ collection_type: str
1020
+ Add appropriate valid value for the collection type.
1021
+ is_own_anchor: bool, optional, defaults to False
1022
+ Indicates if the collection should classified as its own anchor or not.
1023
+ collection_ordering: str, optional, defaults to "OTHER"
1024
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1025
+ "DATE_CREATED", "OTHER"
1026
+ order_property_name: str, optional, defaults to "Something"
1027
+ Property to use for sequencing if collection_ordering is "OTHER"
1028
+ server_name: str, optional, defaults to None
1029
+ The name of the server to configure. If None, the server name associated with the instance is used.
1030
+
1031
+ Returns
1032
+ -------
1033
+ str - the guid of the created collection
1034
+
1035
+ A JSON dict representing the specified collection. Returns a string if none found.
1036
+
1037
+ Raises
1038
+ ------
1039
+ InvalidParameterException
1040
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1041
+ PropertyServerException
1042
+ Raised by the server when an issue arises in processing a valid request
1043
+ NotAuthorizedException
1044
+ The principle specified by the user_id does not have authorization for the requested action
1045
+ """
1046
+
1047
+ if server_name is None:
1048
+ server_name = self.server_name
1049
+ is_own_anchor_s = str(is_own_anchor).lower()
1050
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/data-spec-collection"
1051
+
1052
+ body = {
1053
+ "anchorGUID": anchor_guid,
1054
+ "isOwnAnchor": is_own_anchor_s,
1055
+ "parentGUID": parent_guid,
1056
+ "parentRelationshipTypeName": parent_relationship_type_name,
1057
+ "parentAtEnd1": parent_at_end1,
1058
+ "collectionProperties": {
1059
+ "class": "CollectionProperties",
1060
+ "qualifiedName": f"data-spec-collection-{display_name}-{time.asctime()}",
1061
+ "name": display_name,
1062
+ "description": description,
1063
+ "collectionType": collection_type,
1064
+ "collectionOrdering": collection_ordering,
1065
+ "orderPropertyName": order_property_name
1066
+ }
1067
+ }
1068
+
1069
+ resp = await self._async_make_request("POST", url, body)
1070
+ return resp.json().get("guid", "No GUID Returned")
1071
+
1072
+ def create_data_spec_collection(self, anchor_guid: str, parent_guid: str,
1073
+ parent_relationship_type_name: str, parent_at_end1: bool, display_name: str,
1074
+ description: str, collection_type: str, is_own_anchor: bool,
1075
+ collection_ordering: str = "OTHER",
1076
+ order_property_name: str = "Something", server_name: str = None) -> str:
1077
+ """ Create a new collection with the DataSpec classification. Used to identify a collection of data fields
1078
+ and schema types.
1079
+
1080
+ Parameters
1081
+ ----------
1082
+ anchor_guid: str
1083
+ The unique identifier of the element that should be the anchor for the new element.
1084
+ Set to null if no anchor, or if this collection is to be its own anchor.
1085
+ parent_guid: str
1086
+ The optional unique identifier for an element that should be connected to the newly created element.
1087
+ If this property is specified, parentRelationshipTypeName must also be specified
1088
+ parent_relationship_type_name: str
1089
+ The name of the relationship, if any, that should be established between the new element and the parent
1090
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
1091
+ parent_at_end1: bool
1092
+ Identifies which end any parent entity sits on the relationship.
1093
+ display_name: str
1094
+ The display name of the element. Will also be used as the basis of the qualified_name.
1095
+ description: str
1096
+ A description of the collection.
1097
+ collection_type: str
1098
+ Add appropriate valid value for the collection type.
1099
+ is_own_anchor: bool, optional, defaults to False
1100
+ Indicates if the collection should classified as its own anchor or not.
1101
+ collection_ordering: str, optional, defaults to "OTHER"
1102
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED", "OTHER"
1103
+ order_property_name: str, optional, defaults to "Something"
1104
+ Property to use for sequencing if collection_ordering is "OTHER"
1105
+ server_name: str, optional, defaults to None
1106
+ The name of the server to configure. If not provided, the server name associated with the instance is used.
1107
+
1108
+ Returns
1109
+ -------
1110
+ str - the guid of the created collection
1111
+
1112
+ A JSON dict representing the specified collection. Returns a string if none found.
1113
+
1114
+ Raises
1115
+ ------
1116
+ InvalidParameterException
1117
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1118
+ PropertyServerException
1119
+ Raised by the server when an issue arises in processing a valid request
1120
+ NotAuthorizedException
1121
+ The principle specified by the user_id does not have authorization for the requested action
1122
+
1123
+ """
1124
+ loop = asyncio.get_event_loop()
1125
+ resp = loop.run_until_complete(self._async_create_data_spec_collection(anchor_guid, parent_guid,
1126
+ parent_relationship_type_name,
1127
+ parent_at_end1,
1128
+ display_name, description,
1129
+ collection_type, is_own_anchor,
1130
+ collection_ordering,
1131
+ order_property_name, server_name))
1132
+ return resp
1133
+
1134
+ async def _async_create_folder_collection(self, anchor_guid: str, parent_guid: str,
1135
+ parent_relationship_type_name: str, parent_at_end1: bool,
1136
+ display_name: str,
1137
+ description: str, collection_type: str, is_own_anchor: bool = True,
1138
+ collection_ordering: str = "OTHER",
1139
+ order_property_name: str = "Something", server_name: str = None) -> str:
1140
+ """ Create a new collection with the Folder classification. This is used to identify the organizing
1141
+ collections in a collection hierarchy. Async version.
1142
+
1143
+ Parameters
1144
+ ----------
1145
+ anchor_guid: str
1146
+ The unique identifier of the element that should be the anchor for the new element.
1147
+ Set to null if no anchor, or if this collection is to be its own anchor.
1148
+ parent_guid: str
1149
+ The optional unique identifier for an element that should be connected to the newly created element.
1150
+ If this property is specified, parentRelationshipTypeName must also be specified
1151
+ parent_relationship_type_name: str
1152
+ The name of the relationship, if any, that should be established between the new element and the parent
1153
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
1154
+ parent_at_end1: bool
1155
+ Identifies which end any parent entity sits on the relationship.
1156
+ display_name: str
1157
+ The display name of the element. Will also be used as the basis of the qualified_name.
1158
+ description: str
1159
+ A description of the collection.
1160
+ collection_type: str
1161
+ Add appropriate valid value for the collection type.
1162
+ is_own_anchor: bool, optional, defaults to False
1163
+ Indicates if the collection should classified as its own anchor or not.
1164
+ collection_ordering: str, optional, defaults to "OTHER"
1165
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1166
+ "DATE_CREATED", "OTHER"
1167
+ order_property_name: str, optional, defaults to "Something"
1168
+ Property to use for sequencing if collection_ordering is "OTHER"
1169
+ server_name: str, optional, defaults to None
1170
+ The name of the server to configure. If None, the server name associated with the instance is used.
1171
+
1172
+ Returns
1173
+ -------
1174
+ str - the guid of the created collection
1175
+
1176
+ A JSON dict representing the specified collection. Returns a string if none found.
1177
+
1178
+ Raises
1179
+ ------
1180
+ InvalidParameterException
1181
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1182
+ PropertyServerException
1183
+ Raised by the server when an issue arises in processing a valid request
1184
+ NotAuthorizedException
1185
+ The principle specified by the user_id does not have authorization for the requested action
1186
+
1187
+ """
1188
+ if server_name is None:
1189
+ server_name = self.server_name
1190
+ is_own_anchor_s = str(is_own_anchor).lower()
1191
+
1192
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/folder"
1193
+
1194
+ body = {
1195
+ "anchorGUID": anchor_guid,
1196
+ "isOwnAnchor": is_own_anchor_s,
1197
+ "parentGUID": parent_guid,
1198
+ "parentRelationshipTypeName": parent_relationship_type_name,
1199
+ "parentAtEnd1": parent_at_end1,
1200
+ "collectionProperties": {
1201
+ "class": "CollectionProperties",
1202
+ "qualifiedName": f"folder-collection-{display_name}-{time.asctime()}",
1203
+ "name": display_name,
1204
+ "description": description,
1205
+ "collectionType": collection_type,
1206
+ "collectionOrdering": collection_ordering,
1207
+ "orderPropertyName": order_property_name
1208
+ }
1209
+ }
1210
+
1211
+ resp = await self._async_make_request("POST", url, body)
1212
+ return resp.json().get("guid", "No GUID returned")
1213
+
1214
+ def create_folder_collection(self, anchor_guid: str, parent_guid: str,
1215
+ parent_relationship_type_name: str, parent_at_end1: bool, display_name: str,
1216
+ description: str, collection_type: str, is_own_anchor: bool,
1217
+ collection_ordering: str = "OTHER",
1218
+ order_property_name: str = "Something", server_name: str = None) -> str:
1219
+ """ Create a new collection with the Folder classification. This is used to identify the organizing
1220
+ collections in a collection hierarchy.
1221
+
1222
+ Parameters
1223
+ ----------
1224
+ anchor_guid: str
1225
+ The unique identifier of the element that should be the anchor for the new element.
1226
+ Set to null if no anchor, or if this collection is to be its own anchor.
1227
+ parent_guid: str
1228
+ The optional unique identifier for an element that should be connected to the newly created element.
1229
+ If this property is specified, parentRelationshipTypeName must also be specified
1230
+ parent_relationship_type_name: str
1231
+ The name of the relationship, if any, that should be established between the new element and the parent
1232
+ element. Examples could be "ResourceList" or "DigitalServiceProduct".
1233
+ parent_at_end1: bool
1234
+ Identifies which end any parent entity sits on the relationship.
1235
+ display_name: str
1236
+ The display name of the element. Will also be used as the basis of the qualified_name.
1237
+ description: str
1238
+ A description of the collection.
1239
+ collection_type: str
1240
+ Add appropriate valid value for the collection type.
1241
+ is_own_anchor: bool, optional, defaults to False
1242
+ Indicates if the collection should classified as its own anchor or not.
1243
+ collection_ordering: str, optional, defaults to "OTHER"
1244
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED",
1245
+ "OTHER"
1246
+ order_property_name: str, optional, defaults to "Something"
1247
+ Property to use for sequencing if collection_ordering is "OTHER"
1248
+ server_name: str, optional, defaults to None
1249
+ The name of the server to configure. If None, the server name associated with the instance is used.
1250
+
1251
+ Returns
1252
+ -------
1253
+ str - the guid of the created collection
1254
+
1255
+ A JSON dict representing the specified collection. Returns a string if none found.
1256
+
1257
+ Raises
1258
+ ------
1259
+ InvalidParameterException
1260
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1261
+ PropertyServerException
1262
+ Raised by the server when an issue arises in processing a valid request
1263
+ NotAuthorizedException
1264
+ The principle specified by the user_id does not have authorization for the requested action
1265
+
1266
+ """
1267
+ loop = asyncio.get_event_loop()
1268
+ resp = loop.run_until_complete(self._async_create_folder_collection(anchor_guid, parent_guid,
1269
+ parent_relationship_type_name,
1270
+ parent_at_end1,
1271
+ display_name, description,
1272
+ collection_type, is_own_anchor,
1273
+ collection_ordering,
1274
+ order_property_name, server_name))
1275
+ return resp
1276
+
1277
+ async def _async_create_collection_from_template(self, body: dict, server_name: str = None) -> str:
1278
+ """ Create a new metadata element to represent a collection using an existing metadata element as a template.
1279
+ The template defines additional classifications and relationships that are added to the new collection.
1280
+ Async version.
1281
+
1282
+ Parameters
1283
+ ----------
1284
+
1285
+ body: dict
1286
+ A dict representing the details of the collection to create.
1287
+ server_name: str, optional, defaults to None
1288
+ The name of the server to configure. If None, the server name associated with the instance is used.
1289
+
1290
+ Returns
1291
+ -------
1292
+ str - the guid of the created collection
1293
+
1294
+ Raises
1295
+ ------
1296
+ InvalidParameterException
1297
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1298
+ PropertyServerException
1299
+ Raised by the server when an issue arises in processing a valid request
1300
+ NotAuthorizedException
1301
+ The principle specified by the user_id does not have authorization for the requested action
1302
+
1303
+ Notes
1304
+ -----
1305
+ JSON Structure looks like:
1306
+
1307
+ {
1308
+ "class": "TemplateRequestBody",
1309
+ "anchorGUID": "anchor GUID, if set then isOwnAnchor=false",
1310
+ "isOwnAnchor": false,
1311
+ "parentGUID": "parent GUID, if set, set all parameters beginning 'parent'",
1312
+ "parentRelationshipTypeName": "open metadata type name",
1313
+ "parentAtEnd1": true,
1314
+ "templateGUID": "template GUID",
1315
+ "replacementProperties": {
1316
+ "class": "ElementProperties",
1317
+ "propertyValueMap" : {
1318
+ "propertyName" : {
1319
+ "class": "PrimitiveTypePropertyValue",
1320
+ "typeName": "string",
1321
+ "primitiveTypeCategory" : "OM_PRIMITIVE_TYPE_STRING",
1322
+ "primitiveValue" : "value of property"
1323
+ }
1324
+ }
1325
+ },
1326
+ "placeholderPropertyValues" : {
1327
+ "placeholderProperty1Name" : "property1Value",
1328
+ "placeholderProperty2Name" : "property2Value"
1329
+ }
1330
+ }
1331
+
1332
+ """
1333
+ if server_name is None:
1334
+ server_name = self.server_name
1335
+
1336
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/from-template"
1337
+
1338
+ resp = await self._async_make_request("POST", url, body)
1339
+ return resp.json().get("guid", "No GUID Returned")
1340
+
1341
+ def create_collection_from_template(self, body: dict, server_name: str = None) -> str:
1342
+ """ Create a new metadata element to represent a collection using an existing metadata element as a template.
1343
+ The template defines additional classifications and relationships that are added to the new collection.
1344
+
1345
+ Parameters
1346
+ ----------
1347
+ body: dict
1348
+ A dict representing the details of the collection to create.
1349
+ server_name: str, optional, defaults to None
1350
+ The name of the server to configure. If None, the server name associated with the instance is used.
1351
+
1352
+ Returns
1353
+ -------
1354
+ str - the guid of the created collection
1355
+
1356
+ Raises
1357
+ ------
1358
+ InvalidParameterException
1359
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1360
+ PropertyServerException
1361
+ Raised by the server when an issue arises in processing a valid request
1362
+ NotAuthorizedException
1363
+ The principle specified by the user_id does not have authorization for the requested action
1364
+
1365
+ Notes
1366
+ -----
1367
+ JSON Structure looks like:
1368
+
1369
+ {
1370
+ "class": "TemplateRequestBody",
1371
+ "anchorGUID": "anchor GUID, if set then isOwnAnchor=false",
1372
+ "isOwnAnchor": false,
1373
+ "parentGUID": "parent GUID, if set, set all parameters beginning 'parent'",
1374
+ "parentRelationshipTypeName": "open metadata type name",
1375
+ "parentAtEnd1": true,
1376
+ "templateGUID": "template GUID",
1377
+ "replacementProperties": {
1378
+ "class": "ElementProperties",
1379
+ "propertyValueMap" : {
1380
+ "propertyName" : {
1381
+ "class": "PrimitiveTypePropertyValue",
1382
+ "typeName": "string",
1383
+ "primitiveTypeCategory" : "OM_PRIMITIVE_TYPE_STRING",
1384
+ "primitiveValue" : "value of property"
1385
+ }
1386
+ }
1387
+ },
1388
+ "placeholderPropertyValues" : {
1389
+ "placeholderProperty1Name" : "property1Value",
1390
+ "placeholderProperty2Name" : "property2Value"
1391
+ }
1392
+ }
1393
+ """
1394
+ loop = asyncio.get_event_loop()
1395
+ resp = loop.run_until_complete(self._async_create_collection_from_template(body, server_name))
1396
+ return resp
1397
+
1398
+ async def _async_create_digital_product(self, body: dict, server_name: str = None) -> str:
1399
+ """ Create a new collection that represents a digital product. Async version.
1400
+
1401
+ Parameters
1402
+ ----------
1403
+ body: dict
1404
+ A dict representing the details of the collection to create.
1405
+ server_name: str, optional, defaults to None
1406
+ The name of the server to configure. If not provided, the server name associated
1407
+ with the instance is used.
1408
+
1409
+ Returns
1410
+ -------
1411
+ str - the guid of the created collection
1412
+
1413
+ Raises
1414
+ ------
1415
+ InvalidParameterException
1416
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1417
+ PropertyServerException
1418
+ Raised by the server when an issue arises in processing a valid request
1419
+ NotAuthorizedException
1420
+ The principle specified by the user_id does not have authorization for the requested action
1421
+
1422
+ Notes
1423
+ -----
1424
+ JSON Structure looks like:
1425
+ {
1426
+ "class" : "NewDigitalProductRequestBody",
1427
+ "anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
1428
+ "isOwnAnchor" : false,
1429
+ "parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
1430
+ "parentRelationshipTypeName" : "open metadata type name",
1431
+ "parentAtEnd1": true,
1432
+ "collectionProperties": {
1433
+ "class" : "CollectionProperties",
1434
+ "qualifiedName": "Must provide a unique name here",
1435
+ "name" : "Add display name here",
1436
+ "description" : "Add description of the collection here",
1437
+ "collectionType": "Add appropriate valid value for type",
1438
+ "collectionOrdering" : "OTHER",
1439
+ "orderPropertyName" : "Add property name if 'collectionOrdering' is OTHER"
1440
+ },
1441
+ "digitalProductProperties" : {
1442
+ "class" : "DigitalProductProperties",
1443
+ "productStatus" : "ACTIVE",
1444
+ "productName" : "Add name here",
1445
+ "productType" : "Add valid value here",
1446
+ "description" : "Add description here",
1447
+ "introductionDate" : "date",
1448
+ "maturity" : "Add valid value here",
1449
+ "serviceLife" : "Add the estimated lifetime of the product",
1450
+ "currentVersion": "V1.0",
1451
+ "nextVersion": "V1.1",
1452
+ "withdrawDate": "date",
1453
+ "additionalProperties": {
1454
+ "property1Name" : "property1Value",
1455
+ "property2Name" : "property2Value"
1456
+ }
1457
+ }
1458
+ }
1459
+ """
1460
+ if server_name is None:
1461
+ server_name = self.server_name
1462
+
1463
+ url = f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/digital-products"
1464
+
1465
+ resp = await self._async_make_request("POST", url, body)
1466
+ return resp.json().get("guid", "No GUID returned")
1467
+
1468
+ def create_digital_product(self, body: dict, server_name: str = None) -> str:
1469
+ """ Create a new collection that represents a digital product. Async version.
1470
+
1471
+ Parameters
1472
+ ----------
1473
+ body: dict
1474
+ A dict representing the details of the collection to create.
1475
+ server_name: str, optional, defaults to None
1476
+ The name of the server to configure. If not provided, the server name associated
1477
+ with the instance is used.
1478
+
1479
+ Returns
1480
+ -------
1481
+ str - the guid of the created collection
1482
+
1483
+ Raises
1484
+ ------
1485
+ InvalidParameterException
1486
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1487
+ PropertyServerException
1488
+ Raised by the server when an issue arises in processing a valid request
1489
+ NotAuthorizedException
1490
+ The principle specified by the user_id does not have authorization for the requested action
1491
+
1492
+ Notes
1493
+ -----
1494
+ JSON Structure looks like:
1495
+ {
1496
+ "class" : "NewDigitalProductRequestBody",
1497
+ "anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
1498
+ "isOwnAnchor" : false,
1499
+ "parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
1500
+ "parentRelationshipTypeName" : "open metadata type name",
1501
+ "parentAtEnd1": true,
1502
+ "collectionProperties": {
1503
+ "class" : "CollectionProperties",
1504
+ "qualifiedName": "Must provide a unique name here",
1505
+ "name" : "Add display name here",
1506
+ "description" : "Add description of the collection here",
1507
+ "collectionType": "Add appropriate valid value for type",
1508
+ "collectionOrdering" : "OTHER",
1509
+ "orderPropertyName" : "Add property name if 'collectionOrdering' is OTHER"
1510
+ },
1511
+ "digitalProductProperties" : {
1512
+ "class" : "DigitalProductProperties",
1513
+ "productStatus" : "ACTIVE",
1514
+ "productName" : "Add name here",
1515
+ "productType" : "Add valid value here",
1516
+ "description" : "Add description here",
1517
+ "introductionDate" : "date",
1518
+ "maturity" : "Add valid value here",
1519
+ "serviceLife" : "Add the estimated lifetime of the product",
1520
+ "currentVersion": "V1.0",
1521
+ "nextVersion": "V1.1",
1522
+ "withdrawDate": "date",
1523
+ "additionalProperties": {
1524
+ "property1Name" : "property1Value",
1525
+ "property2Name" : "property2Value"
1526
+ }
1527
+ }
1528
+ }
1529
+ """
1530
+ loop = asyncio.get_event_loop()
1531
+ resp = loop.run_until_complete(self._async_create_digital_product(body, server_name))
1532
+ return resp
1533
+
1534
+ #
1535
+ # Manage collections
1536
+ #
1537
+ async def _async_update_collection(self, collection_guid: str, qualified_name: str = None, display_name: str = None,
1538
+ description: str = None, collection_type: str = None,
1539
+ collection_ordering: str = None, order_property_name: str = None,
1540
+ replace_all_props: bool = False, server_name: str = None) -> None:
1541
+ """ Update the properties of a collection. Async version.
1542
+
1543
+ Parameters
1544
+ ----------
1545
+ collection_guid: str
1546
+ The guid of the collection to update.
1547
+ qualified_name: str, optional, defaults to None
1548
+ The qualified name of the collection to update.
1549
+ display_name: str, optional, defaults to None
1550
+ The display name of the element. Will also be used as the basis of the qualified_name.
1551
+ description: str, optional, defaults to None
1552
+ A description of the collection.
1553
+ collection_type: str, optional, defaults to None
1554
+ Add appropriate valid value for the collection type.
1555
+ collection_ordering: str, optional, defaults to None
1556
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1557
+ "DATE_CREATED", "OTHER"
1558
+ order_property_name: str, optional, defaults to None
1559
+ Property to use for sequencing if collection_ordering is "OTHER"
1560
+ replace_all_props: bool, optional, defaults to False
1561
+ Whether to replace all properties in the collection.
1562
+ server_name: str, optional, defaults to None
1563
+ The name of the server to configure. If not provided, the server name associated
1564
+ with the instance is used.
1565
+
1566
+ Returns
1567
+ -------
1568
+ Nothing
1569
+
1570
+ Raises
1571
+ ------
1572
+ InvalidParameterException
1573
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1574
+ PropertyServerException
1575
+ Raised by the server when an issue arises in processing a valid request
1576
+ NotAuthorizedException
1577
+ The principle specified by the user_id does not have authorization for the requested action
1578
+ """
1579
+ if server_name is None:
1580
+ server_name = self.server_name
1581
+ replace_all_props_s = str(replace_all_props).lower()
1582
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/update?"
1583
+ f"replaceAllProperties={replace_all_props_s}")
1584
+
1585
+ body = {
1586
+ "class": "CollectionProperties",
1587
+ "qualifiedName": qualified_name,
1588
+ "name": display_name,
1589
+ "description": description,
1590
+ "collectionType": collection_type,
1591
+ "collectionOrdering": collection_ordering,
1592
+ "orderPropertyName": order_property_name
1593
+ }
1594
+ body_s = body_slimmer(body)
1595
+ await self._async_make_request("POST", url, body_s)
1596
+ return
1597
+
1598
+ def update_collection(self, collection_guid, qualified_name: str = None, display_name: str = None,
1599
+ description: str = None, collection_type: str = None, collection_ordering: str = None,
1600
+ order_property_name: str = None, replace_all_props: bool = False,
1601
+ server_name: str = None) -> None:
1602
+ """ Update the properties of a collection.
1603
+
1604
+ Parameters
1605
+ ----------
1606
+ collection_guid: str
1607
+ The guid of the collection to update.
1608
+ qualified_name: str
1609
+ The qualified name of the collection to update.
1610
+ display_name: str
1611
+ The display name of the element. Will also be used as the basis of the qualified_name.
1612
+ description: str
1613
+ A description of the collection.
1614
+ collection_type: str
1615
+ Add appropriate valid value for the collection type.
1616
+ collection_ordering: str, optional, defaults to "OTHER"
1617
+ Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
1618
+ "DATE_CREATED", "OTHER"
1619
+ order_property_name: str, optional, defaults to "Something"
1620
+ Property to use for sequencing if collection_ordering is "OTHER"
1621
+ replace_all_props: bool, optional, defaults to False
1622
+ Whether to replace all properties in the collection.
1623
+ server_name: str, optional, defaults to None
1624
+ The name of the server to configure. If not provided, the server name associated
1625
+ with the instance is used.
1626
+
1627
+ Returns
1628
+ -------
1629
+ Nothing
1630
+
1631
+ Raises
1632
+ ------
1633
+ InvalidParameterException
1634
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1635
+ PropertyServerException
1636
+ Raised by the server when an issue arises in processing a valid request
1637
+ NotAuthorizedException
1638
+ The principle specified by the user_id does not have authorization for the requested action
1639
+ """
1640
+ loop = asyncio.get_event_loop()
1641
+ loop.run_until_complete(self._async_update_collection(collection_guid, qualified_name, display_name,
1642
+ description, collection_type,
1643
+ collection_ordering, order_property_name,
1644
+ replace_all_props, server_name))
1645
+ return
1646
+
1647
+ async def _async_update_digital_product(self, collection_guid: str, body: dict, replace_all_props: bool = False,
1648
+ server_name: str = None):
1649
+ """ Update the properties of the DigitalProduct classification attached to a collection. Async version.
1650
+
1651
+ Parameters
1652
+ ----------
1653
+ collection_guid: str
1654
+ The guid of the collection to update.
1655
+ body: dict
1656
+ A dict representing the details of the collection to create.
1657
+ replace_all_props: bool, optional, defaults to False
1658
+ Whether to replace all properties in the collection.
1659
+ server_name: str, optional, defaults to None
1660
+ The name of the server to configure. If not provided, the server name associated with the
1661
+ instance is used.
1662
+
1663
+ Returns
1664
+ -------
1665
+ Nothing
1666
+
1667
+ Raises
1668
+ ------
1669
+ InvalidParameterException
1670
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1671
+ PropertyServerException
1672
+ Raised by the server when an issue arises in processing a valid request
1673
+ NotAuthorizedException
1674
+ The principle specified by the user_id does not have authorization for the requested action
1675
+
1676
+ Notes
1677
+ -----
1678
+ JSON Structure looks like:
1679
+ {
1680
+ "class" : "DigitalProductProperties",
1681
+ "productStatus" : "ACTIVE",
1682
+ "productName" : "Add name here",
1683
+ "productType" : "Add valid value here",
1684
+ "description" : "Add description here",
1685
+ "introductionDate" : "date",
1686
+ "maturity" : "Add valid value here",
1687
+ "serviceLife" : "Add the estimated lifetime of the product",
1688
+ "currentVersion": "V1.0",
1689
+ "nextVersion": "V1.1",
1690
+ "withdrawDate": "date",
1691
+ "additionalProperties": {
1692
+ "property1Name" : "property1Value",
1693
+ "property2Name" : "property2Value"
1694
+ }
1695
+ }
1696
+ """
1697
+ if server_name is None:
1698
+ server_name = self.server_name
1699
+
1700
+ replace_all_props_s = str(replace_all_props).lower()
1701
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/digital-products/"
1702
+ f"{collection_guid}/update?replaceAllProperties={replace_all_props_s}")
1703
+
1704
+ await self._async_make_request("POST", url, body)
1705
+ return
1706
+
1707
+ def update_digital_product(self, collection_guid: str, body: dict, replace_all_props: bool = False,
1708
+ server_name: str = None):
1709
+ """ Update the properties of the DigitalProduct classification attached to a collection.
1710
+
1711
+ Parameters
1712
+ ----------
1713
+ collection_guid: str
1714
+ The guid of the collection to update.
1715
+ body: dict
1716
+ A dict representing the details of the collection to create.
1717
+ replace_all_props: bool, optional, defaults to False
1718
+ Whether to replace all properties in the collection.
1719
+ server_name: str, optional, defaults to None
1720
+ The name of the server to configure. If not provided, the server name associated with the
1721
+ instance is used.
1722
+
1723
+ Returns
1724
+ -------
1725
+ Nothing
1726
+
1727
+ Raises
1728
+ ------
1729
+ InvalidParameterException
1730
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1731
+ PropertyServerException
1732
+ Raised by the server when an issue arises in processing a valid request
1733
+ NotAuthorizedException
1734
+ The principle specified by the user_id does not have authorization for the requested action
1735
+
1736
+ Notes
1737
+ -----
1738
+ JSON Structure looks like:
1739
+ {
1740
+ "class" : "DigitalProductProperties",
1741
+ "productStatus" : "ACTIVE",
1742
+ "productName" : "Add name here",
1743
+ "productType" : "Add valid value here",
1744
+ "description" : "Add description here",
1745
+ "introductionDate" : "date",
1746
+ "maturity" : "Add valid value here",
1747
+ "serviceLife" : "Add the estimated lifetime of the product",
1748
+ "currentVersion": "V1.0",
1749
+ "nextVersion": "V1.1",
1750
+ "withdrawDate": "date",
1751
+ "additionalProperties": {
1752
+ "property1Name" : "property1Value",
1753
+ "property2Name" : "property2Value"
1754
+ }
1755
+ }
1756
+ """
1757
+ loop = asyncio.get_event_loop()
1758
+ loop.run_until_complete(self._async_update_collection(collection_guid, body, replace_all_props, server_name))
1759
+ return
1760
+
1761
+ async def _async_attach_collection(self, collection_guid: str, element_guid: str, resource_use: str,
1762
+ resource_use_description: str = None, resource_use_props: dict = None,
1763
+ watch_resources: bool = False, make_anchor: bool = False,
1764
+ server_name: str = None) -> None:
1765
+ """ Connect an existing collection to an element using the ResourceList relationship (0019). Async version.
1766
+ Parameters
1767
+ ----------
1768
+ collection_guid: str
1769
+ The guid of the collection to update.
1770
+ element_guid: str
1771
+ The guid of the element to attach.
1772
+ resource_use: str,
1773
+ How the resource is being used.
1774
+ resource_use_description: str
1775
+ Describe how the resource is being used.
1776
+ resource_use_props: dict, optional, defaults to None
1777
+ The properties of the resource to be used.
1778
+ watch_resources, bool, optional, defaults to False
1779
+ Whether to watch for the resources to be updated.
1780
+ make_anchor, bool, optional, defaults to False
1781
+ Whether to make the this an anchor.
1782
+ server_name: str, optional, defaults to None
1783
+ The name of the server to configure. If not provided, the server name associated with the
1784
+ 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
1798
+
1799
+ """
1800
+ if server_name is None:
1801
+ server_name = self.server_name
1802
+ watch_resources_s = str(watch_resources).lower()
1803
+ make_anchor_s = str(make_anchor).lower()
1804
+
1805
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/metadata-elements/"
1806
+ f"{element_guid}/collections/{collection_guid}/attach?makeAnchor={make_anchor_s}")
1807
+
1808
+ body = {
1809
+ "class": "ResourceListProperties",
1810
+ "resourceUse": resource_use,
1811
+ "resourceUseDescription": resource_use_description,
1812
+ "watchResource": watch_resources_s,
1813
+ "resourceUseProperties": resource_use_props
1814
+ }
1815
+ await self._async_make_request("POST", url, body)
1816
+ return
1817
+
1818
+ def attach_collection(self, collection_guid: str, element_guid: str, resource_use: str,
1819
+ resource_use_description: str, resource_use_props: dict = None,
1820
+ watch_resources: bool = False, make_anchor: bool = False,
1821
+ server_name: str = None) -> None:
1822
+ """ Connect an existing collection to an element using the ResourceList relationship (0019).
1823
+ Parameters
1824
+ ----------
1825
+ collection_guid: str
1826
+ The guid of the collection to update.
1827
+ element_guid: str
1828
+ The guid of the element to attach.
1829
+ resource_use: str,
1830
+ How the resource is being used.
1831
+ resource_use_description: str
1832
+ Describe how the resource is being used.
1833
+ resource_use_props: dict, optional, defaults to None
1834
+ The properties of the resource to be used.
1835
+ watch_resources: bool, optional, defaults to False
1836
+ Whether to watch for the resources to be updated.
1837
+ make_anchor: bool, optional, defaults to False
1838
+ Whether to make the this an anchor.
1839
+ server_name: str, optional, defaults to None
1840
+ The name of the server to configure. If not provided, the server name associated
1841
+ with the instance is used.
1842
+
1843
+ Returns
1844
+ -------
1845
+ Nothing
1846
+
1847
+ Raises
1848
+ ------
1849
+ InvalidParameterException
1850
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1851
+ PropertyServerException
1852
+ Raised by the server when an issue arises in processing a valid request
1853
+ NotAuthorizedException
1854
+ The principle specified by the user_id does not have authorization for the requested action
1855
+
1856
+ """
1857
+ loop = asyncio.get_event_loop()
1858
+ loop.run_until_complete(self._async_attach_collection(collection_guid, element_guid,
1859
+ resource_use, resource_use_description,
1860
+ resource_use_props, watch_resources,
1861
+ make_anchor, server_name))
1862
+ return
1863
+
1864
+ async def _async_detach_collection(self, collection_guid: str, element_guid: str,
1865
+ server_name: str = None) -> None:
1866
+ """ Detach an existing collection from an element. If the collection is anchored to the element, it is deleted.
1867
+ Async version.
1868
+
1869
+ Parameters
1870
+ ----------
1871
+ collection_guid: str
1872
+ The guid of the collection to update.
1873
+ element_guid: str
1874
+ The guid of the element to attach.
1875
+ server_name: str, optional, defaults to None
1876
+ The name of the server to configure. If not provided, the server name associated
1877
+ with the instance is used.
1878
+
1879
+ Returns
1880
+ -------
1881
+ Nothing
1882
+
1883
+ Raises
1884
+ ------
1885
+ InvalidParameterException
1886
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1887
+ PropertyServerException
1888
+ Raised by the server when an issue arises in processing a valid request
1889
+ NotAuthorizedException
1890
+ The principle specified by the user_id does not have authorization for the requested action
1891
+
1892
+ """
1893
+ if server_name is None:
1894
+ server_name = self.server_name
1895
+ url = (f"{self.platform_url}/servers/{server_name}/api/open-metadata/collection-manager/metadata-elements/"
1896
+ f"{element_guid}/collections/{collection_guid}/detach")
1897
+
1898
+ body = {
1899
+ "class": "NullRequestBody"
1900
+ }
1901
+
1902
+ await self._async_make_request("POST", url, body)
1903
+ return
1904
+
1905
+ def detach_collection(self, collection_guid: str, element_guid: str,
1906
+ server_name: str = None) -> None:
1907
+ """ Connect an existing collection to an element using the ResourceList relationship (0019).
1908
+ Parameters
1909
+ ----------
1910
+ collection_guid: str
1911
+ The guid of the collection to update.
1912
+ element_guid: str
1913
+ The guid of the element to attach.
1914
+ server_name: str, optional, defaults to None
1915
+ The name of the server to configure. If not provided, the server name associated
1916
+ with the instance is used.
1917
+
1918
+ Returns
1919
+ -------
1920
+ Nothing
1921
+
1922
+ Raises
1923
+ ------
1924
+ InvalidParameterException
1925
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1926
+ PropertyServerException
1927
+ Raised by the server when an issue arises in processing a valid request
1928
+ NotAuthorizedException
1929
+ The principle specified by the user_id does not have authorization for the requested action
1930
+
1931
+ """
1932
+ loop = asyncio.get_event_loop()
1933
+ loop.run_until_complete(self._async_detach_collection(collection_guid, element_guid,
1934
+ server_name))
1935
+ return
1936
+
1937
+ async def _async_delete_collection(self, collection_guid: str, server_name: str = None) -> None:
1938
+ """ Delete a collection. It is detected from all parent elements. If members are anchored to the collection
1939
+ then they are also deleted. Async version
1940
+
1941
+
1942
+ Parameters
1943
+ ----------
1944
+ collection_guid: str
1945
+ The guid of the collection to update.
1946
+ server_name: str, optional, defaults to None
1947
+ The name of the server to configure. If not provided, the server name associated
1948
+ with the instance is used.
1949
+
1950
+ Returns
1951
+ -------
1952
+ Nothing
1953
+
1954
+ Raises
1955
+ ------
1956
+ InvalidParameterException
1957
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1958
+ PropertyServerException
1959
+ Raised by the server when an issue arises in processing a valid request
1960
+ NotAuthorizedException
1961
+ The principle specified by the user_id does not have authorization for the requested action
1962
+
1963
+ """
1964
+ if server_name is None:
1965
+ server_name = self.server_name
1966
+ url = f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/delete"
1967
+ body = {
1968
+ "class": "NullRequestBody"
1969
+ }
1970
+
1971
+ await self._async_make_request("POST", url, body)
1972
+ return
1973
+
1974
+ def delete_collection(self, collection_guid: str, server_name: str = None) -> None:
1975
+ """ Delete a collection. It is detected from all parent elements. If members are anchored to the collection
1976
+ then they are also deleted.
1977
+
1978
+ Parameters
1979
+ ----------
1980
+ collection_guid: str
1981
+ The guid of the collection to update.
1982
+ server_name: str, optional, defaults to None
1983
+ The name of the server to configure. If not provided, the server name associated
1984
+ with the instance is used.
1985
+
1986
+ Returns
1987
+ -------
1988
+ Nothing
1989
+
1990
+ Raises
1991
+ ------
1992
+
1993
+ InvalidParameterException
1994
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1995
+ PropertyServerException
1996
+ Raised by the server when an issue arises in processing a valid request
1997
+ NotAuthorizedException
1998
+ The principle specified by the user_id does not have authorization for the requested action
1999
+
2000
+ """
2001
+ loop = asyncio.get_event_loop()
2002
+ loop.run_until_complete(self._async_delete_collection(collection_guid,
2003
+ server_name))
2004
+ return
2005
+
2006
+ async def _async_get_collection_members(self, collection_guid: str, effective_time: str = None,
2007
+ server_name: str = None, start_from: int = 0,
2008
+ page_size: int = None) -> list | str:
2009
+ """ Return a list of elements that are a member of a collection. Async version.
2010
+
2011
+ Parameters
2012
+ ----------
2013
+ collection_guid: str,
2014
+ identity of the collection to return members for.
2015
+ effective_time: str, [default=None], optional
2016
+ Effective time of the query. If not specified will default to any time.
2017
+ server_name : str, optional
2018
+ The name of the server to configure.
2019
+ If not provided, the server name associated with the instance is used.
2020
+ start_from: int, [default=0], optional
2021
+ When multiple pages of results are available, the page number to start from.
2022
+ page_size: int, [default=None]
2023
+ The number of items to return in a single page. If not specified, the default will be taken from
2024
+ the class instance.
2025
+ Returns
2026
+ -------
2027
+ List | str
2028
+
2029
+ A list of collection members in the collection.
2030
+
2031
+ Raises
2032
+ ------
2033
+
2034
+ InvalidParameterException
2035
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2036
+ PropertyServerException
2037
+ Raised by the server when an issue arises in processing a valid request
2038
+ NotAuthorizedException
2039
+ The principle specified by the user_id does not have authorization for the requested action
2040
+
2041
+ """
2042
+ if server_name is None:
2043
+ server_name = self.server_name
2044
+ if page_size is None:
2045
+ page_size = self.page_size
2046
+
2047
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/"
2048
+ f"members?startFrom={start_from}&pageSize={page_size}")
2049
+
2050
+ resp = await self._async_make_request("GET", url)
2051
+ return resp.json().get("elements", "No elements found")
2052
+
2053
+ def get_collection_members(self, collection_guid: str, effective_time: str = None,
2054
+ server_name: str = None, start_from: int = 0,
2055
+ page_size: int = None) -> list | str:
2056
+ """ Return a list of elements that are a member of a collection.
2057
+
2058
+ Parameters
2059
+ ----------
2060
+ collection_guid: str,
2061
+ identity of the collection to return members for.
2062
+ effective_time: str, [default=None], optional
2063
+ Effective time of the query. If not specified will default to any time.
2064
+ server_name : str, optional
2065
+ The name of the server to configure.
2066
+ If not provided, the server name associated with the instance is used.
2067
+ start_from: int, [default=0], optional
2068
+ When multiple pages of results are available, the page number to start from.
2069
+ page_size: int, [default=None]
2070
+ The number of items to return in a single page. If not specified, the default will be taken from
2071
+ the class instance.
2072
+ Returns
2073
+ -------
2074
+ List | str
2075
+
2076
+ A list of collection members in the collection.
2077
+
2078
+ Raises
2079
+ ------
2080
+
2081
+ InvalidParameterException
2082
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2083
+ PropertyServerException
2084
+ Raised by the server when an issue arises in processing a valid request
2085
+ NotAuthorizedException
2086
+ The principle specified by the user_id does not have authorization for the requested action
2087
+
2088
+ """
2089
+ loop = asyncio.get_event_loop()
2090
+ resp = loop.run_until_complete(self._async_get_collection_members(collection_guid, effective_time, server_name,
2091
+ start_from, page_size))
2092
+
2093
+ return resp
2094
+
2095
+ async def _async_add_to_collection(self, collection_guid: str, element_guid: str, body: dict = None,
2096
+ server_name: str = None) -> None:
2097
+ """ Add an element to a collection. The request body is optional. Async version.
2098
+
2099
+ Parameters
2100
+ ----------
2101
+ collection_guid: str
2102
+ identity of the collection to return members for.
2103
+ element_guid: str
2104
+ Effective time of the query. If not specified will default to any time.
2105
+ body: dict, optional, defaults to None
2106
+ The body of the request to add to the collection. See notes.
2107
+ server_name : str, optional
2108
+ The name of the server to use.
2109
+ If not provided, the server name associated with the instance is used.
2110
+
2111
+ Returns
2112
+ -------
2113
+ None
2114
+
2115
+ Raises
2116
+ ------
2117
+
2118
+ InvalidParameterException
2119
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2120
+ PropertyServerException
2121
+ Raised by the server when an issue arises in processing a valid request
2122
+ NotAuthorizedException
2123
+ The principle specified by the user_id does not have authorization for the requested action
2124
+
2125
+ Notes
2126
+ -----
2127
+ Example body:
2128
+ {
2129
+ "class" : "CollectionMembershipProperties",
2130
+ "membershipRationale": "xxx",
2131
+ "createdBy": "user id here",
2132
+ "expression": "expression that described why the element is a part of this collection",
2133
+ "confidence": 100,
2134
+ "status": "PROPOSED",
2135
+ "userDefinedStatus": "Add valid value here",
2136
+ "steward": "identifier of steward that validated this member",
2137
+ "stewardTypeName": "type name of element identifying the steward",
2138
+ "stewardPropertyName": "property name if the steward's identifier",
2139
+ "source": "source of the member",
2140
+ "notes": "Add notes here"
2141
+ }
2142
+
2143
+ """
2144
+ if server_name is None:
2145
+ server_name = self.server_name
2146
+
2147
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/members/"
2148
+ f"{element_guid}/attach")
2149
+ body_s = body_slimmer(body)
2150
+ await self._async_make_request("POST", url, body_s)
2151
+ return
2152
+
2153
+ def add_to_collection(self, collection_guid: str, element_guid: str, body: dict = None,
2154
+ server_name: str = None) -> None:
2155
+ """ Add an element to a collection. The request body is optional.
2156
+
2157
+ Parameters
2158
+ ----------
2159
+ collection_guid: str
2160
+ identity of the collection to return members for.
2161
+ element_guid: str
2162
+ Effective time of the query. If not specified will default to any time.
2163
+ body: dict, optional, defaults to None
2164
+ The body of the request to add to the collection. See notes.
2165
+ server_name : str, optional
2166
+ The name of the server to use.
2167
+ If not provided, the server name associated with the instance is used.
2168
+
2169
+ Returns
2170
+ -------
2171
+ None
2172
+
2173
+ Raises
2174
+ ------
2175
+
2176
+ InvalidParameterException
2177
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2178
+ PropertyServerException
2179
+ Raised by the server when an issue arises in processing a valid request
2180
+ NotAuthorizedException
2181
+ The principle specified by the user_id does not have authorization for the requested action
2182
+
2183
+ Notes
2184
+ -----
2185
+ Example body:
2186
+ {
2187
+ "class" : "CollectionMembershipProperties",
2188
+ "membershipRationale": "xxx",
2189
+ "createdBy": "user id here",
2190
+ "expression": "expression that described why the element is a part of this collection",
2191
+ "confidence": 100,
2192
+ "status": "PROPOSED",
2193
+ "userDefinedStatus": "Add valid value here",
2194
+ "steward": "identifier of steward that validated this member",
2195
+ "stewardTypeName": "type name of element identifying the steward",
2196
+ "stewardPropertyName": "property name if the steward's identifier",
2197
+ "source": "source of the member",
2198
+ "notes": "Add notes here"
2199
+ }
2200
+
2201
+ """
2202
+ loop = asyncio.get_event_loop()
2203
+ loop.run_until_complete(self._async_add_to_collection(collection_guid, element_guid,
2204
+ body, server_name))
2205
+ return
2206
+
2207
+ async def _async_update_collection_membership(self, collection_guid: str, element_guid: str, body: dict = None,
2208
+ replace_all_props: bool = False, server_name: str = None) -> None:
2209
+ """ Update an element's membership to a collection. Async version.
2210
+
2211
+ Parameters
2212
+ ----------
2213
+ collection_guid: str
2214
+ identity of the collection to return members for.
2215
+ element_guid: str
2216
+ Effective time of the query. If not specified will default to any time.
2217
+ body: dict, optional, defaults to None
2218
+ The body of the request to add to the collection. See notes.
2219
+ replace_all_props: bool, optional, defaults to False
2220
+ Replace all properties or just update ones specified in body.
2221
+ server_name : str, optional
2222
+ The name of the server to use.
2223
+ If not provided, the server name associated with the instance is used.
2224
+
2225
+ Returns
2226
+ -------
2227
+ None
2228
+
2229
+ Raises
2230
+ ------
2231
+
2232
+ InvalidParameterException
2233
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2234
+ PropertyServerException
2235
+ Raised by the server when an issue arises in processing a valid request
2236
+ NotAuthorizedException
2237
+ The principle specified by the user_id does not have authorization for the requested action
2238
+
2239
+ Notes
2240
+ -----
2241
+ Example body:
2242
+ {
2243
+ "class" : "CollectionMembershipProperties",
2244
+ "membershipRationale": "xxx",
2245
+ "createdBy": "user id here",
2246
+ "expression": "expression that described why the element is a part of this collection",
2247
+ "confidence": 100,
2248
+ "status": "PROPOSED",
2249
+ "userDefinedStatus": "Add valid value here",
2250
+ "steward": "identifier of steward that validated this member",
2251
+ "stewardTypeName": "type name of element identifying the steward",
2252
+ "stewardPropertyName": "property name if the steward's identifier",
2253
+ "source": "source of the member",
2254
+ "notes": "Add notes here"
2255
+ }
2256
+
2257
+ """
2258
+ if server_name is None:
2259
+ server_name = self.server_name
2260
+ replace_all_props_s = str(replace_all_props).lower()
2261
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/members/"
2262
+ f"{element_guid}/update?replaceAllProperties={replace_all_props_s}")
2263
+ body_s = body_slimmer(body)
2264
+ await self._async_make_request("POST", url, body_s)
2265
+ return
2266
+
2267
+ def update_collection_membership(self, collection_guid: str, element_guid: str, body: dict = None,
2268
+ replace_all_props: bool = False, server_name: str = None) -> None:
2269
+ """ Update an element's membership to a collection.
2270
+
2271
+ Parameters
2272
+ ----------
2273
+ collection_guid: str
2274
+ identity of the collection to update members for.
2275
+ element_guid: str
2276
+ Effective time of the query. If not specified will default to any time.
2277
+ body: dict, optional, defaults to None
2278
+ The body of the request to add to the collection. See notes.
2279
+ replace_all_props: bool, optional, defaults to False
2280
+ Replace all properties or just update ones specified in body.
2281
+ server_name : str, optional
2282
+ The name of the server to use.
2283
+ If not provided, the server name associated with the instance is used.
2284
+
2285
+ Returns
2286
+ -------
2287
+ None
2288
+
2289
+ Raises
2290
+ ------
2291
+
2292
+ InvalidParameterException
2293
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2294
+ PropertyServerException
2295
+ Raised by the server when an issue arises in processing a valid request
2296
+ NotAuthorizedException
2297
+ The principle specified by the user_id does not have authorization for the requested action
2298
+
2299
+ Notes
2300
+ -----
2301
+ Example body:
2302
+ {
2303
+ "class" : "CollectionMembershipProperties",
2304
+ "membershipRationale": "xxx",
2305
+ "createdBy": "user id here",
2306
+ "expression": "expression that described why the element is a part of this collection",
2307
+ "confidence": 100,
2308
+ "status": "PROPOSED",
2309
+ "userDefinedStatus": "Add valid value here",
2310
+ "steward": "identifier of steward that validated this member",
2311
+ "stewardTypeName": "type name of element identifying the steward",
2312
+ "stewardPropertyName": "property name if the steward's identifier",
2313
+ "source": "source of the member",
2314
+ "notes": "Add notes here"
2315
+ }
2316
+
2317
+ """
2318
+ loop = asyncio.get_event_loop()
2319
+ loop.run_until_complete(self._async_update_collection_membership(collection_guid, element_guid,
2320
+ body, replace_all_props, server_name))
2321
+ return
2322
+
2323
+ async def _async_remove_from_collection(self, collection_guid: str, element_guid: str,
2324
+ server_name: str = None) -> None:
2325
+ """ Remove an element from a collection. Async version.
2326
+
2327
+ Parameters
2328
+ ----------
2329
+ collection_guid: str
2330
+ identity of the collection to return members for.
2331
+ element_guid: str
2332
+ Effective time of the query. If not specified will default to any time.
2333
+ server_name : str, optional
2334
+ The name of the server to use.
2335
+ If not provided, the server name associated with the instance is used.
2336
+
2337
+ Returns
2338
+ -------
2339
+ None
2340
+
2341
+ Raises
2342
+ ------
2343
+
2344
+ InvalidParameterException
2345
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2346
+ PropertyServerException
2347
+ Raised by the server when an issue arises in processing a valid request
2348
+ NotAuthorizedException
2349
+ The principle specified by the user_id does not have authorization for the requested action
2350
+
2351
+ """
2352
+ if server_name is None:
2353
+ server_name = self.server_name
2354
+
2355
+ url = (f"{self.platform_url}/servers/{server_name}{self.command_base}/{collection_guid}/members/"
2356
+ f"{element_guid}/detach")
2357
+ body = {
2358
+ "class": "NullRequestBody"
2359
+ }
2360
+ await self._async_make_request("POST", url, body)
2361
+ return
2362
+
2363
+ def remove_from_collection(self, collection_guid: str, element_guid: str, server_name: str = None) -> None:
2364
+ """ Remove an element from a collection.
2365
+
2366
+ Parameters
2367
+ ----------
2368
+ collection_guid: str
2369
+ identity of the collection to return members for.
2370
+ element_guid: str
2371
+ Effective time of the query. If not specified will default to any time.
2372
+ server_name : str, optional
2373
+ The name of the server to use.
2374
+ If not provided, the server name associated with the instance is used.
2375
+
2376
+ Returns
2377
+ -------
2378
+ None
2379
+
2380
+ Raises
2381
+ ------
2382
+
2383
+ InvalidParameterException
2384
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
2385
+ PropertyServerException
2386
+ Raised by the server when an issue arises in processing a valid request
2387
+ NotAuthorizedException
2388
+ The principle specified by the user_id does not have authorization for the requested action
2389
+
2390
+ """
2391
+ loop = asyncio.get_event_loop()
2392
+ loop.run_until_complete(self._async_remove_from_collection(collection_guid, element_guid,
2393
+ server_name))
2394
+ return
2395
+
2396
+ def get_member_list(self, root_collection_name: str, server_name: str = None) -> list | bool:
2397
+ if server_name is None:
2398
+ server_name = self.server_name
2399
+ # first find the guid for the collection we are using as root
2400
+ root_guids = self.get_collections_by_name(root_collection_name)
2401
+ if type(root_guids) is str:
2402
+ return False
2403
+ if len(root_guids) != 1:
2404
+ raise InvalidParameterException(
2405
+ "root_collection_name must have exactly one root collection for this method")
2406
+ root = root_guids[0]['elementHeader']['guid']
2407
+
2408
+ # now find the members of the collection
2409
+ member_list = []
2410
+ members = self.get_collection_members(root)
2411
+ if type(members) is str:
2412
+ return False
2413
+ # finally, construct a list of member information
2414
+ for member_rel in members:
2415
+ member_guid = member_rel['member']['guid']
2416
+ member_resp = self.get_collection(member_guid)
2417
+ member = member_resp['element']
2418
+ # print(json.dumps(member, indent = 4))
2419
+ member_instance = {
2420
+ "name": member['properties']['name'],
2421
+ "qualifiedName": member['properties']['qualifiedName'],
2422
+ "guid": member['elementHeader']['guid'],
2423
+ "description": member['properties']['description'],
2424
+ "collectionType": member['properties']['collectionType'],
2425
+ }
2426
+ member_list.append(member_instance)
2427
+
2428
+ return member_list