pyegeria 1.5.1.0.16__py3-none-any.whl → 1.5.1.0.19__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.
@@ -0,0 +1,1416 @@
1
+ """
2
+ SPDX-License-Identifier: Apache-2.0
3
+ Copyright Contributors to the ODPi Egeria project.
4
+
5
+ Template manager is a view service that supports managing metadata elements using templates.
6
+
7
+ """
8
+ import asyncio
9
+
10
+ from requests import Response
11
+
12
+ from pyegeria import (
13
+ Client,
14
+ max_paging_size,
15
+ body_slimmer,
16
+ InvalidParameterException,
17
+ default_time_out,
18
+ )
19
+
20
+
21
+ class TemplateManager(Client):
22
+ """Client to issue Template Manager requests.
23
+
24
+ Attributes:
25
+
26
+ view_server : str
27
+ Name of the server to use.
28
+ platform_url : str
29
+ URL of the server platform to connect to
30
+ user_id : str
31
+ The identity of the user calling the method - this sets a default optionally used by the methods
32
+ when the user doesn't pass the user_id on a method call.
33
+ user_pwd: str
34
+ The password associated with the user_id. Defaults to None
35
+ token: str, optional
36
+ Bearer token
37
+
38
+ Methods:
39
+
40
+ """
41
+
42
+ def __init__(
43
+ self,
44
+ view_server: str,
45
+ platform_url: str,
46
+ user_id: str,
47
+ user_pwd: str = None,
48
+ token: str = None,
49
+ time_out: int = default_time_out,
50
+ ):
51
+ self.view_server = view_server
52
+ self.time_out = time_out
53
+ Client.__init__(self, view_server, platform_url, user_id, user_pwd, token=token)
54
+ self.command_root = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/template-manager"
55
+
56
+ #
57
+ # Maintain the metadata elements that makes up the template
58
+ #
59
+ async def _async_create_metadata_element_in_store(self, body: dict) -> str:
60
+ """Create a new metadata element in the metadata store. The type name comes from the open metadata types.
61
+ The selected type also controls the names and types of the properties that are allowed.
62
+ This version of the method allows access to advanced features such as multiple states and
63
+ effectivity dates. Async version.
64
+
65
+ Parameters
66
+ ----------
67
+ body : dict
68
+ The definition of the element to create. A sample is below.
69
+
70
+ Returns
71
+ -------
72
+ str: If successful, the GUID of the element created; otherwise None is returned.
73
+
74
+ Raises
75
+ ------
76
+ InvalidParameterException
77
+ PropertyServerException
78
+ UserNotAuthorizedException
79
+
80
+ Notes
81
+ =====
82
+
83
+ Example of the body:
84
+
85
+ {
86
+ "class" : "NewOpenMetadataElementRequestBody",
87
+ "externalSourceGUID" : "666",
88
+ "externalSourceName" : "radio1",
89
+ "typeName" : "",
90
+ "initialStatus" : "ACTIVE",
91
+ "initialClassifications" : {},
92
+ "anchorGUID" : "",
93
+ "isOwnAnchor" : false,
94
+ "effectiveFrom" : "{{$isoTimestamp}}",
95
+ "effectiveTo": "{{$isoTimestamp}}",
96
+ "properties" : {},
97
+ "parentGUID" : "",
98
+ "parentRelationshipTypeName" : "",
99
+ "parentRelationshipProperties" : {},
100
+ "parentAtEnd1" : true,
101
+ "effectiveTime" : "{{$isoTimestamp}}"
102
+ }
103
+
104
+ """
105
+
106
+ url = f"{self.command_root}/metadata-elements"
107
+ response = await self._async_make_request("POST", url, body_slimmer(body))
108
+ guid = response.json().get("guid", None)
109
+ return guid
110
+
111
+ def create_metadata_element_in_store(self, body: dict) -> str:
112
+ """Create a new metadata element in the metadata store. The type name comes from the open metadata types.
113
+ The selected type also controls the names and types of the properties that are allowed.
114
+ This version of the method allows access to advanced features such as multiple states and
115
+ effectivity dates.
116
+
117
+ Parameters
118
+ ----------
119
+ body : dict
120
+ The definition of the element to create. A sample is below.
121
+
122
+ Returns
123
+ -------
124
+ str: If successful, the GUID of the element created; otherwise None is returned.
125
+
126
+ Raises
127
+ ------
128
+ InvalidParameterException
129
+ PropertyServerException
130
+ UserNotAuthorizedException
131
+
132
+ Notes
133
+ =====
134
+
135
+ Example of the body:
136
+
137
+ {
138
+ "class" : "NewOpenMetadataElementRequestBody",
139
+ "externalSourceGUID" : "666",
140
+ "externalSourceName" : "radio1",
141
+ "typeName" : "",
142
+ "initialStatus" : "ACTIVE",
143
+ "initialClassifications" : {},
144
+ "anchorGUID" : "",
145
+ "isOwnAnchor" : false,
146
+ "effectiveFrom" : "{{$isoTimestamp}}",
147
+ "effectiveTo": "{{$isoTimestamp}}",
148
+ "properties" : {},
149
+ "parentGUID" : "",
150
+ "parentRelationshipTypeName" : "",
151
+ "parentRelationshipProperties" : {},
152
+ "parentAtEnd1" : true,
153
+ "effectiveTime" : "{{$isoTimestamp}}"
154
+ }
155
+
156
+ """
157
+ loop = asyncio.get_event_loop()
158
+ response = loop.run_until_complete(
159
+ self._async_create_metadata_element_in_store(body)
160
+ )
161
+ return response
162
+
163
+ async def _async_create_metadata_element_from_template(self, body: dict) -> str:
164
+ """Create a new metadata element in the metadata store using a template. The type name comes from the
165
+ open metadata types. The selected type also controls the names and types of the properties that are allowed.
166
+ Async version.
167
+
168
+ Parameters
169
+ ----------
170
+ body : dict
171
+ The definition of the element to create. A sample is the notes below.
172
+
173
+ Returns
174
+ -------
175
+ None
176
+
177
+ Raises
178
+ ------
179
+ InvalidParameterException
180
+ PropertyServerException
181
+ UserNotAuthorizedException
182
+
183
+ Notes
184
+ -----
185
+ Example of the body:
186
+
187
+ {
188
+ "class" : "TemplateRequestBody",
189
+ "externalSourceGUID" : "",
190
+ "externalSourceName" : "",
191
+ "typeName" : "",
192
+ "templateGUID" : "",
193
+ "anchorGUID" : "",
194
+ "isOwnAnchor" : false,
195
+ "effectiveFrom" : "{{$isoTimestamp}}",
196
+ "effectiveTo": "{{$isoTimestamp}}",
197
+ "replacementProperties" : { },
198
+ "placeholderProperties" : {
199
+ "placeholderName1" : "placeholderValue1",
200
+ "placeholderName2" : "placeholderValue2"
201
+ },
202
+ "parentGUID" : "",
203
+ "parentRelationshipTypeName" : "",
204
+ "parentRelationshipProperties" : {},
205
+ "parentAtEnd1" : true,
206
+ "effectiveTime" : "{{$isoTimestamp}}"
207
+ }
208
+
209
+ """
210
+ url = f"{self.command_root}/metadata-elements/from-templates"
211
+
212
+ response = await self._async_make_request("POST", url, body_slimmer(body))
213
+ guid = response.json().get("guid", None)
214
+ return guid
215
+
216
+ def create_metadata_element_from_template(self, body: dict) -> str:
217
+ """Create a new metadata element in the metadata store using a template. The type name comes from the
218
+ open metadata types. The selected type also controls the names and types of the properties that are allowed.
219
+
220
+ Parameters
221
+ ----------
222
+ body : dict
223
+ dict containing the definition of the element to create. A sample is the notes below.
224
+
225
+ Returns
226
+ -------
227
+ None
228
+
229
+ Raises
230
+ ------
231
+ InvalidParameterException
232
+ PropertyServerException
233
+ UserNotAuthorizedException
234
+
235
+ Notes
236
+ -----
237
+ Example of the body:
238
+
239
+ {
240
+ "class" : "UpdatePropertiesRequestBody",
241
+ "externalSourceGUID" : "",
242
+ "externalSourceName" : "",
243
+ "forLineage" : false,
244
+ "forDuplicateProcessing" : false,
245
+ "effectiveTime" : "{{$isoTimestamp}}"
246
+ }
247
+
248
+ """
249
+ loop = asyncio.get_event_loop()
250
+ response = loop.run_until_complete(
251
+ self._async_create_metadata_element_from_template(body)
252
+ )
253
+ return response
254
+
255
+ async def _async_update_metadata_element_in_store(
256
+ self, element_guid: str, body: dict
257
+ ) -> None:
258
+ """Update the properties of a specific metadata element. The properties must match the type definition
259
+ associated with the metadata element when it was created. However, it is possible to update a few
260
+ properties, or replace all them by the value used in the replaceProperties flag.
261
+ Async version.
262
+
263
+ Parameters
264
+ ----------
265
+ element_guid : str
266
+ The identity of the metadata element to update.
267
+ body : dict
268
+ The definition of the element to create. A sample is the notes below.
269
+
270
+ Returns
271
+ -------
272
+ None
273
+
274
+ Raises
275
+ ------
276
+ InvalidParameterException
277
+ PropertyServerException
278
+ UserNotAuthorizedException
279
+
280
+ Notes
281
+ -----
282
+ Example of the body:
283
+
284
+ {
285
+ "class" : "TemplateRequestBody",
286
+ "externalSourceGUID" : "",
287
+ "externalSourceName" : "",
288
+ "typeName" : "",
289
+ "templateGUID" : "",
290
+ "anchorGUID" : "",
291
+ "isOwnAnchor" : false,
292
+ "effectiveFrom" : "{{$isoTimestamp}}",
293
+ "effectiveTo": "{{$isoTimestamp}}",
294
+ "replacementProperties" : { },
295
+ "placeholderProperties" : {
296
+ "placeholderName1" : "placeholderValue1",
297
+ "placeholderName2" : "placeholderValue2"
298
+ },
299
+ "parentGUID" : "",
300
+ "parentRelationshipTypeName" : "",
301
+ "parentRelationshipProperties" : {},
302
+ "parentAtEnd1" : true,
303
+ "effectiveTime" : "{{$isoTimestamp}}"
304
+ }
305
+
306
+ """
307
+ url = f"{self.command_root}/metadata-elements/{element_guid}/update-properties"
308
+ await self._async_make_request("POST", url, body_slimmer(body))
309
+ return
310
+
311
+ def update_metadata_element_in_store(self, element_guid: str, body: dict) -> None:
312
+ """Update the properties of a specific metadata element. The properties must match the type definition
313
+ associated with the metadata element when it was created. However, it is possible to update a few
314
+ properties, or replace all them by the value used in the replaceProperties flag.
315
+
316
+ Parameters
317
+ ----------
318
+ element_guid : str
319
+ The identity of the metadata element to update.
320
+ body : dict
321
+ The definition of the element to create. A sample is the notes below.
322
+
323
+ Returns
324
+ -------
325
+ None
326
+
327
+ Raises
328
+ ------
329
+ InvalidParameterException
330
+ PropertyServerException
331
+ UserNotAuthorizedException
332
+
333
+ Notes
334
+ -----
335
+ Example of the body:
336
+
337
+ {
338
+ "class" : "TemplateRequestBody",
339
+ "externalSourceGUID" : "",
340
+ "externalSourceName" : "",
341
+ "typeName" : "",
342
+ "templateGUID" : "",
343
+ "anchorGUID" : "",
344
+ "isOwnAnchor" : false,
345
+ "effectiveFrom" : "{{$isoTimestamp}}",
346
+ "effectiveTo": "{{$isoTimestamp}}",
347
+ "replacementProperties" : { },
348
+ "placeholderProperties" : {
349
+ "placeholderName1" : "placeholderValue1",
350
+ "placeholderName2" : "placeholderValue2"
351
+ },
352
+ "parentGUID" : "",
353
+ "parentRelationshipTypeName" : "",
354
+ "parentRelationshipProperties" : {},
355
+ "parentAtEnd1" : true,
356
+ "effectiveTime" : "{{$isoTimestamp}}"
357
+ }
358
+
359
+ """
360
+ loop = asyncio.get_event_loop()
361
+ loop.run_until_complete(
362
+ self._async_update_metadata_element_in_store(element_guid, body)
363
+ )
364
+ return
365
+
366
+ async def _async_update_metadata_element_status_in_store(
367
+ self, element_guid: str, body: dict
368
+ ) -> None:
369
+ """Update the status of a specific metadata element. The new status must match a status value that is defined
370
+ for the element's type assigned when it was created. Async version.
371
+
372
+ Parameters
373
+ ----------
374
+ element_guid : str
375
+ The identity of the metadata element to update.
376
+ body : dict
377
+ The definition of the element to create. A sample is the notes below.
378
+
379
+ Returns
380
+ -------
381
+ None
382
+
383
+ Raises
384
+ ------
385
+ InvalidParameterException
386
+ PropertyServerException
387
+ UserNotAuthorizedException
388
+
389
+ Notes
390
+ -----
391
+ Example of the body:
392
+
393
+ {
394
+ "class" : "UpdateStatusRequestBody",
395
+ "externalSourceGUID" : "",
396
+ "externalSourceName" : "",
397
+ "forLineage" : false,
398
+ "forDuplicateProcessing" : false,
399
+ "effectiveTime" : "{{$isoTimestamp}}"
400
+ }
401
+
402
+ """
403
+ url = f"{self.command_root}/metadata-elements/{element_guid}/update-status"
404
+ await self._async_make_request("POST", url, body_slimmer(body))
405
+ return
406
+
407
+ def update_metadata_element_status_in_store(
408
+ self, element_guid: str, body: dict
409
+ ) -> None:
410
+ """Update the status of a specific metadata element. The new status must match a status value that is defined
411
+ for the element's type assigned when it was created.
412
+
413
+ Parameters
414
+ ----------
415
+ element_guid : str
416
+ The identity of the metadata element to update.
417
+ body : dict
418
+ The definition of the element to create. A sample is the notes below.
419
+
420
+ Returns
421
+ -------
422
+ None
423
+
424
+ Raises
425
+ ------
426
+ InvalidParameterException
427
+ PropertyServerException
428
+ UserNotAuthorizedException
429
+
430
+ Notes
431
+ -----
432
+ Example of the body:
433
+
434
+ {
435
+ "class" : "UpdateStatusRequestBody",
436
+ "externalSourceGUID" : "",
437
+ "externalSourceName" : "",
438
+ "forLineage" : false,
439
+ "forDuplicateProcessing" : false,
440
+ "effectiveTime" : "{{$isoTimestamp}}"
441
+ }
442
+
443
+ """
444
+ loop = asyncio.get_event_loop()
445
+ loop.run_until_complete(
446
+ self._async_update_metadata_element_status_in_store(element_guid, body)
447
+ )
448
+ return
449
+
450
+ async def _async_update_metadata_element_effectivity_in_store(
451
+ self, element_guid: str, body: dict
452
+ ) -> None:
453
+ """Update the effectivity dates control the visibility of the element through specific APIs.
454
+ Async version.
455
+
456
+ Parameters
457
+ ----------
458
+ element_guid : str
459
+ The identity of the metadata element to update.
460
+ body : dict
461
+ The definition of the element to create. A sample is the notes below.
462
+
463
+ Returns
464
+ -------
465
+ None
466
+
467
+ Raises
468
+ ------
469
+ InvalidParameterException
470
+ PropertyServerException
471
+ UserNotAuthorizedException
472
+
473
+ Notes
474
+ -----
475
+ Example of the body:
476
+
477
+ {
478
+ "class" : "UpdateEffectivityDatesRequestBody",
479
+ "externalSourceGUID" : "",
480
+ "externalSourceName" : "",
481
+ "effectiveFrom" : "{{$isoTimestamp}}",
482
+ "effectiveTo": "{{$isoTimestamp}}",
483
+ "forLineage" : false,
484
+ "forDuplicateProcessing" : false,
485
+ "effectiveTime" : "{{$isoTimestamp}}"
486
+ }
487
+
488
+ """
489
+ url = f"{self.command_root}/metadata-elements/{element_guid}/update-effectivity"
490
+ await self._async_make_request("POST", url, body_slimmer(body))
491
+ return
492
+
493
+ def update_metadata_element_effectivity_in_store(
494
+ self, element_guid: str, body: dict
495
+ ) -> None:
496
+ """Update the effectivity dates control the visibility of the element through specific APIs.
497
+ Async version.
498
+
499
+ Parameters
500
+ ----------
501
+ element_guid : str
502
+ The identity of the metadata element to update.
503
+ body : dict
504
+ The definition of the element to create. A sample is the notes below.
505
+
506
+ Returns
507
+ -------
508
+ None
509
+
510
+ Raises
511
+ ------
512
+ InvalidParameterException
513
+ PropertyServerException
514
+ UserNotAuthorizedException
515
+
516
+ Notes
517
+ -----
518
+ Example of the body:
519
+
520
+ {
521
+ "class" : "UpdateEffectivityDatesRequestBody",
522
+ "externalSourceGUID" : "",
523
+ "externalSourceName" : "",
524
+ "effectiveFrom" : "{{$isoTimestamp}}",
525
+ "effectiveTo": "{{$isoTimestamp}}",
526
+ "forLineage" : false,
527
+ "forDuplicateProcessing" : false,
528
+ "effectiveTime" : "{{$isoTimestamp}}"
529
+ }
530
+
531
+ """
532
+ loop = asyncio.get_event_loop()
533
+ loop.run_until_complete(
534
+ self._async_update_metadata_element_effectivity_in_store(element_guid, body)
535
+ )
536
+ return
537
+
538
+ async def _async_delete_metadata_element_in_store(
539
+ self, element_guid: str, body: dict
540
+ ) -> None:
541
+ """Delete a metadata element.
542
+ Async version.
543
+
544
+ Parameters
545
+ ----------
546
+ element_guid : str
547
+ The identity of the metadata element to update.
548
+ body : dict
549
+ The definition of the element to create. A sample is the notes below.
550
+
551
+ Returns
552
+ -------
553
+ None
554
+
555
+ Raises
556
+ ------
557
+ InvalidParameterException
558
+ PropertyServerException
559
+ UserNotAuthorizedException
560
+
561
+ Notes
562
+ -----
563
+ Example of the body:
564
+
565
+ {
566
+ "class" : "UpdateRequestBody",
567
+ "externalSourceGUID" : "",
568
+ "externalSourceName" : "",
569
+ "forLineage" : false,
570
+ "forDuplicateProcessing" : false,
571
+ "effectiveTime" : "{{$isoTimestamp}}"
572
+ }
573
+
574
+ """
575
+ url = f"{self.command_root}/metadata-elements/{element_guid}/delete"
576
+ await self._async_make_request("POST", url, body_slimmer(body))
577
+ return
578
+
579
+ def delete_metadata_element_in_store(self, element_guid: str, body: dict) -> None:
580
+ """Delete a metadata element.
581
+
582
+ Parameters
583
+ ----------
584
+ element_guid : str
585
+ The identity of the metadata element to update.
586
+ body : dict
587
+ The definition of the element to create. A sample is the notes below.
588
+
589
+ Returns
590
+ -------
591
+ None
592
+
593
+ Raises
594
+ ------
595
+ InvalidParameterException
596
+ PropertyServerException
597
+ UserNotAuthorizedException
598
+
599
+ Notes
600
+ -----
601
+ Example of the body:
602
+
603
+ {
604
+ "class" : "UpdateRequestBody",
605
+ "externalSourceGUID" : "",
606
+ "externalSourceName" : "",
607
+ "forLineage" : false,
608
+ "forDuplicateProcessing" : false,
609
+ "effectiveTime" : "{{$isoTimestamp}}"
610
+ }
611
+
612
+ """
613
+ loop = asyncio.get_event_loop()
614
+ loop.run_until_complete(
615
+ self._async_delete_metadata_element_in_store(element_guid, body)
616
+ )
617
+ return
618
+
619
+ async def _async_archive_metadata_element_in_store(
620
+ self, element_guid: str, body: dict
621
+ ) -> None:
622
+ """Archive a specific metadata element.
623
+ Async version.
624
+
625
+ Parameters
626
+ ----------
627
+ element_guid : str
628
+ The identity of the metadata element to update.
629
+ body : dict
630
+ The definition of the element to create. A sample is the notes below.
631
+
632
+ Returns
633
+ -------
634
+ None
635
+
636
+ Raises
637
+ ------
638
+ InvalidParameterException
639
+ PropertyServerException
640
+ UserNotAuthorizedException
641
+
642
+ Notes
643
+ -----
644
+ Example of the body:
645
+
646
+ {
647
+ "class" : "ArchiveRequestBody",
648
+ "externalSourceGUID" : "",
649
+ "externalSourceName" : "",
650
+ "archiveProperties" : {
651
+ "archiveDate" : "{{$isoTimestamp}}",
652
+ "archiveProcess" : "",
653
+ "archiveProperties": {
654
+ "propertyName1" : "propertyValue1",
655
+ "propertyName2" : "propertyValue2"
656
+ }
657
+ },
658
+ "forLineage" : false,
659
+ "forDuplicateProcessing" : false,
660
+ "effectiveTime" : "{{$isoTimestamp}}"
661
+ }
662
+
663
+ """
664
+ url = f"{self.command_root}/metadata-elements/{element_guid}/archive"
665
+ await self._async_make_request("POST", url, body_slimmer(body))
666
+ return
667
+
668
+ def update_metadata_element_effectivity_in_store(
669
+ self, element_guid: str, body: dict
670
+ ) -> None:
671
+ """Archive a specific metadata element.
672
+
673
+ Parameters
674
+ ----------
675
+ element_guid : str
676
+ The identity of the metadata element to update.
677
+ body : dict
678
+ The definition of the element to create. A sample is the notes below.
679
+
680
+ Returns
681
+ -------
682
+ None
683
+
684
+ Raises
685
+ ------
686
+ InvalidParameterException
687
+ PropertyServerException
688
+ UserNotAuthorizedException
689
+
690
+ Notes
691
+ -----
692
+ Example of the body:
693
+
694
+ "class" : "ArchiveRequestBody",
695
+ "externalSourceGUID" : "",
696
+ "externalSourceName" : "",
697
+ "archiveProperties" : {
698
+ "archiveDate" : "{{$isoTimestamp}}",
699
+ "archiveProcess" : "",
700
+ "archiveProperties": {
701
+ "propertyName1" : "propertyValue1",
702
+ "propertyName2" : "propertyValue2"
703
+ }
704
+ },
705
+ "forLineage" : false,
706
+ "forDuplicateProcessing" : false,
707
+ "effectiveTime" : "{{$isoTimestamp}}"
708
+ }
709
+
710
+ """
711
+ loop = asyncio.get_event_loop()
712
+ loop.run_until_complete(
713
+ self._async_archive_metadata_element_in_store(element_guid, body)
714
+ )
715
+ return
716
+
717
+ async def _async_classify_metadata_element_in_store(
718
+ self, element_guid: str, classification: str, body: dict
719
+ ) -> None:
720
+ """Add a new classification to the metadata element. Note that only one classification with the same name can
721
+ be attached to a metadata element. Async version.
722
+
723
+ Parameters
724
+ ----------
725
+ element_guid : str
726
+ The identity of the metadata element to update.
727
+ classification : str
728
+ The classification name to apply.
729
+ body : dict
730
+ The definition of the element to create. A sample is the notes below.
731
+
732
+ Returns
733
+ -------
734
+ None
735
+
736
+ Raises
737
+ ------
738
+ InvalidParameterException
739
+ PropertyServerException
740
+ UserNotAuthorizedException
741
+
742
+ Notes
743
+ -----
744
+ Example of the body:
745
+
746
+ {
747
+ "class" : "NewClassificationRequestBody",
748
+ "externalSourceGUID" : "",
749
+ "externalSourceName" : "",
750
+ "forLineage" : false,
751
+ "forDuplicateProcessing" : false,
752
+ "effectiveTime" : "{{$isoTimestamp}}"
753
+ }
754
+
755
+ """
756
+ url = f"{self.command_root}/metadata-elements/{element_guid}/classifications/{classification}"
757
+ await self._async_make_request("POST", url, body_slimmer(body))
758
+ return
759
+
760
+ def classify_metadata_element_in_store(
761
+ self, element_guid: str, classification: str, body: dict
762
+ ) -> None:
763
+ """Add a new classification to the metadata element. Note that only one classification with the same name can
764
+ be attached to a metadata element.
765
+
766
+ Parameters
767
+ ----------
768
+ element_guid : str
769
+ The identity of the metadata element to update.
770
+ classification : str
771
+ The classification name to apply.
772
+ body : dict
773
+ The definition of the element to create. A sample is the notes below.
774
+
775
+ Returns
776
+ -------
777
+ None
778
+
779
+ Raises
780
+ ------
781
+ InvalidParameterException
782
+ PropertyServerException
783
+ UserNotAuthorizedException
784
+
785
+ Notes
786
+ -----
787
+ Example of the body:
788
+
789
+ {
790
+ "class" : "NewClassificationRequestBody",
791
+ "externalSourceGUID" : "",
792
+ "externalSourceName" : "",
793
+ "forLineage" : false,
794
+ "forDuplicateProcessing" : false,
795
+ "effectiveTime" : "{{$isoTimestamp}}"
796
+ }
797
+
798
+ """
799
+ loop = asyncio.get_event_loop()
800
+ loop.run_until_complete(
801
+ self._async_classify_metadata_element_in_store(
802
+ element_guid, classification, body
803
+ )
804
+ )
805
+ return
806
+
807
+ async def _async_reclassify_metadata_element_in_store(
808
+ self, element_guid: str, classification: str, body: dict
809
+ ) -> None:
810
+ """Update the properties of a classification that is currently attached to a specific metadata element.
811
+ Async version.
812
+
813
+ Parameters
814
+ ----------
815
+ element_guid : str
816
+ The identity of the metadata element to update.
817
+ classification: str
818
+ The classification name to apply.
819
+ body : dict
820
+ The definition of the element to create. A sample is the notes below.
821
+
822
+ Returns
823
+ -------
824
+ None
825
+
826
+ Raises
827
+ ------
828
+ InvalidParameterException
829
+ PropertyServerException
830
+ UserNotAuthorizedException
831
+
832
+ Notes
833
+ -----
834
+ Example of the body:
835
+
836
+ {
837
+ "class" : "UpdatePropertiesRequestBody",
838
+ "externalSourceGUID" : "",
839
+ "externalSourceName" : "",
840
+ "forLineage" : false,
841
+ "forDuplicateProcessing" : false,
842
+ "effectiveTime" : "{{$isoTimestamp}}"
843
+ }
844
+
845
+ """
846
+ url = f"{self.command_root}/metadata-elements/{element_guid}/classifications/{classification}/update-properties"
847
+ await self._async_make_request("POST", url, body_slimmer(body))
848
+ return
849
+
850
+ def reclassify_metadata_element_in_store(
851
+ self, element_guid: str, classification: str, body: dict
852
+ ) -> None:
853
+ """Update the properties of a classification that is currently attached to a specific metadata element.
854
+
855
+ Parameters
856
+ ----------
857
+ element_guid : str
858
+ The identity of the metadata element to update.
859
+ classification: str
860
+ The classification name to apply.
861
+ body : dict
862
+ The definition of the element to create. A sample is the notes below.
863
+
864
+ Returns
865
+ -------
866
+ None
867
+
868
+ Raises
869
+ ------
870
+ InvalidParameterException
871
+ PropertyServerException
872
+ UserNotAuthorizedException
873
+
874
+ Notes
875
+ -----
876
+ Example of the body:
877
+
878
+ {
879
+ "class" : "UpdatePropertiesRequestBody",
880
+ "externalSourceGUID" : "",
881
+ "externalSourceName" : "",
882
+ "forLineage" : false,
883
+ "forDuplicateProcessing" : false,
884
+ "effectiveTime" : "{{$isoTimestamp}}"
885
+ }
886
+
887
+ """
888
+ loop = asyncio.get_event_loop()
889
+ loop.run_until_complete(
890
+ self._async_reclassify_metadata_element_in_store(
891
+ element_guid, classification, body
892
+ )
893
+ )
894
+ return
895
+
896
+ async def _async_update_classification_effectivity_in_store(
897
+ self, element_guid: str, classification: str, body: dict
898
+ ) -> None:
899
+ """Update the effectivity dates of a specific classification attached to a metadata element.
900
+ The effectivity dates control the visibility of the classification through specific APIs.
901
+ Async version.
902
+
903
+ Parameters
904
+ ----------
905
+ element_guid : str
906
+ The identity of the metadata element to update.
907
+ classification: str
908
+ The classification name to apply.
909
+ body : dict
910
+ The definition of the element to create. A sample is the notes below.
911
+
912
+ Returns
913
+ -------
914
+ None
915
+
916
+ Raises
917
+ ------
918
+ InvalidParameterException
919
+ PropertyServerException
920
+ UserNotAuthorizedException
921
+
922
+ Notes
923
+ -----
924
+ Example of the body:
925
+
926
+ {
927
+ "class" : "UpdateEffectivityDatesRequestBody",
928
+ "externalSourceGUID" : "",
929
+ "externalSourceName" : "",
930
+ "effectiveFrom" : "{{$isoTimestamp}}",
931
+ "effectiveTo": "{{$isoTimestamp}}",
932
+ "forLineage" : false,
933
+ "forDuplicateProcessing" : false,
934
+ "effectiveTime" : "{{$isoTimestamp}}"
935
+ }
936
+ """
937
+ url = f"{self.command_root}/metadata-elements/{element_guid}/classifications/{classification}/update-effectivity"
938
+ await self._async_make_request("POST", url, body_slimmer(body))
939
+ return
940
+
941
+ def update_classification_effectivity_in_store(
942
+ self, element_guid: str, classification: str, body: dict
943
+ ) -> None:
944
+ """Update the effectivity dates of a specific classification attached to a metadata element.
945
+ The effectivity dates control the visibility of the classification through specific APIs.
946
+
947
+
948
+ Parameters
949
+ ----------
950
+ element_guid : str
951
+ The identity of the metadata element to update.
952
+ classification: str
953
+ The classification name to apply.
954
+ body : dict
955
+ The definition of the element to create. A sample is the notes below.
956
+
957
+ Returns
958
+ -------
959
+ None
960
+
961
+ Raises
962
+ ------
963
+ InvalidParameterException
964
+ PropertyServerException
965
+ UserNotAuthorizedException
966
+
967
+ Notes
968
+ -----
969
+ Example of the body:
970
+
971
+ {
972
+ "class" : "UpdateEffectivityDatesRequestBody",
973
+ "externalSourceGUID" : "",
974
+ "externalSourceName" : "",
975
+ "effectiveFrom" : "{{$isoTimestamp}}",
976
+ "effectiveTo": "{{$isoTimestamp}}",
977
+ "forLineage" : false,
978
+ "forDuplicateProcessing" : false,
979
+ "effectiveTime" : "{{$isoTimestamp}}"
980
+ }
981
+ """
982
+ loop = asyncio.get_event_loop()
983
+ loop.run_until_complete(
984
+ self._async_update_classification_effectivity_in_store(
985
+ element_guid, classification, body
986
+ )
987
+ )
988
+ return
989
+
990
+ async def _async_declassify_metadata_element_in_store(
991
+ self, element_guid: str, classification: str, body: dict
992
+ ) -> None:
993
+ """Remove the named classification from a specific metadata element. Async version.
994
+
995
+ Parameters
996
+ ----------
997
+ element_guid : str
998
+ The identity of the metadata element to update.
999
+ classification: str
1000
+ The classification name to apply.
1001
+ body : dict
1002
+ The definition of the element to create. A sample is the notes below.
1003
+
1004
+ Returns
1005
+ -------
1006
+ None
1007
+
1008
+ Raises
1009
+ ------
1010
+ InvalidParameterException
1011
+ PropertyServerException
1012
+ UserNotAuthorizedException
1013
+
1014
+ Notes
1015
+ -----
1016
+ Example of the body:
1017
+
1018
+ {
1019
+ "class" : "UpdateRequestBody",
1020
+ "externalSourceGUID" : "",
1021
+ "externalSourceName" : "",
1022
+ "forLineage" : false,
1023
+ "forDuplicateProcessing" : false,
1024
+ "effectiveTime" : "{{$isoTimestamp}}"
1025
+ }
1026
+ """
1027
+ url = f"{self.command_root}/metadata-elements/{element_guid}/classifications/{classification}/delete"
1028
+ await self._async_make_request("POST", url, body_slimmer(body))
1029
+ return
1030
+
1031
+ def declassify_metadata_element_in_store(
1032
+ self, element_guid: str, classification: str, body: dict
1033
+ ) -> None:
1034
+ """Remove the named classification from a specific metadata element.
1035
+
1036
+ Parameters
1037
+ ----------
1038
+ element_guid : str
1039
+ The identity of the metadata element to update.
1040
+ classification: str
1041
+ The classification name to apply.
1042
+ body : dict
1043
+ The definition of the element to create. A sample is the notes below.
1044
+
1045
+ Returns
1046
+ -------
1047
+ None
1048
+
1049
+ Raises
1050
+ ------
1051
+ InvalidParameterException
1052
+ PropertyServerException
1053
+ UserNotAuthorizedException
1054
+
1055
+ Notes
1056
+ -----
1057
+ Example of the body:
1058
+
1059
+ {
1060
+ "class" : "UpdateRequestBody",
1061
+ "externalSourceGUID" : "",
1062
+ "externalSourceName" : "",
1063
+ "forLineage" : false,
1064
+ "forDuplicateProcessing" : false,
1065
+ "effectiveTime" : "{{$isoTimestamp}}"
1066
+ }
1067
+ """
1068
+ loop = asyncio.get_event_loop()
1069
+ loop.run_until_complete(
1070
+ self._async_declassify_metadata_element_in_store(
1071
+ element_guid, classification, body
1072
+ )
1073
+ )
1074
+ return
1075
+
1076
+ async def _async_create_related_elements_in_store(self, body: dict) -> str:
1077
+ """Create a relationship between two metadata elements. It is important to put the right element at each end
1078
+ of the relationship according to the type definition since this will affect how the relationship is
1079
+ interpreted. Async version.
1080
+
1081
+ Parameters
1082
+ ----------
1083
+ body : dict
1084
+ The definition of the element to create. A sample is the notes below.
1085
+
1086
+ Returns
1087
+ -------
1088
+ str containing the relationship GUID.
1089
+
1090
+ Raises
1091
+ ------
1092
+ InvalidParameterException
1093
+ PropertyServerException
1094
+ UserNotAuthorizedException
1095
+
1096
+ Notes
1097
+ -----
1098
+ Example of the body:
1099
+
1100
+ {
1101
+ "class" : "NewRelatedElementsRequestBody",
1102
+ "externalSourceGUID" : "",
1103
+ "externalSourceName" : "",
1104
+ "forLineage" : false,
1105
+ "forDuplicateProcessing" : false,
1106
+ "effectiveTime" : "{{$isoTimestamp}}"
1107
+ "typeName": "string",
1108
+ "metadataElement1GUID": "string",
1109
+ "metadataElement2GUID": "string",
1110
+ }
1111
+ """
1112
+ url = f"{self.command_root}/related-elements"
1113
+ response = await self._async_make_request("POST", url, body_slimmer(body))
1114
+ guid = response.json().get("guid", None)
1115
+ return guid
1116
+
1117
+ def create_related_elements_in_store(self, body: dict) -> str:
1118
+ """Create a relationship between two metadata elements. It is important to put the right element at each end
1119
+ of the relationship according to the type definition since this will affect how the relationship is
1120
+ interpreted.
1121
+
1122
+ Parameters
1123
+ ----------
1124
+ body : dict
1125
+ The definition of the element to create. A sample is the notes below.
1126
+
1127
+ Returns
1128
+ -------
1129
+ str containing the relationship GUID.
1130
+
1131
+ Raises
1132
+ ------
1133
+ InvalidParameterException
1134
+ PropertyServerException
1135
+ UserNotAuthorizedException
1136
+
1137
+ Notes
1138
+ -----
1139
+ Example of the body:
1140
+
1141
+ {
1142
+ "class" : "NewRelatedElementsRequestBody",
1143
+ "externalSourceGUID" : "",
1144
+ "externalSourceName" : "",
1145
+ "forLineage" : false,
1146
+ "forDuplicateProcessing" : false,
1147
+ "effectiveTime" : "{{$isoTimestamp}}"
1148
+ "typeName": "string",
1149
+ "metadataElement1GUID": "string",
1150
+ "metadataElement2GUID": "string",
1151
+ }
1152
+ """
1153
+ loop = asyncio.get_event_loop()
1154
+ response = loop.run_until_complete(
1155
+ self._async_create_related_elements_in_store(body)
1156
+ )
1157
+ return response
1158
+
1159
+ async def _async_update_related_elements_in_store(
1160
+ self, relationship_guid: str, body: dict
1161
+ ) -> None:
1162
+ """Update the properties associated with a relationship. Async version.
1163
+
1164
+ Parameters
1165
+ ----------
1166
+ relationship_guid : str
1167
+ The identity of the relationship to update.
1168
+ body : dict
1169
+ The definition of the element to create. A sample is the notes below.
1170
+
1171
+ Returns
1172
+ -------
1173
+ None
1174
+
1175
+ Raises
1176
+ ------
1177
+ InvalidParameterException
1178
+ PropertyServerException
1179
+ UserNotAuthorizedException
1180
+
1181
+ Notes
1182
+ -----
1183
+ Example of the body:
1184
+
1185
+ {
1186
+ "class" : "UpdatePropertiesRequestBody",
1187
+ "externalSourceGUID" : "",
1188
+ "externalSourceName" : "",
1189
+ "forLineage" : false,
1190
+ "forDuplicateProcessing" : false,
1191
+ "typeName": "string",
1192
+ "metadataElement1GUID": "string",
1193
+ "metadataElement2GUID": "string",
1194
+ "effectiveTime" : "{{$isoTimestamp}}"
1195
+ }
1196
+ """
1197
+ url = f"{self.command_root}/related-elements/{relationship_guid}/update-properties"
1198
+ await self._async_make_request("POST", url, body_slimmer(body))
1199
+ return
1200
+
1201
+ def update_related_elements_in_store(
1202
+ self, relationship_guid: str, body: dict
1203
+ ) -> None:
1204
+ """Update the properties associated with a relationship. Async version.
1205
+
1206
+ Parameters
1207
+ ----------
1208
+ relationship_guid : str
1209
+ The identity of the relationship to update.
1210
+ body : dict
1211
+ The definition of the element to create. A sample is the notes below.
1212
+
1213
+ Returns
1214
+ -------
1215
+ None
1216
+
1217
+ Raises
1218
+ ------
1219
+ InvalidParameterException
1220
+ PropertyServerException
1221
+ UserNotAuthorizedException
1222
+
1223
+ Notes
1224
+ -----
1225
+ Example of the body:
1226
+
1227
+ {
1228
+ "class" : "UpdatePropertiesRequestBody",
1229
+ "externalSourceGUID" : "",
1230
+ "externalSourceName" : "",
1231
+ "forLineage" : false,
1232
+ "forDuplicateProcessing" : false,
1233
+ "typeName": "string",
1234
+ "metadataElement1GUID": "string",
1235
+ "metadataElement2GUID": "string",
1236
+ "effectiveTime" : "{{$isoTimestamp}}"
1237
+ }
1238
+ """
1239
+ loop = asyncio.get_event_loop()
1240
+ loop.run_until_complete(
1241
+ self._async_update_related_elements_in_store(relationship_guid, body)
1242
+ )
1243
+ return
1244
+
1245
+ async def _async_update_related_elements_effectivity_in_store(
1246
+ self, relationship_guid: str, body: dict
1247
+ ) -> None:
1248
+ """Update the effectivity dates of a specific relationship between metadata elements.
1249
+ The effectivity dates control the visibility of the classification through specific APIs.
1250
+ Async version.
1251
+
1252
+ Parameters
1253
+ ----------
1254
+ relationship_guid : str
1255
+ The identity of the relationship to update.
1256
+ body : dict
1257
+ The definition of the element to create. A sample is the notes below.
1258
+
1259
+ Returns
1260
+ -------
1261
+ None
1262
+
1263
+ Raises
1264
+ ------
1265
+ InvalidParameterException
1266
+ PropertyServerException
1267
+ UserNotAuthorizedException
1268
+
1269
+ Notes
1270
+ -----
1271
+ Example of the body:
1272
+
1273
+ {
1274
+ "class" : "UpdateEffectivityDatesRequestBody",
1275
+ "externalSourceGUID" : "",
1276
+ "externalSourceName" : "",
1277
+ "effectiveFrom" : "{{$isoTimestamp}}",
1278
+ "effectiveTo": "{{$isoTimestamp}}",
1279
+ "forLineage" : false,
1280
+ "forDuplicateProcessing" : false,
1281
+ "effectiveTime" : "{{$isoTimestamp}}"
1282
+ }
1283
+ """
1284
+ url = f"{self.command_root}/metadata-elements/related-elements/{relationship_guid}/update-effectivity"
1285
+ await self._async_make_request("POST", url, body_slimmer(body))
1286
+ return
1287
+
1288
+ def update_related_elements_effectivity_in_store(
1289
+ self, relationship_guid: str, body: dict
1290
+ ) -> None:
1291
+ """Update the effectivity dates of a specific relationship between metadata elements.
1292
+ The effectivity dates control the visibility of the classification through specific APIs.
1293
+
1294
+ Parameters
1295
+ ----------
1296
+ relationship_guid : str
1297
+ The identity of the relationship to update.
1298
+ body : dict
1299
+ The definition of the element to create. A sample is the notes below.
1300
+
1301
+ Returns
1302
+ -------
1303
+ None
1304
+
1305
+ Raises
1306
+ ------
1307
+ InvalidParameterException
1308
+ PropertyServerException
1309
+ UserNotAuthorizedException
1310
+
1311
+ Notes
1312
+ -----
1313
+ Example of the body:
1314
+
1315
+ {
1316
+ "class" : "UpdateEffectivityDatesRequestBody",
1317
+ "externalSourceGUID" : "",
1318
+ "externalSourceName" : "",
1319
+ "effectiveFrom" : "{{$isoTimestamp}}",
1320
+ "effectiveTo": "{{$isoTimestamp}}",
1321
+ "forLineage" : false,
1322
+ "forDuplicateProcessing" : false,
1323
+ "effectiveTime" : "{{$isoTimestamp}}"
1324
+ }
1325
+ """
1326
+ loop = asyncio.get_event_loop()
1327
+ loop.run_until_complete(
1328
+ self._async_update_related_elements_effectivity_in_store(
1329
+ relationship_guid, body
1330
+ )
1331
+ )
1332
+ return
1333
+
1334
+ async def _async_delete_related_elements_in_store(
1335
+ self, relationship_guid: str, body: dict
1336
+ ) -> None:
1337
+ """Delete a relationship between two metadata elements. Async version.
1338
+
1339
+ Parameters
1340
+ ----------
1341
+ relationship_guid : str
1342
+ The identity of the relationship to delete.
1343
+ body : dict
1344
+ The definition of the element to create. A sample is the notes below.
1345
+
1346
+ Returns
1347
+ -------
1348
+ None
1349
+
1350
+ Raises
1351
+ ------
1352
+ InvalidParameterException
1353
+ PropertyServerException
1354
+ UserNotAuthorizedException
1355
+
1356
+ Notes
1357
+ -----
1358
+ Example of the body:
1359
+
1360
+ {
1361
+ "class" : "UpdateRequestBody",
1362
+ "externalSourceGUID" : "",
1363
+ "externalSourceName" : "",
1364
+ "forLineage" : false,
1365
+ "forDuplicateProcessing" : false,
1366
+ "effectiveTime" : "{{$isoTimestamp}}"
1367
+ }
1368
+ """
1369
+ url = f"{self.command_root}/metadata-elements/related-elements/{relationship_guid}/delete"
1370
+ await self._async_make_request("POST", url, body_slimmer(body))
1371
+ return
1372
+
1373
+ def delete_related_elements_in_store(
1374
+ self, relationship_guid: str, body: dict
1375
+ ) -> None:
1376
+ """Delete a relationship between two metadata elements.
1377
+
1378
+ Parameters
1379
+ ----------
1380
+ relationship_guid : str
1381
+ The identity of the relationship to delete.
1382
+ body : dict
1383
+ The definition of the element to create. A sample is the notes below.
1384
+
1385
+ Returns
1386
+ -------
1387
+ None
1388
+
1389
+ Raises
1390
+ ------
1391
+ InvalidParameterException
1392
+ PropertyServerException
1393
+ UserNotAuthorizedException
1394
+
1395
+ Notes
1396
+ -----
1397
+ Example of the body:
1398
+
1399
+ {
1400
+ "class" : "UpdateRequestBody",
1401
+ "externalSourceGUID" : "",
1402
+ "externalSourceName" : "",
1403
+ "forLineage" : false,
1404
+ "forDuplicateProcessing" : false,
1405
+ "effectiveTime" : "{{$isoTimestamp}}"
1406
+ }
1407
+ """
1408
+ loop = asyncio.get_event_loop()
1409
+ loop.run_until_complete(
1410
+ self._async_delete_related_elements_in_store(relationship_guid, body)
1411
+ )
1412
+ return
1413
+
1414
+
1415
+ if __name__ == "__main__":
1416
+ print("Main-Template Manager")