pyegeria 5.3.9.2__py3-none-any.whl → 5.3.9.4__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,4849 @@
1
+ """PDX-License-Identifier: Apache-2.0
2
+ Copyright Contributors to the ODPi Egeria project.
3
+
4
+ This module provides access to the data-designer OMVS module.
5
+
6
+ [data-designer](https://egeria-project.org/services/omvs/data-designer/overview)
7
+
8
+ """
9
+
10
+ import asyncio
11
+
12
+ from httpx import Response
13
+
14
+ from pyegeria._client import Client, max_paging_size
15
+ from pyegeria._globals import NO_ELEMENTS_FOUND
16
+ from pyegeria.utils import body_slimmer
17
+
18
+
19
+ def query_seperator(current_string):
20
+ if current_string == "":
21
+ return "?"
22
+ else:
23
+ return "&"
24
+
25
+
26
+ # ("params are in the form of [(paramName, value), (param2Name, value)] if the value is not None, it will be added to "
27
+ # "the query string")
28
+
29
+
30
+ def query_string(params):
31
+ result = ""
32
+ for i in range(len(params)):
33
+ if params[i][1] is not None:
34
+ result = f"{result}{query_seperator(result)}{params[i][0]}={params[i][1]}"
35
+ return result
36
+
37
+
38
+ def base_path(client, view_server: str):
39
+ return f"{client.platform_url}/servers/{view_server}/api/open-metadata/data-designer"
40
+
41
+
42
+ def extract_mermaid_only(elements) -> list:
43
+ result = []
44
+ if type(elements) is dict:
45
+ return(elements.get('mermaidGraph', '___'))
46
+ for element in elements:
47
+ result.append(element.get('mermaidGraph', '___'))
48
+ return result
49
+
50
+
51
+ def extract_basic_dict(elements: dict) -> list:
52
+ list = []
53
+ body = {}
54
+ if type(elements) is dict:
55
+ body['guid'] = elements['elementHeader']['guid']
56
+ for key in elements['properties']:
57
+ body[key] = elements['properties'][key]
58
+ return body
59
+
60
+ for element in elements:
61
+ body['guid'] = element['elementHeader']['guid']
62
+ for key in element['properties']:
63
+ body[key] = element['properties'][key]
64
+ list.append(body)
65
+ return list
66
+
67
+
68
+ class DataDesigner(Client):
69
+ """DataDesigner is a class that extends the Client class. The Data Designer OMVS provides APIs for
70
+ building specifications for data. This includes common data fields in a data dictionary, data specifications
71
+ for a project and data classes for data quality validation.
72
+ """
73
+
74
+ def __init__(self, view_server_name: str, platform_url: str, user_id: str = None, user_pwd: str = None,
75
+ token: str = None, ):
76
+ self.view_server = view_server_name
77
+ self.platform_url = platform_url
78
+ self.user_id = user_id
79
+ self.user_pwd = user_pwd
80
+ self.metadata_explorer_command_root: str = (
81
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/data-designer")
82
+ Client.__init__(self, view_server_name, platform_url, user_id=user_id, user_pwd=user_pwd, token=token, )
83
+
84
+ #
85
+ # Data Structures
86
+ #
87
+
88
+ async def _async_create_data_structure(self, name: str, description: str, qualified_name: str = None,
89
+ namespace: str = None, version_id: str = None) -> str:
90
+ """
91
+ Create a new data structure from a provided dict body. Async version.
92
+
93
+ Parameters
94
+ ----------
95
+ name : str
96
+ - unique name to search for
97
+ description : str
98
+ - description of the data structure
99
+ qualified_name : str, optional
100
+ - unique name of the data structure, if not provided, one will be generated from the name.
101
+ namespace : str
102
+ - a namespace for the data structure
103
+ version_id : str, optional
104
+ - a version identifier for the data structure
105
+
106
+ Returns
107
+ -------
108
+ str
109
+ The GUID of the element - or "No element found"
110
+
111
+ Raises
112
+ ------
113
+ InvalidParameterException
114
+ one of the parameters is null or invalid or
115
+ PropertyServerException
116
+ There is a problem adding the element properties to the metadata repository or
117
+ UserNotAuthorizedException
118
+ the requesting user is not authorized to issue this request.
119
+ """
120
+ if version_id is None:
121
+ qualified_name = qualified_name or f"DataStructure::{name}"
122
+ else:
123
+ qualified_name = qualified_name or f"DataStructure::{name}::{version_id}"
124
+ if namespace:
125
+ qualified_name = f"{namespace}::{qualified_name}"
126
+
127
+ body = {
128
+ "properties": {
129
+ "class": "DataStructureProperties", "qualifiedName": qualified_name, "displayName": name,
130
+ "description": description, "namespace": namespace, "versionIdentifier": version_id
131
+ }
132
+ }
133
+
134
+ url = f"{base_path(self, self.view_server)}/data-structures"
135
+
136
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
137
+ return response.json().get("guid", NO_ELEMENTS_FOUND)
138
+
139
+ def create_data_structure(self, name: str, description: str, qualified_name: str = None, namespace: str = None,
140
+ version_id: str = None) -> str:
141
+ """
142
+ Create a new data structure from a provided dict body.
143
+
144
+ Parameters
145
+ ----------
146
+ name : str
147
+ - unique name to search for
148
+ description : str
149
+ - description of the data structure
150
+ qualified_name : str, optional
151
+ - unique name of the data structure, if not provided, one will be generated from the name.
152
+ namespace : str
153
+ - a namespace for the data structure
154
+ version_id : str, optional
155
+ - a version identifier for the data structure
156
+
157
+ Returns
158
+ -------
159
+ str
160
+ The GUID of the element - or "No element found"
161
+
162
+ Raises
163
+ ------
164
+ InvalidParameterException
165
+ one of the parameters is null or invalid or
166
+ PropertyServerException
167
+ There is a problem adding the element properties to the metadata repository or
168
+ UserNotAuthorizedException
169
+ the requesting user is not authorized to issue this request.
170
+ """
171
+
172
+ loop = asyncio.get_event_loop()
173
+ response = loop.run_until_complete(
174
+ self._async_create_data_structure(name, description, qualified_name, namespace, version_id, ))
175
+ return response
176
+
177
+ async def _async_create_data_structure_w_body(self, body: dict) -> str:
178
+ """
179
+ Create a new data structure with basic parameters. Async version.
180
+
181
+ Parameters
182
+ ----------
183
+ body: dict
184
+ - a dictionary containing the properties of the data structure to be created.
185
+
186
+ Returns
187
+ -------
188
+ str
189
+ The GUID of the element - or "No element found"
190
+
191
+ Raises
192
+ ------
193
+ InvalidParameterException
194
+ one of the parameters is null or invalid or
195
+ PropertyServerException
196
+ There is a problem adding the element properties to the metadata repository or
197
+ UserNotAuthorizedException
198
+ the requesting user is not authorized to issue this request.
199
+
200
+ Note
201
+ ----
202
+
203
+ Full sample body:
204
+
205
+ {
206
+ "class" : "NewDataStructureRequestBody",
207
+ "externalSourceGUID": "add guid here",
208
+ "externalSourceName": "add qualified name here",
209
+ "effectiveTime" : "{{$isoTimestamp}}",
210
+ "forLineage" : false,
211
+ "forDuplicateProcessing" : false,
212
+ "anchorGUID" : "add guid here",
213
+ "isOwnAnchor": false,
214
+ "parentGUID": "add guid here",
215
+ "parentRelationshipTypeName": "add type name here",
216
+ "parentRelationshipProperties": {
217
+ "class": "ElementProperties",
218
+ "propertyValueMap" : {
219
+ "description" : {
220
+ "class": "PrimitiveTypePropertyValue",
221
+ "typeName": "string",
222
+ "primitiveValue" : "New description"
223
+ }
224
+ }
225
+ },
226
+ "parentAtEnd1": false,
227
+ "properties": {
228
+ "class" : "DataStructureProperties",
229
+ "qualifiedName": "add unique name here",
230
+ "displayName": "add short name here",
231
+ "description": "add description here",
232
+ "namespace": "add namespace for this structure",
233
+ "versionIdentifier": "add version for this structure",
234
+ "additionalProperties": {
235
+ "property1" : "propertyValue1",
236
+ "property2" : "propertyValue2"
237
+ },
238
+ "effectiveFrom": "{{$isoTimestamp}}",
239
+ "effectiveTo": "{{$isoTimestamp}}"
240
+ }
241
+ }
242
+
243
+ """
244
+
245
+ url = f"{base_path(self, self.view_server)}/data-structures"
246
+
247
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
248
+ return response.json().get("guid", NO_ELEMENTS_FOUND)
249
+
250
+ def create_data_structure_w_body(self, body: dict) -> str:
251
+ """
252
+ Create a new data structure with basic parameters.
253
+
254
+ Parameters
255
+ ----------
256
+ body: dict
257
+ - a dictionary containing the properties of the data structure to be created.
258
+
259
+ Returns
260
+ -------
261
+ str
262
+ The GUID of the element - or "No element found"
263
+
264
+ Raises
265
+ ------
266
+ InvalidParameterException
267
+ one of the parameters is null or invalid or
268
+ PropertyServerException
269
+ There is a problem adding the element properties to the metadata repository or
270
+ UserNotAuthorizedException
271
+ the requesting user is not authorized to issue this request.
272
+
273
+ Note
274
+ ----
275
+
276
+ Full sample body:
277
+
278
+ {
279
+ "class" : "NewDataStructureRequestBody",
280
+ "externalSourceGUID": "add guid here",
281
+ "externalSourceName": "add qualified name here",
282
+ "effectiveTime" : "{{$isoTimestamp}}",
283
+ "forLineage" : false,
284
+ "forDuplicateProcessing" : false,
285
+ "anchorGUID" : "add guid here",
286
+ "isOwnAnchor": false,
287
+ "parentGUID": "add guid here",
288
+ "parentRelationshipTypeName": "add type name here",
289
+ "parentRelationshipProperties": {
290
+ "class": "ElementProperties",
291
+ "propertyValueMap" : {
292
+ "description" : {
293
+ "class": "PrimitiveTypePropertyValue",
294
+ "typeName": "string",
295
+ "primitiveValue" : "New description"
296
+ }
297
+ }
298
+ },
299
+ "parentAtEnd1": false,
300
+ "properties": {
301
+ "class" : "DataStructureProperties",
302
+ "qualifiedName": "add unique name here",
303
+ "displayName": "add short name here",
304
+ "description": "add description here",
305
+ "namespace": "add namespace for this structure",
306
+ "versionIdentifier": "add version for this structure",
307
+ "additionalProperties": {
308
+ "property1" : "propertyValue1",
309
+ "property2" : "propertyValue2"
310
+ },
311
+ "effectiveFrom": "{{$isoTimestamp}}",
312
+ "effectiveTo": "{{$isoTimestamp}}"
313
+ }
314
+ }
315
+
316
+ """
317
+
318
+ loop = asyncio.get_event_loop()
319
+ response = loop.run_until_complete(self._async_create_data_structure_w_body(body, ))
320
+ return response
321
+
322
+ async def _async_create_data_structure_from_template(self, body: dict) -> str:
323
+ """
324
+ Create a new metadata element to represent a data structure using an existing metadata element as a template.
325
+ The template defines additional classifications and relationships that should be added to the new element.
326
+ Async version.
327
+
328
+ Parameters
329
+ ----------
330
+ body: dict
331
+ - a dictionary containing the properties of the data structure to be created.
332
+
333
+ Returns
334
+ -------
335
+ str
336
+ The GUID of the element - or "No element found"
337
+
338
+ Raises
339
+ ------
340
+ InvalidParameterException
341
+ one of the parameters is null or invalid or
342
+ PropertyServerException
343
+ There is a problem adding the element properties to the metadata repository or
344
+ UserNotAuthorizedException
345
+ the requesting user is not authorized to issue this request.
346
+
347
+ Note
348
+ ----
349
+
350
+ Full sample body:
351
+
352
+ {
353
+ "class" : "TemplateRequestBody",
354
+ "externalSourceGUID": "add guid here",
355
+ "externalSourceName": "add qualified name here",
356
+ "effectiveTime" : "{{$isoTimestamp}}",
357
+ "forLineage" : false,
358
+ "forDuplicateProcessing" : false,
359
+ "anchorGUID" : "add guid here",
360
+ "isOwnAnchor": false,
361
+ "parentGUID": "add guid here",
362
+ "parentRelationshipTypeName": "add type name here",
363
+ "parentRelationshipProperties": {
364
+ "class": "ElementProperties",
365
+ "propertyValueMap" : {
366
+ "description" : {
367
+ "class": "PrimitiveTypePropertyValue",
368
+ "typeName": "string",
369
+ "primitiveValue" : "New description"
370
+ }
371
+ }
372
+ },
373
+ "parentAtEnd1": false,
374
+ "templateGUID": "add guid here",
375
+ "replacementProperties": {
376
+ "class": "ElementProperties",
377
+ "propertyValueMap" : {
378
+ "description" : {
379
+ "class": "PrimitiveTypePropertyValue",
380
+ "typeName": "string",
381
+ "primitiveValue" : "New description"
382
+ }
383
+ }
384
+ },
385
+ "placeholderPropertyValues": {
386
+ "placeholder1" : "propertyValue1",
387
+ "placeholder2" : "propertyValue2"
388
+ }
389
+ }
390
+
391
+ """
392
+
393
+ url = f"{base_path(self, self.view_server)}/data-structures/from-template"
394
+
395
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
396
+ return response.json().get("guid", NO_ELEMENTS_FOUND)
397
+
398
+ def create_data_structure_from_template(self, body: dict) -> str:
399
+ """
400
+ Create a new metadata element to represent a data structure using an existing metadata element as a template.
401
+ The template defines additional classifications and relationships that should be added to the new element.
402
+
403
+ Parameters
404
+ ----------
405
+ body: dict
406
+ - a dictionary containing the properties of the data structure to be created.
407
+
408
+ Returns
409
+ -------
410
+ str
411
+ The GUID of the element - or "No element found"
412
+
413
+ Raises
414
+ ------
415
+ InvalidParameterException
416
+ one of the parameters is null or invalid or
417
+ PropertyServerException
418
+ There is a problem adding the element properties to the metadata repository or
419
+ UserNotAuthorizedException
420
+ the requesting user is not authorized to issue this request.
421
+
422
+ Note
423
+ ----
424
+
425
+ Full sample body:
426
+
427
+ {
428
+ "class" : "TemplateRequestBody",
429
+ "externalSourceGUID": "add guid here",
430
+ "externalSourceName": "add qualified name here",
431
+ "effectiveTime" : "{{$isoTimestamp}}",
432
+ "forLineage" : false,
433
+ "forDuplicateProcessing" : false,
434
+ "anchorGUID" : "add guid here",
435
+ "isOwnAnchor": false,
436
+ "parentGUID": "add guid here",
437
+ "parentRelationshipTypeName": "add type name here",
438
+ "parentRelationshipProperties": {
439
+ "class": "ElementProperties",
440
+ "propertyValueMap" : {
441
+ "description" : {
442
+ "class": "PrimitiveTypePropertyValue",
443
+ "typeName": "string",
444
+ "primitiveValue" : "New description"
445
+ }
446
+ }
447
+ },
448
+ "parentAtEnd1": false,
449
+ "templateGUID": "add guid here",
450
+ "replacementProperties": {
451
+ "class": "ElementProperties",
452
+ "propertyValueMap" : {
453
+ "description" : {
454
+ "class": "PrimitiveTypePropertyValue",
455
+ "typeName": "string",
456
+ "primitiveValue" : "New description"
457
+ }
458
+ }
459
+ },
460
+ "placeholderPropertyValues": {
461
+ "placeholder1" : "propertyValue1",
462
+ "placeholder2" : "propertyValue2"
463
+ }
464
+ }
465
+
466
+ """
467
+
468
+ loop = asyncio.get_event_loop()
469
+ response = loop.run_until_complete(self._async_create_data_structure_from_template(body, ))
470
+ return response
471
+
472
+ async def _async_update_data_structure_w_body(self, data_struct_guid: str, body: dict,
473
+ replace_all_properties: bool = False) -> None:
474
+ """
475
+ Update the properties of a data structure. Async version.
476
+
477
+ Parameters
478
+ ----------
479
+ data_struct_guid: str
480
+ - the GUID of the data structure to be updated.
481
+ body: dict
482
+ - a dictionary containing the properties of the data structure to be created.
483
+ replace_all_properties: bool, default = False
484
+ - if true, then all properties will be replaced with the new ones. Otherwise, only the specified ones
485
+ will be replaced.
486
+ Returns
487
+ -------
488
+ None
489
+
490
+ Raises
491
+ ------
492
+ InvalidParameterException
493
+ one of the parameters is null or invalid or
494
+ PropertyServerException
495
+ There is a problem adding the element properties to the metadata repository or
496
+ UserNotAuthorizedException
497
+ the requesting user is not authorized to issue this request.
498
+
499
+ Note
500
+ ----
501
+
502
+ Full sample body:
503
+
504
+ {
505
+ "class" : "UpdateDataStructureRequestBody",
506
+ "externalSourceGUID": "add guid here",
507
+ "externalSourceName": "add qualified name here",
508
+ "effectiveTime" : "{{$isoTimestamp}}",
509
+ "forLineage" : false,
510
+ "forDuplicateProcessing" : false,
511
+ "properties": {
512
+ "class" : "DataStructureProperties",
513
+ "qualifiedName": "add unique name here",
514
+ "displayName": "add short name here",
515
+ "description": "add description here",
516
+ "namespace": "add namespace for this structure",
517
+ "versionIdentifier": "add version for this structure",
518
+ "additionalProperties": {
519
+ "property1" : "propertyValue1",
520
+ "property2" : "propertyValue2"
521
+ },
522
+ "effectiveFrom": "{{$isoTimestamp}}",
523
+ "effectiveTo": "{{$isoTimestamp}}"
524
+ }
525
+ }
526
+
527
+ """
528
+ replace_all_properties_s = str(replace_all_properties).lower()
529
+
530
+ url = (f"{base_path(self, self.view_server)}/data-structures/{data_struct_guid}/update?"
531
+ f"replaceAllProperties={replace_all_properties_s}")
532
+
533
+ await self._async_make_request("POST", url, body_slimmer(body))
534
+
535
+ def update_data_structure_w_body(self, data_struct_guid: str, body: dict.get,
536
+ replace_all_properties: bool = False) -> None:
537
+ """
538
+ Update the properties of a data structure.
539
+
540
+ Parameters
541
+ ----------
542
+ data_struct_guid: str
543
+ - the GUID of the data structure to be updated.
544
+ body: dict
545
+ - a dictionary containing the properties of the data structure to be created.
546
+ r replace_all_properties: bool, default = False
547
+ - if true, then all properties will be replaced with the new ones. Otherwise, only the specified ones
548
+ will be replaced.
549
+ Returns
550
+ -------
551
+ None
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
+ Note
563
+ ----
564
+
565
+ Full sample body:
566
+
567
+ {
568
+ "class" : "UpdateDataStructureRequestBody",
569
+ "externalSourceGUID": "add guid here",
570
+ "externalSourceName": "add qualified name here",
571
+ "effectiveTime" : "{{$isoTimestamp}}",
572
+ "forLineage" : false,
573
+ "forDuplicateProcessing" : false,
574
+ "properties": {
575
+ "class" : "DataStructureProperties",
576
+ "qualifiedName": "add unique name here",
577
+ "displayName": "add short name here",
578
+ "description": "add description here",
579
+ "namespace": "add namespace for this structure",
580
+ "versionIdentifier": "add version for this structure",
581
+ "additionalProperties": {
582
+ "property1" : "propertyValue1",
583
+ "property2" : "propertyValue2"
584
+ },
585
+ "effectiveFrom": "{{$isoTimestamp}}",
586
+ "effectiveTo": "{{$isoTimestamp}}"
587
+ }
588
+ }
589
+
590
+ """
591
+
592
+ loop = asyncio.get_event_loop()
593
+ loop.run_until_complete(
594
+ self._async_update_data_structure_w_body(data_struct_guid, body, replace_all_properties))
595
+
596
+ async def _async_link_member_data_field(self, parent_data_struct_guid: str, member_data_field_guid: str,
597
+ body: dict = None) -> None:
598
+ """
599
+ Connect a data structure to a data class. Request body is optional. Async version.
600
+
601
+ Parameters
602
+ ----------
603
+ parent_data_struct_guid: str
604
+ - the GUID of the parent data structure the data class will be connected to.
605
+ member_data_field_guid: str
606
+ - the GUID of the data class to be connected.
607
+ body: dict, optional
608
+ - a dictionary containing additional properties.
609
+
610
+ Returns
611
+ -------
612
+ None
613
+
614
+ Raises
615
+ ------
616
+ InvalidParameterException
617
+ one of the parameters is null or invalid or
618
+ PropertyServerException
619
+ There is a problem adding the element properties to the metadata repository or
620
+ UserNotAuthorizedException
621
+ the requesting user is not authorized to issue this request.
622
+
623
+ Note
624
+ ----
625
+
626
+ Full sample body:
627
+
628
+ {
629
+ "class" : "MemberDataFieldRequestBody",
630
+ "externalSourceGUID": "add guid here",
631
+ "externalSourceName": "add qualified name here",
632
+ "effectiveTime" : "{{$isoTimestamp}}",
633
+ "forLineage" : false,
634
+ "forDuplicateProcessing" : false,
635
+ "properties": {
636
+ "class": "MemberDataFieldProperties",
637
+ "dataFieldPosition": 0,
638
+ "minCardinality": 0,
639
+ "maxCardinality": 0,
640
+ "effectiveFrom": "{{$isoTimestamp}}",
641
+ "effectiveTo": "{{$isoTimestamp}}"
642
+ }
643
+ }
644
+
645
+ """
646
+
647
+ url = (f"{base_path(self, self.view_server)}/data-structures/{parent_data_struct_guid}"
648
+ f"/member-data-fields/{member_data_field_guid}/attach")
649
+
650
+ if body is None:
651
+ await self._async_make_request("POST", url)
652
+ else:
653
+ await self._async_make_request("POST", url, body_slimmer(body))
654
+
655
+ def link_member_data_field(self, parent_data_struct_guid: str, member_data_field_guid: str,
656
+ body: dict = None) -> None:
657
+ """
658
+ Connect a data structure to a data class. Request body is optional.
659
+
660
+ Parameters
661
+ ----------
662
+ parent_data_struct_guid: str
663
+ - the GUID of the parent data structure the data class will be connected to.
664
+ member_data_field_guid: str
665
+ - the GUID of the data class to be connected.
666
+ body: dict, optional
667
+ - a dictionary containing additional properties.
668
+
669
+ Returns
670
+ -------
671
+ None
672
+
673
+ Raises
674
+ ------
675
+ InvalidParameterException
676
+ one of the parameters is null or invalid or
677
+ PropertyServerException
678
+ There is a problem adding the element properties to the metadata repository or
679
+ UserNotAuthorizedException
680
+ the requesting user is not authorized to issue this request.
681
+
682
+ Note
683
+ ----
684
+
685
+ Full sample body:
686
+
687
+ {
688
+ "class" : "MemberDataFieldRequestBody",
689
+ "externalSourceGUID": "add guid here",
690
+ "externalSourceName": "add qualified name here",
691
+ "effectiveTime" : "{{$isoTimestamp}}",
692
+ "forLineage" : false,
693
+ "forDuplicateProcessing" : false,
694
+ "properties": {
695
+ "class": "MemberDataFieldProperties",
696
+ "dataFieldPosition": 0,
697
+ "minCardinality": 0,
698
+ "maxCardinality": 0,
699
+ "effectiveFrom": "{{$isoTimestamp}}",
700
+ "effectiveTo": "{{$isoTimestamp}}"
701
+ }
702
+ }
703
+
704
+ """
705
+
706
+ loop = asyncio.get_event_loop()
707
+ loop.run_until_complete(
708
+ self._async_link_member_data_field(parent_data_struct_guid, member_data_field_guid, body))
709
+
710
+ async def _async_detach_member_data_field(self, parent_data_struct_guid: str, member_data_field_guid: str,
711
+ body: dict = None) -> None:
712
+ """
713
+ Detach a data class from a data structure. Request body is optional. Async version.
714
+
715
+ Parameters
716
+ ----------
717
+ parent_data_struct_guid: str
718
+ - the GUID of the parent data structure the data class will be detached from..
719
+ member_data_field_guid: str
720
+ - the GUID of the data class to be disconnected.
721
+ body: dict, optional
722
+ - a dictionary containing additional properties.
723
+
724
+ Returns
725
+ -------
726
+ None
727
+
728
+ Raises
729
+ ------
730
+ InvalidParameterException
731
+ one of the parameters is null or invalid or
732
+ PropertyServerException
733
+ There is a problem adding the element properties to the metadata repository or
734
+ UserNotAuthorizedException
735
+ the requesting user is not authorized to issue this request.
736
+
737
+ Note
738
+ ----
739
+
740
+ Full sample body:
741
+
742
+ {
743
+ "class": "MetadataSourceRequestBody",
744
+ "externalSourceGUID": "add guid here",
745
+ "externalSourceName": "add qualified name here",
746
+ "effectiveTime": "{{$isoTimestamp}}",
747
+ "forLineage": false,
748
+ "forDuplicateProcessing": false
749
+ }
750
+
751
+
752
+ """
753
+
754
+ url = (f"{base_path(self, self.view_server)}/data-structures/{parent_data_struct_guid}"
755
+ f"/member-data-fields/{member_data_field_guid}/detach")
756
+
757
+ if body is None:
758
+ await self._async_make_request("POST", url)
759
+ else:
760
+ await self._async_make_request("POST", url, body_slimmer(body))
761
+
762
+ def detach_member_data_field(self, parent_data_struct_guid: str, member_data_field_guid: str,
763
+ body: dict = None) -> None:
764
+ """
765
+ Detach a data class from a data structure. Request body is optional.
766
+
767
+ Parameters
768
+ ----------
769
+ parent_data_struct_guid: str
770
+ - the GUID of the parent data structure the data class will be detached fromo.
771
+ member_data_field_guid: str
772
+ - the GUID of the data class to be disconnected.
773
+ body: dict, optional
774
+ - a dictionary containing additional properties.
775
+
776
+ Returns
777
+ -------
778
+ None
779
+
780
+ Raises
781
+ ------
782
+ InvalidParameterException
783
+ one of the parameters is null or invalid or
784
+ PropertyServerException
785
+ There is a problem adding the element properties to the metadata repository or
786
+ UserNotAuthorizedException
787
+ the requesting user is not authorized to issue this request.
788
+
789
+ Note
790
+ ----
791
+
792
+ Full sample body:
793
+
794
+ {
795
+ "class": "MetadataSourceRequestBody",
796
+ "externalSourceGUID": "add guid here",
797
+ "externalSourceName": "add qualified name here",
798
+ "effectiveTime": "{{$isoTimestamp}}",
799
+ "forLineage": false,
800
+ "forDuplicateProcessing": false
801
+ }
802
+
803
+ """
804
+
805
+ loop = asyncio.get_event_loop()
806
+ loop.run_until_complete(
807
+ self._async_detach_member_data_field(parent_data_struct_guid, member_data_field_guid, body))
808
+
809
+ async def _async_delete_data_structure(self, data_struct_guid: str, body: dict = None) -> None:
810
+ """
811
+ Delete a data structure. Request body is optional. Async version.
812
+
813
+ Parameters
814
+ ----------
815
+ data_struct_guid: str
816
+ - the GUID of the parent data structure to delete.
817
+ body: dict, optional
818
+ - a dictionary containing additional properties.
819
+
820
+ Returns
821
+ -------
822
+ None
823
+
824
+ Raises
825
+ ------
826
+ InvalidParameterException
827
+ one of the parameters is null or invalid or
828
+ PropertyServerException
829
+ There is a problem adding the element properties to the metadata repository or
830
+ UserNotAuthorizedException
831
+ the requesting user is not authorized to issue this request.
832
+
833
+ Note
834
+ ----
835
+
836
+ Full sample body:
837
+
838
+ {
839
+ "class": "MetadataSourceRequestBody",
840
+ "externalSourceGUID": "add guid here",
841
+ "externalSourceName": "add qualified name here",
842
+ "effectiveTime": "{{$isoTimestamp}}",
843
+ "forLineage": false,
844
+ "forDuplicateProcessing": false
845
+ }
846
+
847
+
848
+ """
849
+
850
+ url = f"{base_path(self, self.view_server)}/data-structures/{data_struct_guid}/delete"
851
+
852
+ if body is None:
853
+ await self._async_make_request("POST", url)
854
+ else:
855
+ await self._async_make_request("POST", url, body_slimmer(body))
856
+
857
+ def delete_data_structure(self, data_struct_guid: str, body: dict = None) -> None:
858
+ """
859
+ Delete a data structure. Request body is optional.
860
+
861
+ Parameters
862
+ ----------
863
+ data_struct_guid: str
864
+ - the GUID of the data structure to delete.
865
+ body: dict, optional
866
+ - a dictionary containing additional properties.
867
+
868
+ Returns
869
+ -------
870
+ None
871
+
872
+ Raises
873
+ ------
874
+ InvalidParameterException
875
+ one of the parameters is null or invalid or
876
+ PropertyServerException
877
+ There is a problem adding the element properties to the metadata repository or
878
+ UserNotAuthorizedException
879
+ the requesting user is not authorized to issue this request.
880
+
881
+ Note
882
+ ----
883
+
884
+ Full sample body:
885
+
886
+ {
887
+ "class": "MetadataSourceRequestBody",
888
+ "externalSourceGUID": "add guid here",
889
+ "externalSourceName": "add qualified name here",
890
+ "effectiveTime": "{{$isoTimestamp}}",
891
+ "forLineage": false,
892
+ "forDuplicateProcessing": false
893
+ }
894
+
895
+ """
896
+
897
+ loop = asyncio.get_event_loop()
898
+ loop.run_until_complete(self._async_delete_data_field(data_struct_guid, body))
899
+
900
+ async def _async_find_all_data_structures(self, start_from: int = 0, page_size: int = max_paging_size,
901
+ output_format: str = "DICT") -> list | str:
902
+ """Returns a list of all known data structures. Async version.
903
+
904
+ Parameters
905
+ ----------
906
+ start_from: int, default = 0
907
+ - index of the list to start from (0 for start).
908
+ page_size
909
+ - maximum number of elements to return.
910
+ output_format: str, default = "DICT"
911
+ - output format of the data structure. Possible values: "DICT", "JSON", "MERMAID".
912
+
913
+ Returns
914
+ -------
915
+ [dict] | str
916
+ Returns a string if no elements are found and a list of dict of elements with the results.
917
+
918
+ Raises
919
+ ------
920
+ InvalidParameterException
921
+ one of the parameters is null or invalid or
922
+ PropertyServerException
923
+ There is a problem adding the element properties to the metadata repository or
924
+ UserNotAuthorizedException
925
+ the requesting user is not authorized to issue this request.
926
+
927
+ """
928
+
929
+ possible_query_params = query_string(
930
+ [("startFrom", start_from), ("pageSize", page_size), ("startsWith", 'false'), ("endsWith", 'false'),
931
+ ("ignoreCase", 'true')])
932
+
933
+ url = (f"{base_path(self, self.view_server)}/data-structures/by-search-string"
934
+ f"{possible_query_params}")
935
+
936
+ response: Response = await self._async_make_request("POST", url)
937
+
938
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
939
+ if type(elements) is str:
940
+ return NO_ELEMENTS_FOUND
941
+ if output_format != 'JSON': # return other representations
942
+ return self.generate_data_structure_output(elements, filter, output_format)
943
+ return elements
944
+
945
+ def find_all_data_structures(self, start_from: int = 0, page_size: int = max_paging_size,
946
+ output_format: str = "DICT") -> list | str:
947
+ """ Returns a list of all known data structures.
948
+
949
+ Parameters
950
+ ----------
951
+ start_from: int, default = 0
952
+ - index of the list to start from (0 for start).
953
+ page_size
954
+ - maximum number of elements to return.
955
+ output_format: str, default = "DICT"
956
+ - output format of the data structure. Possible values: "DICT", "JSON", "MERMAID".
957
+
958
+
959
+ Returns
960
+ -------
961
+ [dict] | str
962
+ Returns a string if no elements are found and a list of dict elements with the results.
963
+
964
+ Raises
965
+ ------
966
+ InvalidParameterException
967
+ one of the parameters is null or invalid or
968
+ PropertyServerException
969
+ There is a problem adding the element properties to the metadata repository or
970
+ UserNotAuthorizedException
971
+ the requesting user is not authorized to issue this request.
972
+
973
+ """
974
+
975
+ loop = asyncio.get_event_loop()
976
+ response = loop.run_until_complete(self._async_find_all_data_structures(start_from, page_size, output_format))
977
+ return response
978
+
979
+ async def _async_find_data_structures_w_body(self, body: dict, start_from: int = 0,
980
+ page_size: int = max_paging_size, starts_with: bool = True,
981
+ ends_with: bool = False, ignore_case: bool = True,
982
+ output_format: str = "DICT") -> list | str:
983
+ """ Retrieve the list of data structure metadata elements that contain the search string.
984
+ Async version.
985
+
986
+ Parameters
987
+ ----------
988
+ body: dict
989
+ - A structure containing the search criteria. (example below)
990
+ start_from: int, default = 0
991
+ - index of the list to start from (0 for start).
992
+ page_size
993
+ - maximum number of elements to return.
994
+ starts_with: bool, default = True
995
+ - if True, the search string filters from the beginning of the string.
996
+ ends_with: bool, default = False
997
+ - if True, the search string filters from the end of the string.
998
+ ignore_case: bool, default = True
999
+ - If True, the case of the search string is ignored.
1000
+ output_format: str, default = "DICT"
1001
+ - output format of the data structure. Possible values: "DICT", "JSON", "MERMAID".
1002
+
1003
+ Returns
1004
+ -------
1005
+ [dict] | str
1006
+ Returns a string if no elements are found and a list of dict with the results.
1007
+
1008
+ Raises
1009
+ ------
1010
+ InvalidParameterException
1011
+ one of the parameters is null or invalid or
1012
+ PropertyServerException
1013
+ There is a problem adding the element properties to the metadata repository or
1014
+ UserNotAuthorizedException
1015
+ the requesting user is not authorized to issue this request.
1016
+
1017
+ Notes:
1018
+
1019
+ {
1020
+ "class": "FilterRequestBody",
1021
+ "asOfTime": "{{$isoTimestamp}}",
1022
+ "effectiveTime": "{{$isoTimestamp}}",
1023
+ "forLineage": false,
1024
+ "forDuplicateProcessing : false,
1025
+ "limitResultsByStatus": ["ACTIVE"],
1026
+ "sequencingOrder": "PROPERTY_ASCENDING",
1027
+ "sequencingProperty": "qualifiedName",
1028
+ "filter": ""
1029
+ }
1030
+
1031
+ """
1032
+ starts_with_s = str(starts_with).lower()
1033
+ ends_with_s = str(ends_with).lower()
1034
+ ignore_case_s = str(ignore_case).lower()
1035
+ possible_query_params = query_string(
1036
+ [("startFrom", start_from), ("pageSize", page_size), ("startsWith", starts_with_s),
1037
+ ("endsWith", ends_with_s), ("ignoreCase", ignore_case_s), ])
1038
+
1039
+ url = (f"{base_path(self, self.view_server)}/data-structures/by-search-string"
1040
+ f"{possible_query_params}")
1041
+
1042
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
1043
+
1044
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
1045
+ if type(elements) is list and len(elements) == 0:
1046
+ return NO_ELEMENTS_FOUND
1047
+ if output_format != 'JSON': # return other representations
1048
+ return self.generate_data_structure_output(elements, filter, output_format)
1049
+ return elements
1050
+
1051
+ def find_data_structures_w_body(self, body: dict, start_from: int = 0, page_size: int = max_paging_size,
1052
+ starts_with: bool = True, ends_with: bool = False, ignore_case: bool = True,
1053
+ output_format: str = "DICT") -> list | str:
1054
+ """ Retrieve the list of data structure metadata elements that contain the search string.
1055
+
1056
+ Parameters
1057
+ ----------
1058
+ body: dict
1059
+ - A structure containing the search criteria. (example below)
1060
+ start_from: int, default = 0
1061
+ - index of the list to start from (0 for start).
1062
+ page_size
1063
+ - maximum number of elements to return.
1064
+ starts_with: bool, default = True
1065
+ - if True, the search string filters from the beginning of the string.
1066
+ ends_with: bool, default = False
1067
+ - if True, the search string filters from the end of the string.
1068
+ ignore_case: bool, default = True
1069
+ - If True, the case of the search string is ignored.
1070
+ output_format: str, default = "DICT"
1071
+ - output format of the data structure. Possible values: "DICT", "JSON", "MERMAID".
1072
+
1073
+ Returns
1074
+ -------
1075
+ [dict] | str
1076
+ Returns a string if no elements are found and a list of dict with the results.
1077
+
1078
+ Raises
1079
+ ------
1080
+ InvalidParameterException
1081
+ one of the parameters is null or invalid or
1082
+ PropertyServerException
1083
+ There is a problem adding the element properties to the metadata repository or
1084
+ UserNotAuthorizedException
1085
+ the requesting user is not authorized to issue this request.
1086
+
1087
+ Notes:
1088
+
1089
+ {
1090
+ "class": "FilterRequestBody",
1091
+ "asOfTime": "{{$isoTimestamp}}",
1092
+ "effectiveTime": "{{$isoTimestamp}}",
1093
+ "forLineage": false,
1094
+ "forDuplicateProcessing : false,
1095
+ "limitResultsByStatus": ["ACTIVE"],
1096
+ "sequencingOrder": "PROPERTY_ASCENDING",
1097
+ "sequencingProperty": "qualifiedName",
1098
+ "filter": ""
1099
+ }
1100
+
1101
+ """
1102
+
1103
+ loop = asyncio.get_event_loop()
1104
+ response = loop.run_until_complete(
1105
+ self._async_find_data_structures_w_body(body, start_from, page_size, starts_with, ends_with, ignore_case,
1106
+ output_format))
1107
+ return response
1108
+
1109
+ async def _async_find_data_structures(self, filter: str, start_from: int = 0, page_size: int = max_paging_size,
1110
+ starts_with: bool = True, ends_with: bool = False, ignore_case: bool = True,
1111
+ output_format: str = "DICT") -> list | str:
1112
+ """ Find the list of data structure metadata elements that contain the search string.
1113
+ Async version.
1114
+
1115
+ Parameters
1116
+ ----------
1117
+ filter: str
1118
+ - search string to filter on.
1119
+ start_from: int, default = 0
1120
+ - index of the list to start from (0 for start).
1121
+ page_size
1122
+ - maximum number of elements to return.
1123
+ starts_with: bool, default = True
1124
+ - if True, the search string filters from the beginning of the string.
1125
+ ends_with: bool, default = False
1126
+ - if True, the search string filters from the end of the string.
1127
+ ignore_case: bool, default = True
1128
+ - If True, the case of the search string is ignored.
1129
+ output_format: str, default = "DICT"
1130
+ - one of "DICT", "MERMAID" or "JSON"
1131
+
1132
+ Returns
1133
+ -------
1134
+ [dict] | str
1135
+ Returns a string if no elements are found and a list of dict with the results.
1136
+
1137
+ Raises
1138
+ ------
1139
+ InvalidParameterException
1140
+ one of the parameters is null or invalid or
1141
+ PropertyServerException
1142
+ There is a problem adding the element properties to the metadata repository or
1143
+ UserNotAuthorizedException
1144
+ the requesting user is not authorized to issue this request.
1145
+
1146
+ """
1147
+
1148
+ body = {"filter": filter}
1149
+
1150
+ possible_query_params = query_string(
1151
+ [("startFrom", start_from), ("pageSize", page_size), ("startsWith", str(starts_with).lower),
1152
+ ("endsWith", str(ends_with).lower()), ("ignoreCase", str(ignore_case).lower()), ])
1153
+
1154
+ url = (f"{base_path(self, self.view_server)}/data-structures/by-search-string"
1155
+ f"{possible_query_params}")
1156
+
1157
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
1158
+
1159
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
1160
+ if type(elements) is list and len(elements) == 0:
1161
+ return NO_ELEMENTS_FOUND
1162
+
1163
+ if output_format != 'JSON': # return a simplified markdown representation
1164
+ return self.generate_data_structure_output(elements, filter, output_format)
1165
+ return elements
1166
+
1167
+ def find_data_structures(self, filter: str, start_from: int = 0, page_size: int = max_paging_size,
1168
+ starts_with: bool = True, ends_with: bool = False, ignore_case: bool = True,
1169
+ output_format: str = "DICT") -> list | str:
1170
+ """ Retrieve the list of data structure metadata elements that contain the search string filter.
1171
+
1172
+ Parameters
1173
+ ----------
1174
+ filter: str
1175
+ - search string to filter on.
1176
+ start_from: int, default = 0
1177
+ - index of the list to start from (0 for start).
1178
+ page_size
1179
+ - maximum number of elements to return.
1180
+ starts_with: bool, default = True
1181
+ - if True, the search string filters from the beginning of the string.
1182
+ ends_with: bool, default = False
1183
+ - if True, the search string filters from the end of the string.
1184
+ ignore_case: bool, default = True
1185
+ - If True, the case of the search string is ignored.
1186
+ output_format: str, default = "DICT"
1187
+ output_format: str, default = "DICT"
1188
+ - one of "DICT", "MERMAID" or "JSON"
1189
+ Returns
1190
+ -------
1191
+ [dict] | str
1192
+ Returns a string if no elements are found and a list of dict with the results.
1193
+
1194
+ Raises
1195
+ ------
1196
+ InvalidParameterException
1197
+ one of the parameters is null or invalid or
1198
+ PropertyServerException
1199
+ There is a problem adding the element properties to the metadata repository or
1200
+ UserNotAuthorizedException
1201
+ the requesting user is not authorized to issue this request.
1202
+
1203
+
1204
+ """
1205
+
1206
+ loop = asyncio.get_event_loop()
1207
+ response = loop.run_until_complete(
1208
+ self._async_find_data_structures(filter, start_from, page_size, starts_with, ends_with, ignore_case,
1209
+ output_format))
1210
+ return response
1211
+
1212
+ async def _async_get_data_structures_by_name(self, filter: str, body: dict = None, start_from: int = 0,
1213
+ page_size: int = max_paging_size,
1214
+ output_format: str = "DICT") -> list | str:
1215
+ """ Get the list of data structure metadata elements with a matching name to the search string filter.
1216
+ Async version.
1217
+
1218
+ Parameters
1219
+ ----------
1220
+ filter: str
1221
+ - search string to filter on.
1222
+ body: dict, optional
1223
+ - a dictionary containing additional properties for the request.
1224
+ start_from: int, default = 0
1225
+ - index of the list to start from (0 for start).
1226
+ page_size
1227
+ - maximum number of elements to return.
1228
+ output_format: str, default = "DICT"
1229
+ - one of "DICT", "MERMAID" or "JSON"
1230
+ Returns
1231
+ -------
1232
+ [dict] | str
1233
+ Returns a string if no elements are found and a list of dict with the results.
1234
+
1235
+ Raises
1236
+ ------
1237
+ InvalidParameterException
1238
+ one of the parameters is null or invalid or
1239
+ PropertyServerException
1240
+ There is a problem adding the element properties to the metadata repository or
1241
+ UserNotAuthorizedException
1242
+ the requesting user is not authorized to issue this request.
1243
+
1244
+ Notes
1245
+ -----
1246
+ {
1247
+ "class": "FilterRequestBody",
1248
+ "asOfTime": "{{$isoTimestamp}}",
1249
+ "effectiveTime": "{{$isoTimestamp}}",
1250
+ "forLineage": false,
1251
+ "forDuplicateProcessing": false,
1252
+ "limitResultsByStatus": ["ACTIVE"],
1253
+ "sequencingOrder": "PROPERTY_ASCENDING",
1254
+ "sequencingProperty": "qualifiedName",
1255
+ "filter": "Add name here"
1256
+ }
1257
+ """
1258
+ if body is None:
1259
+ body = {"filter": filter}
1260
+
1261
+ possible_query_params = query_string([("startFrom", start_from), ("pageSize", page_size), ])
1262
+
1263
+ url = (f"{base_path(self, self.view_server)}/data-structures/by-name"
1264
+ f"{possible_query_params}")
1265
+
1266
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
1267
+
1268
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
1269
+ if type(elements) is str:
1270
+ return NO_ELEMENTS_FOUND
1271
+ if output_format != 'JSON': # return other representations
1272
+ return self.generate_data_structure_output(elements, filter, output_format)
1273
+ return elements
1274
+
1275
+ def get_data_structures_by_name(self, filter: str, body: dict = None, start_from: int = 0,
1276
+ page_size: int = max_paging_size, output_format: str = "DICT") -> list | str:
1277
+ """ Get the list of data structure metadata elements with a matching name to the search string filter.
1278
+
1279
+ Parameters
1280
+ ----------
1281
+ filter: str
1282
+ - search string to filter on.
1283
+ body: dict, optional
1284
+ - a dictionary containing additional properties for the request.
1285
+ start_from: int, default = 0
1286
+ - index of the list to start from (0 for start).
1287
+ page_size
1288
+ - maximum number of elements to return.
1289
+ output_format: str, default = "DICT"
1290
+ - one of "DICT", "MERMAID" or "JSON"
1291
+
1292
+ Returns
1293
+ -------
1294
+ [dict] | str
1295
+ Returns a string if no elements are found and a list of dict with the results.
1296
+
1297
+ Raises
1298
+ ------
1299
+ InvalidParameterException
1300
+ one of the parameters is null or invalid or
1301
+ PropertyServerException
1302
+ There is a problem adding the element properties to the metadata repository or
1303
+ UserNotAuthorizedException
1304
+ the requesting user is not authorized to issue this request.
1305
+
1306
+
1307
+ """
1308
+
1309
+ loop = asyncio.get_event_loop()
1310
+ response = loop.run_until_complete(
1311
+ self._async_get_data_structures_by_name(filter, body, start_from, page_size, output_format))
1312
+ return response
1313
+
1314
+ async def _async_get_data_structures_by_guid(self, guid: str, body: dict = None, output_format: str = "DICT") -> list | str:
1315
+ """ Get the data structure metadata elements for the specified GUID.
1316
+ Async version.
1317
+
1318
+ Parameters
1319
+ ----------
1320
+ guid: str
1321
+ - unique identifier of the data structure metadata element.
1322
+ body: dict, optional
1323
+ - optional request body.
1324
+ output_format: str, default = "DICT"
1325
+ - one of "DICT", "MERMAID" or "JSON"
1326
+ Returns
1327
+ -------
1328
+ [dict] | str
1329
+ Returns a string if no elements are found and a list of dict with the results.
1330
+
1331
+ Raises
1332
+ ------
1333
+ InvalidParameterException
1334
+ one of the parameters is null or invalid or
1335
+ PropertyServerException
1336
+ There is a problem adding the element properties to the metadata repository or
1337
+ UserNotAuthorizedException
1338
+ the requesting user is not authorized to issue this request.
1339
+
1340
+ Notes
1341
+ ----
1342
+
1343
+ Optional request body:
1344
+ {
1345
+ "class": "AnyTimeRequestBody",
1346
+ "asOfTime": "{{$isoTimestamp}}",
1347
+ "effectiveTime": "{{$isoTimestamp}}",
1348
+ "forLineage": false,
1349
+ "forDuplicateProcessing": false
1350
+ }
1351
+
1352
+ """
1353
+
1354
+ url = (f"{base_path(self, self.view_server)}/data-structures/{guid}/retrieve")
1355
+ if body:
1356
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
1357
+ else:
1358
+ response: Response = await self._async_make_request("POST", url)
1359
+
1360
+ element = response.json().get("element", NO_ELEMENTS_FOUND)
1361
+ if type(element) is str:
1362
+ return NO_ELEMENTS_FOUND
1363
+ if output_format != 'JSON': # return other representations
1364
+ return self.generate_data_structure_output(element, filter, output_format)
1365
+ return element
1366
+
1367
+ def get_data_structures_by_guid(self, guid: str, body: str = None, output_format: str = "DICT") -> list | str:
1368
+ """ Get the data structure metadata element with the specified unique identifier..
1369
+
1370
+ Parameters
1371
+ ----------
1372
+ guid: str
1373
+ - unique identifier of the data structure metadata element.
1374
+ body: dict, optional
1375
+ - optional request body.
1376
+ output_format: str, default = "DICT"
1377
+ - one of "DICT", "MERMAID" or "JSON"
1378
+ Returns
1379
+ -------
1380
+ [dict] | str
1381
+ Returns a string if no elements are found and a list of dict with the results.
1382
+
1383
+ Raises
1384
+ ------
1385
+ InvalidParameterException
1386
+ one of the parameters is null or invalid or
1387
+ PropertyServerException
1388
+ There is a problem adding the element properties to the metadata repository or
1389
+ UserNotAuthorizedException
1390
+ the requesting user is not authorized to issue this request.
1391
+
1392
+ Notes
1393
+ ----
1394
+
1395
+ Optional request body:
1396
+ {
1397
+ "class": "AnyTimeRequestBody",
1398
+ "asOfTime": "{{$isoTimestamp}}",
1399
+ "effectiveTime": "{{$isoTimestamp}}",
1400
+ "forLineage": false,
1401
+ "forDuplicateProcessing": false
1402
+ }
1403
+
1404
+ """
1405
+
1406
+ loop = asyncio.get_event_loop()
1407
+ response = loop.run_until_complete(self._async_get_data_structures_by_guid(guid, body, output_format))
1408
+ return response
1409
+
1410
+ #
1411
+ # Work with Data Fields
1412
+ # https://egeria-project.org/concepts/data-class
1413
+ #
1414
+ async def _async_create_data_field(self, body: dict) -> str:
1415
+ """
1416
+ Create a new data class with parameters defined in the body. Async version.
1417
+
1418
+ Parameters
1419
+ ----------
1420
+ body: dict
1421
+ - a dictionary containing the properties of the data class to be created.
1422
+
1423
+ Returns
1424
+ -------
1425
+ str
1426
+ The GUID of the element - or "No element found"
1427
+
1428
+ Raises
1429
+ ------
1430
+ InvalidParameterException
1431
+ one of the parameters is null or invalid or
1432
+ PropertyServerException
1433
+ There is a problem adding the element properties to the metadata repository or
1434
+ UserNotAuthorizedException
1435
+ the requesting user is not authorized to issue this request.
1436
+
1437
+ Note
1438
+ ----
1439
+ Sample bodies:
1440
+
1441
+ {
1442
+ "class" : "NewDataFieldRequestBody",
1443
+ "externalSourceGUID": "add guid here",
1444
+ "externalSourceName": "add qualified name here",
1445
+ "effectiveTime" : "{{$isoTimestamp}}",
1446
+ "forLineage" : false,
1447
+ "forDuplicateProcessing" : false,
1448
+ "anchorGUID" : "add guid here",
1449
+ "isOwnAnchor": false,
1450
+ "parentGUID": "add guid here",
1451
+ "parentRelationshipTypeName": "add type name here",
1452
+ "parentRelationshipProperties": {
1453
+ "class": "ElementProperties",
1454
+ "propertyValueMap" : {
1455
+ "description" : {
1456
+ "class": "PrimitiveTypePropertyValue",
1457
+ "typeName": "string",
1458
+ "primitiveValue" : "New description"
1459
+ }
1460
+ }
1461
+ },
1462
+ "parentAtEnd1": false,
1463
+ "properties": {
1464
+ "class" : "DataFieldProperties",
1465
+ "qualifiedName": "add unique name here",
1466
+ "displayName": "add short name here",
1467
+ "namespace": "",
1468
+ "description": "add description here",
1469
+ "versionIdentifier": "add version",
1470
+ "aliases": ["alias1", "alias2"],
1471
+ "isDeprecated": false,
1472
+ "isNullable" : false,
1473
+ "defaultValue": "",
1474
+ "dataType": "",
1475
+ "minimumLength": 0,
1476
+ "length": 0,
1477
+ "precision": 0,
1478
+ "orderedValues": false,
1479
+ "sortOrder": "UNSORTED",
1480
+ "additionalProperties": {
1481
+ "property1" : "propertyValue1",
1482
+ "property2" : "propertyValue2"
1483
+ },
1484
+ "effectiveFrom": "{{$isoTimestamp}}",
1485
+ "effectiveTo": "{{$isoTimestamp}}"
1486
+ }
1487
+ }
1488
+ or
1489
+ {
1490
+ "properties": {
1491
+ "class": "DataFieldProperties",
1492
+ "qualifiedName": "add unique name here",
1493
+ "displayName": "add short name here",
1494
+ "namespace": "",
1495
+ "description": "add description here",
1496
+ "versionIdentifier": "add version",
1497
+ "aliases": [
1498
+ "alias1",
1499
+ "alias2"
1500
+ ],
1501
+ "namePatterns": [],
1502
+ "isDeprecated": false,
1503
+ "isNullable": false,
1504
+ "defaultValue": "",
1505
+ "dataType": "",
1506
+ "minimumLength": 0,
1507
+ "length": 0,
1508
+ "precision": 0,
1509
+ "orderedValues": false,
1510
+ "sortOrder": "UNSORTED",
1511
+ "additionalProperties": {
1512
+ "property1": "propertyValue1",
1513
+ "property2": "propertyValue2"
1514
+ }
1515
+ }
1516
+ }
1517
+
1518
+
1519
+ """
1520
+
1521
+ url = f"{base_path(self, self.view_server)}/data-fields"
1522
+
1523
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
1524
+ return response.json().get("guid", NO_ELEMENTS_FOUND)
1525
+
1526
+ def create_data_field(self, body: dict) -> str:
1527
+ """
1528
+ Create a new data class with parameters defined in the body..
1529
+
1530
+ Parameters
1531
+ ----------
1532
+ body: dict
1533
+ - a dictionary containing the properties of the data class to be created.
1534
+
1535
+ Returns
1536
+ -------
1537
+ str
1538
+ The GUID of the element - or "No element found"
1539
+
1540
+ Raises
1541
+ ------
1542
+ InvalidParameterException
1543
+ one of the parameters is null or invalid or
1544
+ PropertyServerException
1545
+ There is a problem adding the element properties to the metadata repository or
1546
+ UserNotAuthorizedException
1547
+ the requesting user is not authorized to issue this request.
1548
+
1549
+ Note
1550
+ ----
1551
+
1552
+ Sample bodies:
1553
+
1554
+ {
1555
+ "class" : "NewDataFieldRequestBody",
1556
+ "externalSourceGUID": "add guid here",
1557
+ "externalSourceName": "add qualified name here",
1558
+ "effectiveTime" : "{{$isoTimestamp}}",
1559
+ "forLineage" : false,
1560
+ "forDuplicateProcessing" : false,
1561
+ "anchorGUID" : "add guid here",
1562
+ "isOwnAnchor": false,
1563
+ "parentGUID": "add guid here",
1564
+ "parentRelationshipTypeName": "add type name here",
1565
+ "parentRelationshipProperties": {
1566
+ "class": "ElementProperties",
1567
+ "propertyValueMap" : {
1568
+ "description" : {
1569
+ "class": "PrimitiveTypePropertyValue",
1570
+ "typeName": "string",
1571
+ "primitiveValue" : "New description"
1572
+ }
1573
+ }
1574
+ },
1575
+ "parentAtEnd1": false,
1576
+ "properties": {
1577
+ "class" : "DataFieldProperties",
1578
+ "qualifiedName": "add unique name here",
1579
+ "displayName": "add short name here",
1580
+ "namespace": "",
1581
+ "description": "add description here",
1582
+ "versionIdentifier": "add version",
1583
+ "aliases": ["alias1", "alias2"],
1584
+ "isDeprecated": false,
1585
+ "isNullable" : false,
1586
+ "defaultValue": "",
1587
+ "dataType": "",
1588
+ "minimumLength": 0,
1589
+ "length": 0,
1590
+ "precision": 0,
1591
+ "orderedValues": false,
1592
+ "sortOrder": "UNSORTED",
1593
+ "additionalProperties": {
1594
+ "property1" : "propertyValue1",
1595
+ "property2" : "propertyValue2"
1596
+ },
1597
+ "effectiveFrom": "{{$isoTimestamp}}",
1598
+ "effectiveTo": "{{$isoTimestamp}}"
1599
+ }
1600
+ }
1601
+ or
1602
+ {
1603
+ "properties": {
1604
+ "class": "DataFieldProperties",
1605
+ "qualifiedName": "add unique name here",
1606
+ "displayName": "add short name here",
1607
+ "namespace": "",
1608
+ "description": "add description here",
1609
+ "versionIdentifier": "add version",
1610
+ "aliases": [
1611
+ "alias1",
1612
+ "alias2"
1613
+ ],
1614
+ "namePatterns": [],
1615
+ "isDeprecated": false,
1616
+ "isNullable": false,
1617
+ "defaultValue": "",
1618
+ "dataType": "",
1619
+ "minimumLength": 0,
1620
+ "length": 0,
1621
+ "precision": 0,
1622
+ "orderedValues": false,
1623
+ "sortOrder": "UNSORTED",
1624
+ "additionalProperties": {
1625
+ "property1": "propertyValue1",
1626
+ "property2": "propertyValue2"
1627
+ }
1628
+ }
1629
+ }
1630
+
1631
+
1632
+ """
1633
+
1634
+ loop = asyncio.get_event_loop()
1635
+ response = loop.run_until_complete(self._async_create_data_field(body))
1636
+ return response
1637
+
1638
+ async def _async_create_data_field_from_template(self, body: dict) -> str:
1639
+ """
1640
+ Create a new metadata element to represent a data class using an existing metadata element as a template.
1641
+ The template defines additional classifications and relationships that should be added to the new element.
1642
+ Async version.
1643
+
1644
+ Parameters
1645
+ ----------
1646
+ body: dict
1647
+ - a dictionary containing the properties of the data class to be created.
1648
+
1649
+ Returns
1650
+ -------
1651
+ str
1652
+ The GUID of the element - or "No element found"
1653
+
1654
+ Raises
1655
+ ------
1656
+ InvalidParameterException
1657
+ one of the parameters is null or invalid or
1658
+ PropertyServerException
1659
+ There is a problem adding the element properties to the metadata repository or
1660
+ UserNotAuthorizedException
1661
+ the requesting user is not authorized to issue this request.
1662
+
1663
+ Note
1664
+ ----
1665
+ {
1666
+ "class" : "TemplateRequestBody",
1667
+ "externalSourceGUID": "add guid here",
1668
+ "externalSourceName": "add qualified name here",
1669
+ "effectiveTime" : "{{$isoTimestamp}}",
1670
+ "forLineage" : false,
1671
+ "forDuplicateProcessing" : false,
1672
+ "anchorGUID" : "add guid here",
1673
+ "isOwnAnchor": false,
1674
+ "parentGUID": "add guid here",
1675
+ "parentRelationshipTypeName": "add type name here",
1676
+ "parentRelationshipProperties": {
1677
+ "class": "ElementProperties",
1678
+ "propertyValueMap" : {
1679
+ "description" : {
1680
+ "class": "PrimitiveTypePropertyValue",
1681
+ "typeName": "string",
1682
+ "primitiveValue" : "New description"
1683
+ }
1684
+ }
1685
+ },
1686
+ "parentAtEnd1": false,
1687
+ "templateGUID": "add guid here",
1688
+ "replacementProperties": {
1689
+ "class": "ElementProperties",
1690
+ "propertyValueMap" : {
1691
+ "description" : {
1692
+ "class": "PrimitiveTypePropertyValue",
1693
+ "typeName": "string",
1694
+ "primitiveValue" : "New description"
1695
+ }
1696
+ }
1697
+ },
1698
+ "placeholderPropertyValues": {
1699
+ "placeholder1" : "propertyValue1",
1700
+ "placeholder2" : "propertyValue2"
1701
+ }
1702
+ }
1703
+
1704
+ """
1705
+
1706
+ url = f"{base_path(self, self.view_server)}/data-fields/from-template"
1707
+
1708
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
1709
+ return response.json().get("guid", NO_ELEMENTS_FOUND)
1710
+
1711
+ def create_data_field_from_template(self, body: dict) -> str:
1712
+ """
1713
+ Create a new metadata element to represent a data class using an existing metadata element as a template.
1714
+ The template defines additional classifications and relationships that should be added to the new element.
1715
+ Async version.
1716
+
1717
+ Parameters
1718
+ ----------
1719
+ body: dict
1720
+ - a dictionary containing the properties of the data class to be created.
1721
+
1722
+ Returns
1723
+ -------
1724
+ str
1725
+ The GUID of the element - or "No element found"
1726
+
1727
+ Raises
1728
+ ------
1729
+ InvalidParameterException
1730
+ one of the parameters is null or invalid or
1731
+ PropertyServerException
1732
+ There is a problem adding the element properties to the metadata repository or
1733
+ UserNotAuthorizedException
1734
+ the requesting user is not authorized to issue this request.
1735
+
1736
+ Note
1737
+ ----
1738
+ {
1739
+ "class" : "TemplateRequestBody",
1740
+ "externalSourceGUID": "add guid here",
1741
+ "externalSourceName": "add qualified name here",
1742
+ "effectiveTime" : "{{$isoTimestamp}}",
1743
+ "forLineage" : false,
1744
+ "forDuplicateProcessing" : false,
1745
+ "anchorGUID" : "add guid here",
1746
+ "isOwnAnchor": false,
1747
+ "parentGUID": "add guid here",
1748
+ "parentRelationshipTypeName": "add type name here",
1749
+ "parentRelationshipProperties": {
1750
+ "class": "ElementProperties",
1751
+ "propertyValueMap" : {
1752
+ "description" : {
1753
+ "class": "PrimitiveTypePropertyValue",
1754
+ "typeName": "string",
1755
+ "primitiveValue" : "New description"
1756
+ }
1757
+ }
1758
+ },
1759
+ "parentAtEnd1": false,
1760
+ "templateGUID": "add guid here",
1761
+ "replacementProperties": {
1762
+ "class": "ElementProperties",
1763
+ "propertyValueMap" : {
1764
+ "description" : {
1765
+ "class": "PrimitiveTypePropertyValue",
1766
+ "typeName": "string",
1767
+ "primitiveValue" : "New description"
1768
+ }
1769
+ }
1770
+ },
1771
+ "placeholderPropertyValues": {
1772
+ "placeholder1" : "propertyValue1",
1773
+ "placeholder2" : "propertyValue2"
1774
+ }
1775
+ }
1776
+
1777
+ """
1778
+
1779
+ loop = asyncio.get_event_loop()
1780
+ response = loop.run_until_complete(self._async_create_data_field_from_template(body))
1781
+ return response
1782
+
1783
+ async def _async_update_data_field(self, data_field_guid: str, body: dict,
1784
+ replace_all_properties: bool = False) -> None:
1785
+ """
1786
+ Update the properties of a data class. Async version.
1787
+
1788
+ Parameters
1789
+ ----------
1790
+ data_field_guid: str
1791
+ - the GUID of the data class to be updated.
1792
+ body: dict
1793
+ - a dictionary containing the properties of the data structure to be created.
1794
+ replace_all_properties: bool, default = False
1795
+ - if true, then all properties will be replaced with the new ones. Otherwise, only the specified ones
1796
+ will be replaced.
1797
+ Returns
1798
+ -------
1799
+ None
1800
+
1801
+ Raises
1802
+ ------
1803
+ InvalidParameterException
1804
+ one of the parameters is null or invalid or
1805
+ PropertyServerException
1806
+ There is a problem adding the element properties to the metadata repository or
1807
+ UserNotAuthorizedException
1808
+ the requesting user is not authorized to issue this request.
1809
+
1810
+ Note
1811
+ ----
1812
+
1813
+ Full sample body:
1814
+
1815
+ {
1816
+ "class" : "UpdateDataFieldRequestBody",
1817
+ "externalSourceGUID": "add guid here",
1818
+ "externalSourceName": "add qualified name here",
1819
+ "effectiveTime" : "{{$isoTimestamp}}",
1820
+ "forLineage" : false,
1821
+ "forDuplicateProcessing" : false,
1822
+ "properties": {
1823
+ "class" : "DataFieldProperties",
1824
+ "qualifiedName": "add unique name here",
1825
+ "displayName": "add short name here",
1826
+ "namespace": "",
1827
+ "description": "add description here",
1828
+ "versionIdentifier": "add version",
1829
+ "aliases": ["alias1", "alias2"],
1830
+ "namePatterns": [],
1831
+ "isDeprecated": false,
1832
+ "isNullable" : false,
1833
+ "defaultValue": "",
1834
+ "dataType": "",
1835
+ "minimumLength": 0,
1836
+ "length": 0,
1837
+ "precision": 0,
1838
+ "orderedValues": false,
1839
+ "sortOrder": "UNSORTED",
1840
+ "additionalProperties": {
1841
+ "property1" : "propertyValue1",
1842
+ "property2" : "propertyValue2"
1843
+ },
1844
+ "effectiveFrom": "{{$isoTimestamp}}",
1845
+ "effectiveTo": "{{$isoTimestamp}}"
1846
+ }
1847
+ }
1848
+
1849
+ """
1850
+ replace_all_properties_s = str(replace_all_properties).lower()
1851
+
1852
+ url = (f"{base_path(self, self.view_server)}/data-fields/{data_field_guid}/update?"
1853
+ f"replaceAllProperties={replace_all_properties_s}")
1854
+
1855
+ await self._async_make_request("POST", url, body_slimmer(body))
1856
+
1857
+ def update_data_field(self, data_field_guid: str, body: dict.get, replace_all_properties: bool = False) -> None:
1858
+ """
1859
+ Update the properties of a data class.
1860
+
1861
+ Parameters
1862
+ ----------
1863
+ data_field_guid: str
1864
+ - the GUID of the data class to be updated.
1865
+ body: dict
1866
+ - a dictionary containing the properties of the data structure to be created.
1867
+ replace_all_properties: bool, default = False
1868
+ - if true, then all properties will be replaced with the new ones. Otherwise, only the specified ones
1869
+ will be replaced.
1870
+ Returns
1871
+ -------
1872
+ None
1873
+
1874
+ Raises
1875
+ ------
1876
+ InvalidParameterException
1877
+ one of the parameters is null or invalid or
1878
+ PropertyServerException
1879
+ There is a problem adding the element properties to the metadata repository or
1880
+ UserNotAuthorizedException
1881
+ the requesting user is not authorized to issue this request.
1882
+
1883
+ Note
1884
+ ----
1885
+
1886
+ Full sample body:
1887
+
1888
+ {
1889
+ "class" : "UpdateDataFieldRequestBody",
1890
+ "externalSourceGUID": "add guid here",
1891
+ "externalSourceName": "add qualified name here",
1892
+ "effectiveTime" : "{{$isoTimestamp}}",
1893
+ "forLineage" : false,
1894
+ "forDuplicateProcessing" : false,
1895
+ "properties": {
1896
+ "class" : "DataFieldProperties",
1897
+ "qualifiedName": "add unique name here",
1898
+ "displayName": "add short name here",
1899
+ "namespace": "",
1900
+ "description": "add description here",
1901
+ "versionIdentifier": "add version",
1902
+ "aliases": ["alias1", "alias2"],
1903
+ "namePatterns": [],
1904
+ "isDeprecated": false,
1905
+ "isNullable" : false,
1906
+ "defaultValue": "",
1907
+ "dataType": "",
1908
+ "minimumLength": 0,
1909
+ "length": 0,
1910
+ "precision": 0,
1911
+ "orderedValues": false,
1912
+ "sortOrder": "UNSORTED",
1913
+ "additionalProperties": {
1914
+ "property1" : "propertyValue1",
1915
+ "property2" : "propertyValue2"
1916
+ },
1917
+ "effectiveFrom": "{{$isoTimestamp}}",
1918
+ "effectiveTo": "{{$isoTimestamp}}"
1919
+ }
1920
+ }
1921
+ """
1922
+
1923
+ loop = asyncio.get_event_loop()
1924
+ loop.run_until_complete(self._async_update_data_field(data_field_guid, body, replace_all_properties))
1925
+
1926
+ async def _async_link_nested_data_field(self, parent_data_field_guid: str, nested_data_field_guid: str,
1927
+ body: dict = None) -> None:
1928
+ """
1929
+ Connect a nested data class to a data class. Request body is optional. Async version.
1930
+
1931
+ Parameters
1932
+ ----------
1933
+ parent_data_field_guid: str
1934
+ - the GUID of the parent data class the nested data class will be connected to.
1935
+ nested_data_field_guid: str
1936
+ - the GUID of the nested data class to be connected.
1937
+ body: dict, optional
1938
+ - a dictionary containing additional properties.
1939
+
1940
+ Returns
1941
+ -------
1942
+ None
1943
+
1944
+ Raises
1945
+ ------
1946
+ InvalidParameterException
1947
+ one of the parameters is null or invalid or
1948
+ PropertyServerException
1949
+ There is a problem adding the element properties to the metadata repository or
1950
+ UserNotAuthorizedException
1951
+ the requesting user is not authorized to issue this request.
1952
+
1953
+ Note
1954
+ ----
1955
+
1956
+ Full sample body:
1957
+
1958
+ {
1959
+ "class" : "MemberDataFieldRequestBody",
1960
+ "externalSourceGUID": "add guid here",
1961
+ "externalSourceName": "add qualified name here",
1962
+ "effectiveTime" : "{{$isoTimestamp}}",
1963
+ "forLineage" : false,
1964
+ "forDuplicateProcessing" : false,
1965
+ "properties": {
1966
+ "class": "MemberDataFieldProperties",
1967
+ "dataFieldPosition": 0,
1968
+ "minCardinality": 0,
1969
+ "maxCardinality": 0,
1970
+ "effectiveFrom": "{{$isoTimestamp}}",
1971
+ "effectiveTo": "{{$isoTimestamp}}"
1972
+ }
1973
+ }
1974
+
1975
+ """
1976
+
1977
+ url = (f"{base_path(self, self.view_server)}/data-fields/{parent_data_field_guid}"
1978
+ f"/nested-data-fields/{nested_data_field_guid}/attach")
1979
+
1980
+ if body is None:
1981
+ await self._async_make_request("POST", url)
1982
+ else:
1983
+ await self._async_make_request("POST", url, body_slimmer(body))
1984
+
1985
+ def link_nested_data_field(self, parent_data_field_guid: str, nested_data_field_guid: str,
1986
+ body: dict = None) -> None:
1987
+ """
1988
+ Connect a nested data class to a data class. Request body is optional.
1989
+
1990
+ Parameters
1991
+ ----------
1992
+ parent_data_field_guid: str
1993
+ - the GUID of the parent data class the nested data class will be connected to.
1994
+ nested_data_field_guid: str
1995
+ - the GUID of the nested data class to be connected.
1996
+ body: dict, optional
1997
+ - a dictionary containing additional properties.
1998
+
1999
+ Returns
2000
+ -------
2001
+ None
2002
+
2003
+ Raises
2004
+ ------
2005
+ InvalidParameterException
2006
+ one of the parameters is null or invalid or
2007
+ PropertyServerException
2008
+ There is a problem adding the element properties to the metadata repository or
2009
+ UserNotAuthorizedException
2010
+ the requesting user is not authorized to issue this request.
2011
+
2012
+ Note
2013
+ ----
2014
+
2015
+ Full sample body:
2016
+
2017
+ {
2018
+ "class" : "MemberDataFieldRequestBody",
2019
+ "externalSourceGUID": "add guid here",
2020
+ "externalSourceName": "add qualified name here",
2021
+ "effectiveTime" : "{{$isoTimestamp}}",
2022
+ "forLineage" : false,
2023
+ "forDuplicateProcessing" : false,
2024
+ "properties": {
2025
+ "class": "MemberDataFieldProperties",
2026
+ "dataFieldPosition": 0,
2027
+ "minCardinality": 0,
2028
+ "maxCardinality": 0,
2029
+ "effectiveFrom": "{{$isoTimestamp}}",
2030
+ "effectiveTo": "{{$isoTimestamp}}"
2031
+ }
2032
+ }
2033
+
2034
+ """
2035
+
2036
+ loop = asyncio.get_event_loop()
2037
+ loop.run_until_complete(
2038
+ self._async_link_nested_data_field(parent_data_field_guid, nested_data_field_guid, body))
2039
+
2040
+ async def _async_detach_nested_data_field(self, parent_data_field_guid: str, nested_data_field_guid: str,
2041
+ body: dict = None) -> None:
2042
+ """
2043
+ Detach a nested data class from a data class. Request body is optional. Async version.
2044
+
2045
+ Parameters
2046
+ ----------
2047
+ parent_data_field_guid: str
2048
+ - the GUID of the parent data class the data class will be detached from..
2049
+ nested_data_field_guid: str
2050
+ - the GUID of the data class to be disconnected.
2051
+ body: dict, optional
2052
+ - a dictionary containing additional properties.
2053
+
2054
+ Returns
2055
+ -------
2056
+ None
2057
+
2058
+ Raises
2059
+ ------
2060
+ InvalidParameterException
2061
+ one of the parameters is null or invalid or
2062
+ PropertyServerException
2063
+ There is a problem adding the element properties to the metadata repository or
2064
+ UserNotAuthorizedException
2065
+ the requesting user is not authorized to issue this request.
2066
+
2067
+ Note
2068
+ ----
2069
+
2070
+ Full sample body:
2071
+
2072
+ {
2073
+ "class": "MetadataSourceRequestBody",
2074
+ "externalSourceGUID": "add guid here",
2075
+ "externalSourceName": "add qualified name here",
2076
+ "effectiveTime": "{{$isoTimestamp}}",
2077
+ "forLineage": false,
2078
+ "forDuplicateProcessing": false
2079
+ }
2080
+
2081
+
2082
+ """
2083
+
2084
+ url = (f"{base_path(self, self.view_server)}/data-fields/{parent_data_field_guid}"
2085
+ f"/member-data-fields/{nested_data_field_guid}/detach")
2086
+
2087
+ if body is None:
2088
+ await self._async_make_request("POST", url)
2089
+ else:
2090
+ await self._async_make_request("POST", url, body_slimmer(body))
2091
+
2092
+ def detach_nested_data_field(self, parent_data_field_guid: str, nested_data_field_guid: str,
2093
+ body: dict = None) -> None:
2094
+ """
2095
+ Detach a nested data class from a data class. Request body is optional.
2096
+
2097
+ Parameters
2098
+ ----------
2099
+ parent_data_field_guid: str
2100
+ - the GUID of the parent data structure the data class will be detached fromo.
2101
+ nested_data_field_guid: str
2102
+ - the GUID of the data class to be disconnected.
2103
+ body: dict, optional
2104
+ - a dictionary containing additional properties.
2105
+
2106
+ Returns
2107
+ -------
2108
+ None
2109
+
2110
+ Raises
2111
+ ------
2112
+ InvalidParameterException
2113
+ one of the parameters is null or invalid or
2114
+ PropertyServerException
2115
+ There is a problem adding the element properties to the metadata repository or
2116
+ UserNotAuthorizedException
2117
+ the requesting user is not authorized to issue this request.
2118
+
2119
+ Note
2120
+ ----
2121
+
2122
+ Full sample body:
2123
+
2124
+ {
2125
+ "class": "MetadataSourceRequestBody",
2126
+ "externalSourceGUID": "add guid here",
2127
+ "externalSourceName": "add qualified name here",
2128
+ "effectiveTime": "{{$isoTimestamp}}",
2129
+ "forLineage": false,
2130
+ "forDuplicateProcessing": false
2131
+ }
2132
+
2133
+ """
2134
+
2135
+ loop = asyncio.get_event_loop()
2136
+ loop.run_until_complete(
2137
+ self._async_detach_nested_data_field(parent_data_field_guid, nested_data_field_guid, body))
2138
+
2139
+ async def _async_delete_data_field(self, data_field_guid: str, body: dict = None) -> None:
2140
+ """
2141
+ Delete a data class. Request body is optional. Async version.
2142
+
2143
+ Parameters
2144
+ ----------
2145
+ data_field_guid: str
2146
+ - the GUID of the data class to delete.
2147
+ body: dict, optional
2148
+ - a dictionary containing additional properties.
2149
+
2150
+ Returns
2151
+ -------
2152
+ None
2153
+
2154
+ Raises
2155
+ ------
2156
+ InvalidParameterException
2157
+ one of the parameters is null or invalid or
2158
+ PropertyServerException
2159
+ There is a problem adding the element properties to the metadata repository or
2160
+ UserNotAuthorizedException
2161
+ the requesting user is not authorized to issue this request.
2162
+
2163
+ Note
2164
+ ----
2165
+
2166
+ Full sample body:
2167
+
2168
+ {
2169
+ "class": "MetadataSourceRequestBody",
2170
+ "externalSourceGUID": "add guid here",
2171
+ "externalSourceName": "add qualified name here",
2172
+ "effectiveTime": "{{$isoTimestamp}}",
2173
+ "forLineage": false,
2174
+ "forDuplicateProcessing": false
2175
+ }
2176
+
2177
+
2178
+ """
2179
+
2180
+ url = f"{base_path(self, self.view_server)}/data-fields/{data_field_guid}/delete"
2181
+
2182
+ if body is None:
2183
+ await self._async_make_request("POST", url)
2184
+ else:
2185
+ await self._async_make_request("POST", url, body_slimmer(body))
2186
+
2187
+ def delete_data_field(self, data_field_guid: str, body: dict = None) -> None:
2188
+ """
2189
+ Delete a data class. Request body is optional.
2190
+
2191
+ Parameters
2192
+ ----------
2193
+ data_field_guid: str
2194
+ - the GUID of the data class the data class to delete.
2195
+ body: dict, optional
2196
+ - a dictionary containing additional properties.
2197
+
2198
+ Returns
2199
+ -------
2200
+ None
2201
+
2202
+ Raises
2203
+ ------
2204
+ InvalidParameterException
2205
+ one of the parameters is null or invalid or
2206
+ PropertyServerException
2207
+ There is a problem adding the element properties to the metadata repository or
2208
+ UserNotAuthorizedException
2209
+ the requesting user is not authorized to issue this request.
2210
+
2211
+ Note
2212
+ ----
2213
+
2214
+ Full sample body:
2215
+
2216
+ {
2217
+ "class": "MetadataSourceRequestBody",
2218
+ "externalSourceGUID": "add guid here",
2219
+ "externalSourceName": "add qualified name here",
2220
+ "effectiveTime": "{{$isoTimestamp}}",
2221
+ "forLineage": false,
2222
+ "forDuplicateProcessing": false
2223
+ }
2224
+
2225
+ """
2226
+
2227
+ loop = asyncio.get_event_loop()
2228
+ loop.run_until_complete(self._async_delete_data_field(data_field_guid, body))
2229
+
2230
+ async def _async_find_all_data_fields(self, start_from: int = 0, page_size: int = max_paging_size, ) -> list | str:
2231
+ """Returns a list of all known data fields. Async version.
2232
+
2233
+ Parameters
2234
+ ----------
2235
+ start_from: int, default = 0
2236
+ - index of the list to start from (0 for start).
2237
+ page_size
2238
+ - maximum number of elements to return.
2239
+
2240
+ Returns
2241
+ -------
2242
+ [dict] | str
2243
+ Returns a string if no elements are found and a list of dict elements with the results.
2244
+
2245
+ Raises
2246
+ ------
2247
+ InvalidParameterException
2248
+ one of the parameters is null or invalid or
2249
+ PropertyServerException
2250
+ There is a problem adding the element properties to the metadata repository or
2251
+ UserNotAuthorizedException
2252
+ the requesting user is not authorized to issue this request.
2253
+
2254
+ """
2255
+
2256
+ possible_query_params = query_string(
2257
+ [("startFrom", start_from), ("pageSize", page_size), ("startsWith", 'false'), ("endsWith", 'false'),
2258
+ ("ignoreCase", 'true')])
2259
+
2260
+ url = (f"{base_path(self, self.view_server)}/data-fields/by-search-string"
2261
+ f"{possible_query_params}")
2262
+
2263
+ response: Response = await self._async_make_request("POST", url)
2264
+
2265
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
2266
+ if type(elements) is list:
2267
+ if len(elements) == 0:
2268
+ return NO_ELEMENTS_FOUND
2269
+ return elements
2270
+
2271
+ def find_all_data_fields(self, start_from: int = 0, page_size: int = max_paging_size, ) -> list | str:
2272
+ """ Returns a list of all known data fields.
2273
+
2274
+ Parameters
2275
+ ----------
2276
+ start_from: int, default = 0
2277
+ - index of the list to start from (0 for start).
2278
+ page_size
2279
+ - maximum number of elements to return.
2280
+
2281
+ Returns
2282
+ -------
2283
+ [dict] | str
2284
+ Returns a string if no elements are found and a list of dict elements with the results.
2285
+
2286
+ Raises
2287
+ ------
2288
+ InvalidParameterException
2289
+ one of the parameters is null or invalid or
2290
+ PropertyServerException
2291
+ There is a problem adding the element properties to the metadata repository or
2292
+ UserNotAuthorizedException
2293
+ the requesting user is not authorized to issue this request.
2294
+
2295
+ """
2296
+
2297
+ loop = asyncio.get_event_loop()
2298
+ response = loop.run_until_complete(self._async_find_all_data_fields(start_from, page_size))
2299
+ return response
2300
+
2301
+ async def _async_find_data_fields_w_body(self, body: dict, start_from: int = 0, page_size: int = max_paging_size,
2302
+ starts_with: bool = True, ends_with: bool = False,
2303
+ ignore_case: bool = True) -> list | str:
2304
+ """ Retrieve the list of data class metadata elements that contain the search string.
2305
+ Async version.
2306
+
2307
+ Parameters
2308
+ ----------
2309
+ body: dict
2310
+ - A structure containing the search criteria. (example below)
2311
+ start_from: int, default = 0
2312
+ - index of the list to start from (0 for start).
2313
+ page_size
2314
+ - maximum number of elements to return.
2315
+ starts_with: bool, default = True
2316
+ - if True, the search string filters from the beginning of the string.
2317
+ ends_with: bool, default = False
2318
+ - if True, the search string filters from the end of the string.
2319
+ ignore_case: bool, default = True
2320
+ - If True, the case of the search string is ignored.
2321
+
2322
+ Returns
2323
+ -------
2324
+ [dict] | str
2325
+ Returns a string if no elements are found and a list of dict with the results.
2326
+
2327
+ Raises
2328
+ ------
2329
+ InvalidParameterException
2330
+ one of the parameters is null or invalid or
2331
+ PropertyServerException
2332
+ There is a problem adding the element properties to the metadata repository or
2333
+ UserNotAuthorizedException
2334
+ the requesting user is not authorized to issue this request.
2335
+
2336
+ Notes:
2337
+
2338
+ {
2339
+ "class": "FilterRequestBody",
2340
+ "asOfTime": "{{$isoTimestamp}}",
2341
+ "effectiveTime": "{{$isoTimestamp}}",
2342
+ "forLineage": false,
2343
+ "forDuplicateProcessing : false,
2344
+ "limitResultsByStatus": ["ACTIVE"],
2345
+ "sequencingOrder": "PROPERTY_ASCENDING",
2346
+ "sequencingProperty": "qualifiedName",
2347
+ "filter": ""
2348
+ }
2349
+
2350
+ """
2351
+ starts_with_s = str(starts_with).lower()
2352
+ ends_with_s = str(ends_with).lower()
2353
+ ignore_case_s = str(ignore_case).lower()
2354
+ possible_query_params = query_string(
2355
+ [("startFrom", start_from), ("pageSize", page_size), ("startsWith", starts_with_s),
2356
+ ("endsWith", ends_with_s), ("ignoreCase", ignore_case_s), ])
2357
+
2358
+ url = (f"{base_path(self, self.view_server)}/data-fields/by-search-string"
2359
+ f"{possible_query_params}")
2360
+
2361
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
2362
+
2363
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
2364
+ if type(elements) is list:
2365
+ if len(elements) == 0:
2366
+ return NO_ELEMENTS_FOUND
2367
+ return elements
2368
+
2369
+ def find_data_fields_w_body(self, body: dict, start_from: int = 0, page_size: int = max_paging_size,
2370
+ starts_with: bool = True, ends_with: bool = False,
2371
+ ignore_case: bool = True) -> list | str:
2372
+ """ Retrieve the list of data class metadata elements that contain the search string.
2373
+
2374
+ Parameters
2375
+ ----------
2376
+ body: dict
2377
+ - A structure containing the search criteria. (example below)
2378
+ start_from: int, default = 0
2379
+ - index of the list to start from (0 for start).
2380
+ page_size
2381
+ - maximum number of elements to return.
2382
+ starts_with: bool, default = True
2383
+ - if True, the search string filters from the beginning of the string.
2384
+ ends_with: bool, default = False
2385
+ - if True, the search string filters from the end of the string.
2386
+ ignore_case: bool, default = True
2387
+ - If True, the case of the search string is ignored.
2388
+
2389
+ Returns
2390
+ -------
2391
+ [dict] | str
2392
+ Returns a string if no elements are found and a list of dict with the results.
2393
+
2394
+ Raises
2395
+ ------
2396
+ InvalidParameterException
2397
+ one of the parameters is null or invalid or
2398
+ PropertyServerException
2399
+ There is a problem adding the element properties to the metadata repository or
2400
+ UserNotAuthorizedException
2401
+ the requesting user is not authorized to issue this request.
2402
+
2403
+ Notes:
2404
+
2405
+ {
2406
+ "class": "FilterRequestBody",
2407
+ "asOfTime": "{{$isoTimestamp}}",
2408
+ "effectiveTime": "{{$isoTimestamp}}",
2409
+ "forLineage": false,
2410
+ "forDuplicateProcessing : false,
2411
+ "limitResultsByStatus": ["ACTIVE"],
2412
+ "sequencingOrder": "PROPERTY_ASCENDING",
2413
+ "sequencingProperty": "qualifiedName",
2414
+ "filter": ""
2415
+ }
2416
+
2417
+ """
2418
+
2419
+ loop = asyncio.get_event_loop()
2420
+ response = loop.run_until_complete(
2421
+ self._async_find_data_fields_w_body(body, start_from, page_size, starts_with, ends_with, ignore_case))
2422
+ return response
2423
+
2424
+ async def _async_find_data_fields(self, filter: str, start_from: int = 0, page_size: int = max_paging_size,
2425
+ starts_with: bool = True, ends_with: bool = False,
2426
+ ignore_case: bool = True) -> list | str:
2427
+ """ Find the list of data class elements that contain the search string.
2428
+ Async version.
2429
+
2430
+ Parameters
2431
+ ----------
2432
+ filter: str
2433
+ - search string to filter on.
2434
+ start_from: int, default = 0
2435
+ - index of the list to start from (0 for start).
2436
+ page_size
2437
+ - maximum number of elements to return.
2438
+ starts_with: bool, default = True
2439
+ - if True, the search string filters from the beginning of the string.
2440
+ ends_with: bool, default = False
2441
+ - if True, the search string filters from the end of the string.
2442
+ ignore_case: bool, default = True
2443
+ - If True, the case of the search string is ignored.
2444
+
2445
+ Returns
2446
+ -------
2447
+ [dict] | str
2448
+ Returns a string if no elements are found and a list of dict with the results.
2449
+
2450
+ Raises
2451
+ ------
2452
+ InvalidParameterException
2453
+ one of the parameters is null or invalid or
2454
+ PropertyServerException
2455
+ There is a problem adding the element properties to the metadata repository or
2456
+ UserNotAuthorizedException
2457
+ the requesting user is not authorized to issue this request.
2458
+
2459
+ """
2460
+
2461
+ body = {"filter": filter}
2462
+
2463
+ possible_query_params = query_string(
2464
+ [("startFrom", start_from), ("pageSize", page_size), ("startsWith", str(starts_with).lower),
2465
+ ("endsWith", str(ends_with).lower()), ("ignoreCase", str(ignore_case).lower()), ])
2466
+
2467
+ url = (f"{base_path(self, self.view_server)}/data-fields/by-search-string"
2468
+ f"{possible_query_params}")
2469
+
2470
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
2471
+
2472
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
2473
+ if type(elements) is list:
2474
+ if len(elements) == 0:
2475
+ return NO_ELEMENTS_FOUND
2476
+ return elements
2477
+
2478
+ def find_data_fields(self, filter: str, start_from: int = 0, page_size: int = max_paging_size,
2479
+ starts_with: bool = True, ends_with: bool = False, ignore_case: bool = True) -> list | str:
2480
+ """ Retrieve the list of data fields elements that contain the search string filter.
2481
+
2482
+ Parameters
2483
+ ----------
2484
+ filter: str
2485
+ - search string to filter on.
2486
+ start_from: int, default = 0
2487
+ - index of the list to start from (0 for start).
2488
+ page_size
2489
+ - maximum number of elements to return.
2490
+ starts_with: bool, default = True
2491
+ - if True, the search string filters from the beginning of the string.
2492
+ ends_with: bool, default = False
2493
+ - if True, the search string filters from the end of the string.
2494
+ ignore_case: bool, default = True
2495
+ - If True, the case of the search string is ignored.
2496
+
2497
+ Returns
2498
+ -------
2499
+ [dict] | str
2500
+ Returns a string if no elements are found and a list of dict with the results.
2501
+
2502
+ Raises
2503
+ ------
2504
+ InvalidParameterException
2505
+ one of the parameters is null or invalid or
2506
+ PropertyServerException
2507
+ There is a problem adding the element properties to the metadata repository or
2508
+ UserNotAuthorizedException
2509
+ the requesting user is not authorized to issue this request.
2510
+
2511
+
2512
+ """
2513
+
2514
+ loop = asyncio.get_event_loop()
2515
+ response = loop.run_until_complete(
2516
+ self._async_find_data_fields(filter, start_from, page_size, starts_with, ends_with, ignore_case))
2517
+ return response
2518
+
2519
+ async def _async_get_data_fields_by_name(self, filter: str, body: dict = None, start_from: int = 0,
2520
+ page_size: int = max_paging_size) -> list | str:
2521
+ """ Get the list of data class metadata elements with a matching name to the search string filter.
2522
+ Async version.
2523
+
2524
+ Parameters
2525
+ ----------
2526
+ filter: str
2527
+ - search string to filter on.
2528
+ body: dict, optional
2529
+ - a dictionary containing additional properties to use in the request.
2530
+ start_from: int, default = 0
2531
+ - index of the list to start from (0 for start).
2532
+ page_size
2533
+ - maximum number of elements to return.
2534
+
2535
+ Returns
2536
+ -------
2537
+ [dict] | str
2538
+ Returns a string if no elements are found and a list of dict with the results.
2539
+
2540
+ Raises
2541
+ ------
2542
+ InvalidParameterException
2543
+ one of the parameters is null or invalid or
2544
+ PropertyServerException
2545
+ There is a problem adding the element properties to the metadata repository or
2546
+ UserNotAuthorizedException
2547
+ the requesting user is not authorized to issue this request.
2548
+ Notes
2549
+ -----
2550
+
2551
+ {
2552
+ "class": "FilterRequestBody",
2553
+ "asOfTime": "{{$isoTimestamp}}",
2554
+ "effectiveTime": "{{$isoTimestamp}}",
2555
+ "forLineage": false,
2556
+ "forDuplicateProcessing": false,
2557
+ "limitResultsByStatus": ["ACTIVE"],
2558
+ "sequencingOrder": "PROPERTY_ASCENDING",
2559
+ "sequencingProperty": "qualifiedName",
2560
+ "filter": "Add name here"
2561
+ }
2562
+ """
2563
+ if body is None:
2564
+ body = {"filter": filter}
2565
+
2566
+ possible_query_params = query_string([("startFrom", start_from), ("pageSize", page_size), ])
2567
+
2568
+ url = (f"{base_path(self, self.view_server)}/data-fields/by-name"
2569
+ f"{possible_query_params}")
2570
+
2571
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
2572
+
2573
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
2574
+ if type(elements) is list:
2575
+ if len(elements) == 0:
2576
+ return NO_ELEMENTS_FOUND
2577
+ return elements
2578
+
2579
+ def get_data_fields_by_name(self, filter: str, body: dict = None, start_from: int = 0,
2580
+ page_size: int = max_paging_size) -> list | str:
2581
+ """ Get the list of data class elements with a matching name to the search string filter.
2582
+
2583
+ Parameters
2584
+ ----------
2585
+ filter: str
2586
+ - search string to filter on.
2587
+ body: dict, optional
2588
+ - a dictionary containing additional properties to use in the request.
2589
+ start_from: int, default = 0
2590
+ - index of the list to start from (0 for start).
2591
+ page_size
2592
+ - maximum number of elements to return.
2593
+
2594
+ Returns
2595
+ -------
2596
+ [dict] | str
2597
+ Returns a string if no elements are found and a list of dict with the results.
2598
+
2599
+ Raises
2600
+ ------
2601
+ InvalidParameterException
2602
+ one of the parameters is null or invalid or
2603
+ PropertyServerException
2604
+ There is a problem adding the element properties to the metadata repository or
2605
+ UserNotAuthorizedException
2606
+ the requesting user is not authorized to issue this request.
2607
+
2608
+ Notes
2609
+ -----
2610
+ {
2611
+ "class": "FilterRequestBody",
2612
+ "asOfTime": "{{$isoTimestamp}}",
2613
+ "effectiveTime": "{{$isoTimestamp}}",
2614
+ "forLineage": false,
2615
+ "forDuplicateProcessing": false,
2616
+ "limitResultsByStatus": ["ACTIVE"],
2617
+ "sequencingOrder": "PROPERTY_ASCENDING",
2618
+ "sequencingProperty": "qualifiedName",
2619
+ "filter": "Add name here"
2620
+ }
2621
+
2622
+
2623
+ """
2624
+
2625
+ loop = asyncio.get_event_loop()
2626
+ response = loop.run_until_complete(self._async_get_data_fields_by_name(filter, body, start_from, page_size))
2627
+ return response
2628
+
2629
+ async def _async_get_data_field_by_guid(self, guid: str, body: dict = None) -> list | str:
2630
+ """ Get the data class elements for the specified GUID.
2631
+ Async version.
2632
+
2633
+ Parameters
2634
+ ----------
2635
+ guid: str
2636
+ - unique identifier of the data class metadata element.
2637
+ body: dict, optional
2638
+ - optional request body.
2639
+ Returns
2640
+ -------
2641
+ [dict] | str
2642
+ Returns a string if no elements are found and a list of dict with the results.
2643
+
2644
+ Raises
2645
+ ------
2646
+ InvalidParameterException
2647
+ one of the parameters is null or invalid or
2648
+ PropertyServerException
2649
+ There is a problem adding the element properties to the metadata repository or
2650
+ UserNotAuthorizedException
2651
+ the requesting user is not authorized to issue this request.
2652
+
2653
+ Notes
2654
+ ----
2655
+
2656
+ Optional request body:
2657
+ {
2658
+ "class": "AnyTimeRequestBody",
2659
+ "asOfTime": "{{$isoTimestamp}}",
2660
+ "effectiveTime": "{{$isoTimestamp}}",
2661
+ "forLineage": false,
2662
+ "forDuplicateProcessing": false
2663
+ }
2664
+
2665
+ """
2666
+
2667
+ url = (f"{base_path(self, self.view_server)}/data-fields/{guid}/retrieve")
2668
+ if body:
2669
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
2670
+ else:
2671
+ response: Response = await self._async_make_request("POST", url)
2672
+
2673
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
2674
+ if type(elements) is list:
2675
+ if len(elements) == 0:
2676
+ return NO_ELEMENTS_FOUND
2677
+ return elements
2678
+
2679
+ def get_data_field_by_guid(self, guid: str, body: str = None) -> list | str:
2680
+ """ Get the data structure metadata element with the specified unique identifier..
2681
+
2682
+ Parameters
2683
+ ----------
2684
+ guid: str
2685
+ - unique identifier of the data structure metadata element.
2686
+ body: dict, optional
2687
+ - optional request body.
2688
+ Returns
2689
+ -------
2690
+ [dict] | str
2691
+ Returns a string if no elements are found and a list of dict with the results.
2692
+
2693
+ Raises
2694
+ ------
2695
+ InvalidParameterException
2696
+ one of the parameters is null or invalid or
2697
+ PropertyServerException
2698
+ There is a problem adding the element properties to the metadata repository or
2699
+ UserNotAuthorizedException
2700
+ the requesting user is not authorized to issue this request.
2701
+
2702
+ Notes
2703
+ ----
2704
+
2705
+ Optional request body:
2706
+ {
2707
+ "class": "AnyTimeRequestBody",
2708
+ "asOfTime": "{{$isoTimestamp}}",
2709
+ "effectiveTime": "{{$isoTimestamp}}",
2710
+ "forLineage": false,
2711
+ "forDuplicateProcessing": false
2712
+ }
2713
+
2714
+ """
2715
+
2716
+ loop = asyncio.get_event_loop()
2717
+ response = loop.run_until_complete(self._async_get_data_field_by_guid(guid, body))
2718
+ return response
2719
+
2720
+ ###
2721
+ # =====================================================================================================================
2722
+ # Work with Data Classes
2723
+ # https://egeria-project.org/concepts/data-class
2724
+ #
2725
+ #
2726
+ async def _async_create_data_class(self, body: dict) -> str:
2727
+ """
2728
+ Create a new data class with parameters defined in the body. Async version.
2729
+
2730
+ Parameters
2731
+ ----------
2732
+ body: dict
2733
+ - a dictionary containing the properties of the data class to be created.
2734
+
2735
+ Returns
2736
+ -------
2737
+ str
2738
+ The GUID of the element - or "No element found"
2739
+
2740
+ Raises
2741
+ ------
2742
+ InvalidParameterException
2743
+ one of the parameters is null or invalid or
2744
+ PropertyServerException
2745
+ There is a problem adding the element properties to the metadata repository or
2746
+ UserNotAuthorizedException
2747
+ the requesting user is not authorized to issue this request.
2748
+
2749
+ Note
2750
+ ----
2751
+ Sample bodies:
2752
+
2753
+ {
2754
+ "class" : "NewDataClassRequestBody",
2755
+ "externalSourceGUID": "add guid here",
2756
+ "externalSourceName": "add qualified name here",
2757
+ "effectiveTime" : "{{$isoTimestamp}}",
2758
+ "forLineage" : false,
2759
+ "forDuplicateProcessing" : false,
2760
+ "anchorGUID" : "add guid here",
2761
+ "isOwnAnchor": false,
2762
+ "parentGUID": "add guid here",
2763
+ "parentRelationshipTypeName": "add type name here",
2764
+ "parentRelationshipProperties": {
2765
+ "class": "ElementProperties",
2766
+ "propertyValueMap" : {
2767
+ "description" : {
2768
+ "class": "PrimitiveTypePropertyValue",
2769
+ "typeName": "string",
2770
+ "primitiveValue" : "New description"
2771
+ }
2772
+ }
2773
+ },
2774
+ "parentAtEnd1": false,
2775
+ "properties": {
2776
+ "class" : "DataClassProperties",
2777
+ "qualifiedName": "add unique name here",
2778
+ "displayName": "add short name here",
2779
+ "description": "add description here",
2780
+ "namespace": "add scope of this data class's applicability.",
2781
+ "matchPropertyNames": ["name1", "name2"],
2782
+ "matchThreshold": 0,
2783
+ "specification": "",
2784
+ "specificationDetails": {
2785
+ "property1" : "propertyValue1",
2786
+ "property2" : "propertyValue2"
2787
+ },
2788
+ "dataType": "",
2789
+ "allowsDuplicateValues": true,
2790
+ "isNullable": false,
2791
+ "defaultValue": "",
2792
+ "averageValue": "",
2793
+ "valueList": [],
2794
+ "valueRangeFrom": "",
2795
+ "valueRangeTo": "",
2796
+ "sampleValues": [],
2797
+ "dataPatterns" : [],
2798
+ "additionalProperties": {
2799
+ "property1" : "propertyValue1",
2800
+ "property2" : "propertyValue2"
2801
+ },
2802
+ "effectiveFrom": "{{$isoTimestamp}}",
2803
+ "effectiveTo": "{{$isoTimestamp}}"
2804
+ }
2805
+ }
2806
+ or
2807
+ {
2808
+ "properties": {
2809
+ "class": "DataClassProperties",
2810
+ "qualifiedName": "add unique name here",
2811
+ "displayName": "add short name here",
2812
+ "description": "add description here",
2813
+ "namespace": "add scope of this data class's applicability.",
2814
+ "matchPropertyNames": [
2815
+ "name1",
2816
+ "name2"
2817
+ ],
2818
+ "matchThreshold": 0,
2819
+ "specification": "",
2820
+ "specificationDetails": {
2821
+ "property1": "propertyValue1",
2822
+ "property2": "propertyValue2"
2823
+ },
2824
+ "dataType": "",
2825
+ "allowsDuplicateValues": true,
2826
+ "isNullable": false,
2827
+ "defaultValue": "",
2828
+ "averageValue": "",
2829
+ "valueList": [],
2830
+ "valueRangeFrom": "",
2831
+ "valueRangeTo": "",
2832
+ "sampleValues": [],
2833
+ "dataPatterns": [],
2834
+ "additionalProperties": {
2835
+ "property1": "propertyValue1",
2836
+ "property2": "propertyValue2"
2837
+ }
2838
+ }
2839
+ }
2840
+
2841
+ """
2842
+
2843
+ url = f"{base_path(self, self.view_server)}/data-classes"
2844
+
2845
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
2846
+ return response.json().get("guid", NO_ELEMENTS_FOUND)
2847
+
2848
+ def create_data_class(self, body: dict) -> str:
2849
+ """
2850
+ Create a new data class with parameters defined in the body..
2851
+
2852
+ Parameters
2853
+ ----------
2854
+ body: dict
2855
+ - a dictionary containing the properties of the data class to be created.
2856
+
2857
+ Returns
2858
+ -------
2859
+ str
2860
+ The GUID of the element - or "No element found"
2861
+
2862
+ Raises
2863
+ ------
2864
+ InvalidParameterException
2865
+ one of the parameters is null or invalid or
2866
+ PropertyServerException
2867
+ There is a problem adding the element properties to the metadata repository or
2868
+ UserNotAuthorizedException
2869
+ the requesting user is not authorized to issue this request.
2870
+
2871
+ Note
2872
+ ----
2873
+
2874
+ {
2875
+ "class" : "NewDataClassRequestBody",
2876
+ "externalSourceGUID": "add guid here",
2877
+ "externalSourceName": "add qualified name here",
2878
+ "effectiveTime" : "{{$isoTimestamp}}",
2879
+ "forLineage" : false,
2880
+ "forDuplicateProcessing" : false,
2881
+ "anchorGUID" : "add guid here",
2882
+ "isOwnAnchor": false,
2883
+ "parentGUID": "add guid here",
2884
+ "parentRelationshipTypeName": "add type name here",
2885
+ "parentRelationshipProperties": {
2886
+ "class": "ElementProperties",
2887
+ "propertyValueMap" : {
2888
+ "description" : {
2889
+ "class": "PrimitiveTypePropertyValue",
2890
+ "typeName": "string",
2891
+ "primitiveValue" : "New description"
2892
+ }
2893
+ }
2894
+ },
2895
+ "parentAtEnd1": false,
2896
+ "properties": {
2897
+ "class" : "DataClassProperties",
2898
+ "qualifiedName": "add unique name here",
2899
+ "displayName": "add short name here",
2900
+ "description": "add description here",
2901
+ "namespace": "add scope of this data class's applicability.",
2902
+ "matchPropertyNames": ["name1", "name2"],
2903
+ "matchThreshold": 0,
2904
+ "specification": "",
2905
+ "specificationDetails": {
2906
+ "property1" : "propertyValue1",
2907
+ "property2" : "propertyValue2"
2908
+ },
2909
+ "dataType": "",
2910
+ "allowsDuplicateValues": true,
2911
+ "isNullable": false,
2912
+ "defaultValue": "",
2913
+ "averageValue": "",
2914
+ "valueList": [],
2915
+ "valueRangeFrom": "",
2916
+ "valueRangeTo": "",
2917
+ "sampleValues": [],
2918
+ "dataPatterns" : [],
2919
+ "additionalProperties": {
2920
+ "property1" : "propertyValue1",
2921
+ "property2" : "propertyValue2"
2922
+ },
2923
+ "effectiveFrom": "{{$isoTimestamp}}",
2924
+ "effectiveTo": "{{$isoTimestamp}}"
2925
+ }
2926
+ }
2927
+
2928
+ or
2929
+ {
2930
+ "properties": {
2931
+ "class": "DataClassProperties",
2932
+ "qualifiedName": "add unique name here",
2933
+ "displayName": "add short name here",
2934
+ "description": "add description here",
2935
+ "namespace": "add scope of this data class's applicability.",
2936
+ "matchPropertyNames": [
2937
+ "name1",
2938
+ "name2"
2939
+ ],
2940
+ "matchThreshold": 0,
2941
+ "specification": "",
2942
+ "specificationDetails": {
2943
+ "property1": "propertyValue1",
2944
+ "property2": "propertyValue2"
2945
+ },
2946
+ "dataType": "",
2947
+ "allowsDuplicateValues": true,
2948
+ "isNullable": false,
2949
+ "defaultValue": "",
2950
+ "averageValue": "",
2951
+ "valueList": [],
2952
+ "valueRangeFrom": "",
2953
+ "valueRangeTo": "",
2954
+ "sampleValues": [],
2955
+ "dataPatterns": [],
2956
+ "additionalProperties": {
2957
+ "property1": "propertyValue1",
2958
+ "property2": "propertyValue2"
2959
+ }
2960
+ }
2961
+ }
2962
+
2963
+ """
2964
+
2965
+ loop = asyncio.get_event_loop()
2966
+ response = loop.run_until_complete(self._async_create_data_class(body))
2967
+ return response
2968
+
2969
+ async def _async_create_data_class_from_template(self, body: dict) -> str:
2970
+ """
2971
+ Create a new metadata element to represent a data class using an existing metadata element as a template.
2972
+ The template defines additional classifications and relationships that should be added to the new element.
2973
+ Async version.
2974
+
2975
+ Parameters
2976
+ ----------
2977
+ body: dict
2978
+ - a dictionary containing the properties of the data class to be created.
2979
+
2980
+ Returns
2981
+ -------
2982
+ str
2983
+ The GUID of the element - or "No element found"
2984
+
2985
+ Raises
2986
+ ------
2987
+ InvalidParameterException
2988
+ one of the parameters is null or invalid or
2989
+ PropertyServerException
2990
+ There is a problem adding the element properties to the metadata repository or
2991
+ UserNotAuthorizedException
2992
+ the requesting user is not authorized to issue this request.
2993
+
2994
+ Note
2995
+ ----
2996
+ {
2997
+ "class" : "TemplateRequestBody",
2998
+ "externalSourceGUID": "add guid here",
2999
+ "externalSourceName": "add qualified name here",
3000
+ "effectiveTime" : "{{$isoTimestamp}}",
3001
+ "forLineage" : false,
3002
+ "forDuplicateProcessing" : false,
3003
+ "anchorGUID" : "add guid here",
3004
+ "isOwnAnchor": false,
3005
+ "parentGUID": "add guid here",
3006
+ "parentRelationshipTypeName": "add type name here",
3007
+ "parentRelationshipProperties": {
3008
+ "class": "ElementProperties",
3009
+ "propertyValueMap" : {
3010
+ "description" : {
3011
+ "class": "PrimitiveTypePropertyValue",
3012
+ "typeName": "string",
3013
+ "primitiveValue" : "New description"
3014
+ }
3015
+ }
3016
+ },
3017
+ "parentAtEnd1": false,
3018
+ "templateGUID": "add guid here",
3019
+ "replacementProperties": {
3020
+ "class": "ElementProperties",
3021
+ "propertyValueMap" : {
3022
+ "description" : {
3023
+ "class": "PrimitiveTypePropertyValue",
3024
+ "typeName": "string",
3025
+ "primitiveValue" : "New description"
3026
+ }
3027
+ }
3028
+ },
3029
+ "placeholderPropertyValues": {
3030
+ "placeholder1" : "propertyValue1",
3031
+ "placeholder2" : "propertyValue2"
3032
+ }
3033
+ }
3034
+
3035
+ """
3036
+
3037
+ url = f"{base_path(self, self.view_server)}/data-classes/from-template"
3038
+
3039
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
3040
+ return response.json().get("guid", NO_ELEMENTS_FOUND)
3041
+
3042
+ def create_data_class_from_template(self, body: dict) -> str:
3043
+ """
3044
+ Create a new metadata element to represent a data class using an existing metadata element as a template.
3045
+ The template defines additional classifications and relationships that should be added to the new element.
3046
+ Async version.
3047
+
3048
+ Parameters
3049
+ ----------
3050
+ body: dict
3051
+ - a dictionary containing the properties of the data class to be created.
3052
+
3053
+ Returns
3054
+ -------
3055
+ str
3056
+ The GUID of the element - or "No element found"
3057
+
3058
+ Raises
3059
+ ------
3060
+ InvalidParameterException
3061
+ one of the parameters is null or invalid or
3062
+ PropertyServerException
3063
+ There is a problem adding the element properties to the metadata repository or
3064
+ UserNotAuthorizedException
3065
+ the requesting user is not authorized to issue this request.
3066
+
3067
+ Note
3068
+ ----
3069
+ {
3070
+ "class" : "TemplateRequestBody",
3071
+ "externalSourceGUID": "add guid here",
3072
+ "externalSourceName": "add qualified name here",
3073
+ "effectiveTime" : "{{$isoTimestamp}}",
3074
+ "forLineage" : false,
3075
+ "forDuplicateProcessing" : false,
3076
+ "anchorGUID" : "add guid here",
3077
+ "isOwnAnchor": false,
3078
+ "parentGUID": "add guid here",
3079
+ "parentRelationshipTypeName": "add type name here",
3080
+ "parentRelationshipProperties": {
3081
+ "class": "ElementProperties",
3082
+ "propertyValueMap" : {
3083
+ "description" : {
3084
+ "class": "PrimitiveTypePropertyValue",
3085
+ "typeName": "string",
3086
+ "primitiveValue" : "New description"
3087
+ }
3088
+ }
3089
+ },
3090
+ "parentAtEnd1": false,
3091
+ "templateGUID": "add guid here",
3092
+ "replacementProperties": {
3093
+ "class": "ElementProperties",
3094
+ "propertyValueMap" : {
3095
+ "description" : {
3096
+ "class": "PrimitiveTypePropertyValue",
3097
+ "typeName": "string",
3098
+ "primitiveValue" : "New description"
3099
+ }
3100
+ }
3101
+ },
3102
+ "placeholderPropertyValues": {
3103
+ "placeholder1" : "propertyValue1",
3104
+ "placeholder2" : "propertyValue2"
3105
+ }
3106
+ }
3107
+ """
3108
+
3109
+ loop = asyncio.get_event_loop()
3110
+ response = loop.run_until_complete(self._async_create_data_class_from_template(body))
3111
+ return response
3112
+
3113
+ async def _async_update_data_class(self, data_class_guid: str, body: dict,
3114
+ replace_all_properties: bool = False) -> None:
3115
+ """
3116
+ Update the properties of a data class. Async version.
3117
+
3118
+ Parameters
3119
+ ----------
3120
+ data_class_guid: str
3121
+ - the GUID of the data class to be updated.
3122
+ body: dict
3123
+ - a dictionary containing the properties of the data structure to be created.
3124
+ replace_all_properties: bool, default = False
3125
+ - if true, then all properties will be replaced with the new ones. Otherwise, only the specified ones
3126
+ will be replaced.
3127
+ Returns
3128
+ -------
3129
+ None
3130
+
3131
+ Raises
3132
+ ------
3133
+ InvalidParameterException
3134
+ one of the parameters is null or invalid or
3135
+ PropertyServerException
3136
+ There is a problem adding the element properties to the metadata repository or
3137
+ UserNotAuthorizedException
3138
+ the requesting user is not authorized to issue this request.
3139
+
3140
+ Note
3141
+ ----
3142
+ Full sample body:
3143
+ {
3144
+ "class" : "UpdateDataClassRequestBody",
3145
+ "externalSourceGUID": "add guid here",
3146
+ "externalSourceName": "add qualified name here",
3147
+ "effectiveTime" : "{{$isoTimestamp}}",
3148
+ "forLineage" : false,
3149
+ "forDuplicateProcessing" : false,
3150
+ "properties": {
3151
+ "class" : "DataClassProperties",
3152
+ "qualifiedName": "add unique name here",
3153
+ "displayName": "add short name here",
3154
+ "description": "add description here",
3155
+ "namespace": "add scope of this data class's applicability.",
3156
+ "matchPropertyNames": ["name1", "name2"],
3157
+ "matchThreshold": 0,
3158
+ "specification": "",
3159
+ "specificationDetails": {
3160
+ "property1" : "propertyValue1",
3161
+ "property2" : "propertyValue2"
3162
+ },
3163
+ "dataType": "",
3164
+ "allowsDuplicateValues": true,
3165
+ "isNullable": false,
3166
+ "defaultValue": "",
3167
+ "averageValue": "",
3168
+ "valueList": [],
3169
+ "valueRangeFrom": "",
3170
+ "valueRangeTo": "",
3171
+ "sampleValues": [],
3172
+ "dataPatterns" : [],
3173
+ "additionalProperties": {
3174
+ "property1" : "propertyValue1",
3175
+ "property2" : "propertyValue2"
3176
+ }
3177
+ }
3178
+ }
3179
+ """
3180
+ replace_all_properties_s = str(replace_all_properties).lower()
3181
+
3182
+ url = (f"{base_path(self, self.view_server)}/data-class/{data_class_guid}/update?"
3183
+ f"replaceAllProperties={replace_all_properties_s}")
3184
+
3185
+ await self._async_make_request("POST", url, body_slimmer(body))
3186
+
3187
+ def update_data_class(self, data_class_guid: str, body: dict.get, replace_all_properties: bool = False) -> None:
3188
+ """
3189
+ Update the properties of a data class.
3190
+
3191
+ Parameters
3192
+ ----------
3193
+ data_class_guid: str
3194
+ - the GUID of the data class to be updated.
3195
+ body: dict
3196
+ - a dictionary containing the properties of the data structure to be created.
3197
+ replace_all_properties: bool, default = False
3198
+ - if true, then all properties will be replaced with the new ones. Otherwise, only the specified ones
3199
+ will be replaced.
3200
+ Returns
3201
+ -------
3202
+ None
3203
+
3204
+ Raises
3205
+ ------
3206
+ InvalidParameterException
3207
+ one of the parameters is null or invalid or
3208
+ PropertyServerException
3209
+ There is a problem adding the element properties to the metadata repository or
3210
+ UserNotAuthorizedException
3211
+ the requesting user is not authorized to issue this request.
3212
+
3213
+ Note
3214
+ ----
3215
+
3216
+ {
3217
+ "class" : "UpdateDataClassRequestBody",
3218
+ "externalSourceGUID": "add guid here",
3219
+ "externalSourceName": "add qualified name here",
3220
+ "effectiveTime" : "{{$isoTimestamp}}",
3221
+ "forLineage" : false,
3222
+ "forDuplicateProcessing" : false,
3223
+ "properties": {
3224
+ "class" : "DataClassProperties",
3225
+ "qualifiedName": "add unique name here",
3226
+ "displayName": "add short name here",
3227
+ "description": "add description here",
3228
+ "namespace": "add scope of this data class's applicability.",
3229
+ "matchPropertyNames": ["name1", "name2"],
3230
+ "matchThreshold": 0,
3231
+ "specification": "",
3232
+ "specificationDetails": {
3233
+ "property1" : "propertyValue1",
3234
+ "property2" : "propertyValue2"
3235
+ },
3236
+ "dataType": "",
3237
+ "allowsDuplicateValues": true,
3238
+ "isNullable": false,
3239
+ "defaultValue": "",
3240
+ "averageValue": "",
3241
+ "valueList": [],
3242
+ "valueRangeFrom": "",
3243
+ "valueRangeTo": "",
3244
+ "sampleValues": [],
3245
+ "dataPatterns" : [],
3246
+ "additionalProperties": {
3247
+ "property1" : "propertyValue1",
3248
+ "property2" : "propertyValue2"
3249
+ }
3250
+ }
3251
+ }
3252
+ """
3253
+
3254
+ loop = asyncio.get_event_loop()
3255
+ loop.run_until_complete(self._async_update_data_class(data_class_guid, body, replace_all_properties))
3256
+
3257
+ async def _async_link_nested_data_class(self, parent_data_class_guid: str, child_data_class_guid: str,
3258
+ body: dict = None) -> None:
3259
+ """
3260
+ Connect two data classes to show that one is used by the other when it is validating (typically a complex
3261
+ data item). Request body is optional. Async version.
3262
+
3263
+ Parameters
3264
+ ----------
3265
+ parent_data_class_guid: str
3266
+ - the GUID of the parent data class the nested data class will be connected to.
3267
+ child_data_class_guid: str
3268
+ - the GUID of the nested data class to be connected.
3269
+ body: dict, optional
3270
+ - a dictionary containing additional properties.
3271
+
3272
+ Returns
3273
+ -------
3274
+ None
3275
+
3276
+ Raises
3277
+ ------
3278
+ InvalidParameterException
3279
+ one of the parameters is null or invalid or
3280
+ PropertyServerException
3281
+ There is a problem adding the element properties to the metadata repository or
3282
+ UserNotAuthorizedException
3283
+ the requesting user is not authorized to issue this request.
3284
+
3285
+ Note
3286
+ ----
3287
+
3288
+ Sample body:
3289
+
3290
+ {
3291
+ "class": "MetadataSourceRequestBody",
3292
+ "externalSourceGUID": "add guid here",
3293
+ "externalSourceName": "add qualified name here",
3294
+ "effectiveTime": "{{$isoTimestamp}}",
3295
+ "forLineage": false,
3296
+ "forDuplicateProcessing": false
3297
+ }
3298
+
3299
+ """
3300
+
3301
+ url = (f"{base_path(self, self.view_server)}/data-classes/{parent_data_class_guid}"
3302
+ f"/nested-data-classes/{child_data_class_guid}/attach")
3303
+
3304
+ if body is None:
3305
+ await self._async_make_request("POST", url)
3306
+ else:
3307
+ await self._async_make_request("POST", url, body_slimmer(body))
3308
+
3309
+ def link_nested_data_class(self, parent_data_class_guid: str, child_data_class_guid: str,
3310
+ body: dict = None) -> None:
3311
+ """
3312
+ Connect a nested data class to a data class. Request body is optional.
3313
+
3314
+ Parameters
3315
+ ----------
3316
+ parent_data_class_guid: str
3317
+ - the GUID of the parent data class the nested data class will be connected to.
3318
+ child_data_class_guid: str
3319
+ - the GUID of the nested data class to be connected.
3320
+ body: dict, optional
3321
+ - a dictionary containing additional properties.
3322
+
3323
+ Returns
3324
+ -------
3325
+ None
3326
+
3327
+ Raises
3328
+ ------
3329
+ InvalidParameterException
3330
+ one of the parameters is null or invalid or
3331
+ PropertyServerException
3332
+ There is a problem adding the element properties to the metadata repository or
3333
+ UserNotAuthorizedException
3334
+ the requesting user is not authorized to issue this request.
3335
+
3336
+ Note
3337
+ ----
3338
+
3339
+ Sample body:
3340
+
3341
+ {
3342
+ "class": "MetadataSourceRequestBody",
3343
+ "externalSourceGUID": "add guid here",
3344
+ "externalSourceName": "add qualified name here",
3345
+ "effectiveTime": "{{$isoTimestamp}}",
3346
+ "forLineage": false,
3347
+ "forDuplicateProcessing": false
3348
+ }
3349
+
3350
+ """
3351
+
3352
+ loop = asyncio.get_event_loop()
3353
+ loop.run_until_complete(self._async_link_nested_data_class(parent_data_class_guid, child_data_class_guid, body))
3354
+
3355
+ async def _async_detach_nested_data_class(self, parent_data_class_guid: str, child_data_class_guid: str,
3356
+ body: dict = None) -> None:
3357
+ """
3358
+ Detach two nested data classes from each other. Request body is optional. Async version.
3359
+
3360
+ Parameters
3361
+ ----------
3362
+ parent_data_class_guid: str
3363
+ - the GUID of the parent data class the data class will be detached from..
3364
+ child_data_class_guid: str
3365
+ - the GUID of the data class to be disconnected.
3366
+ body: dict, optional
3367
+ - a dictionary containing additional properties.
3368
+
3369
+ Returns
3370
+ -------
3371
+ None
3372
+
3373
+ Raises
3374
+ ------
3375
+ InvalidParameterException
3376
+ one of the parameters is null or invalid or
3377
+ PropertyServerException
3378
+ There is a problem adding the element properties to the metadata repository or
3379
+ UserNotAuthorizedException
3380
+ the requesting user is not authorized to issue this request.
3381
+
3382
+ Note
3383
+ ----
3384
+
3385
+ Sample body:
3386
+
3387
+ {
3388
+ "class": "MetadataSourceRequestBody",
3389
+ "externalSourceGUID": "add guid here",
3390
+ "externalSourceName": "add qualified name here",
3391
+ "effectiveTime": "{{$isoTimestamp}}",
3392
+ "forLineage": false,
3393
+ "forDuplicateProcessing": false
3394
+ }
3395
+
3396
+
3397
+ """
3398
+
3399
+ url = (f"{base_path(self, self.view_server)}/data-classes/{parent_data_class_guid}"
3400
+ f"/member-data-classes/{child_data_class_guid}/detach")
3401
+
3402
+ if body is None:
3403
+ await self._async_make_request("POST", url)
3404
+ else:
3405
+ await self._async_make_request("POST", url, body_slimmer(body))
3406
+
3407
+ def detach_nested_data_class(self, parent_data_class_guid: str, child_data_class_guid: str,
3408
+ body: dict = None) -> None:
3409
+ """
3410
+ Detach two nested data classes from each other. Request body is optional.
3411
+
3412
+ Parameters
3413
+ ----------
3414
+ parent_data_class_guid: str
3415
+ - the GUID of the parent data structure the data class will be detached fromo.
3416
+ child_data_class_guid: str
3417
+ - the GUID of the data class to be disconnected.
3418
+ body: dict, optional
3419
+ - a dictionary containing additional properties.
3420
+
3421
+ Returns
3422
+ -------
3423
+ None
3424
+
3425
+ Raises
3426
+ ------
3427
+ InvalidParameterException
3428
+ one of the parameters is null or invalid or
3429
+ PropertyServerException
3430
+ There is a problem adding the element properties to the metadata repository or
3431
+ UserNotAuthorizedException
3432
+ the requesting user is not authorized to issue this request.
3433
+
3434
+ Note
3435
+ ----
3436
+
3437
+ Full sample body:
3438
+
3439
+ {
3440
+ "class": "MetadataSourceRequestBody",
3441
+ "externalSourceGUID": "add guid here",
3442
+ "externalSourceName": "add qualified name here",
3443
+ "effectiveTime": "{{$isoTimestamp}}",
3444
+ "forLineage": false,
3445
+ "forDuplicateProcessing": false
3446
+ }
3447
+
3448
+ """
3449
+
3450
+ loop = asyncio.get_event_loop()
3451
+ loop.run_until_complete(
3452
+ self._async_detach_nested_data_class(parent_data_class_guid, child_data_class_guid, body))
3453
+
3454
+ async def _async_link_specialist_data_class(self, parent_data_class_guid: str, child_data_class_guid: str,
3455
+ body: dict = None) -> None:
3456
+ """
3457
+ Connect two data classes to show that one provides a more specialist evaluation. Request body is optional.
3458
+ Async version.
3459
+
3460
+ Parameters
3461
+ ----------
3462
+ parent_data_class_guid: str
3463
+ - the GUID of the parent data class the nested data class will be connected to.
3464
+ child_data_class_guid: str
3465
+ - the GUID of the nested data class to be connected.
3466
+ body: dict, optional
3467
+ - a dictionary containing additional properties.
3468
+
3469
+ Returns
3470
+ -------
3471
+ None
3472
+
3473
+ Raises
3474
+ ------
3475
+ InvalidParameterException
3476
+ one of the parameters is null or invalid or
3477
+ PropertyServerException
3478
+ There is a problem adding the element properties to the metadata repository or
3479
+ UserNotAuthorizedException
3480
+ the requesting user is not authorized to issue this request.
3481
+
3482
+ Note
3483
+ ----
3484
+
3485
+ Sample body:
3486
+
3487
+ {
3488
+ "class": "MetadataSourceRequestBody",
3489
+ "externalSourceGUID": "add guid here",
3490
+ "externalSourceName": "add qualified name here",
3491
+ "effectiveTime": "{{$isoTimestamp}}",
3492
+ "forLineage": false,
3493
+ "forDuplicateProcessing": false
3494
+ }
3495
+
3496
+ """
3497
+
3498
+ url = (f"{base_path(self, self.view_server)}/data-classes/{parent_data_class_guid}"
3499
+ f"/specialist-data-classes/{child_data_class_guid}/attach")
3500
+
3501
+ if body is None:
3502
+ await self._async_make_request("POST", url)
3503
+ else:
3504
+ await self._async_make_request("POST", url, body_slimmer(body))
3505
+
3506
+ def link_specialist_data_class(self, parent_data_class_guid: str, child_data_class_guid: str,
3507
+ body: dict = None) -> None:
3508
+ """
3509
+ Connect two data classes to show that one provides a more specialist evaluation. Request body is optional.
3510
+
3511
+ Parameters
3512
+ ----------
3513
+ parent_data_class_guid: str
3514
+ - the GUID of the parent data class the nested data class will be connected to.
3515
+ child_data_class_guid: str
3516
+ - the GUID of the nested data class to be connected.
3517
+ body: dict, optional
3518
+ - a dictionary containing additional properties.
3519
+
3520
+ Returns
3521
+ -------
3522
+ None
3523
+
3524
+ Raises
3525
+ ------
3526
+ InvalidParameterException
3527
+ one of the parameters is null or invalid or
3528
+ PropertyServerException
3529
+ There is a problem adding the element properties to the metadata repository or
3530
+ UserNotAuthorizedException
3531
+ the requesting user is not authorized to issue this request.
3532
+
3533
+ Note
3534
+ ----
3535
+
3536
+ Sample body:
3537
+
3538
+ {
3539
+ "class": "MetadataSourceRequestBody",
3540
+ "externalSourceGUID": "add guid here",
3541
+ "externalSourceName": "add qualified name here",
3542
+ "effectiveTime": "{{$isoTimestamp}}",
3543
+ "forLineage": false,
3544
+ "forDuplicateProcessing": false
3545
+ }
3546
+
3547
+ """
3548
+
3549
+ loop = asyncio.get_event_loop()
3550
+ loop.run_until_complete(
3551
+ self._async_link_specialist_data_class(parent_data_class_guid, child_data_class_guid, body))
3552
+
3553
+ async def _async_detach_specialist_data_class(self, parent_data_class_guid: str, child_data_class_guid: str,
3554
+ body: dict = None) -> None:
3555
+ """
3556
+ Detach two data classes from each other. Request body is optional. Async version.
3557
+
3558
+ Parameters
3559
+ ----------
3560
+ parent_data_class_guid: str
3561
+ - the GUID of the parent data class the data class will be detached from..
3562
+ child_data_class_guid: str
3563
+ - the GUID of the data class to be disconnected.
3564
+ body: dict, optional
3565
+ - a dictionary containing additional properties.
3566
+
3567
+ Returns
3568
+ -------
3569
+ None
3570
+
3571
+ Raises
3572
+ ------
3573
+ InvalidParameterException
3574
+ one of the parameters is null or invalid or
3575
+ PropertyServerException
3576
+ There is a problem adding the element properties to the metadata repository or
3577
+ UserNotAuthorizedException
3578
+ the requesting user is not authorized to issue this request.
3579
+
3580
+ Note
3581
+ ----
3582
+
3583
+ Sample body:
3584
+
3585
+ {
3586
+ "class": "MetadataSourceRequestBody",
3587
+ "externalSourceGUID": "add guid here",
3588
+ "externalSourceName": "add qualified name here",
3589
+ "effectiveTime": "{{$isoTimestamp}}",
3590
+ "forLineage": false,
3591
+ "forDuplicateProcessing": false
3592
+ }
3593
+
3594
+
3595
+ """
3596
+
3597
+ url = (f"{base_path(self, self.view_server)}/data-classes/{parent_data_class_guid}"
3598
+ f"/specialist-data-classes/{child_data_class_guid}/detach")
3599
+
3600
+ if body is None:
3601
+ await self._async_make_request("POST", url)
3602
+ else:
3603
+ await self._async_make_request("POST", url, body_slimmer(body))
3604
+
3605
+ def detach_specialist_data_class(self, parent_data_class_guid: str, child_data_class_guid: str,
3606
+ body: dict = None) -> None:
3607
+ """
3608
+ Detach two data classes from each other. Request body is optional.
3609
+
3610
+ Parameters
3611
+ ----------
3612
+ parent_data_class_guid: str
3613
+ - the GUID of the parent data structure the data class will be detached from.
3614
+ child_data_class_guid: str
3615
+ - the GUID of the data class to be disconnected.
3616
+ body: dict, optional
3617
+ - a dictionary containing additional properties.
3618
+
3619
+ Returns
3620
+ -------
3621
+ None
3622
+
3623
+ Raises
3624
+ ------
3625
+ InvalidParameterException
3626
+ one of the parameters is null or invalid or
3627
+ PropertyServerException
3628
+ There is a problem adding the element properties to the metadata repository or
3629
+ UserNotAuthorizedException
3630
+ the requesting user is not authorized to issue this request.
3631
+
3632
+ Note
3633
+ ----
3634
+
3635
+ Full sample body:
3636
+
3637
+ {
3638
+ "class": "MetadataSourceRequestBody",
3639
+ "externalSourceGUID": "add guid here",
3640
+ "externalSourceName": "add qualified name here",
3641
+ "effectiveTime": "{{$isoTimestamp}}",
3642
+ "forLineage": false,
3643
+ "forDuplicateProcessing": false
3644
+ }
3645
+
3646
+ """
3647
+
3648
+ loop = asyncio.get_event_loop()
3649
+ loop.run_until_complete(
3650
+ self._async_detach_specialist_data_class(parent_data_class_guid, child_data_class_guid, body))
3651
+
3652
+ async def _async_delete_data_class(self, data_class_guid: str, body: dict = None) -> None:
3653
+ """
3654
+ Delete a data class. Request body is optional. Async version.
3655
+
3656
+ Parameters
3657
+ ----------
3658
+ data_class_guid: str
3659
+ - the GUID of the data class to delete.
3660
+ body: dict, optional
3661
+ - a dictionary containing additional properties.
3662
+
3663
+ Returns
3664
+ -------
3665
+ None
3666
+
3667
+ Raises
3668
+ ------
3669
+ InvalidParameterException
3670
+ one of the parameters is null or invalid or
3671
+ PropertyServerException
3672
+ There is a problem adding the element properties to the metadata repository or
3673
+ UserNotAuthorizedException
3674
+ the requesting user is not authorized to issue this request.
3675
+
3676
+ Note
3677
+ ----
3678
+
3679
+ Full sample body:
3680
+
3681
+ {
3682
+ "class": "MetadataSourceRequestBody",
3683
+ "externalSourceGUID": "add guid here",
3684
+ "externalSourceName": "add qualified name here",
3685
+ "effectiveTime": "{{$isoTimestamp}}",
3686
+ "forLineage": false,
3687
+ "forDuplicateProcessing": false
3688
+ }
3689
+
3690
+
3691
+ """
3692
+
3693
+ url = f"{base_path(self, self.view_server)}/data-classes/{data_class_guid}/delete"
3694
+
3695
+ if body is None:
3696
+ await self._async_make_request("POST", url)
3697
+ else:
3698
+ await self._async_make_request("POST", url, body_slimmer(body))
3699
+
3700
+ def delete_data_class(self, data_class_guid: str, body: dict = None) -> None:
3701
+ """
3702
+ Delete a data class. Request body is optional.
3703
+
3704
+ Parameters
3705
+ ----------
3706
+ data_class_guid: str
3707
+ - the GUID of the data class the data class to delete.
3708
+ body: dict, optional
3709
+ - a dictionary containing additional properties.
3710
+
3711
+ Returns
3712
+ -------
3713
+ None
3714
+
3715
+ Raises
3716
+ ------
3717
+ InvalidParameterException
3718
+ one of the parameters is null or invalid or
3719
+ PropertyServerException
3720
+ There is a problem adding the element properties to the metadata repository or
3721
+ UserNotAuthorizedException
3722
+ the requesting user is not authorized to issue this request.
3723
+
3724
+ Note
3725
+ ----
3726
+
3727
+ Full sample body:
3728
+
3729
+ {
3730
+ "class": "MetadataSourceRequestBody",
3731
+ "externalSourceGUID": "add guid here",
3732
+ "externalSourceName": "add qualified name here",
3733
+ "effectiveTime": "{{$isoTimestamp}}",
3734
+ "forLineage": false,
3735
+ "forDuplicateProcessing": false
3736
+ }
3737
+
3738
+ """
3739
+
3740
+ loop = asyncio.get_event_loop()
3741
+ loop.run_until_complete(self._async_delete_data_class(data_class_guid, body))
3742
+
3743
+ async def _async_find_all_data_classes(self, start_from: int = 0, page_size: int = max_paging_size, ) -> list | str:
3744
+ """ Returns a list of all data classes. Async version.
3745
+
3746
+ Parameters
3747
+ ----------
3748
+ start_from: int, default = 0
3749
+ - index of the list to start from (0 for start).
3750
+ page_size
3751
+ - maximum number of elements to return.
3752
+
3753
+ Returns
3754
+ -------
3755
+ [dict] | str
3756
+ Returns a string if no elements are found and a list of dict elements with the results.
3757
+
3758
+ Raises
3759
+ ------
3760
+ InvalidParameterException
3761
+ one of the parameters is null or invalid or
3762
+ PropertyServerException
3763
+ There is a problem adding the element properties to the metadata repository or
3764
+ UserNotAuthorizedException
3765
+ the requesting user is not authorized to issue this request.
3766
+
3767
+ """
3768
+
3769
+ possible_query_params = query_string(
3770
+ [("startFrom", start_from), ("pageSize", page_size), ("startsWith", 'false'), ("endsWith", 'false'),
3771
+ ("ignoreCase", 'true')])
3772
+
3773
+ url = (f"{base_path(self, self.view_server)}/data-classes/by-search-string"
3774
+ f"{possible_query_params}")
3775
+
3776
+ response: Response = await self._async_make_request("POST", url)
3777
+
3778
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
3779
+ if type(elements) is list:
3780
+ if len(elements) == 0:
3781
+ return NO_ELEMENTS_FOUND
3782
+ return elements
3783
+
3784
+ def find_all_data_classes(self, start_from: int = 0, page_size: int = max_paging_size, ) -> list | str:
3785
+ """ Returns a list of all data classes.
3786
+
3787
+ Parameters
3788
+ ----------
3789
+ start_from: int, default = 0
3790
+ - index of the list to start from (0 for start).
3791
+ page_size
3792
+ - maximum number of elements to return.
3793
+
3794
+ Returns
3795
+ -------
3796
+ [dict] | str
3797
+ Returns a string if no elements are found and a list of dict elements with the results.
3798
+
3799
+ Raises
3800
+ ------
3801
+ InvalidParameterException
3802
+ one of the parameters is null or invalid or
3803
+ PropertyServerException
3804
+ There is a problem adding the element properties to the metadata repository or
3805
+ UserNotAuthorizedException
3806
+ the requesting user is not authorized to issue this request.
3807
+
3808
+ """
3809
+
3810
+ loop = asyncio.get_event_loop()
3811
+ response = loop.run_until_complete(self._async_find_all_data_classes(start_from, page_size))
3812
+ return response
3813
+
3814
+ async def _async_find_data_classes_w_body(self, body: dict, start_from: int = 0, page_size: int = max_paging_size,
3815
+ starts_with: bool = True, ends_with: bool = False,
3816
+ ignore_case: bool = True) -> list | str:
3817
+ """ Retrieve the list of data class metadata elements that contain the search string.
3818
+ Async version.
3819
+
3820
+ Parameters
3821
+ ----------
3822
+ body: dict
3823
+ - A structure containing the search criteria. (example below)
3824
+ start_from: int, default = 0
3825
+ - index of the list to start from (0 for start).
3826
+ page_size
3827
+ - maximum number of elements to return.
3828
+ starts_with: bool, default = True
3829
+ - if True, the search string filters from the beginning of the string.
3830
+ ends_with: bool, default = False
3831
+ - if True, the search string filters from the end of the string.
3832
+ ignore_case: bool, default = True
3833
+ - If True, the case of the search string is ignored.
3834
+
3835
+ Returns
3836
+ -------
3837
+ [dict] | str
3838
+ Returns a string if no elements are found and a list of dict with the results.
3839
+
3840
+ Raises
3841
+ ------
3842
+ InvalidParameterException
3843
+ one of the parameters is null or invalid or
3844
+ PropertyServerException
3845
+ There is a problem adding the element properties to the metadata repository or
3846
+ UserNotAuthorizedException
3847
+ the requesting user is not authorized to issue this request.
3848
+
3849
+ Notes:
3850
+
3851
+ {
3852
+ "class": "FilterRequestBody",
3853
+ "asOfTime": "{{$isoTimestamp}}",
3854
+ "effectiveTime": "{{$isoTimestamp}}",
3855
+ "forLineage": false,
3856
+ "forDuplicateProcessing : false,
3857
+ "limitResultsByStatus": ["ACTIVE"],
3858
+ "sequencingOrder": "PROPERTY_ASCENDING",
3859
+ "sequencingProperty": "qualifiedName",
3860
+ "filter": ""
3861
+ }
3862
+
3863
+ """
3864
+ starts_with_s = str(starts_with).lower()
3865
+ ends_with_s = str(ends_with).lower()
3866
+ ignore_case_s = str(ignore_case).lower()
3867
+ possible_query_params = query_string(
3868
+ [("startFrom", start_from), ("pageSize", page_size), ("startsWith", starts_with_s),
3869
+ ("endsWith", ends_with_s), ("ignoreCase", ignore_case_s), ])
3870
+
3871
+ url = (f"{base_path(self, self.view_server)}/data-classes/by-search-string"
3872
+ f"{possible_query_params}")
3873
+
3874
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
3875
+
3876
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
3877
+ if type(elements) is list:
3878
+ if len(elements) == 0:
3879
+ return NO_ELEMENTS_FOUND
3880
+ return elements
3881
+
3882
+ def find_data_classes_w_body(self, body: dict, start_from: int = 0, page_size: int = max_paging_size,
3883
+ starts_with: bool = True, ends_with: bool = False,
3884
+ ignore_case: bool = True) -> list | str:
3885
+ """ Retrieve the list of data class metadata elements that contain the search string.
3886
+
3887
+ Parameters
3888
+ ----------
3889
+ body: dict
3890
+ - A structure containing the search criteria. (example below)
3891
+ start_from: int, default = 0
3892
+ - index of the list to start from (0 for start).
3893
+ page_size
3894
+ - maximum number of elements to return.
3895
+ starts_with: bool, default = True
3896
+ - if True, the search string filters from the beginning of the string.
3897
+ ends_with: bool, default = False
3898
+ - if True, the search string filters from the end of the string.
3899
+ ignore_case: bool, default = True
3900
+ - If True, the case of the search string is ignored.
3901
+
3902
+ Returns
3903
+ -------
3904
+ [dict] | str
3905
+ Returns a string if no elements are found and a list of dict with the results.
3906
+
3907
+ Raises
3908
+ ------
3909
+ InvalidParameterException
3910
+ one of the parameters is null or invalid or
3911
+ PropertyServerException
3912
+ There is a problem adding the element properties to the metadata repository or
3913
+ UserNotAuthorizedException
3914
+ the requesting user is not authorized to issue this request.
3915
+
3916
+ Notes:
3917
+
3918
+ {
3919
+ "class": "FilterRequestBody",
3920
+ "asOfTime": "{{$isoTimestamp}}",
3921
+ "effectiveTime": "{{$isoTimestamp}}",
3922
+ "forLineage": false,
3923
+ "forDuplicateProcessing : false,
3924
+ "limitResultsByStatus": ["ACTIVE"],
3925
+ "sequencingOrder": "PROPERTY_ASCENDING",
3926
+ "sequencingProperty": "qualifiedName",
3927
+ "filter": ""
3928
+ }
3929
+
3930
+ """
3931
+
3932
+ loop = asyncio.get_event_loop()
3933
+ response = loop.run_until_complete(
3934
+ self._async_find_data_classes_w_body(body, start_from, page_size, starts_with, ends_with, ignore_case))
3935
+ return response
3936
+
3937
+ async def _async_find_data_classes(self, filter: str, start_from: int = 0, page_size: int = max_paging_size,
3938
+ starts_with: bool = True, ends_with: bool = False,
3939
+ ignore_case: bool = True) -> list | str:
3940
+ """ Find the list of data class elements that contain the search string.
3941
+ Async version.
3942
+
3943
+ Parameters
3944
+ ----------
3945
+ filter: str
3946
+ - search string to filter on.
3947
+ start_from: int, default = 0
3948
+ - index of the list to start from (0 for start).
3949
+ page_size
3950
+ - maximum number of elements to return.
3951
+ starts_with: bool, default = True
3952
+ - if True, the search string filters from the beginning of the string.
3953
+ ends_with: bool, default = False
3954
+ - if True, the search string filters from the end of the string.
3955
+ ignore_case: bool, default = True
3956
+ - If True, the case of the search string is ignored.
3957
+
3958
+ Returns
3959
+ -------
3960
+ [dict] | str
3961
+ Returns a string if no elements are found and a list of dict with the results.
3962
+
3963
+ Raises
3964
+ ------
3965
+ InvalidParameterException
3966
+ one of the parameters is null or invalid or
3967
+ PropertyServerException
3968
+ There is a problem adding the element properties to the metadata repository or
3969
+ UserNotAuthorizedException
3970
+ the requesting user is not authorized to issue this request.
3971
+
3972
+ """
3973
+
3974
+ body = {"filter": filter}
3975
+
3976
+ possible_query_params = query_string(
3977
+ [("startFrom", start_from), ("pageSize", page_size), ("startsWith", str(starts_with).lower),
3978
+ ("endsWith", str(ends_with).lower()), ("ignoreCase", str(ignore_case).lower()), ])
3979
+
3980
+ url = (f"{base_path(self, self.view_server)}/data-classes/by-search-string"
3981
+ f"{possible_query_params}")
3982
+
3983
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
3984
+
3985
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
3986
+ if type(elements) is list:
3987
+ if len(elements) == 0:
3988
+ return NO_ELEMENTS_FOUND
3989
+ return elements
3990
+
3991
+ def find_data_classes(self, filter: str, start_from: int = 0, page_size: int = max_paging_size,
3992
+ starts_with: bool = True, ends_with: bool = False, ignore_case: bool = True) -> list | str:
3993
+ """ Retrieve the list of data fields elements that contain the search string filter.
3994
+
3995
+ Parameters
3996
+ ----------
3997
+ filter: str
3998
+ - search string to filter on.
3999
+ start_from: int, default = 0
4000
+ - index of the list to start from (0 for start).
4001
+ page_size
4002
+ - maximum number of elements to return.
4003
+ starts_with: bool, default = True
4004
+ - if True, the search string filters from the beginning of the string.
4005
+ ends_with: bool, default = False
4006
+ - if True, the search string filters from the end of the string.
4007
+ ignore_case: bool, default = True
4008
+ - If True, the case of the search string is ignored.
4009
+
4010
+ Returns
4011
+ -------
4012
+ [dict] | str
4013
+ Returns a string if no elements are found and a list of dict with the results.
4014
+
4015
+ Raises
4016
+ ------
4017
+ InvalidParameterException
4018
+ one of the parameters is null or invalid or
4019
+ PropertyServerException
4020
+ There is a problem adding the element properties to the metadata repository or
4021
+ UserNotAuthorizedException
4022
+ the requesting user is not authorized to issue this request.
4023
+
4024
+
4025
+ """
4026
+
4027
+ loop = asyncio.get_event_loop()
4028
+ response = loop.run_until_complete(
4029
+ self._async_find_data_classes(filter, start_from, page_size, starts_with, ends_with, ignore_case))
4030
+ return response
4031
+
4032
+ async def _async_get_data_classes_by_name(self, filter: str, body: dict = None, start_from: int = 0,
4033
+ page_size: int = max_paging_size) -> list | str:
4034
+ """ Get the list of data class metadata elements with a matching name to the search string filter.
4035
+ Async version.
4036
+
4037
+ Parameters
4038
+ ----------
4039
+ filter: str
4040
+ - search string to filter on.
4041
+ body: dict, optional
4042
+ - a dictionary containing additional properties to use in the request.
4043
+ start_from: int, default = 0
4044
+ - index of the list to start from (0 for start).
4045
+ page_size
4046
+ - maximum number of elements to return.
4047
+
4048
+ Returns
4049
+ -------
4050
+ [dict] | str
4051
+ Returns a string if no elements are found and a list of dict with the results.
4052
+
4053
+ Raises
4054
+ ------
4055
+ InvalidParameterException
4056
+ one of the parameters is null or invalid or
4057
+ PropertyServerException
4058
+ There is a problem adding the element properties to the metadata repository or
4059
+ UserNotAuthorizedException
4060
+ the requesting user is not authorized to issue this request.
4061
+ Notes
4062
+ -----
4063
+
4064
+ {
4065
+ "class": "FilterRequestBody",
4066
+ "asOfTime": "{{$isoTimestamp}}",
4067
+ "effectiveTime": "{{$isoTimestamp}}",
4068
+ "forLineage": false,
4069
+ "forDuplicateProcessing": false,
4070
+ "limitResultsByStatus": ["ACTIVE"],
4071
+ "sequencingOrder": "PROPERTY_ASCENDING",
4072
+ "sequencingProperty": "qualifiedName",
4073
+ "filter": "Add name here"
4074
+ }
4075
+ """
4076
+ if body is None:
4077
+ body = {"filter": filter}
4078
+
4079
+ possible_query_params = query_string([("startFrom", start_from), ("pageSize", page_size), ])
4080
+
4081
+ url = (f"{base_path(self, self.view_server)}/data-classes/by-name"
4082
+ f"{possible_query_params}")
4083
+
4084
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
4085
+
4086
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
4087
+ if type(elements) is list:
4088
+ if len(elements) == 0:
4089
+ return NO_ELEMENTS_FOUND
4090
+ return elements
4091
+
4092
+ def get_data_classes_by_name(self, filter: str, body: dict = None, start_from: int = 0,
4093
+ page_size: int = max_paging_size) -> list | str:
4094
+ """ Get the list of data class elements with a matching name to the search string filter.
4095
+
4096
+ Parameters
4097
+ ----------
4098
+ filter: str
4099
+ - search string to filter on.
4100
+ body: dict, optional
4101
+ - a dictionary containing additional properties to use in the request.
4102
+ start_from: int, default = 0
4103
+ - index of the list to start from (0 for start).
4104
+ page_size
4105
+ - maximum number of elements to return.
4106
+
4107
+ Returns
4108
+ -------
4109
+ [dict] | str
4110
+ Returns a string if no elements are found and a list of dict with the results.
4111
+
4112
+ Raises
4113
+ ------
4114
+ InvalidParameterException
4115
+ one of the parameters is null or invalid or
4116
+ PropertyServerException
4117
+ There is a problem adding the element properties to the metadata repository or
4118
+ UserNotAuthorizedException
4119
+ the requesting user is not authorized to issue this request.
4120
+
4121
+ Notes
4122
+ -----
4123
+ {
4124
+ "class": "FilterRequestBody",
4125
+ "asOfTime": "{{$isoTimestamp}}",
4126
+ "effectiveTime": "{{$isoTimestamp}}",
4127
+ "forLineage": false,
4128
+ "forDuplicateProcessing": false,
4129
+ "limitResultsByStatus": ["ACTIVE"],
4130
+ "sequencingOrder": "PROPERTY_ASCENDING",
4131
+ "sequencingProperty": "qualifiedName",
4132
+ "filter": "Add name here"
4133
+ }
4134
+
4135
+
4136
+ """
4137
+
4138
+ loop = asyncio.get_event_loop()
4139
+ response = loop.run_until_complete(self._async_get_data_classes_by_name(filter, body, start_from, page_size))
4140
+ return response
4141
+
4142
+ async def _async_get_data_class_by_guid(self, guid: str, body: dict = None) -> list | str:
4143
+ """ Get the data class elements for the specified GUID.
4144
+ Async version.
4145
+
4146
+ Parameters
4147
+ ----------
4148
+ guid: str
4149
+ - unique identifier of the data class metadata element.
4150
+ body: dict, optional
4151
+ - optional request body.
4152
+ Returns
4153
+ -------
4154
+ [dict] | str
4155
+ Returns a string if no elements are found and a list of dict with the results.
4156
+
4157
+ Raises
4158
+ ------
4159
+ InvalidParameterException
4160
+ one of the parameters is null or invalid or
4161
+ PropertyServerException
4162
+ There is a problem adding the element properties to the metadata repository or
4163
+ UserNotAuthorizedException
4164
+ the requesting user is not authorized to issue this request.
4165
+
4166
+ Notes
4167
+ ----
4168
+
4169
+ Optional request body:
4170
+ {
4171
+ "class": "AnyTimeRequestBody",
4172
+ "asOfTime": "{{$isoTimestamp}}",
4173
+ "effectiveTime": "{{$isoTimestamp}}",
4174
+ "forLineage": false,
4175
+ "forDuplicateProcessing": false
4176
+ }
4177
+
4178
+ """
4179
+
4180
+ url = (f"{base_path(self, self.view_server)}/data-classes/{guid}/retrieve")
4181
+ if body:
4182
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
4183
+ else:
4184
+ response: Response = await self._async_make_request("POST", url)
4185
+
4186
+ elements = response.json().get("elements", NO_ELEMENTS_FOUND)
4187
+ if type(elements) is list:
4188
+ if len(elements) == 0:
4189
+ return NO_ELEMENTS_FOUND
4190
+ return elements
4191
+
4192
+ def get_data_class_by_guid(self, guid: str, body: str = None) -> list | str:
4193
+ """ Get the data structure metadata element with the specified unique identifier..
4194
+
4195
+ Parameters
4196
+ ----------
4197
+ guid: str
4198
+ - unique identifier of the data structure metadata element.
4199
+ body: dict, optional
4200
+ - optional request body.
4201
+ Returns
4202
+ -------
4203
+ [dict] | str
4204
+ Returns a string if no elements are found and a list of dict with the results.
4205
+
4206
+ Raises
4207
+ ------
4208
+ InvalidParameterException
4209
+ one of the parameters is null or invalid or
4210
+ PropertyServerException
4211
+ There is a problem adding the element properties to the metadata repository or
4212
+ UserNotAuthorizedException
4213
+ the requesting user is not authorized to issue this request.
4214
+
4215
+ Notes
4216
+ ----
4217
+
4218
+ Optional request body:
4219
+ {
4220
+ "class": "AnyTimeRequestBody",
4221
+ "asOfTime": "{{$isoTimestamp}}",
4222
+ "effectiveTime": "{{$isoTimestamp}}",
4223
+ "forLineage": false,
4224
+ "forDuplicateProcessing": false
4225
+ }
4226
+
4227
+ """
4228
+
4229
+ loop = asyncio.get_event_loop()
4230
+ response = loop.run_until_complete(self._async_get_data_class_by_guid(guid, body))
4231
+ return response
4232
+
4233
+ ###
4234
+ # =====================================================================================================================
4235
+ # Assembling a data specification
4236
+ # https://egeria-project.org/concepts/data-specification
4237
+ #
4238
+ async def _async_link_data_class_definition(self, data_definition_guid: str, data_class_guid: str,
4239
+ body: dict = None) -> None:
4240
+ """
4241
+ Connect an element that is part of a data design to a data class to show that the data class should be used as
4242
+ the specification for the data values when interpreting the data definition. Request body is optional.
4243
+ Async version
4244
+ Parameters
4245
+ ----------
4246
+ data_definition_guid: str
4247
+ - the GUID of the data class definition to link.
4248
+ data_class_guid: str
4249
+ - the GUID of the data class to be connected.
4250
+ body: dict, optional
4251
+ - a dictionary containing additional properties.
4252
+
4253
+ Returns
4254
+ -------
4255
+ None
4256
+
4257
+ Raises
4258
+ ------
4259
+ InvalidParameterException
4260
+ one of the parameters is null or invalid or
4261
+ PropertyServerException
4262
+ There is a problem adding the element properties to the metadata repository or
4263
+ UserNotAuthorizedException
4264
+ the requesting user is not authorized to issue this request.
4265
+
4266
+ Note
4267
+ ----
4268
+
4269
+ Sample body:
4270
+
4271
+ {
4272
+ "class": "MetadataSourceRequestBody",
4273
+ "externalSourceGUID": "add guid here",
4274
+ "externalSourceName": "add qualified name here",
4275
+ "effectiveTime": "{{$isoTimestamp}}",
4276
+ "forLineage": false,
4277
+ "forDuplicateProcessing": false
4278
+ }
4279
+
4280
+ """
4281
+
4282
+ url = (f"{base_path(self, self.view_server)}/data-definitions/{data_definition_guid}"
4283
+ f"/data-class-definition/{data_class_guid}/attach")
4284
+
4285
+ if body is None:
4286
+ await self._async_make_request("POST", url)
4287
+ else:
4288
+ await self._async_make_request("POST", url, body_slimmer(body))
4289
+
4290
+ def link_data_class_definition(self, data_definition_guid: str, data_class_guid: str, body: dict = None) -> None:
4291
+ """
4292
+ Connect an element that is part of a data design to a data class to show that the data class should be used as
4293
+ the specification for the data values when interpreting the data definition. Request body is optional.
4294
+ Async version
4295
+ Parameters
4296
+ ----------
4297
+ data_definition_guid: str
4298
+ - the GUID of the data class definition to link.
4299
+ data_class_guid: str
4300
+ - the GUID of the data class to be connected.
4301
+ body: dict, optional
4302
+ - a dictionary containing additional properties.
4303
+
4304
+ Returns
4305
+ -------
4306
+ None
4307
+
4308
+ Raises
4309
+ ------
4310
+ InvalidParameterException
4311
+ one of the parameters is null or invalid or
4312
+ PropertyServerException
4313
+ There is a problem adding the element properties to the metadata repository or
4314
+ UserNotAuthorizedException
4315
+ the requesting user is not authorized to issue this request.
4316
+
4317
+ Note
4318
+ ----
4319
+
4320
+ Sample body:
4321
+
4322
+ {
4323
+ "class": "MetadataSourceRequestBody",
4324
+ "externalSourceGUID": "add guid here",
4325
+ "externalSourceName": "add qualified name here",
4326
+ "effectiveTime": "{{$isoTimestamp}}",
4327
+ "forLineage": false,
4328
+ "forDuplicateProcessing": false
4329
+ }
4330
+
4331
+ """
4332
+
4333
+ loop = asyncio.get_event_loop()
4334
+ loop.run_until_complete(self._async_link_data_class_definition(data_definition_guid, data_class_guid, body))
4335
+
4336
+ async def _async_detach_data_class_definition(self, data_definition_guid: str, data_class_guid: str,
4337
+ body: dict = None) -> None:
4338
+ """
4339
+ Detach a data definition from a data class. Request body is optional. Async version.
4340
+
4341
+ Parameters
4342
+ ----------
4343
+ data_definition_guid: str
4344
+ - the GUID of the data class definition.
4345
+ data_class_guid: str
4346
+ - the GUID of the data class to be disconnected.
4347
+ body: dict, optional
4348
+ - a dictionary containing additional properties.
4349
+
4350
+ Returns
4351
+ -------
4352
+ None
4353
+
4354
+ Raises
4355
+ ------
4356
+ InvalidParameterException
4357
+ one of the parameters is null or invalid or
4358
+ PropertyServerException
4359
+ There is a problem adding the element properties to the metadata repository or
4360
+ UserNotAuthorizedException
4361
+ the requesting user is not authorized to issue this request.
4362
+
4363
+ Note
4364
+ ----
4365
+
4366
+ Sample body:
4367
+
4368
+ {
4369
+ "class": "MetadataSourceRequestBody",
4370
+ "externalSourceGUID": "add guid here",
4371
+ "externalSourceName": "add qualified name here",
4372
+ "effectiveTime": "{{$isoTimestamp}}",
4373
+ "forLineage": false,
4374
+ "forDuplicateProcessing": false
4375
+ }
4376
+
4377
+
4378
+ """
4379
+
4380
+ url = (f"{base_path(self, self.view_server)}/data-definitions/{data_definition_guid}"
4381
+ f"/data-class-definition/{data_class_guid}/detach")
4382
+
4383
+ if body is None:
4384
+ await self._async_make_request("POST", url)
4385
+ else:
4386
+ await self._async_make_request("POST", url, body_slimmer(body))
4387
+
4388
+ def detach_data_class_definition(self, data_definition_guid: str, data_class_guid: str, body: dict = None) -> None:
4389
+ """
4390
+ Detach a data definition from a data class. Request body is optional.
4391
+
4392
+ Parameters
4393
+ ----------
4394
+ data_definition_guid: str
4395
+ - the GUID of the data class definition.
4396
+ data_class_guid: str
4397
+ - the GUID of the data class to be disconnected.
4398
+ body: dict, optional
4399
+ - a dictionary containing additional properties.
4400
+
4401
+ Returns
4402
+ -------
4403
+ None
4404
+
4405
+ Raises
4406
+ ------
4407
+ InvalidParameterException
4408
+ one of the parameters is null or invalid or
4409
+ PropertyServerException
4410
+ There is a problem adding the element properties to the metadata repository or
4411
+ UserNotAuthorizedException
4412
+ the requesting user is not authorized to issue this request.
4413
+
4414
+ Note
4415
+ ----
4416
+
4417
+ Sample body:
4418
+
4419
+ {
4420
+ "class": "MetadataSourceRequestBody",
4421
+ "externalSourceGUID": "add guid here",
4422
+ "externalSourceName": "add qualified name here",
4423
+ "effectiveTime": "{{$isoTimestamp}}",
4424
+ "forLineage": false,
4425
+ "forDuplicateProcessing": false
4426
+ }
4427
+
4428
+
4429
+ """
4430
+
4431
+ loop = asyncio.get_event_loop()
4432
+ loop.run_until_complete(self._async_detach_data_class_definition(data_definition_guid, data_class_guid, body))
4433
+
4434
+ async def _async_link_semantic_definition(self, data_definition_guid: str, glossary_term_guid: str,
4435
+ body: dict = None) -> None:
4436
+ """
4437
+ Connect an element that is part of a data design to a glossary term to show that the term should be used as
4438
+ the semantic definition for the data values when interpreting the data definition. Request body is optional.
4439
+ Async version
4440
+
4441
+ Parameters
4442
+ ----------
4443
+ data_definition_guid: str
4444
+ - the GUID of the data class definition to link.
4445
+ glossary_term_guid: str
4446
+ - the GUID of the glossary term to be connected.
4447
+ body: dict, optional
4448
+ - a dictionary containing additional properties.
4449
+
4450
+ Returns
4451
+ -------
4452
+ None
4453
+
4454
+ Raises
4455
+ ------
4456
+ InvalidParameterException
4457
+ one of the parameters is null or invalid or
4458
+ PropertyServerException
4459
+ There is a problem adding the element properties to the metadata repository or
4460
+ UserNotAuthorizedException
4461
+ the requesting user is not authorized to issue this request.
4462
+
4463
+ Note
4464
+ ----
4465
+
4466
+ Sample body:
4467
+
4468
+ {
4469
+ "class": "MetadataSourceRequestBody",
4470
+ "externalSourceGUID": "add guid here",
4471
+ "externalSourceName": "add qualified name here",
4472
+ "effectiveTime": "{{$isoTimestamp}}",
4473
+ "forLineage": false,
4474
+ "forDuplicateProcessing": false
4475
+ }
4476
+
4477
+ """
4478
+
4479
+ url = (f"{base_path(self, self.view_server)}/data-definitions/{data_definition_guid}"
4480
+ f"/semantic-definition/{glossary_term_guid}/attach")
4481
+
4482
+ if body is None:
4483
+ await self._async_make_request("POST", url)
4484
+ else:
4485
+ await self._async_make_request("POST", url, body_slimmer(body))
4486
+
4487
+ def link_semantic_definition(self, data_definition_guid: str, glossary_term_guid: str, body: dict = None) -> None:
4488
+ """
4489
+ Connect an element that is part of a data design to a glossary term to show that the term should be used as
4490
+ the semantic definition for the data values when interpreting the data definition. Request body is optional.
4491
+ Async version
4492
+
4493
+ Parameters
4494
+ ----------
4495
+ data_definition_guid: str
4496
+ - the GUID of the data class definition to link.
4497
+ glossary_term_guid: str
4498
+ - the GUID of the glossary term to be connected.
4499
+ body: dict, optional
4500
+ - a dictionary containing additional properties.
4501
+
4502
+ Returns
4503
+ -------
4504
+ None
4505
+
4506
+ Raises
4507
+ ------
4508
+ InvalidParameterException
4509
+ one of the parameters is null or invalid or
4510
+ PropertyServerException
4511
+ There is a problem adding the element properties to the metadata repository or
4512
+ UserNotAuthorizedException
4513
+ the requesting user is not authorized to issue this request.
4514
+
4515
+ Note
4516
+ ----
4517
+
4518
+ Sample body:
4519
+
4520
+ {
4521
+ "class": "MetadataSourceRequestBody",
4522
+ "externalSourceGUID": "add guid here",
4523
+ "externalSourceName": "add qualified name here",
4524
+ "effectiveTime": "{{$isoTimestamp}}",
4525
+ "forLineage": false,
4526
+ "forDuplicateProcessing": false
4527
+ }
4528
+
4529
+ """
4530
+
4531
+ loop = asyncio.get_event_loop()
4532
+ loop.run_until_complete(self._async_link_semantic_definition(data_definition_guid, glossary_term_guid, body))
4533
+
4534
+ async def _async_detach_semantic_definition(self, data_definition_guid: str, glossary_term_guid: str,
4535
+ body: dict = None) -> None:
4536
+ """
4537
+ Detach a data definition from a glossary term. Request body is optional. Async version.
4538
+
4539
+ Parameters
4540
+ ----------
4541
+ data_definition_guid: str
4542
+ - the GUID of the data class definition.
4543
+ glossary_term_guid: str
4544
+ - the GUID of the glossary term to be disconnected.
4545
+ body: dict, optional
4546
+ - a dictionary containing additional properties.
4547
+
4548
+ Returns
4549
+ -------
4550
+ None
4551
+
4552
+ Raises
4553
+ ------
4554
+ InvalidParameterException
4555
+ one of the parameters is null or invalid or
4556
+ PropertyServerException
4557
+ There is a problem adding the element properties to the metadata repository or
4558
+ UserNotAuthorizedException
4559
+ the requesting user is not authorized to issue this request.
4560
+
4561
+ Note
4562
+ ----
4563
+
4564
+ Sample body:
4565
+
4566
+ {
4567
+ "class": "MetadataSourceRequestBody",
4568
+ "externalSourceGUID": "add guid here",
4569
+ "externalSourceName": "add qualified name here",
4570
+ "effectiveTime": "{{$isoTimestamp}}",
4571
+ "forLineage": false,
4572
+ "forDuplicateProcessing": false
4573
+ }
4574
+
4575
+
4576
+ """
4577
+
4578
+ url = (f"{base_path(self, self.view_server)}/data-definitions/{data_definition_guid}"
4579
+ f"/semantic-definition/{glossary_term_guid}/detach")
4580
+
4581
+ if body is None:
4582
+ await self._async_make_request("POST", url)
4583
+ else:
4584
+ await self._async_make_request("POST", url, body_slimmer(body))
4585
+
4586
+ def detach_semantic_definition(self, data_definition_guid: str, glossary_term_guid: str, body: dict = None) -> None:
4587
+ """
4588
+ Detach a data definition from a glossary term. Request body is optional.
4589
+
4590
+ Parameters
4591
+ ----------
4592
+ data_definition_guid: str
4593
+ - the GUID of the data class definition.
4594
+ glossary_term_guid: str
4595
+ - the GUID of the glossary term to be disconnected.
4596
+ body: dict, optional
4597
+ - a dictionary containing additional properties.
4598
+
4599
+ Returns
4600
+ -------
4601
+ None
4602
+
4603
+ Raises
4604
+ ------
4605
+ InvalidParameterException
4606
+ one of the parameters is null or invalid or
4607
+ PropertyServerException
4608
+ There is a problem adding the element properties to the metadata repository or
4609
+ UserNotAuthorizedException
4610
+ the requesting user is not authorized to issue this request.
4611
+
4612
+ Note
4613
+ ----
4614
+
4615
+ Sample body:
4616
+
4617
+ {
4618
+ "class": "MetadataSourceRequestBody",
4619
+ "externalSourceGUID": "add guid here",
4620
+ "externalSourceName": "add qualified name here",
4621
+ "effectiveTime": "{{$isoTimestamp}}",
4622
+ "forLineage": false,
4623
+ "forDuplicateProcessing": false
4624
+ }
4625
+
4626
+
4627
+ """
4628
+
4629
+ loop = asyncio.get_event_loop()
4630
+ loop.run_until_complete(self._async_detach_semantic_definition(data_definition_guid, glossary_term_guid, body))
4631
+
4632
+ async def _async_link_certification_type_to_data_structure(self, certification_type_guid: str,
4633
+ data_structure_guid: str, body: dict = None) -> None:
4634
+ """
4635
+ Connect a certification type to a data structure to guide the survey action service (that checks the data
4636
+ quality of a data resource as part of certifying it with the supplied certification type) to the definition
4637
+ of the data structure to use as a specification of how the data should be both structured and (if data
4638
+ classes are attached to the associated data fields using the DataClassDefinition relationship) contain the
4639
+ valid values. Request body is optional.
4640
+ Async version
4641
+
4642
+ Parameters
4643
+ ----------
4644
+ certification_type_guid: str
4645
+ - the GUID of the certification type to link.
4646
+ data_structure_guid: str
4647
+ - the GUID of the data structure to be connected.
4648
+ body: dict, optional
4649
+ - a dictionary containing additional properties.
4650
+
4651
+ Returns
4652
+ -------
4653
+ None
4654
+
4655
+ Raises
4656
+ ------
4657
+ InvalidParameterException
4658
+ one of the parameters is null or invalid or
4659
+ PropertyServerException
4660
+ There is a problem adding the element properties to the metadata repository or
4661
+ UserNotAuthorizedException
4662
+ the requesting user is not authorized to issue this request.
4663
+
4664
+ Note
4665
+ ----
4666
+
4667
+ Sample body:
4668
+
4669
+ {
4670
+ "class": "MetadataSourceRequestBody",
4671
+ "externalSourceGUID": "add guid here",
4672
+ "externalSourceName": "add qualified name here",
4673
+ "effectiveTime": "{{$isoTimestamp}}",
4674
+ "forLineage": false,
4675
+ "forDuplicateProcessing": false
4676
+ }
4677
+
4678
+ """
4679
+
4680
+ url = (f"{base_path(self, self.view_server)}/certification-types/{certification_type_guid}"
4681
+ f"/data-structure-definition/{data_structure_guid}/attach")
4682
+
4683
+ if body is None:
4684
+ await self._async_make_request("POST", url)
4685
+ else:
4686
+ await self._async_make_request("POST", url, body_slimmer(body))
4687
+
4688
+ def link_certification_type_to_data_structure(self, certification_type_guid: str, data_structure_guid: str,
4689
+ body: dict = None) -> None:
4690
+ """
4691
+ Connect a certification type to a data structure to guide the survey action service (that checks the data
4692
+ quality of a data resource as part of certifying it with the supplied certification type) to the definition
4693
+ of the data structure to use as a specification of how the data should be both structured and (if data
4694
+ classes are attached to the associated data fields using the DataClassDefinition relationship) contain the
4695
+ valid values. Request body is optional.
4696
+
4697
+ Parameters
4698
+ ----------
4699
+ certification_type_guid: str
4700
+ - the GUID of the certification type to link.
4701
+ data_structure_guid: str
4702
+ - the GUID of the data structure to be connected.
4703
+ body: dict, optional
4704
+ - a dictionary containing additional properties.
4705
+
4706
+ Returns
4707
+ -------
4708
+ None
4709
+
4710
+ Raises
4711
+ ------
4712
+ InvalidParameterException
4713
+ one of the parameters is null or invalid or
4714
+ PropertyServerException
4715
+ There is a problem adding the element properties to the metadata repository or
4716
+ UserNotAuthorizedException
4717
+ the requesting user is not authorized to issue this request.
4718
+
4719
+ Note
4720
+ ----
4721
+
4722
+ Sample body:
4723
+
4724
+ {
4725
+ "class": "MetadataSourceRequestBody",
4726
+ "externalSourceGUID": "add guid here",
4727
+ "externalSourceName": "add qualified name here",
4728
+ "effectiveTime": "{{$isoTimestamp}}",
4729
+ "forLineage": false,
4730
+ "forDuplicateProcessing": false
4731
+ }
4732
+
4733
+ """
4734
+
4735
+ loop = asyncio.get_event_loop()
4736
+ loop.run_until_complete(
4737
+ self._async_link_certification_type_to_data_structure(certification_type_guid, data_structure_guid, body))
4738
+
4739
+ async def _async_detach_certification_type_from_data_structure(self, certification_type_guid: str,
4740
+ data_structure_guid: str, body: dict = None) -> None:
4741
+ """
4742
+ Detach a data structure from a certification type. Request body is optional. Async version.
4743
+
4744
+ Parameters
4745
+ ----------
4746
+ certification_type_guid: str
4747
+ - the GUID of the certification type to link.
4748
+ data_structure_guid: str
4749
+ - the GUID of the data structure to be connected.
4750
+ body: dict, optional
4751
+ - a dictionary containing additional properties.
4752
+
4753
+ Returns
4754
+ -------
4755
+ None
4756
+
4757
+ Raises
4758
+ ------
4759
+ InvalidParameterException
4760
+ one of the parameters is null or invalid or
4761
+ PropertyServerException
4762
+ There is a problem adding the element properties to the metadata repository or
4763
+ UserNotAuthorizedException
4764
+ the requesting user is not authorized to issue this request.
4765
+
4766
+ Note
4767
+ ----
4768
+
4769
+ Sample body:
4770
+
4771
+ {
4772
+ "class": "MetadataSourceRequestBody",
4773
+ "externalSourceGUID": "add guid here",
4774
+ "externalSourceName": "add qualified name here",
4775
+ "effectiveTime": "{{$isoTimestamp}}",
4776
+ "forLineage": false,
4777
+ "forDuplicateProcessing": false
4778
+ }
4779
+
4780
+ """
4781
+
4782
+ url = (f"{base_path(self, self.view_server)}/certification-stypes/{certification_type_guid}"
4783
+ f"/data-structure-definition/{data_structure_guid}/detach")
4784
+
4785
+ if body is None:
4786
+ await self._async_make_request("POST", url)
4787
+ else:
4788
+ await self._async_make_request("POST", url, body_slimmer(body))
4789
+
4790
+ def detach_certification_type_from_data_structure(self, certification_type_guid: str, data_structure_guid: str,
4791
+ body: dict = None) -> None:
4792
+ """
4793
+ Detach a data structure from a certification type. Request body is optional.
4794
+
4795
+ Parameters
4796
+ ----------
4797
+ certification_type_guid: str
4798
+ - the GUID of the certification type to link.
4799
+ data_structure_guid: str
4800
+ - the GUID of the data structure to be connected.
4801
+ body: dict, optional
4802
+ - a dictionary containing additional properties.
4803
+
4804
+ Returns
4805
+ -------
4806
+ None
4807
+
4808
+ Raises
4809
+ ------
4810
+ InvalidParameterException
4811
+ one of the parameters is null or invalid or
4812
+ PropertyServerException
4813
+ There is a problem adding the element properties to the metadata repository or
4814
+ UserNotAuthorizedException
4815
+ the requesting user is not authorized to issue this request.
4816
+
4817
+ Note
4818
+ ----
4819
+
4820
+ Sample body:
4821
+
4822
+ {
4823
+ "class": "MetadataSourceRequestBody",
4824
+ "externalSourceGUID": "add guid here",
4825
+ "externalSourceName": "add qualified name here",
4826
+ "effectiveTime": "{{$isoTimestamp}}",
4827
+ "forLineage": false,
4828
+ "forDuplicateProcessing": false
4829
+ }
4830
+
4831
+ """
4832
+
4833
+ loop = asyncio.get_event_loop()
4834
+ loop.run_until_complete(
4835
+ self._async_detach_certification_type_from_data_structure(certification_type_guid, data_structure_guid,
4836
+ body))
4837
+
4838
+ def generate_data_structure_output(self, elements, filter, output_format) -> str | list:
4839
+ match output_format:
4840
+ case "MERMAID":
4841
+ return extract_mermaid_only(elements)
4842
+ case "DICT":
4843
+ return extract_basic_dict(elements)
4844
+ case _:
4845
+ return None
4846
+
4847
+
4848
+ if __name__ == "__main__":
4849
+ print("Data Designer")