pyegeria 5.2.0.6__py3-none-any.whl → 5.2.0.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. pyegeria/__init__.py +2 -0
  2. pyegeria/_client.py +7 -2
  3. pyegeria/asset_catalog_omvs.py +34 -0
  4. pyegeria/classification_manager_omvs.py +2 -3
  5. pyegeria/collection_manager_omvs.py +83 -39
  6. pyegeria/commands/cat/get_collection.py +22 -13
  7. pyegeria/commands/cat/list_collections.py +10 -5
  8. pyegeria/commands/cat/list_deployed_database_schemas.py +5 -11
  9. pyegeria/commands/cli/egeria.py +7 -7
  10. pyegeria/commands/cli/egeria_cat.py +3 -3
  11. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.30.02@2x.png +0 -0
  12. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.31.47@2x.png +0 -0
  13. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.32.11@2x.png +0 -0
  14. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.34.19@2x.png +0 -0
  15. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.36.42@2x.png +0 -0
  16. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.36.55@2x.png +0 -0
  17. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/CleanShot 2024-11-25 at 20.37.07@2x.png +0 -0
  18. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-schemas 2024-11-25 at 20.14.50@2x.png +0 -0
  19. pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-servers 2024-11-25 at 20.21.25@2x.png +0 -0
  20. pyegeria/commands/doc/Visual Command Reference/cat/show/glossary/list-glossaries 2024-11-25 at 20.30.02.png +0 -0
  21. pyegeria/commands/doc/Visual Command Reference/cat/show/glossary/list-terms 2024-11-25 at 20.32.11.png +0 -0
  22. pyegeria/commands/doc/Visual Command Reference/cat/show/info/asset-types 2024-11-25 at 20.34.19@2x.png +0 -0
  23. pyegeria/commands/doc/Visual Command Reference/cat/show/info/certification-types 2024-11-25 at 20.37.07.png +0 -0
  24. pyegeria/egeria_client.py +2 -0
  25. pyegeria/egeria_tech_client.py +5 -0
  26. pyegeria/metadata_explorer_omvs.py +2086 -0
  27. {pyegeria-5.2.0.6.dist-info → pyegeria-5.2.0.7.dist-info}/METADATA +1 -1
  28. {pyegeria-5.2.0.6.dist-info → pyegeria-5.2.0.7.dist-info}/RECORD +31 -17
  29. {pyegeria-5.2.0.6.dist-info → pyegeria-5.2.0.7.dist-info}/LICENSE +0 -0
  30. {pyegeria-5.2.0.6.dist-info → pyegeria-5.2.0.7.dist-info}/WHEEL +0 -0
  31. {pyegeria-5.2.0.6.dist-info → pyegeria-5.2.0.7.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,2086 @@
1
+ """PDX-License-Identifier: Apache-2.0
2
+ Copyright Contributors to the ODPi Egeria project.
3
+
4
+ This module provides access to the metadata-explorer OMVS module.
5
+
6
+ [metadata-explorer](https://egeria-project.org/services/omvs/metadata-explorer/overview/)
7
+
8
+ """
9
+
10
+ import asyncio
11
+
12
+ from httpx import Response
13
+
14
+ from pyegeria import body_slimmer
15
+
16
+
17
+ from pyegeria._client import Client, max_paging_size
18
+ from pyegeria._globals import default_time_out
19
+ from tests.test_classification_manager_omvs import element_guid
20
+
21
+
22
+ def query_seperator(current_string):
23
+ if current_string == "":
24
+ return "?"
25
+ else:
26
+ return "&"
27
+
28
+
29
+ "params are in the form of [(paramName, value), (param2Name, value)] if the value is not None, it will be added to the query string"
30
+
31
+
32
+ def query_string(params):
33
+ result = ""
34
+ for i in range(len(params)):
35
+ if params[i][1] is not None:
36
+ result = f"{result}{query_seperator(result)}{params[i][0]}={params[i][1]}"
37
+ return result
38
+
39
+
40
+ def base_path(client, view_server: str):
41
+ return f"{client.platform_url}/servers/{view_server}/api/open-metadata/metadata-explorer"
42
+
43
+
44
+ class MetadataExplorer(Client):
45
+ """MetadataExplorer is a class that extends the Client class. The Metadata Explorer OMVS provides APIs for
46
+ supporting the search, query and retrieval of open metadata. It is an advanced API for users that understands
47
+ the Open Metadata Types.
48
+
49
+ Attributes:
50
+
51
+ view_server_name: str
52
+ The name of the View Server to connect to.
53
+ platform_url : str
54
+ URL of the server platform to connect to
55
+ user_id : str
56
+ The identity of the user calling the method - this sets a
57
+ default optionally used by the methods when the user
58
+ doesn't pass the user_id on a method call.
59
+ user_pwd: str
60
+ The password associated with the user_id. Defaults to None
61
+
62
+
63
+ """
64
+
65
+ def __init__(
66
+ self,
67
+ view_server: str,
68
+ platform_url: str,
69
+ user_id: str = None,
70
+ user_pwd: str = None,
71
+ token: str = None,
72
+ ):
73
+ self.view_server = view_server
74
+ self.platform_url = platform_url
75
+ self.user_id = user_id
76
+ self.user_pwd = user_pwd
77
+ self.metadata_explorer_command_root: str = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/metadata-explorer"
78
+ Client.__init__(
79
+ self,
80
+ view_server,
81
+ platform_url,
82
+ user_id=user_id,
83
+ user_pwd=user_pwd,
84
+ token=token,
85
+ )
86
+
87
+ #
88
+ # Get
89
+ #
90
+
91
+ async def _async_get_metadata_guid_by_unique_name(
92
+ self,
93
+ name: str,
94
+ property_name: str,
95
+ effective_time: str = None,
96
+ for_lineage: bool = None,
97
+ for_duplicate_processing: bool = None,
98
+ ) -> str:
99
+ """
100
+ Retrieve the metadata element GUID using its unique name (typically the qualified name, but it is possible to
101
+ specify a different property name in the request body as long as it is unique).
102
+ If multiple matching instances are found, an exception is thrown. Async version.
103
+
104
+ Parameters
105
+ ----------
106
+ name : str
107
+ - unique name to search for
108
+ property_name: str
109
+ - property name to search in (typically the qualified name)
110
+ effective_time: str, default = None
111
+ - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
112
+ for_lineage: bool, default is set by server
113
+ - determines if elements classified as Memento should be returned - normally false
114
+ for_duplicate_processing: bool, default is set by server
115
+ - Normally false. Set true when the caller is part of a deduplication function
116
+
117
+ Returns
118
+ -------
119
+ str
120
+ The GUID of the element - or "No element found"
121
+
122
+ Raises
123
+ ------
124
+ InvalidParameterException
125
+ one of the parameters is null or invalid or
126
+ PropertyServerException
127
+ There is a problem adding the element properties to the metadata repository or
128
+ UserNotAuthorizedException
129
+ the requesting user is not authorized to issue this request.
130
+ """
131
+
132
+ possible_query_params = query_string(
133
+ [
134
+ ("forLineage", for_lineage),
135
+ ("forDuplicateProcessing", for_duplicate_processing),
136
+ ]
137
+ )
138
+
139
+ body = {
140
+ "class": "NameRequestBody",
141
+ "name": name,
142
+ "namePropertyName": property_name,
143
+ "effectiveTime": effective_time,
144
+ }
145
+
146
+ url = (
147
+ f"{base_path(self, self.view_server)}/metadata-elements/guid-by-unique-name"
148
+ f"{possible_query_params}"
149
+ )
150
+ response: Response = await self._async_make_request(
151
+ "POST", url, body_slimmer(body)
152
+ )
153
+ return response.json().get("guid", "No elements found")
154
+
155
+ def get_metadata_guid_by_unique_name(
156
+ self,
157
+ name: str,
158
+ property_name: str,
159
+ effective_time: str = None,
160
+ for_lineage: bool = None,
161
+ for_duplicate_processing: bool = None,
162
+ ) -> str:
163
+ """
164
+ Retrieve the metadata element GUID using its unique name (typically the qualified name, but it is possible to
165
+ specify a different property name in the request body as long as it is unique).
166
+ If multiple matching instances are found, an exception is thrown.
167
+
168
+ Parameters
169
+ ----------
170
+ name : str
171
+ - unique name to search for
172
+ property_name: str
173
+ - property name to search in (typically the qualified name)
174
+ effective_time: str, default = None
175
+ - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
176
+ for_lineage: bool, default is set by server
177
+ - determines if elements classified as Memento should be returned - normally false
178
+ for_duplicate_processing: bool, default is set by server
179
+ - Normally false. Set true when the caller is part of a deduplication function
180
+
181
+ Returns
182
+ -------
183
+ str
184
+ The GUID of the element - or "No element found"
185
+
186
+ Raises
187
+ ------
188
+ InvalidParameterException
189
+ one of the parameters is null or invalid or
190
+ PropertyServerException
191
+ There is a problem adding the element properties to the metadata repository or
192
+ UserNotAuthorizedException
193
+ the requesting user is not authorized to issue this request.
194
+ """
195
+
196
+ loop = asyncio.get_event_loop()
197
+ response = loop.run_until_complete(
198
+ self._async_get_metadata_guid_by_unique_name(
199
+ name,
200
+ property_name,
201
+ effective_time,
202
+ for_lineage,
203
+ for_duplicate_processing,
204
+ )
205
+ )
206
+ return response
207
+
208
+ async def _async_get_metadata_element_by_guid(
209
+ self,
210
+ guid: str,
211
+ effective_time: str = None,
212
+ for_lineage: bool = None,
213
+ for_duplicate_processing: bool = None,
214
+ ) -> dict | str:
215
+ """
216
+ Retrieve the metadata element using its unique identifier. Async version.
217
+
218
+ Parameters
219
+ ----------
220
+ guid : str
221
+ - unique identifier of the element to retrieve
222
+ effective_time: str, default = None
223
+ - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
224
+ for_lineage: bool, default is set by server
225
+ - determines if elements classified as Memento should be returned - normally false
226
+ for_duplicate_processing: bool, default is set by server
227
+ - Normally false. Set true when the caller is part of a deduplication function
228
+
229
+ Returns
230
+ -------
231
+ dict | str
232
+ If the element is found, a dict of the element details is returned. Otherwise the string "No element found".
233
+
234
+ Raises
235
+ ------
236
+ InvalidParameterException
237
+ one of the parameters is null or invalid or
238
+ PropertyServerException
239
+ There is a problem adding the element properties to the metadata repository or
240
+ UserNotAuthorizedException
241
+ the requesting user is not authorized to issue this request.
242
+ """
243
+
244
+ possible_query_params = query_string(
245
+ [
246
+ ("forLineage", for_lineage),
247
+ ("forDuplicateProcessing", for_duplicate_processing),
248
+ ]
249
+ )
250
+
251
+ body = {
252
+ "class": "EffectiveTimeRequestBody",
253
+ "effectiveTime": effective_time,
254
+ }
255
+
256
+ url = (
257
+ f"{base_path(self, self.view_server)}/metadata-elements/{guid}"
258
+ f"{possible_query_params}"
259
+ )
260
+ response: Response = await self._async_make_request(
261
+ "POST", url, body_slimmer(body)
262
+ )
263
+ return response.json().get("element", "No elements found")
264
+
265
+ def get_metadata_element_by_guid(
266
+ self,
267
+ guid: str,
268
+ effective_time: str = None,
269
+ for_lineage: bool = None,
270
+ for_duplicate_processing: bool = None,
271
+ ) -> dict | str:
272
+ """
273
+ Retrieve the metadata element using its unique identifier.
274
+
275
+ Parameters
276
+ ----------
277
+ guid : str
278
+ - unique identifier of the element to retrieve
279
+ effective_time: str, default = None
280
+ - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
281
+ for_lineage: bool, default is set by server
282
+ - determines if elements classified as Memento should be returned - normally false
283
+ for_duplicate_processing: bool, default is set by server
284
+ - Normally false. Set true when the caller is part of a deduplication function
285
+
286
+ Returns
287
+ -------
288
+ dict | str
289
+ If the element is found, a dict of the element details is returned. Otherwise the string "No element found".
290
+
291
+ Raises
292
+ ------
293
+ InvalidParameterException
294
+ one of the parameters is null or invalid or
295
+ PropertyServerException
296
+ There is a problem adding the element properties to the metadata repository or
297
+ UserNotAuthorizedException
298
+ the requesting user is not authorized to issue this request.
299
+ """
300
+
301
+ loop = asyncio.get_event_loop()
302
+ response = loop.run_until_complete(
303
+ self._async_get_metadata_element_by_guid(
304
+ guid, effective_time, for_lineage, for_duplicate_processing
305
+ )
306
+ )
307
+ return response
308
+
309
+ async def _async_get_metadata_element_by_unique_name(
310
+ self,
311
+ name: str,
312
+ property_name: str = "qualifiedName",
313
+ effective_time: str = None,
314
+ for_lineage: bool = None,
315
+ for_duplicate_processing: bool = None,
316
+ ) -> dict | str:
317
+ """
318
+ Retrieve the metadata element using its unique name (typically the *qualifiedName* attribute but other attributes
319
+ can be used if they are unique - such as *pathName* for a file). Async version.
320
+
321
+ Parameters
322
+ ----------
323
+ name : str
324
+ - unique name to search for
325
+ property_name: str, default = "qualifiedName"
326
+ - property name to search in (typically the qualified name)
327
+ effective_time: str, default = None
328
+ - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
329
+ for_lineage: bool, default is set by server
330
+ - determines if elements classified as Memento should be returned - normally false
331
+ for_duplicate_processing: bool, default is set by server
332
+ - Normally false. Set true when the caller is part of a deduplication function
333
+
334
+ Returns
335
+ -------
336
+ dict | str
337
+ If the element is found, a dict of the element details is returned. Otherwise the string "No element found".
338
+
339
+ Raises
340
+ ------
341
+ InvalidParameterException
342
+ one of the parameters is null or invalid or
343
+ PropertyServerException
344
+ There is a problem adding the element properties to the metadata repository or
345
+ UserNotAuthorizedException
346
+ the requesting user is not authorized to issue this request.
347
+ """
348
+
349
+ possible_query_params = query_string(
350
+ [
351
+ ("forLineage", for_lineage),
352
+ ("forDuplicateProcessing", for_duplicate_processing),
353
+ ]
354
+ )
355
+
356
+ body = {
357
+ "class": "NameRequestBody",
358
+ "name": name,
359
+ "namePropertyName": property_name,
360
+ "effectiveTime": effective_time,
361
+ }
362
+
363
+ url = (
364
+ f"{base_path(self, self.view_server)}/metadata-elements/by-unique-name"
365
+ f"{possible_query_params}"
366
+ )
367
+ response: Response = await self._async_make_request(
368
+ "POST", url, body_slimmer(body)
369
+ )
370
+ return response.json().get("element", "No elements found")
371
+
372
+ def get_metadata_element_by_unique_name(
373
+ self,
374
+ name: str,
375
+ property_name: str = "qualifiedName",
376
+ effective_time: str = None,
377
+ for_lineage: bool = False,
378
+ for_duplicate_processing: bool = False,
379
+ ) -> str:
380
+ """
381
+ Retrieve the metadata element using its unique name (typically the *qualifiedName* attribute but other attributes
382
+ can be used if they are unique - such as *pathName* for a file).
383
+
384
+ Parameters
385
+ ----------
386
+ name : str
387
+ - unique name to search for
388
+ property_name: str, default = "qualifiedName"
389
+ - property name to search in (typically the qualified name)
390
+ effective_time: str, default = None
391
+ - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
392
+ for_lineage: bool, default is set by server
393
+ - determines if elements classified as Memento should be returned - normally false
394
+ for_duplicate_processing: bool, default is set by server
395
+ - Normally false. Set true when the caller is part of a deduplication function
396
+
397
+ Returns
398
+ -------
399
+ dict | str
400
+ If the element is found, a dict of the element details is returned. Otherwise the string "No element found".
401
+
402
+
403
+ Raises
404
+ ------
405
+ InvalidParameterException
406
+ one of the parameters is null or invalid or
407
+ PropertyServerException
408
+ There is a problem adding the element properties to the metadata repository or
409
+ UserNotAuthorizedException
410
+ the requesting user is not authorized to issue this request.
411
+ """
412
+
413
+ loop = asyncio.get_event_loop()
414
+ response = loop.run_until_complete(
415
+ self._async_get_metadata_element_by_unique_name(
416
+ name,
417
+ property_name,
418
+ effective_time,
419
+ for_lineage,
420
+ for_duplicate_processing,
421
+ )
422
+ )
423
+ return response
424
+
425
+ async def _async_get_metadata_element_history(
426
+ self,
427
+ guid: str,
428
+ effective_time: str = None,
429
+ oldest_first: bool = False,
430
+ from_time: str = None,
431
+ to_time: str = None,
432
+ for_lineage: bool = None,
433
+ for_duplicate_processing: bool = None,
434
+ start_from: int = 0,
435
+ page_size: int = max_paging_size,
436
+ time_out: int = default_time_out,
437
+ ) -> list | str:
438
+ """
439
+ Retrieve all the versions of a metadata element. Async version.
440
+
441
+ Parameters
442
+ ----------
443
+ guid: str
444
+ - Unique identity of element to retrieve.
445
+ effective_time: str, default = None
446
+ - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
447
+ oldest_first: bool, default = False
448
+ from_time: str, default = None
449
+ Time to begin returning history
450
+ to_time: str, default = None
451
+ Time to end returning history
452
+ for_lineage: bool, default is set by server
453
+ - determines if elements classified as Memento should be returned - normally false
454
+ for_duplicate_processing: bool, default is set by server
455
+ - Normally false. Set true when the caller is part of a deduplication function
456
+ start_from: int, default = 0
457
+ - index of the list to start from (0 for start).
458
+ page_size
459
+ - maximum number of elements to return.
460
+ time_out: int, default = default_time_out
461
+ - http request timeout for this request
462
+
463
+ Returns
464
+ -------
465
+ [dict] | str
466
+ Returns a string if no elements found and a list of dict of elements with the results.
467
+
468
+ Raises
469
+ ------
470
+ InvalidParameterException
471
+ one of the parameters is null or invalid or
472
+ PropertyServerException
473
+ There is a problem adding the element properties to the metadata repository or
474
+ UserNotAuthorizedException
475
+ the requesting user is not authorized to issue this request.
476
+ """
477
+
478
+ possible_query_params = query_string(
479
+ [
480
+ ("startFrom", start_from),
481
+ ("pageSize", page_size),
482
+ ("oldestFirst", oldest_first),
483
+ ("forLineage", for_lineage),
484
+ ("forDuplicateProcessing", for_duplicate_processing),
485
+ ]
486
+ )
487
+
488
+ body = {
489
+ "class": "HistoryRequestBody",
490
+ "effectiveTime": effective_time,
491
+ "fromTime": from_time,
492
+ "toTime": to_time,
493
+ }
494
+
495
+ url = (
496
+ f"{base_path(self, self.view_server)}/metadata-elements/{guid}/history"
497
+ f"{possible_query_params}"
498
+ )
499
+
500
+ response: Response = await self._async_make_request(
501
+ "POST", url, body_slimmer(body), time_out=time_out
502
+ )
503
+
504
+ elements = response.json().get("elementList", "No elements found")
505
+ if type(elements) is list:
506
+ if len(elements) == 0:
507
+ return "No elements found"
508
+ return elements
509
+
510
+ def get_metadata_element_history(
511
+ self,
512
+ guid: str,
513
+ effective_time: str = None,
514
+ oldest_first: bool = False,
515
+ from_time: str = None,
516
+ to_time: str = None,
517
+ for_lineage: bool = None,
518
+ for_duplicate_processing: bool = None,
519
+ start_from: int = 0,
520
+ page_size: int = max_paging_size,
521
+ time_out: int = default_time_out,
522
+ ) -> list | str:
523
+ """
524
+ Retrieve all the versions of a metadata element.
525
+
526
+ Parameters
527
+ ----------
528
+ guid: str
529
+ - Unique identity of element to retrieve.
530
+ effective_time: str, default = None
531
+ - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
532
+ oldest_first: bool, default = False
533
+ from_time: str, default = None
534
+ Time to begin returning history
535
+ to_time: str, default = None
536
+ Time to end returning history
537
+ for_lineage: bool, default is set by server
538
+ - determines if elements classified as Memento should be returned - normally false
539
+ for_duplicate_processing: bool, default is set by server
540
+ - Normally false. Set true when the caller is part of a deduplication function
541
+ start_from: int, default = 0
542
+ - index of the list to start from (0 for start).
543
+ page_size
544
+ - maximum number of elements to return.
545
+ time_out: int, default = default_time_out
546
+ - http request timeout for this request
547
+
548
+ Returns
549
+ -------
550
+ [dict] | str
551
+ Returns a string if no elements found and a list of dict of elements with the results.
552
+
553
+ Raises
554
+ ------
555
+ InvalidParameterException
556
+ one of the parameters is null or invalid or
557
+ PropertyServerException
558
+ There is a problem adding the element properties to the metadata repository or
559
+ UserNotAuthorizedException
560
+ the requesting user is not authorized to issue this request.
561
+ """
562
+
563
+ loop = asyncio.get_event_loop()
564
+ response = loop.run_until_complete(
565
+ self._async_get_metadata_element_history(
566
+ guid,
567
+ effective_time,
568
+ oldest_first,
569
+ from_time,
570
+ to_time,
571
+ for_lineage,
572
+ for_duplicate_processing,
573
+ start_from,
574
+ page_size,
575
+ time_out,
576
+ )
577
+ )
578
+ return response
579
+
580
+ async def _async_find_metadata_elements_with_string(
581
+ self,
582
+ body: dict,
583
+ for_lineage: bool = None,
584
+ for_duplicate_processing: bool = None,
585
+ start_from: int = 0,
586
+ page_size: int = max_paging_size,
587
+ time_out: int = default_time_out,
588
+ ) -> list | str:
589
+ """
590
+ Return a list of metadata elements that match the supplied criteria. The results can be returned over many pages.
591
+ Async version.
592
+
593
+ Parameters
594
+ ----------
595
+ body: dict
596
+ - A structure containing the search criteria. (example below)
597
+ for_lineage: bool, default is set by server
598
+ - determines if elements classified as Memento should be returned - normally false
599
+ for_duplicate_processing: bool, default is set by server
600
+ - Normally false. Set true when the caller is part of a deduplication function
601
+ start_from: int, default = 0
602
+ - index of the list to start from (0 for start).
603
+ page_size
604
+ - maximum number of elements to return.
605
+ time_out: int, default = default_time_out
606
+ - http request timeout for this request
607
+
608
+ Returns
609
+ -------
610
+ [dict] | str
611
+ Returns a string if no elements found and a list of dict of elements with the results.
612
+
613
+ Raises
614
+ ------
615
+ InvalidParameterException
616
+ one of the parameters is null or invalid or
617
+ PropertyServerException
618
+ There is a problem adding the element properties to the metadata repository or
619
+ UserNotAuthorizedException
620
+ the requesting user is not authorized to issue this request.
621
+
622
+ Notes:
623
+
624
+ Sample body:
625
+ {
626
+ "class" : "SearchStringRequestBody",
627
+ "searchString" : "Egeria",
628
+ "typeName" : "ValidValueDefinition",
629
+ "effectiveTime" : "{{$isoTimestamp}}",
630
+ "limitResultsByStatus" : ["ACTIVE"],
631
+ "asOfTime" : "{{$isoTimestamp}}",
632
+ "sequencingOrder": "CREATION_DATE_RECENT",
633
+ "sequencingProperty": ""
634
+ }
635
+
636
+ """
637
+
638
+ possible_query_params = query_string(
639
+ [
640
+ ("startFrom", start_from),
641
+ ("pageSize", page_size),
642
+ ("forLineage", for_lineage),
643
+ ("forDuplicateProcessing", for_duplicate_processing),
644
+ ]
645
+ )
646
+
647
+ url = (
648
+ f"{base_path(self, self.view_server)}/metadata-elements/by-search-string"
649
+ f"{possible_query_params}"
650
+ )
651
+
652
+ response: Response = await self._async_make_request(
653
+ "POST", url, body_slimmer(body), time_out=time_out
654
+ )
655
+
656
+ elements = response.json().get("elementList", "No elements found")
657
+ if type(elements) is list:
658
+ if len(elements) == 0:
659
+ return "No elements found"
660
+ return elements
661
+
662
+ def find_metadata_elements_with_string(
663
+ self,
664
+ body: dict,
665
+ for_lineage: bool = None,
666
+ for_duplicate_processing: bool = None,
667
+ start_from: int = 0,
668
+ page_size: int = max_paging_size,
669
+ time_out: int = default_time_out,
670
+ ) -> list | str:
671
+ """
672
+ Return a list of metadata elements that match the supplied criteria. The results can be returned over many pages.
673
+ Async version.
674
+
675
+ Parameters
676
+ ----------
677
+ body: dict
678
+ - A structure containing the search criteria. (example below)
679
+ for_lineage: bool, default is set by server
680
+ - determines if elements classified as Memento should be returned - normally false
681
+ for_duplicate_processing: bool, default is set by server
682
+ - Normally false. Set true when the caller is part of a deduplication function
683
+ start_from: int, default = 0
684
+ - index of the list to start from (0 for start).
685
+ page_size
686
+ - maximum number of elements to return.
687
+ time_out: int, default = default_time_out
688
+ - http request timeout for this request
689
+
690
+ Returns
691
+ -------
692
+ [dict] | str
693
+ Returns a string if no elements found and a list of dict of elements with the results.
694
+
695
+ Raises
696
+ ------
697
+ InvalidParameterException
698
+ one of the parameters is null or invalid or
699
+ PropertyServerException
700
+ There is a problem adding the element properties to the metadata repository or
701
+ UserNotAuthorizedException
702
+ the requesting user is not authorized to issue this request.
703
+
704
+ Notes:
705
+
706
+ Sample body:
707
+ {
708
+ "class" : "SearchStringRequestBody",
709
+ "searchString" : "Egeria",
710
+ "typeName" : "ValidValueDefinition",
711
+ "effectiveTime" : "{{$isoTimestamp}}",
712
+ "limitResultsByStatus" : ["ACTIVE"],
713
+ "asOfTime" : "{{$isoTimestamp}}",
714
+ "sequencingOrder": "CREATION_DATE_RECENT",
715
+ "sequencingProperty": ""
716
+ }
717
+
718
+ """
719
+ loop = asyncio.get_event_loop()
720
+ response = loop.run_until_complete(
721
+ self._async_find_metadata_elements_with_string(
722
+ body,
723
+ for_lineage,
724
+ for_duplicate_processing,
725
+ start_from,
726
+ page_size,
727
+ time_out,
728
+ )
729
+ )
730
+ return response
731
+
732
+ async def _async_get_all_related_metadata_elements(
733
+ self,
734
+ guid: str,
735
+ body: dict,
736
+ for_lineage: bool = None,
737
+ for_duplicate_processing: bool = None,
738
+ starting_at_end: int = 0,
739
+ start_from: int = 0,
740
+ page_size: int = max_paging_size,
741
+ time_out: int = default_time_out,
742
+ ) -> list | str:
743
+ """
744
+ Retrieve the metadata elements connected to the supplied element.
745
+ Async version.
746
+
747
+ Parameters
748
+ ----------
749
+ guid: str
750
+ - Unique identity of element to retrieve.
751
+ body: dict
752
+ - A structure containing the search criteria. (example below)
753
+ for_lineage: bool, default is set by server
754
+ - determines if elements classified as Memento should be returned - normally false
755
+ for_duplicate_processing: bool, default is set by server
756
+ - Normally false. Set true when the caller is part of a deduplication function
757
+ starting_at_end: int, default = 0
758
+ - Relationship end to start from.
759
+ start_from: int, default = 0
760
+ - index of the list to start from (0 for start).
761
+ page_size
762
+ - maximum number of elements to return.
763
+ time_out: int, default = default_time_out
764
+ - http request timeout for this request
765
+
766
+ Returns
767
+ -------
768
+ [dict] | str
769
+ Returns a string if no elements found and a list of dict of elements with the results.
770
+
771
+ Raises
772
+ ------
773
+ InvalidParameterException
774
+ one of the parameters is null or invalid or
775
+ PropertyServerException
776
+ There is a problem adding the element properties to the metadata repository or
777
+ UserNotAuthorizedException
778
+ the requesting user is not authorized to issue this request.
779
+
780
+ Notes:
781
+
782
+ Sample body:
783
+ {
784
+ "class" : "ResultsRequestBody",
785
+ "effectiveTime" : "{{$isoTimestamp}}",
786
+ "limitResultsByStatus" : ["ACTIVE"],
787
+ "asOfTime" : "{{$isoTimestamp}}",
788
+ "sequencingOrder": "PROPERTY_ASCENDING",
789
+ "sequencingProperty": "fileName"
790
+ }
791
+
792
+ """
793
+
794
+ possible_query_params = query_string(
795
+ [
796
+ ("startingAtEnd", starting_at_end),
797
+ ("startFrom", start_from),
798
+ ("pageSize", page_size),
799
+ ("forLineage", for_lineage),
800
+ ("forDuplicateProcessing", for_duplicate_processing),
801
+ ]
802
+ )
803
+
804
+ url = (
805
+ f"{base_path(self, self.view_server)}/related-elements/{guid}/any-type"
806
+ f"{possible_query_params}"
807
+ )
808
+
809
+ response: Response = await self._async_make_request(
810
+ "POST", url, body_slimmer(body), time_out=time_out
811
+ )
812
+
813
+ elements = response.json().get("elementList", "No elements found")
814
+ if type(elements) is list:
815
+ if len(elements) == 0:
816
+ return "No elements found"
817
+ return elements
818
+
819
+ def get_all_related_metadata_elements(
820
+ self,
821
+ guid: str,
822
+ body: dict,
823
+ for_lineage: bool = None,
824
+ for_duplicate_processing: bool = None,
825
+ starting_at_end: int = 0,
826
+ start_from: int = 0,
827
+ page_size: int = max_paging_size,
828
+ time_out: int = default_time_out,
829
+ ) -> list | str:
830
+ """
831
+ Retrieve the metadata elements connected to the supplied element.
832
+
833
+ Parameters
834
+ ----------
835
+ guid: str
836
+ - unique identity of element
837
+ body: dict
838
+ - A structure containing the search criteria. (example below)
839
+ for_lineage: bool, default is set by server
840
+ - determines if elements classified as Memento should be returned - normally false
841
+ for_duplicate_processing: bool, default is set by server
842
+ - Normally false. Set true when the caller is part of a deduplication function
843
+ starting_at_end: int, default = 0
844
+ - Relationship end to start from.
845
+ start_from: int, default = 0
846
+ - index of the list to start from (0 for start).
847
+ page_size
848
+ - maximum number of elements to return.
849
+ time_out: int, default = default_time_out
850
+ - http request timeout for this request
851
+
852
+ Returns
853
+ -------
854
+ [dict] | str
855
+ Returns a string if no elements found and a list of dict of elements with the results.
856
+
857
+ Raises
858
+ ------
859
+ InvalidParameterException
860
+ one of the parameters is null or invalid or
861
+ PropertyServerException
862
+ There is a problem adding the element properties to the metadata repository or
863
+ UserNotAuthorizedException
864
+ the requesting user is not authorized to issue this request.
865
+
866
+ Notes:
867
+
868
+ Sample body:
869
+ {
870
+ "class" : "ResultsRequestBody",
871
+ "effectiveTime" : "{{$isoTimestamp}}",
872
+ "limitResultsByStatus" : ["ACTIVE"],
873
+ "asOfTime" : "{{$isoTimestamp}}",
874
+ "sequencingOrder": "PROPERTY_ASCENDING",
875
+ "sequencingProperty": "fileName"
876
+ }
877
+
878
+ """
879
+ loop = asyncio.get_event_loop()
880
+ response = loop.run_until_complete(
881
+ self._async_get_all_related_metadata_elements(
882
+ guid,
883
+ body,
884
+ for_lineage,
885
+ for_duplicate_processing,
886
+ starting_at_end,
887
+ start_from,
888
+ page_size,
889
+ time_out,
890
+ )
891
+ )
892
+ return response
893
+
894
+ async def _async_get_related_metadata_elements(
895
+ self,
896
+ guid: str,
897
+ relationship_type: str,
898
+ body: dict,
899
+ for_lineage: bool = None,
900
+ for_duplicate_processing: bool = None,
901
+ starting_at_end: int = 0,
902
+ start_from: int = 0,
903
+ page_size: int = max_paging_size,
904
+ time_out: int = default_time_out,
905
+ ) -> list | str:
906
+ """
907
+ Retrieve the metadata elements connected to the supplied element.
908
+ Async version.
909
+
910
+ Parameters
911
+ ----------
912
+ guid: str
913
+ - Unique identity of element to retrieve.
914
+ relationship_type: str
915
+ - name of relationship type to retrieve relationships of
916
+ body: dict
917
+ - A structure containing the search criteria. (example below)
918
+ for_lineage: bool, default is set by server
919
+ - determines if elements classified as Memento should be returned - normally false
920
+ for_duplicate_processing: bool, default is set by server
921
+ - Normally false. Set true when the caller is part of a deduplication function
922
+ starting_at_end: int, default = 0
923
+ - Relationship end to start from.
924
+ start_from: int, default = 0
925
+ - index of the list to start from (0 for start).
926
+ page_size
927
+ - maximum number of elements to return.
928
+ time_out: int, default = default_time_out
929
+ - http request timeout for this request
930
+
931
+ Returns
932
+ -------
933
+ [dict] | str
934
+ Returns a string if no elements found and a list of dict of elements with the results.
935
+
936
+ Raises
937
+ ------
938
+ InvalidParameterException
939
+ one of the parameters is null or invalid or
940
+ PropertyServerException
941
+ There is a problem adding the element properties to the metadata repository or
942
+ UserNotAuthorizedException
943
+ the requesting user is not authorized to issue this request.
944
+
945
+ Notes:
946
+
947
+ Sample body:
948
+ {
949
+ "class" : "ResultsRequestBody",
950
+ "effectiveTime" : "{{$isoTimestamp}}",
951
+ "limitResultsByStatus" : ["ACTIVE"],
952
+ "asOfTime" : "{{$isoTimestamp}}",
953
+ "sequencingOrder": "PROPERTY_ASCENDING",
954
+ "sequencingProperty": "fileName"
955
+ }
956
+
957
+ """
958
+
959
+ possible_query_params = query_string(
960
+ [
961
+ ("startingAtEnd", starting_at_end),
962
+ ("startFrom", start_from),
963
+ ("pageSize", page_size),
964
+ ("forLineage", for_lineage),
965
+ ("forDuplicateProcessing", for_duplicate_processing),
966
+ ]
967
+ )
968
+
969
+ url = (
970
+ f"{base_path(self, self.view_server)}/related-elements/{guid}/type/{relationship_type}"
971
+ f"{possible_query_params}"
972
+ )
973
+
974
+ response: Response = await self._async_make_request(
975
+ "POST", url, body_slimmer(body), time_out=time_out
976
+ )
977
+
978
+ elements = response.json().get("elementList", "No elements found")
979
+ if type(elements) is list:
980
+ if len(elements) == 0:
981
+ return "No elements found"
982
+ return elements
983
+
984
+ def get_related_metadata_elements(
985
+ self,
986
+ guid: str,
987
+ relationship_type: str,
988
+ body: dict,
989
+ for_lineage: bool = None,
990
+ for_duplicate_processing: bool = None,
991
+ starting_at_end: int = 0,
992
+ start_from: int = 0,
993
+ page_size: int = max_paging_size,
994
+ time_out: int = default_time_out,
995
+ ) -> list | str:
996
+ """
997
+ Retrieve the metadata elements connected to the supplied element.
998
+
999
+ Parameters
1000
+ ----------
1001
+ guid: str
1002
+ - Unique identity of element to retrieve.
1003
+ relationship_type: str
1004
+ - name of relationship type to retrieve relationships of
1005
+ body: dict
1006
+ - A structure containing the search criteria. (example below)
1007
+ for_lineage: bool, default is set by server
1008
+ - determines if elements classified as Memento should be returned - normally false
1009
+ for_duplicate_processing: bool, default is set by server
1010
+ - Normally false. Set true when the caller is part of a deduplication function
1011
+ starting_at_end: int, default = 0
1012
+ - Relationship end to start from.
1013
+ start_from: int, default = 0
1014
+ - index of the list to start from (0 for start).
1015
+ page_size
1016
+ - maximum number of elements to return.
1017
+ time_out: int, default = default_time_out
1018
+ - http request timeout for this request
1019
+
1020
+ Returns
1021
+ -------
1022
+ [dict] | str
1023
+ Returns a string if no elements found and a list of dict of elements with the results.
1024
+
1025
+ Raises
1026
+ ------
1027
+ InvalidParameterException
1028
+ one of the parameters is null or invalid or
1029
+ PropertyServerException
1030
+ There is a problem adding the element properties to the metadata repository or
1031
+ UserNotAuthorizedException
1032
+ the requesting user is not authorized to issue this request.
1033
+
1034
+ Notes:
1035
+
1036
+ Sample body:
1037
+ {
1038
+ "class" : "ResultsRequestBody",
1039
+ "effectiveTime" : "{{$isoTimestamp}}",
1040
+ "limitResultsByStatus" : ["ACTIVE"],
1041
+ "asOfTime" : "{{$isoTimestamp}}",
1042
+ "sequencingOrder": "PROPERTY_ASCENDING",
1043
+ "sequencingProperty": "fileName"
1044
+ }
1045
+
1046
+ """
1047
+ loop = asyncio.get_event_loop()
1048
+ response = loop.run_until_complete(
1049
+ self._async_get_related_metadata_elements(
1050
+ guid,
1051
+ relationship_type,
1052
+ body,
1053
+ for_lineage,
1054
+ for_duplicate_processing,
1055
+ starting_at_end,
1056
+ start_from,
1057
+ page_size,
1058
+ time_out,
1059
+ )
1060
+ )
1061
+ return response
1062
+
1063
+ async def _async_get_all_metadata_element_relationships(
1064
+ self,
1065
+ end1_guid: str,
1066
+ end2_guid: str,
1067
+ body: dict,
1068
+ for_lineage: bool = None,
1069
+ for_duplicate_processing: bool = None,
1070
+ starting_at_end: int = 0,
1071
+ start_from: int = 0,
1072
+ page_size: int = max_paging_size,
1073
+ time_out: int = default_time_out,
1074
+ ) -> list | str:
1075
+ """
1076
+ Retrieve the relationships linking the supplied elements.
1077
+ Async version.
1078
+
1079
+ Parameters
1080
+ ----------
1081
+ end1_guid: str
1082
+ - Unique identity of the metadata element at end1 of a relationship.
1083
+ end2_guid: str
1084
+ - Unique identity of the metadata element at end2 of a relationship.
1085
+ body: dict
1086
+ - A structure containing the search criteria. (example below)
1087
+ for_lineage: bool, default is set by server
1088
+ - determines if elements classified as Memento should be returned - normally false
1089
+ for_duplicate_processing: bool, default is set by server
1090
+ - Normally false. Set true when the caller is part of a deduplication function
1091
+ starting_at_end: int, default = 0
1092
+ - Relationship end to start from.
1093
+ start_from: int, default = 0
1094
+ - index of the list to start from (0 for start).
1095
+ page_size
1096
+ - maximum number of elements to return.
1097
+ time_out: int, default = default_time_out
1098
+ - http request timeout for this request
1099
+
1100
+ Returns
1101
+ -------
1102
+ [dict] | str
1103
+ Returns a string if no elements found and a list of dict of elements with the results.
1104
+
1105
+ Raises
1106
+ ------
1107
+ InvalidParameterException
1108
+ one of the parameters is null or invalid or
1109
+ PropertyServerException
1110
+ There is a problem adding the element properties to the metadata repository or
1111
+ UserNotAuthorizedException
1112
+ the requesting user is not authorized to issue this request.
1113
+
1114
+ Notes:
1115
+
1116
+ Sample body:
1117
+ {
1118
+ "class" : "ResultsRequestBody",
1119
+ "effectiveTime" : "{{$isoTimestamp}}",
1120
+ "limitResultsByStatus" : ["ACTIVE"],
1121
+ "asOfTime" : "{{$isoTimestamp}}",
1122
+ "sequencingOrder": "PROPERTY_ASCENDING",
1123
+ "sequencingProperty": "fileName"
1124
+ }
1125
+
1126
+ """
1127
+
1128
+ possible_query_params = query_string(
1129
+ [
1130
+ ("startingAtEnd", starting_at_end),
1131
+ ("startFrom", start_from),
1132
+ ("pageSize", page_size),
1133
+ ("forLineage", for_lineage),
1134
+ ("forDuplicateProcessing", for_duplicate_processing),
1135
+ ]
1136
+ )
1137
+
1138
+ url = (
1139
+ f"{base_path(self, self.view_server)}/metadata-elements/{end1_guid}/linked-by-any-type/"
1140
+ f"to-elements/{end2_guid}"
1141
+ f"{possible_query_params}"
1142
+ )
1143
+
1144
+ response: Response = await self._async_make_request(
1145
+ "POST", url, body_slimmer(body), time_out=time_out
1146
+ )
1147
+
1148
+ elements = response.json().get("elementList", "No elements found")
1149
+ if type(elements) is list:
1150
+ if len(elements) == 0:
1151
+ return "No elements found"
1152
+ return elements
1153
+
1154
+ def get_all_metadata_element_relationships(
1155
+ self,
1156
+ end1_guid: str,
1157
+ end2_guid: str,
1158
+ body: dict,
1159
+ for_lineage: bool = None,
1160
+ for_duplicate_processing: bool = None,
1161
+ starting_at_end: int = 0,
1162
+ start_from: int = 0,
1163
+ page_size: int = max_paging_size,
1164
+ time_out: int = default_time_out,
1165
+ ) -> list | str:
1166
+ """
1167
+ Retrieve the relationships linking the supplied elements.
1168
+
1169
+ Parameters
1170
+ ----------
1171
+ end1_guid: str
1172
+ - Unique identity of the metadata element at end1 of a relationship.
1173
+ end2_guid: str
1174
+ - Unique identity of the metadata element at end2 of a relationship.
1175
+ body: dict
1176
+ - A structure containing the search criteria. (example below)
1177
+ for_lineage: bool, default is set by server
1178
+ - determines if elements classified as Memento should be returned - normally false
1179
+ for_duplicate_processing: bool, default is set by server
1180
+ - Normally false. Set true when the caller is part of a deduplication function
1181
+ starting_at_end: int, default = 0
1182
+ - Relationship end to start from.
1183
+ start_from: int, default = 0
1184
+ - index of the list to start from (0 for start).
1185
+ page_size
1186
+ - maximum number of elements to return.
1187
+ time_out: int, default = default_time_out
1188
+ - http request timeout for this request
1189
+
1190
+ Returns
1191
+ -------
1192
+ [dict] | str
1193
+ Returns a string if no elements found and a list of dict of elements with the results.
1194
+
1195
+ Raises
1196
+ ------
1197
+ InvalidParameterException
1198
+ one of the parameters is null or invalid or
1199
+ PropertyServerException
1200
+ There is a problem adding the element properties to the metadata repository or
1201
+ UserNotAuthorizedException
1202
+ the requesting user is not authorized to issue this request.
1203
+
1204
+ Notes:
1205
+
1206
+ Sample body:
1207
+ {
1208
+ "class" : "ResultsRequestBody",
1209
+ "effectiveTime" : "{{$isoTimestamp}}",
1210
+ "limitResultsByStatus" : ["ACTIVE"],
1211
+ "asOfTime" : "{{$isoTimestamp}}",
1212
+ "sequencingOrder": "PROPERTY_ASCENDING",
1213
+ "sequencingProperty": "fileName"
1214
+ }
1215
+
1216
+ """
1217
+ loop = asyncio.get_event_loop()
1218
+ response = loop.run_until_complete(
1219
+ self._async_get_all_metadata_element_relationships(
1220
+ end1_guid,
1221
+ end2_guid,
1222
+ body,
1223
+ for_lineage,
1224
+ for_duplicate_processing,
1225
+ starting_at_end,
1226
+ start_from,
1227
+ page_size,
1228
+ time_out,
1229
+ )
1230
+ )
1231
+ return response
1232
+
1233
+ async def _async_get_metadata_element_relationships(
1234
+ self,
1235
+ end1_guid: str,
1236
+ end2_guid: str,
1237
+ relationship_type: str,
1238
+ body: dict,
1239
+ for_lineage: bool = None,
1240
+ for_duplicate_processing: bool = None,
1241
+ starting_at_end: int = 0,
1242
+ start_from: int = 0,
1243
+ page_size: int = max_paging_size,
1244
+ time_out: int = default_time_out,
1245
+ ) -> list | str:
1246
+ """
1247
+ Retrieve the relationships linking the supplied elements.
1248
+ Async version.
1249
+
1250
+ Parameters
1251
+ ----------
1252
+ end1_guid: str
1253
+ - Unique identity of the metadata element at end1 of a relationship.
1254
+ end2_guid: str
1255
+ - Unique identity of the metadata element at end2 of a relationship.
1256
+ relationship_type: str
1257
+ - name of relationship type to retrieve relationships of
1258
+ body: dict
1259
+ - A structure containing the search criteria. (example below)
1260
+ for_lineage: bool, default is set by server
1261
+ - determines if elements classified as Memento should be returned - normally false
1262
+ for_duplicate_processing: bool, default is set by server
1263
+ - Normally false. Set true when the caller is part of a deduplication function
1264
+ starting_at_end: int, default = 0
1265
+ - Relationship end to start from.
1266
+ start_from: int, default = 0
1267
+ - index of the list to start from (0 for start).
1268
+ page_size
1269
+ - maximum number of elements to return.
1270
+ time_out: int, default = default_time_out
1271
+ - http request timeout for this request
1272
+
1273
+ Returns
1274
+ -------
1275
+ [dict] | str
1276
+ Returns a string if no elements found and a list of dict of elements with the results.
1277
+
1278
+ Raises
1279
+ ------
1280
+ InvalidParameterException
1281
+ one of the parameters is null or invalid or
1282
+ PropertyServerException
1283
+ There is a problem adding the element properties to the metadata repository or
1284
+ UserNotAuthorizedException
1285
+ the requesting user is not authorized to issue this request.
1286
+
1287
+ Notes:
1288
+
1289
+ Sample body:
1290
+ {
1291
+ "class" : "ResultsRequestBody",
1292
+ "effectiveTime" : "{{$isoTimestamp}}",
1293
+ "limitResultsByStatus" : ["ACTIVE"],
1294
+ "asOfTime" : "{{$isoTimestamp}}",
1295
+ "sequencingOrder": "PROPERTY_ASCENDING",
1296
+ "sequencingProperty": "fileName"
1297
+ }
1298
+
1299
+ """
1300
+
1301
+ possible_query_params = query_string(
1302
+ [
1303
+ ("startingAtEnd", starting_at_end),
1304
+ ("startFrom", start_from),
1305
+ ("pageSize", page_size),
1306
+ ("forLineage", for_lineage),
1307
+ ("forDuplicateProcessing", for_duplicate_processing),
1308
+ ]
1309
+ )
1310
+
1311
+ url = (
1312
+ f"{base_path(self, self.view_server)}/metadata-elements/{end1_guid}/linked-by-type/"
1313
+ f"{relationship_type}/to-elements/{end2_guid}"
1314
+ f"{possible_query_params}"
1315
+ )
1316
+
1317
+ response: Response = await self._async_make_request(
1318
+ "POST", url, body_slimmer(body), time_out=time_out
1319
+ )
1320
+
1321
+ elements = response.json().get("elementList", "No elements found")
1322
+ if type(elements) is list:
1323
+ if len(elements) == 0:
1324
+ return "No elements found"
1325
+ return elements
1326
+
1327
+ def get_metadata_element_relationships(
1328
+ self,
1329
+ end1_guid: str,
1330
+ end2_guid: str,
1331
+ relationship_type: str,
1332
+ body: dict,
1333
+ for_lineage: bool = None,
1334
+ for_duplicate_processing: bool = None,
1335
+ starting_at_end: int = 0,
1336
+ start_from: int = 0,
1337
+ page_size: int = max_paging_size,
1338
+ time_out: int = default_time_out,
1339
+ ) -> list | str:
1340
+ """
1341
+ Retrieve the relationships linking the supplied elements.
1342
+
1343
+ Parameters
1344
+ ----------
1345
+ end1_guid: str
1346
+ - Unique identity of the metadata element at end1 of a relationship.
1347
+ end2_guid: str
1348
+ - Unique identity of the metadata element at end2 of a relationship.
1349
+ relationship_type: str
1350
+ - name of relationship type to retrieve relationships of
1351
+ body: dict
1352
+ - A structure containing the search criteria. (example below)
1353
+ for_lineage: bool, default is set by server
1354
+ - determines if elements classified as Memento should be returned - normally false
1355
+ for_duplicate_processing: bool, default is set by server
1356
+ - Normally false. Set true when the caller is part of a deduplication function
1357
+ starting_at_end: int, default = 0
1358
+ - Relationship end to start from.
1359
+ start_from: int, default = 0
1360
+ - index of the list to start from (0 for start).
1361
+ page_size
1362
+ - maximum number of elements to return.
1363
+ time_out: int, default = default_time_out
1364
+ - http request timeout for this request
1365
+
1366
+ Returns
1367
+ -------
1368
+ [dict] | str
1369
+ Returns a string if no elements found and a list of dict of elements with the results.
1370
+
1371
+ Raises
1372
+ ------
1373
+ InvalidParameterException
1374
+ one of the parameters is null or invalid or
1375
+ PropertyServerException
1376
+ There is a problem adding the element properties to the metadata repository or
1377
+ UserNotAuthorizedException
1378
+ the requesting user is not authorized to issue this request.
1379
+
1380
+ Notes:
1381
+
1382
+ Sample body:
1383
+ {
1384
+ "class" : "ResultsRequestBody",
1385
+ "effectiveTime" : "{{$isoTimestamp}}",
1386
+ "limitResultsByStatus" : ["ACTIVE"],
1387
+ "asOfTime" : "{{$isoTimestamp}}",
1388
+ "sequencingOrder": "PROPERTY_ASCENDING",
1389
+ "sequencingProperty": "fileName"
1390
+ }
1391
+
1392
+ """
1393
+ loop = asyncio.get_event_loop()
1394
+ response = loop.run_until_complete(
1395
+ self._async_get_metadata_element_relationships(
1396
+ end1_guid,
1397
+ end2_guid,
1398
+ relationship_type,
1399
+ body,
1400
+ for_lineage,
1401
+ for_duplicate_processing,
1402
+ starting_at_end,
1403
+ start_from,
1404
+ page_size,
1405
+ time_out,
1406
+ )
1407
+ )
1408
+ return response
1409
+
1410
+ async def _async_find_metadata_elements(
1411
+ self,
1412
+ body: dict,
1413
+ for_lineage: bool = None,
1414
+ for_duplicate_processing: bool = None,
1415
+ start_from: int = 0,
1416
+ page_size: int = max_paging_size,
1417
+ time_out: int = default_time_out,
1418
+ ) -> list | str:
1419
+ """Return a list of metadata elements that match the supplied criteria.
1420
+ The results can be returned over many pages. Async version.
1421
+
1422
+ Parameters
1423
+ ----------
1424
+ body: dict
1425
+ - A structure containing the search criteria. (example below)
1426
+ for_lineage: bool, default is set by server
1427
+ - determines if elements classified as Memento should be returned - normally false
1428
+ for_duplicate_processing: bool, default is set by server
1429
+ - Normally false. Set true when the caller is part of a deduplication function
1430
+ start_from: int, default = 0
1431
+ - index of the list to start from (0 for start).
1432
+ page_size
1433
+ - maximum number of elements to return.
1434
+ time_out: int, default = default_time_out
1435
+ - http request timeout for this request
1436
+
1437
+ Returns
1438
+ -------
1439
+ [dict] | str
1440
+ Returns a string if no elements found and a list of dict of elements with the results.
1441
+
1442
+ Raises
1443
+ ------
1444
+ InvalidParameterException
1445
+ one of the parameters is null or invalid or
1446
+ PropertyServerException
1447
+ There is a problem adding the element properties to the metadata repository or
1448
+ UserNotAuthorizedException
1449
+ the requesting user is not authorized to issue this request.
1450
+
1451
+ Notes:
1452
+
1453
+ Sample body:
1454
+ {
1455
+ "class" : "FindRequestBody",
1456
+ "metadataElementTypeName": "add typeName here",
1457
+ "metadataElementSubtypeNames": [],
1458
+ "searchProperties": {
1459
+ "class" : "SearchProperties",
1460
+ "conditions": [ {
1461
+ "nestedConditions": {
1462
+ "class" : "SearchProperties",
1463
+ "conditions": [
1464
+ {
1465
+ "property" : "add name of property here",
1466
+ "operator": "EQ",
1467
+ "value": {
1468
+ "class" : "PrimitiveTypePropertyValue",
1469
+ "typeName" : "string",
1470
+ "primitiveValue" : "Add value here"
1471
+ }
1472
+ }],
1473
+ "matchCriteria": "ALL"
1474
+ }
1475
+ }],
1476
+ "matchCriteria": "ANY"
1477
+ },
1478
+ "matchClassifications": {
1479
+ "class" : "SearchClassifications",
1480
+ "conditions": [{
1481
+ "name" : "add classification name here",
1482
+ "searchProperties": {
1483
+ "class" : "SearchProperties",
1484
+ "conditions": [
1485
+ {
1486
+ "property" : "add name of property here",
1487
+ "operator": "EQ",
1488
+ "value": {
1489
+ "class" : "PrimitiveTypePropertyValue",
1490
+ "typeName" : "string",
1491
+ "primitiveValue" : "Add value here"
1492
+ }
1493
+ }],
1494
+ "matchCriteria": "ALL"
1495
+ }
1496
+ }],
1497
+ "matchCriteria": "ANY"
1498
+ },
1499
+ "effectiveTime" : "{{$isoTimestamp}}",
1500
+ "limitResultsByStatus" : ["ACTIVE"],
1501
+ "asOfTime" : "{{$isoTimestamp}}",
1502
+ "sequencingOrder": "CREATION_DATE_RECENT",
1503
+ "sequencingProperty": ""
1504
+ }
1505
+ """
1506
+
1507
+ possible_query_params = query_string(
1508
+ [
1509
+ ("startFrom", start_from),
1510
+ ("pageSize", page_size),
1511
+ ("forLineage", for_lineage),
1512
+ ("forDuplicateProcessing", for_duplicate_processing),
1513
+ ]
1514
+ )
1515
+
1516
+ url = (
1517
+ f"{base_path(self, self.view_server)}/metadata-elements/by-search-specification"
1518
+ f"{possible_query_params}"
1519
+ )
1520
+
1521
+ response: Response = await self._async_make_request(
1522
+ "POST", url, body_slimmer(body), time_out=time_out
1523
+ )
1524
+
1525
+ elements = response.json().get("elementList", "No elements found")
1526
+ if type(elements) is list:
1527
+ if len(elements) == 0:
1528
+ return "No elements found"
1529
+ return elements
1530
+
1531
+ def find_metadata_elements(
1532
+ self,
1533
+ body: dict,
1534
+ for_lineage: bool = None,
1535
+ for_duplicate_processing: bool = None,
1536
+ start_from: int = 0,
1537
+ page_size: int = max_paging_size,
1538
+ time_out: int = default_time_out,
1539
+ ) -> list | str:
1540
+ """
1541
+ Retrieve the relationships linking the supplied elements.
1542
+
1543
+ Parameters
1544
+ ----------
1545
+ body: dict
1546
+ - A structure containing the search criteria. (example below)
1547
+ for_lineage: bool, default is set by server
1548
+ - determines if elements classified as Memento should be returned - normally false
1549
+ for_duplicate_processing: bool, default is set by server
1550
+ - Normally false. Set true when the caller is part of a deduplication function
1551
+ start_from: int, default = 0
1552
+ - index of the list to start from (0 for start).
1553
+ page_size
1554
+ - maximum number of elements to return.
1555
+ time_out: int, default = default_time_out
1556
+ - http request timeout for this request
1557
+
1558
+ Returns
1559
+ -------
1560
+ [dict] | str
1561
+ Returns a string if no elements found and a list of dict of elements with the results.
1562
+
1563
+ Raises
1564
+ ------
1565
+ InvalidParameterException
1566
+ one of the parameters is null or invalid or
1567
+ PropertyServerException
1568
+ There is a problem adding the element properties to the metadata repository or
1569
+ UserNotAuthorizedException
1570
+ the requesting user is not authorized to issue this request.
1571
+
1572
+ Notes:
1573
+
1574
+ Sample body:
1575
+ {
1576
+ "class" : "FindRequestBody",
1577
+ "metadataElementTypeName": "add typeName here",
1578
+ "metadataElementSubtypeNames": [],
1579
+ "searchProperties": {
1580
+ "class" : "SearchProperties",
1581
+ "conditions": [ {
1582
+ "nestedConditions": {
1583
+ "class" : "SearchProperties",
1584
+ "conditions": [
1585
+ {
1586
+ "property" : "add name of property here",
1587
+ "operator": "EQ",
1588
+ "value": {
1589
+ "class" : "PrimitiveTypePropertyValue",
1590
+ "typeName" : "string",
1591
+ "primitiveValue" : "Add value here"
1592
+ }
1593
+ }],
1594
+ "matchCriteria": "ALL"
1595
+ }
1596
+ }],
1597
+ "matchCriteria": "ANY"
1598
+ },
1599
+ "matchClassifications": {
1600
+ "class" : "SearchClassifications",
1601
+ "conditions": [{
1602
+ "name" : "add classification name here",
1603
+ "searchProperties": {
1604
+ "class" : "SearchProperties",
1605
+ "conditions": [
1606
+ {
1607
+ "property" : "add name of property here",
1608
+ "operator": "EQ",
1609
+ "value": {
1610
+ "class" : "PrimitiveTypePropertyValue",
1611
+ "typeName" : "string",
1612
+ "primitiveValue" : "Add value here"
1613
+ }
1614
+ }],
1615
+ "matchCriteria": "ALL"
1616
+ }
1617
+ }],
1618
+ "matchCriteria": "ANY"
1619
+ },
1620
+ "effectiveTime" : "{{$isoTimestamp}}",
1621
+ "limitResultsByStatus" : ["ACTIVE"],
1622
+ "asOfTime" : "{{$isoTimestamp}}",
1623
+ "sequencingOrder": "CREATION_DATE_RECENT",
1624
+ "sequencingProperty": ""
1625
+ }
1626
+
1627
+ """
1628
+ loop = asyncio.get_event_loop()
1629
+ response = loop.run_until_complete(
1630
+ self._async_find_metadata_elements(
1631
+ body,
1632
+ for_lineage,
1633
+ for_duplicate_processing,
1634
+ start_from,
1635
+ page_size,
1636
+ time_out,
1637
+ )
1638
+ )
1639
+ return response
1640
+
1641
+ async def _async_find_relationships_between_elements(
1642
+ self,
1643
+ body: dict,
1644
+ for_lineage: bool = None,
1645
+ for_duplicate_processing: bool = None,
1646
+ start_from: int = 0,
1647
+ page_size: int = max_paging_size,
1648
+ time_out: int = default_time_out,
1649
+ ) -> list | str:
1650
+ """Return a list of relationships that match the requested conditions.
1651
+ The results can be received as a series of pages. Async version.
1652
+
1653
+ Parameters
1654
+ ----------
1655
+ body: dict
1656
+ - A structure containing the search criteria. (example below)
1657
+ for_lineage: bool, default is set by server
1658
+ - determines if elements classified as Memento should be returned - normally false
1659
+ for_duplicate_processing: bool, default is set by server
1660
+ - Normally false. Set true when the caller is part of a deduplication function
1661
+ start_from: int, default = 0
1662
+ - index of the list to start from (0 for start).
1663
+ page_size
1664
+ - maximum number of elements to return.
1665
+ time_out: int, default = default_time_out
1666
+ - http request timeout for this request
1667
+
1668
+ Returns
1669
+ -------
1670
+ [dict] | str
1671
+ Returns a string if no elements found and a list of dict of elements with the results.
1672
+
1673
+ Raises
1674
+ ------
1675
+ InvalidParameterException
1676
+ one of the parameters is null or invalid or
1677
+ PropertyServerException
1678
+ There is a problem adding the element properties to the metadata repository or
1679
+ UserNotAuthorizedException
1680
+ the requesting user is not authorized to issue this request.
1681
+
1682
+ Notes:
1683
+
1684
+ Sample body:
1685
+ {
1686
+ "class" : "FindRelationshipRequestBody",
1687
+ "relationshipTypeName": "add typeName here",
1688
+ "searchProperties": {
1689
+ "class" : "SearchProperties",
1690
+ "conditions": [ {
1691
+ "nestedConditions": {
1692
+ "class" : "SearchProperties",
1693
+ "conditions": [
1694
+ {
1695
+ "property" : "add name of property here",
1696
+ "operator": "EQ",
1697
+ "value": {
1698
+ "class" : "PrimitiveTypePropertyValue",
1699
+ "typeName" : "string",
1700
+ "primitiveValue" : "Add value here"
1701
+ }
1702
+ }],
1703
+ "matchCriteria": "ALL"
1704
+ }
1705
+ }],
1706
+ "matchCriteria": "ANY"
1707
+ },
1708
+ "effectiveTime" : "{{$isoTimestamp}}",
1709
+ "limitResultsByStatus" : ["ACTIVE"],
1710
+ "asOfTime" : "{{$isoTimestamp}}",
1711
+ "sequencingOrder": "CREATION_DATE_RECENT",
1712
+ "sequencingProperty": ""
1713
+ }
1714
+ """
1715
+
1716
+ possible_query_params = query_string(
1717
+ [
1718
+ ("startFrom", start_from),
1719
+ ("pageSize", page_size),
1720
+ ("forLineage", for_lineage),
1721
+ ("forDuplicateProcessing", for_duplicate_processing),
1722
+ ]
1723
+ )
1724
+
1725
+ url = (
1726
+ f"{base_path(self, self.view_server)}/relationships/by-search-specification"
1727
+ f"{possible_query_params}"
1728
+ )
1729
+
1730
+ response: Response = await self._async_make_request(
1731
+ "POST", url, body_slimmer(body), time_out=time_out
1732
+ )
1733
+
1734
+ elements = response.json().get("elementList", "No elements found")
1735
+ if type(elements) is list:
1736
+ if len(elements) == 0:
1737
+ return "No elements found"
1738
+ return elements
1739
+
1740
+ def find_relationships_between_elements(
1741
+ self,
1742
+ body: dict,
1743
+ for_lineage: bool = None,
1744
+ for_duplicate_processing: bool = None,
1745
+ start_from: int = 0,
1746
+ page_size: int = max_paging_size,
1747
+ time_out: int = default_time_out,
1748
+ ) -> list | str:
1749
+ """Return a list of relationships that match the requested conditions.
1750
+ The results can be received as a series of pages.
1751
+
1752
+ Parameters
1753
+ ----------
1754
+ body: dict
1755
+ - A structure containing the search criteria. (example below)
1756
+ for_lineage: bool, default is set by server
1757
+ - determines if elements classified as Memento should be returned - normally false
1758
+ for_duplicate_processing: bool, default is set by server
1759
+ - Normally false. Set true when the caller is part of a deduplication function
1760
+ start_from: int, default = 0
1761
+ - index of the list to start from (0 for start).
1762
+ page_size
1763
+ - maximum number of elements to return.
1764
+ time_out: int, default = default_time_out
1765
+ - http request timeout for this request
1766
+
1767
+ Returns
1768
+ -------
1769
+ [dict] | str
1770
+ Returns a string if no elements found and a list of dict of elements with the results.
1771
+
1772
+ Raises
1773
+ ------
1774
+ InvalidParameterException
1775
+ one of the parameters is null or invalid or
1776
+ PropertyServerException
1777
+ There is a problem adding the element properties to the metadata repository or
1778
+ UserNotAuthorizedException
1779
+ the requesting user is not authorized to issue this request.
1780
+
1781
+ Notes:
1782
+
1783
+ Sample body:
1784
+ {
1785
+ "class" : "FindRelationshipRequestBody",
1786
+ "relationshipTypeName": "add typeName here",
1787
+ "searchProperties": {
1788
+ "class" : "SearchProperties",
1789
+ "conditions": [ {
1790
+ "nestedConditions": {
1791
+ "class" : "SearchProperties",
1792
+ "conditions": [
1793
+ {
1794
+ "property" : "add name of property here",
1795
+ "operator": "EQ",
1796
+ "value": {
1797
+ "class" : "PrimitiveTypePropertyValue",
1798
+ "typeName" : "string",
1799
+ "primitiveValue" : "Add value here"
1800
+ }
1801
+ }],
1802
+ "matchCriteria": "ALL"
1803
+ }
1804
+ }],
1805
+ "matchCriteria": "ANY"
1806
+ },
1807
+ "effectiveTime" : "{{$isoTimestamp}}",
1808
+ "limitResultsByStatus" : ["ACTIVE"],
1809
+ "asOfTime" : "{{$isoTimestamp}}",
1810
+ "sequencingOrder": "CREATION_DATE_RECENT",
1811
+ "sequencingProperty": ""
1812
+ }
1813
+
1814
+ """
1815
+ loop = asyncio.get_event_loop()
1816
+ response = loop.run_until_complete(
1817
+ self._async_find_relationships_between_elements(
1818
+ body,
1819
+ for_lineage,
1820
+ for_duplicate_processing,
1821
+ start_from,
1822
+ page_size,
1823
+ time_out,
1824
+ )
1825
+ )
1826
+ return response
1827
+
1828
+ async def _async_get_relationship_by_guid(
1829
+ self,
1830
+ guid: str,
1831
+ effective_time: str = None,
1832
+ for_lineage: bool = None,
1833
+ for_duplicate_processing: bool = None,
1834
+ ) -> dict | str:
1835
+ """
1836
+ Retrieve the relationship using its unique identifier. Async version.
1837
+
1838
+ Parameters
1839
+ ----------
1840
+ guid : str
1841
+ - unique identifier of the relationship to retrieve
1842
+ effective_time: str, default = None
1843
+ - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1844
+ for_lineage: bool, default is set by server
1845
+ - determines if elements classified as Memento should be returned - normally false
1846
+ for_duplicate_processing: bool, default is set by server
1847
+ - Normally false. Set true when the caller is part of a deduplication function
1848
+
1849
+ Returns
1850
+ -------
1851
+ dict | str
1852
+ If the relationship is found, a dict of the relationship details is returned. Otherwise, the string "No element found".
1853
+
1854
+ Raises
1855
+ ------
1856
+ InvalidParameterException
1857
+ one of the parameters is null or invalid or
1858
+ PropertyServerException
1859
+ There is a problem adding the element properties to the metadata repository or
1860
+ UserNotAuthorizedException
1861
+ the requesting user is not authorized to issue this request.
1862
+ """
1863
+
1864
+ possible_query_params = query_string(
1865
+ [
1866
+ ("forLineage", for_lineage),
1867
+ ("forDuplicateProcessing", for_duplicate_processing),
1868
+ ]
1869
+ )
1870
+
1871
+ body = {
1872
+ "class": "EffectiveTimeRequestBody",
1873
+ "effectiveTime": effective_time,
1874
+ }
1875
+
1876
+ url = (
1877
+ f"{base_path(self, self.view_server)}/relationships/by-guid/{guid}"
1878
+ f"{possible_query_params}"
1879
+ )
1880
+ response: Response = await self._async_make_request(
1881
+ "POST", url, body_slimmer(body)
1882
+ )
1883
+ return response.json().get("element", "No elements found")
1884
+
1885
+ def get_relationship_by_guid(
1886
+ self,
1887
+ guid: str,
1888
+ effective_time: str = None,
1889
+ for_lineage: bool = None,
1890
+ for_duplicate_processing: bool = None,
1891
+ ) -> dict | str:
1892
+ """
1893
+ Retrieve the relationship using its unique identifier.
1894
+
1895
+ Parameters
1896
+ ----------
1897
+ guid : str
1898
+ - unique identifier of the relationship to retrieve
1899
+ effective_time: str, default = None
1900
+ - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1901
+ for_lineage: bool, default is set by server
1902
+ - determines if elements classified as Memento should be returned - normally false
1903
+ for_duplicate_processing: bool, default is set by server
1904
+ - Normally false. Set true when the caller is part of a deduplication function
1905
+
1906
+ Returns
1907
+ -------
1908
+ dict | str
1909
+ If the relationship is found, a dict of the relationship details is returned. Otherwise, the string "No element found".
1910
+
1911
+ Raises
1912
+ ------
1913
+ InvalidParameterException
1914
+ one of the parameters is null or invalid or
1915
+ PropertyServerException
1916
+ There is a problem adding the element properties to the metadata repository or
1917
+ UserNotAuthorizedException
1918
+ the requesting user is not authorized to issue this request.
1919
+ """
1920
+
1921
+ loop = asyncio.get_event_loop()
1922
+ response = loop.run_until_complete(
1923
+ self._async_get_relationship_by_guid(
1924
+ guid, effective_time, for_lineage, for_duplicate_processing
1925
+ )
1926
+ )
1927
+ return response
1928
+
1929
+ async def _async_get_relationship_history(
1930
+ self,
1931
+ guid: str,
1932
+ effective_time: str = None,
1933
+ oldest_first: bool = False,
1934
+ from_time: str = None,
1935
+ to_time: str = None,
1936
+ for_lineage: bool = None,
1937
+ for_duplicate_processing: bool = None,
1938
+ start_from: int = 0,
1939
+ page_size: int = max_paging_size,
1940
+ time_out: int = default_time_out,
1941
+ ) -> list | str:
1942
+ """
1943
+ Retrieve all the versions of a relationship. Async version.
1944
+
1945
+ Parameters
1946
+ ----------
1947
+ guid: str
1948
+ - Unique identity of element to retrieve.
1949
+ effective_time: str, default = None
1950
+ - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
1951
+ oldest_first: bool, default = False
1952
+ from_time: str, default = None
1953
+ Time to begin returning history
1954
+ to_time: str, default = None
1955
+ Time to end returning history
1956
+ for_lineage: bool, default is set by server
1957
+ - determines if elements classified as Memento should be returned - normally false
1958
+ for_duplicate_processing: bool, default is set by server
1959
+ - Normally false. Set true when the caller is part of a deduplication function
1960
+ start_from: int, default = 0
1961
+ - index of the list to start from (0 for start).
1962
+ page_size
1963
+ - maximum number of elements to return.
1964
+ time_out: int, default = default_time_out
1965
+ - http request timeout for this request
1966
+
1967
+ Returns
1968
+ -------
1969
+ [dict] | str
1970
+ Returns a string if no elements found and a list of dict of elements with the results.
1971
+
1972
+ Raises
1973
+ ------
1974
+ InvalidParameterException
1975
+ one of the parameters is null or invalid or
1976
+ PropertyServerException
1977
+ There is a problem adding the element properties to the metadata repository or
1978
+ UserNotAuthorizedException
1979
+ the requesting user is not authorized to issue this request.
1980
+ """
1981
+
1982
+ possible_query_params = query_string(
1983
+ [
1984
+ ("startFrom", start_from),
1985
+ ("pageSize", page_size),
1986
+ ("oldestFirst", oldest_first),
1987
+ ("forLineage", for_lineage),
1988
+ ("forDuplicateProcessing", for_duplicate_processing),
1989
+ ]
1990
+ )
1991
+
1992
+ body = {
1993
+ "class": "HistoryRequestBody",
1994
+ "effectiveTime": effective_time,
1995
+ "fromTime": from_time,
1996
+ "toTime": to_time,
1997
+ }
1998
+
1999
+ url = (
2000
+ f"{base_path(self, self.view_server)}/relationships/{guid}/history"
2001
+ f"{possible_query_params}"
2002
+ )
2003
+
2004
+ response: Response = await self._async_make_request(
2005
+ "POST", url, body_slimmer(body), time_out=time_out
2006
+ )
2007
+
2008
+ elements = response.json().get("elementList", "No elements found")
2009
+ if type(elements) is list:
2010
+ if len(elements) == 0:
2011
+ return "No elements found"
2012
+ return elements
2013
+
2014
+ def get_relationship_history(
2015
+ self,
2016
+ guid: str,
2017
+ effective_time: str = None,
2018
+ oldest_first: bool = False,
2019
+ from_time: str = None,
2020
+ to_time: str = None,
2021
+ for_lineage: bool = None,
2022
+ for_duplicate_processing: bool = None,
2023
+ start_from: int = 0,
2024
+ page_size: int = max_paging_size,
2025
+ time_out: int = default_time_out,
2026
+ ) -> list | str:
2027
+ """
2028
+ Retrieve all the versions of a relationship.
2029
+
2030
+ Parameters
2031
+ ----------
2032
+ guid: str
2033
+ - Unique identity of element to retrieve.
2034
+ effective_time: str, default = None
2035
+ - Time format is "YYYY-MM-DDTHH:MM:SS" (ISO 8601)
2036
+ oldest_first: bool, default = False
2037
+ from_time: str, default = None
2038
+ Time to begin returning history
2039
+ to_time: str, default = None
2040
+ Time to end returning history
2041
+ for_lineage: bool, default is set by server
2042
+ - determines if elements classified as Memento should be returned - normally false
2043
+ for_duplicate_processing: bool, default is set by server
2044
+ - Normally false. Set true when the caller is part of a deduplication function
2045
+ start_from: int, default = 0
2046
+ - index of the list to start from (0 for start).
2047
+ page_size
2048
+ - maximum number of elements to return.
2049
+ time_out: int, default = default_time_out
2050
+ - http request timeout for this request
2051
+
2052
+ Returns
2053
+ -------
2054
+ [dict] | str
2055
+ Returns a string if no elements found and a list of dict of elements with the results.
2056
+
2057
+ Raises
2058
+ ------
2059
+ InvalidParameterException
2060
+ one of the parameters is null or invalid or
2061
+ PropertyServerException
2062
+ There is a problem adding the element properties to the metadata repository or
2063
+ UserNotAuthorizedException
2064
+ the requesting user is not authorized to issue this request.
2065
+ """
2066
+
2067
+ loop = asyncio.get_event_loop()
2068
+ response = loop.run_until_complete(
2069
+ self._async_get_relationship_history(
2070
+ guid,
2071
+ effective_time,
2072
+ oldest_first,
2073
+ from_time,
2074
+ to_time,
2075
+ for_lineage,
2076
+ for_duplicate_processing,
2077
+ start_from,
2078
+ page_size,
2079
+ time_out,
2080
+ )
2081
+ )
2082
+ return response
2083
+
2084
+
2085
+ if __name__ == "__main__":
2086
+ print("Main-Metadata Explorer")