pyegeria 5.3.10__py3-none-any.whl → 5.4.0.dev3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. commands/cat/debug_log.2025-06-05_20-24-18_123924.log.zip +0 -0
  2. commands/cat/debug_log.2025-06-10_08-45-03_929921.log.zip +0 -0
  3. commands/cat/debug_log.2025-06-11_09-57-21_247890.log.zip +0 -0
  4. commands/cat/debug_log.2025-06-12_16-14-31_212042.log.zip +0 -0
  5. commands/cat/debug_log.log +1267 -0
  6. commands/cat/dr_egeria_md.py +32 -5
  7. commands/cat/list_collections.py +10 -4
  8. commands/cat/list_data_designer.py +172 -0
  9. commands/cat/solution_architect_log.log +0 -0
  10. md_processing/__init__.py +7 -2
  11. md_processing/data/commands.json +4666 -848
  12. md_processing/dr_egeria_inbox/data_designer_search_test.md +11 -0
  13. md_processing/dr_egeria_inbox/data_test.md +106 -13
  14. md_processing/dr_egeria_inbox/data_test2.md +376 -0
  15. md_processing/dr_egeria_inbox/{search_test.md → glossary_search_test.md} +1 -0
  16. md_processing/dr_egeria_inbox/solution-components.md +66 -91
  17. md_processing/md_commands/data_designer_commands.py +840 -557
  18. md_processing/md_commands/solution_architect_commands.py +985 -0
  19. md_processing/md_processing_utils/common_md_proc_utils.py +262 -89
  20. md_processing/md_processing_utils/common_md_utils.py +11 -4
  21. md_processing/md_processing_utils/md_processing_constants.py +18 -16
  22. pyegeria/_client.py +39 -0
  23. pyegeria/classification_manager_omvs.py +1 -1
  24. pyegeria/collection_manager_omvs.py +248 -188
  25. pyegeria/data_designer_omvs.py +217 -9
  26. pyegeria/governance_officer_omvs.py +2349 -0
  27. pyegeria/output_formatter.py +24 -12
  28. pyegeria/solution_architect_omvs.py +4219 -1084
  29. pyegeria/utils.py +15 -2
  30. {pyegeria-5.3.10.dist-info → pyegeria-5.4.0.dev3.dist-info}/METADATA +2 -1
  31. {pyegeria-5.3.10.dist-info → pyegeria-5.4.0.dev3.dist-info}/RECORD +35 -36
  32. {pyegeria-5.3.10.dist-info → pyegeria-5.4.0.dev3.dist-info}/entry_points.txt +4 -0
  33. md_processing/dr_egeria_outbox/processed-2025-05-15 19:52-data_test.md +0 -94
  34. md_processing/dr_egeria_outbox/processed-2025-05-16 07:39-data_test.md +0 -88
  35. md_processing/dr_egeria_outbox/processed-2025-05-17 16:01-data_field.md +0 -56
  36. md_processing/dr_egeria_outbox/processed-2025-05-18 15:51-data_test.md +0 -103
  37. md_processing/dr_egeria_outbox/processed-2025-05-18 16:47-data_test.md +0 -94
  38. md_processing/dr_egeria_outbox/processed-2025-05-19 07:14-data_test.md +0 -96
  39. md_processing/dr_egeria_outbox/processed-2025-05-19 07:20-data_test.md +0 -100
  40. md_processing/dr_egeria_outbox/processed-2025-05-19 07:22-data_test.md +0 -88
  41. md_processing/dr_egeria_outbox/processed-2025-05-19 09:26-data_test.md +0 -91
  42. md_processing/dr_egeria_outbox/processed-2025-05-19 10:27-data_test.md +0 -91
  43. md_processing/dr_egeria_outbox/processed-2025-05-19 14:04-data_test.md +0 -91
  44. md_processing/md_commands/blueprint_commands.py +0 -303
  45. /commands/cat/{list_data_structures.py → list_data_structures_full.py} +0 -0
  46. {pyegeria-5.3.10.dist-info → pyegeria-5.4.0.dev3.dist-info}/LICENSE +0 -0
  47. {pyegeria-5.3.10.dist-info → pyegeria-5.4.0.dev3.dist-info}/WHEEL +0 -0
@@ -0,0 +1,2349 @@
1
+ """PDX-License-Identifier: Apache-2.0
2
+ Copyright Contributors to the ODPi Egeria project.
3
+
4
+ This module provides access to the Governance Officer OMVS module.
5
+
6
+
7
+ """
8
+
9
+ import asyncio
10
+ import os
11
+ import sys
12
+ from typing import Dict, List, Union
13
+
14
+ from httpx import Response
15
+
16
+ from pyegeria import validate_guid
17
+ from pyegeria._client import Client, max_paging_size
18
+ from pyegeria._globals import NO_ELEMENTS_FOUND
19
+ from pyegeria.utils import body_slimmer
20
+
21
+ sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
22
+
23
+ DEFAULT_BODY_SKELETON = {
24
+ "effective_time": None, "limitResultsByStatus": ["ACTIVE"], "asOfTime": None, "sequencingOrder": None,
25
+ "sequencingProperty": None, "filter": None,
26
+ }
27
+
28
+
29
+ def query_seperator(current_string):
30
+ if current_string == "":
31
+ return "?"
32
+ else:
33
+ return "&"
34
+
35
+
36
+ # ("params are in the form of [(paramName, value), (param2Name, value)] if the value is not None, it will be added to "
37
+ # "the query string")
38
+
39
+
40
+ def query_string(params):
41
+ result = ""
42
+ for i in range(len(params)):
43
+ if params[i][1] is not None:
44
+ result = f"{result}{query_seperator(result)}{params[i][0]}={params[i][1]}"
45
+ return result
46
+
47
+
48
+ def base_path(client, view_server: str):
49
+ return f"{client.platform_url}/servers/{view_server}/api/open-metadata/metadata-explorer"
50
+
51
+
52
+ class GovernanceOfficer(Client):
53
+ """GovernanceOfficer is a class that extends the Client class. The Governance Officer OMVS provides APIs for
54
+ defining and managing governance definitions.
55
+
56
+ Attributes:
57
+
58
+ view_server: str
59
+ The name of the View Server to connect to.
60
+ platform_url : str
61
+ URL of the server platform to connect to
62
+ user_id : str
63
+ The identity of the user calling the method - this sets a
64
+ default optionally used by the methods when the user
65
+ doesn't pass the user_id on a method call.
66
+ user_pwd: str
67
+ The password associated with the user_id. Defaults to None
68
+
69
+
70
+ """
71
+
72
+ def __init__(self, view_server: str, platform_url: str, user_id: str = None, user_pwd: str = None,
73
+ token: str = None, ):
74
+ self.view_server = view_server
75
+ self.platform_url = platform_url
76
+ self.user_id = user_id
77
+ self.user_pwd = user_pwd
78
+
79
+ Client.__init__(self, view_server, platform_url, user_id=user_id, user_pwd=user_pwd, token=token, )
80
+
81
+ #
82
+ # Extract properties functions
83
+ #
84
+
85
+ def _extract_supply_chain_list(self, element: Union[Dict, List[Dict]]) -> List[Dict]:
86
+ """
87
+ Normalize supply chain response for a list of dictionaries.
88
+ Args:
89
+ element: Dict or List
90
+
91
+ Returns:
92
+ list of Dict
93
+
94
+ """
95
+ if isinstance(element, dict):
96
+ return [self._extract_info_supply_chain_properties(element)]
97
+ elif isinstance(element, list):
98
+ comp_list = []
99
+ for i in range(len(element)):
100
+ comp_list.append(self._extract_info_supply_chain_properties(element[i]))
101
+ return comp_list
102
+ else:
103
+ return []
104
+
105
+ def _extract_info_supply_chain_properties(self, element: dict) -> dict:
106
+ """
107
+ Extract properties from an information supply chain element.
108
+
109
+ Args:
110
+ element: Dictionary containing element data
111
+
112
+ Returns:
113
+ Dictionary with extracted properties
114
+ """
115
+ guid = element['elementHeader'].get("guid", None)
116
+ properties = element['properties']
117
+ qualified_name = properties.get("qualifiedName", None)
118
+ display_name = properties.get("displayName", None)
119
+ description = properties.get("description", None)
120
+ scope = properties.get("scope", None)
121
+ purposes = properties.get("purposes", [])
122
+ purpose_md = ""
123
+ if len(purposes) > 0:
124
+ for purpose in purposes:
125
+ purpose_md += f"{purpose},\n"
126
+ extended_properties = properties.get("extendedProperties", {})
127
+ additional_properties = properties.get("additionalProperties", {})
128
+ segments = element.get("segments", [])
129
+ segments_list = []
130
+ if len(segments) > 0:
131
+ for segment in segments:
132
+ segment_dict = {}
133
+ segment_guid = segment['elementHeader'].get("guid", "")
134
+ segment_props = segment['properties']
135
+ segment_qname = segment_props.get("qualifiedName", "")
136
+ segment_display_name = segment_props.get("displayName", "")
137
+ segment_description = segment_props.get("description", "")
138
+ segment_scope = segment_props.get("scope", "")
139
+ segment_integration_style = segment_props.get("integrationStyle", "")
140
+ segment_estimated_volumetrics = segment_props.get("estimatedVolumetrics", "")
141
+ segment_dict["segment_display_name"] = segment_display_name
142
+ segment_dict["segment_qname"] = segment_qname
143
+ segment_dict["segment_guid"] = segment_guid
144
+ segment_dict["segment_description"] = segment_description
145
+ segment_dict["segment_scope"] = segment_scope
146
+ segment_dict["segment_estimated_volumetrics"] = segment_estimated_volumetrics
147
+ segments_list.append(segment_dict)
148
+
149
+ return {
150
+ 'guid': guid, 'qualified_name': qualified_name, 'display_name': display_name, 'description': description,
151
+ 'scope': scope, 'purposes': purpose_md, 'extended_properties': extended_properties,
152
+ 'additional_properties': additional_properties, 'segments': segments_list
153
+ }
154
+
155
+ def _extract_solution_blueprint_properties(self, element: dict) -> dict:
156
+ """
157
+ Extract properties from a solution blueprint element.
158
+
159
+ Args:
160
+ element: Dictionary containing element data
161
+
162
+ Returns:
163
+ Dictionary with extracted properties
164
+ """
165
+ guid = element['elementHeader'].get("guid", None)
166
+ element_properties = element['properties']
167
+ display_name = element_properties.get("displayName", None)
168
+ description = element_properties.get("description", None)
169
+ version = element_properties.get("version", None)
170
+ qualified_name = element_properties.get("qualifiedName", None)
171
+
172
+ solution_components = element.get('solutionComponents', None)
173
+ solution_components_md = ""
174
+ if solution_components:
175
+ for solution_component in solution_components:
176
+ sol_comp_prop = solution_component['solutionComponent']['properties']
177
+ sol_comp_name = sol_comp_prop.get("displayName", None)
178
+ sol_comp_desc = sol_comp_prop.get("description", None)
179
+ solution_components_md += '{' + f" {sol_comp_name}:\t {sol_comp_desc}" + " },\n"
180
+
181
+ return {
182
+ 'guid': guid, 'qualified_name': qualified_name, 'display_name': display_name, 'description': description,
183
+ 'version': version, 'solution_components': solution_components_md
184
+ }
185
+
186
+ def _extract_solution_roles_properties(self, element: dict) -> dict:
187
+ """
188
+ Extract properties from a solution role element.
189
+
190
+ Args:
191
+ element: Dictionary containing element data
192
+
193
+ Returns:
194
+ Dictionary with extracted properties
195
+ """
196
+ guid = element['elementHeader'].get("guid", None)
197
+ element_properties = element['properties']
198
+ display_name = element_properties.get("title", None)
199
+ role_id = element_properties.get("roleId", None)
200
+ scope = element_properties.get("scope", None)
201
+ description = element_properties.get("description", None)
202
+ domain_identifier = element_properties.get("domainIdentifier", None)
203
+ qualified_name = element_properties.get("qualifiedName", None)
204
+
205
+ solution_components = element.get('solutionComponents', None)
206
+ solution_components_md = ""
207
+ if solution_components:
208
+ for solution_component in solution_components:
209
+ sol_comp_prop = solution_component.get('relationshipProperties', None)
210
+ if sol_comp_prop:
211
+ sol_comp_name = sol_comp_prop.get("role", None)
212
+ sol_comp_desc = sol_comp_prop.get("description", None)
213
+ solution_components_md += "{" + f" {sol_comp_name}:\t {sol_comp_desc}" + " },\n"
214
+
215
+ return {
216
+ 'guid': guid, 'qualified_name': qualified_name, 'display_name': display_name, 'description': description,
217
+ 'role_id': role_id, 'scope': scope, 'domain_identifier': domain_identifier,
218
+ 'solution_components': solution_components_md
219
+ }
220
+
221
+ def _extract_component_list(self, element: Union[Dict, List[Dict]]) -> List[Dict]:
222
+ """
223
+ Normalize for a list of dictionaries.
224
+ Args:
225
+ element: Dict or List
226
+
227
+ Returns:
228
+ list of Dict
229
+
230
+ """
231
+ if isinstance(element, dict):
232
+ return [self._extract_solution_components_properties(element)]
233
+ elif isinstance(element, list):
234
+ comp_list = []
235
+ for i in range(len(element)):
236
+ comp_list.append(self._extract_solution_components_properties(element[i]))
237
+ return comp_list
238
+ else:
239
+ return []
240
+
241
+ def _extract_solution_components_properties(self, element: Union[Dict, List[Dict]]) -> dict:
242
+ """
243
+ Extract properties from a solution component element.
244
+
245
+ Args:
246
+ element: Dictionary containing element data
247
+
248
+ Returns:
249
+ Dictionary with extracted properties
250
+ """
251
+
252
+ guid = element['elementHeader'].get("guid", None)
253
+ properties = element.get('glossaryCategoryProperties', element.get('properties', {}))
254
+ display_name = properties.get("displayName", None)
255
+ description = properties.get("description", None)
256
+ component_type = properties.get("solutionComponentType", properties.get("componentType", None))
257
+ version = properties.get("version", None)
258
+ qualified_name = properties.get("qualifiedName", None)
259
+
260
+ # Extract extended properties
261
+ extended_props = properties.get("extendedProperties", None)
262
+ extended_props_md = ""
263
+ if extended_props:
264
+ for key in extended_props.keys():
265
+ extended_props_md += "{" + f" {key}: {extended_props[key]}" + " }, "
266
+
267
+ # Extract additional properties
268
+ additional_props = properties.get("additionalProperties", None)
269
+ additional_props_md = ""
270
+ if additional_props:
271
+ for key in additional_props.keys():
272
+ additional_props_md += "{" + f" {key}: {additional_props[key]}" + " }, "
273
+
274
+ # Extract blueprints
275
+ blueprints_md = ""
276
+ blueprints = element.get('blueprints', None)
277
+ if blueprints:
278
+ for blueprint in blueprints:
279
+ if 'relatedElement' in blueprint:
280
+ bp_q_name = blueprint["relatedElement"]['properties']['qualifiedName']
281
+ blueprints_md += f" {bp_q_name}, \n"
282
+ elif 'blueprint' in blueprint:
283
+ bp_prop = blueprint['blueprint']['properties']
284
+ bp_name = bp_prop.get("displayName", None)
285
+ bp_desc = bp_prop.get("description", None)
286
+ blueprints_md += "{" + f" {bp_name}:\t {bp_desc}" + " },\n"
287
+
288
+ # Extract parent components
289
+ parent_comp_md = ""
290
+ context = element.get("context", None)
291
+ if context:
292
+ parent_components = element.get('parentComponents', None)
293
+ if parent_components:
294
+ for parent_component in parent_components:
295
+ parent_comp_prop = parent_component['parentComponent']['properties']
296
+ parent_comp_name = parent_comp_prop.get("name", None)
297
+ parent_comp_desc = parent_comp_prop.get("description", None)
298
+ parent_comp_md += f" {parent_comp_name}"
299
+
300
+ # Extract sub components
301
+ sub_comp_md = ""
302
+ sub_components = element.get('subComponents', None)
303
+ if sub_components:
304
+ for sub_component in sub_components:
305
+ sub_comp_prop = sub_component['properties']
306
+ sub_comp_name = sub_comp_prop.get("displayName", None)
307
+ sub_comp_desc = sub_comp_prop.get("description", None)
308
+ sub_comp_md += f" {sub_comp_name}"
309
+
310
+ comp_graph = element.get('mermaidGraph', None)
311
+
312
+ return {
313
+ 'guid': guid, 'qualified_name': qualified_name, 'display_name': display_name, 'description': description,
314
+ 'component_type': component_type, 'version': version, 'blueprints': blueprints_md,
315
+ 'parent_components': parent_comp_md, 'sub_components': sub_comp_md,
316
+ 'additional_properties': additional_props_md, 'extended_properties': extended_props_md,
317
+ 'mermaid_graph': comp_graph
318
+ }
319
+
320
+ #
321
+ # Markdown output support
322
+ #
323
+
324
+ async def _async_create_governance_definition(self, url_marker: str, body: dict) -> str:
325
+ """Create an information supply. Async version.
326
+
327
+ Parameters
328
+ ----------
329
+ url_marker: str
330
+ Indicates which service should be used to create the governance definition.
331
+ body: dict
332
+ A dictionary containing the definition of the supply chain to create.
333
+
334
+ Returns
335
+ -------
336
+
337
+ str - guid of the supply chain created.
338
+
339
+ Raises
340
+ ------
341
+ InvalidParameterException
342
+ one of the parameters is null or invalid or
343
+ PropertyServerException
344
+ There is a problem adding the element properties to the metadata repository or
345
+ UserNotAuthorizedException
346
+ the requesting user is not authorized to issue this request.
347
+
348
+ Notes
349
+ ----
350
+ https://egeria-project.org/concepts/governance-definition
351
+
352
+ Body structure:
353
+ {
354
+ "externalSourceGUID": "string",
355
+ "externalSourceName": "string",
356
+ "forLineage": true,
357
+ "forDuplicateProcessing": true,
358
+ "effectiveTime": "2025-06-12T21:00:52.332Z",
359
+ "anchorGUID": "string",
360
+ "isOwnAnchor": true,
361
+ "anchorScopeGUID": "string",
362
+ "parentGUID": "string",
363
+ "parentRelationshipTypeName": "string",
364
+ "parentRelationshipProperties": {
365
+ "propertyValueMap": {
366
+ "additionalProp1": {
367
+ "typeName": "string",
368
+ "class": "string",
369
+ "arrayCount": 0,
370
+ "arrayValues": "string"
371
+ },
372
+ "additionalProp2": {
373
+ "typeName": "string",
374
+ "class": "string",
375
+ "arrayCount": 0,
376
+ "arrayValues": "string"
377
+ },
378
+ "additionalProp3": {
379
+ "typeName": "string",
380
+ "class": "string",
381
+ "arrayCount": 0,
382
+ "arrayValues": "string"
383
+ }
384
+ },
385
+ "propertyCount": 0,
386
+ "propertiesAsStrings": {
387
+ "additionalProp1": "string",
388
+ "additionalProp2": "string",
389
+ "additionalProp3": "string"
390
+ },
391
+ "propertyNames": {}
392
+ },
393
+ "parentAtEnd1": true,
394
+ "properties": {
395
+ "effectiveFrom": "2025-06-12T21:00:52.332Z",
396
+ "effectiveTo": "2025-06-12T21:00:52.332Z",
397
+ "typeName": "string",
398
+ "extendedProperties": {
399
+ "additionalProp1": {},
400
+ "additionalProp2": {},
401
+ "additionalProp3": {}
402
+ },
403
+ "documentIdentifier": "string",
404
+ "additionalProperties": {
405
+ "additionalProp1": "string",
406
+ "additionalProp2": "string",
407
+ "additionalProp3": "string"
408
+ },
409
+ "title": "string",
410
+ "summary": "string",
411
+ "description": "string",
412
+ "scope": "string",
413
+ "domainIdentifier": 0,
414
+ "importance": "string",
415
+ "implications": [
416
+ "string"
417
+ ],
418
+ "outcomes": [
419
+ "string"
420
+ ],
421
+ "results": [
422
+ "string"
423
+ ],
424
+ "class": "string"
425
+ },
426
+ "initialStatus": "GovernanceDefinitionStatus : Draft"
427
+ }
428
+
429
+ """
430
+ url = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance_definitions"
431
+
432
+ response = await self._async_make_request("POST", url, body_slimmer(body))
433
+
434
+ return response.json().get("guid", "Supply Chain not created")
435
+
436
+ def create_governance_definition(self, url_marker: str, body: dict) -> str:
437
+ """Create a governance definition.
438
+
439
+ Parameters
440
+ ----------
441
+ url_marker: str
442
+ Indicates which service should be used to create the governance definition.
443
+ body: dict
444
+ A dictionary containing the definition of the supply chain to create.
445
+
446
+ Returns
447
+ -------
448
+
449
+ str - guid of the supply chain created.
450
+
451
+ Raises
452
+ ------
453
+ InvalidParameterException
454
+ one of the parameters is null or invalid or
455
+ PropertyServerException
456
+ There is a problem adding the element properties to the metadata repository or
457
+ UserNotAuthorizedException
458
+ the requesting user is not authorized to issue this request.
459
+
460
+ Notes
461
+ ----
462
+
463
+ Body structure:
464
+ {
465
+ "externalSourceGUID": "string",
466
+ "externalSourceName": "string",
467
+ "forLineage": true,
468
+ "forDuplicateProcessing": true,
469
+ "effectiveTime": "2025-06-12T21:00:52.332Z",
470
+ "anchorGUID": "string",
471
+ "isOwnAnchor": true,
472
+ "anchorScopeGUID": "string",
473
+ "parentGUID": "string",
474
+ "parentRelationshipTypeName": "string",
475
+ "parentRelationshipProperties": {
476
+ "propertyValueMap": {
477
+ "additionalProp1": {
478
+ "typeName": "string",
479
+ "class": "string",
480
+ "arrayCount": 0,
481
+ "arrayValues": "string"
482
+ },
483
+ "additionalProp2": {
484
+ "typeName": "string",
485
+ "class": "string",
486
+ "arrayCount": 0,
487
+ "arrayValues": "string"
488
+ },
489
+ "additionalProp3": {
490
+ "typeName": "string",
491
+ "class": "string",
492
+ "arrayCount": 0,
493
+ "arrayValues": "string"
494
+ }
495
+ },
496
+ "propertyCount": 0,
497
+ "propertiesAsStrings": {
498
+ "additionalProp1": "string",
499
+ "additionalProp2": "string",
500
+ "additionalProp3": "string"
501
+ },
502
+ "propertyNames": {}
503
+ },
504
+ "parentAtEnd1": true,
505
+ "properties": {
506
+ "effectiveFrom": "2025-06-12T21:00:52.332Z",
507
+ "effectiveTo": "2025-06-12T21:00:52.332Z",
508
+ "typeName": "string",
509
+ "extendedProperties": {
510
+ "additionalProp1": {},
511
+ "additionalProp2": {},
512
+ "additionalProp3": {}
513
+ },
514
+ "documentIdentifier": "string",
515
+ "additionalProperties": {
516
+ "additionalProp1": "string",
517
+ "additionalProp2": "string",
518
+ "additionalProp3": "string"
519
+ },
520
+ "title": "string",
521
+ "summary": "string",
522
+ "description": "string",
523
+ "scope": "string",
524
+ "domainIdentifier": 0,
525
+ "importance": "string",
526
+ "implications": [
527
+ "string"
528
+ ],
529
+ "outcomes": [
530
+ "string"
531
+ ],
532
+ "results": [
533
+ "string"
534
+ ],
535
+ "class": "string"
536
+ },
537
+ "initialStatus": "GovernanceDefinitionStatus : Draft"
538
+ }
539
+
540
+ """
541
+
542
+ loop = asyncio.get_event_loop()
543
+ response = loop.run_until_complete(self._async_create_governance_definition(url_marker, body))
544
+ return response
545
+
546
+ async def _async_delete_governance_definition(self, guid: str, url_marker: str, body: dict) -> str:
547
+ """ Delete an information supply. Async version.
548
+
549
+ Parameters
550
+ ----------
551
+ guid: str
552
+ GUID of the governance definition to delete.
553
+ url_marker: str
554
+ Indicates which service should be used to create the governance definition.
555
+ body: dict
556
+ A dictionary containing the definition of the supply chain to create.
557
+
558
+ Returns
559
+ -------
560
+
561
+ str - guid of the supply chain created.
562
+
563
+ Raises
564
+ ------
565
+ InvalidParameterException
566
+ one of the parameters is null or invalid or
567
+ PropertyServerException
568
+ There is a problem adding the element properties to the metadata repository or
569
+ UserNotAuthorizedException
570
+ the requesting user is not authorized to issue this request.
571
+
572
+ Notes
573
+ ----
574
+ https://egeria-project.org/concepts/governance-definition
575
+
576
+ Body structure:
577
+ {
578
+ "class": "",
579
+ "externalSourceGUID": "string",
580
+ "externalSourceName": "string",
581
+ "forLineage": true,
582
+ "forDuplicateProcessing": true,
583
+ "effectiveTime": "2025-06-13T01:45:46.235Z"
584
+ }
585
+ """
586
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
587
+ f"{url_marker}/governance_definitions/delete")
588
+
589
+ response = await self._async_make_request("POST", url, body_slimmer(body))
590
+
591
+ return
592
+
593
+ def create_delete_governance_definition(self, guid: str, url_marker: str, body: dict) -> str:
594
+ """ Delete an information supply. Async version.
595
+
596
+ Parameters
597
+ ----------
598
+ guid: str
599
+ GUID of the governance definition to delete.
600
+ url_marker: str
601
+ Indicates which service should be used to create the governance definition.
602
+ body: dict
603
+ A dictionary containing the definition of the supply chain to create.
604
+
605
+ Returns
606
+ -------
607
+
608
+ str - guid of the supply chain created.
609
+
610
+ Raises
611
+ ------
612
+ InvalidParameterException
613
+ one of the parameters is null or invalid or
614
+ PropertyServerException
615
+ There is a problem adding the element properties to the metadata repository or
616
+ UserNotAuthorizedException
617
+ the requesting user is not authorized to issue this request.
618
+
619
+ Notes
620
+ ----
621
+ https://egeria-project.org/concepts/governance-definition
622
+
623
+ Body structure:
624
+ {
625
+ "class": "",
626
+ "externalSourceGUID": "string",
627
+ "externalSourceName": "string",
628
+ "forLineage": true,
629
+ "forDuplicateProcessing": true,
630
+ "effectiveTime": "2025-06-13T01:45:46.235Z"
631
+ }
632
+ """
633
+
634
+ loop = asyncio.get_event_loop()
635
+ response = loop.run_until_complete(self._async_delete_governance_definition(guid, url_marker, body))
636
+ return
637
+
638
+ async def _async_get_gov_def_in_context(self, guid: str, url_marker: str, body: dict, output_format: str,
639
+ start_from: int = 0, page_size: int = max_paging_size) -> list[dict] | str:
640
+
641
+ """ Get governance definition in context.
642
+ Async version.
643
+
644
+ Parameters
645
+ ----------
646
+ guid: str
647
+ GUID of the governance definition to get.
648
+ url_marker: str
649
+ Indicates which service should be used to create the governance definition.
650
+ body: dict
651
+ A dictionary containing the definition of the supply chain to create.
652
+ output_format: str
653
+ The output format to use.
654
+ start_from: int, default= 0
655
+ Indicates the start of the page range.
656
+ page_size: int, default = max_paging_size
657
+ The page size to use.
658
+
659
+ Returns
660
+ -------
661
+
662
+ list[dict] | str
663
+ A list of information supply chain structures or a string if there are no elements found.
664
+
665
+
666
+ Raises
667
+ ------
668
+ InvalidParameterException
669
+ one of the parameters is null or invalid or
670
+ PropertyServerException
671
+ There is a problem adding the element properties to the metadata repository or
672
+ UserNotAuthorizedException
673
+ the requesting user is not authorized to issue this request.
674
+
675
+ Notes
676
+ ----
677
+ https://egeria-project.org/concepts/governance-definition
678
+
679
+ Body structure:
680
+ {
681
+ "forLineage": true,
682
+ "forDuplicateProcessing": true,
683
+ "effectiveTime": "2025-06-13T14:12:44.896Z",
684
+ "limitResultsByStatus": [
685
+ "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}"
686
+ ],
687
+ "asOfTime": "2025-06-13T14:12:44.896Z",
688
+ "sequencingOrder": "SequencingOrder{Any Order}",
689
+ "sequencingProperty": "string"
690
+ }
691
+
692
+ """
693
+ possible_query_params = query_string([("startFrom", start_from), ("pageSize", page_size)])
694
+
695
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance_definitions/"
696
+ f"in-context{possible_query_params}")
697
+
698
+ if body:
699
+ response = await self._async_make_request("POST", url, body_slimmer(body))
700
+ else:
701
+ response = await self._async_make_request("POST", url)
702
+
703
+ element = response.json().get("elements", NO_ELEMENTS_FOUND)
704
+ if element == NO_ELEMENTS_FOUND:
705
+ return NO_ELEMENTS_FOUND
706
+ if output_format != 'JSON': # return a simplified markdown representation
707
+ return self.generate_gov_def_output(element, guid, output_format)
708
+ return response.json().get("elements", NO_ELEMENTS_FOUND)
709
+
710
+ def get_gov_def_in_context(self, guid: str, url_marker: str, body: dict, output_format: str, start_from: int = 0,
711
+ page_size: int = max_paging_size) -> list[dict] | str:
712
+
713
+ """ Get governance definition in context.
714
+
715
+ Parameters
716
+ ----------
717
+ guid: str
718
+ GUID of the governance definition to get.
719
+ url_marker: str
720
+ Indicates which service should be used to create the governance definition.
721
+ body: dict
722
+ A dictionary containing the definition of the supply chain to create.
723
+ output_format: str
724
+ The output format to use.
725
+ start_from: int, default= 0
726
+ Indicates the start of the page range.
727
+ page_size: int, default = max_paging_size
728
+ The page size to use.
729
+
730
+ Returns
731
+ -------
732
+
733
+ list[dict] | str
734
+ A list of information supply chain structures or a string if there are no elements found.
735
+
736
+
737
+ Raises
738
+ ------
739
+ InvalidParameterException
740
+ one of the parameters is null or invalid or
741
+ PropertyServerException
742
+ There is a problem adding the element properties to the metadata repository or
743
+ UserNotAuthorizedException
744
+ the requesting user is not authorized to issue this request.
745
+
746
+ Notes
747
+ ----
748
+ https://egeria-project.org/concepts/governance-definition
749
+
750
+ Body structure:
751
+ {
752
+ "forLineage": true,
753
+ "forDuplicateProcessing": true,
754
+ "effectiveTime": "2025-06-13T14:12:44.896Z",
755
+ "limitResultsByStatus": [
756
+ "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}"
757
+ ],
758
+ "asOfTime": "2025-06-13T14:12:44.896Z",
759
+ "sequencingOrder": "SequencingOrder{Any Order}",
760
+ "sequencingProperty": "string"
761
+ }
762
+
763
+ """
764
+
765
+ loop = asyncio.get_event_loop()
766
+ response = loop.run_until_complete(
767
+ self._async_get_gov_def_in_context(guid, url_marker, body, output_format, start_from, page_size))
768
+ return response
769
+
770
+ async def _async_get_gov_def_by_guid(self, guid: str, url_marker: str, body: dict, output_format: str,
771
+ start_from: int = 0, page_size: int = max_paging_size) -> dict | str:
772
+
773
+ """ Get governance definition by guid.
774
+ Async version.
775
+
776
+ Parameters
777
+ ----------
778
+ guid: str
779
+ GUID of the governance definition to get.
780
+ url_marker: str
781
+ Indicates which service should be used to create the governance definition.
782
+ body: dict
783
+ A dictionary containing the definition of the supply chain to create.
784
+ output_format: str
785
+ The output format to use.
786
+
787
+ Returns
788
+ -------
789
+
790
+ dict | str
791
+ A list of information supply chain structures or a string if there are no elements found.
792
+
793
+
794
+ Raises
795
+ ------
796
+ InvalidParameterException
797
+ one of the parameters is null or invalid or
798
+ PropertyServerException
799
+ There is a problem adding the element properties to the metadata repository or
800
+ UserNotAuthorizedException
801
+ the requesting user is not authorized to issue this request.
802
+
803
+ Notes
804
+ ----
805
+ https://egeria-project.org/concepts/governance-definition
806
+
807
+ Body structure:
808
+ {
809
+ "effectiveTime": "2025-06-13T14:43:32.194Z",
810
+ "asOfTime": "2025-06-13T14:43:32.194Z",
811
+ "forLineage": true,
812
+ "forDuplicateProcessing": true
813
+ }
814
+
815
+ """
816
+ possible_query_params = query_string([("startFrom", start_from), ("pageSize", page_size)])
817
+
818
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance_definitions/"
819
+ f"retrieve")
820
+
821
+ if body:
822
+ response = await self._async_make_request("POST", url, body_slimmer(body))
823
+ else:
824
+ response = await self._async_make_request("POST", url)
825
+
826
+ element = response.json().get("elements", NO_ELEMENTS_FOUND)
827
+ if element == NO_ELEMENTS_FOUND:
828
+ return NO_ELEMENTS_FOUND
829
+ if output_format != 'JSON': # return a simplified markdown representation
830
+ return self.generate_gov_def_output(element, guid, output_format)
831
+ return response.json().get("elements", NO_ELEMENTS_FOUND)
832
+
833
+ def get_gov_def_by_guid(self, guid: str, url_marker: str, body: dict, output_format: str) -> dict | str:
834
+
835
+ """ Get governance definition by guid.
836
+
837
+ Parameters
838
+ ----------
839
+ guid: str
840
+ GUID of the governance definition to get.
841
+ url_marker: str
842
+ Indicates which service should be used to create the governance definition.
843
+ body: dict
844
+ A dictionary containing the definition of the supply chain to create.
845
+ output_format: str
846
+ The output format to use.
847
+
848
+ Returns
849
+ -------
850
+
851
+ dict | str
852
+ A list of information supply chain structures or a string if there are no elements found.
853
+
854
+
855
+ Raises
856
+ ------
857
+ InvalidParameterException
858
+ one of the parameters is null or invalid or
859
+ PropertyServerException
860
+ There is a problem adding the element properties to the metadata repository or
861
+ UserNotAuthorizedException
862
+ the requesting user is not authorized to issue this request.
863
+
864
+ Notes
865
+ ----
866
+ https://egeria-project.org/concepts/governance-definition
867
+
868
+ Body structure:
869
+ {
870
+ "forLineage": true,
871
+ "forDuplicateProcessing": true,
872
+ "effectiveTime": "2025-06-13T14:12:44.896Z",
873
+ "limitResultsByStatus": [
874
+ "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}"
875
+ ],
876
+ "asOfTime": "2025-06-13T14:12:44.896Z",
877
+ "sequencingOrder": "SequencingOrder{Any Order}",
878
+ "sequencingProperty": "string"
879
+ }
880
+
881
+ """
882
+
883
+ loop = asyncio.get_event_loop()
884
+ response = loop.run_until_complete(self._async_get_gov_def_by_guid(guid, url_marker, body, output_format))
885
+ return response
886
+
887
+ async def _async_update_governance_definition_status(self, guid: str, url_marker: str, body: dict,
888
+ replace_all_properties: bool = False) -> None:
889
+ """ Update the status of a governance definition. Async Version.
890
+
891
+ Parameters
892
+ ----------
893
+ guid: str
894
+ guid of the governance definition to update.
895
+ url_marker: str
896
+ Indicates which service should be used to update the governance definition.
897
+ body: dict
898
+ A dictionary containing the updates to the governance definition.
899
+ replace_all_properties: bool, optional
900
+ Whether to replace all properties with those provided in the body or to merge with existing properties.
901
+
902
+ Returns
903
+ -------
904
+
905
+ None
906
+
907
+ Raises
908
+ ------
909
+ InvalidParameterException
910
+ one of the parameters is null or invalid or
911
+ PropertyServerException
912
+ There is a problem adding the element properties to the metadata repository or
913
+ UserNotAuthorizedException
914
+ the requesting user is not authorized to issue this request.
915
+
916
+ Notes
917
+ ----
918
+
919
+ Body structure:
920
+ {
921
+ "externalSourceGUID": "string",
922
+ "externalSourceName": "string",
923
+ "forLineage": true,
924
+ "forDuplicateProcessing": true,
925
+ "effectiveTime": "2025-06-13T14:57:32.040Z",
926
+ "status": "GovernanceDefinitionStatus : Draft"
927
+ }
928
+ """
929
+ validate_guid(guid)
930
+ replace_all_properties_s = str(replace_all_properties).lower()
931
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance-defnitions/"
932
+ f"{guid}/update-status?replaceAllProperties={replace_all_properties_s}")
933
+
934
+ await self._async_make_request("POST", url, body_slimmer(body))
935
+
936
+ def update_governance_definition_status(self, guid: str, url_marker: str, body: dict,
937
+ replace_all_properties: bool = False) -> None:
938
+ """ Update the status of a governance definition.
939
+
940
+ Parameters
941
+ ----------
942
+ guid: str
943
+ guid of the information supply chain to update.
944
+ url_marker: str
945
+ Indicates which service should be used to update the governance definition.
946
+ body: dict
947
+ A dictionary containing the updates to the supply chain.
948
+ replace_all_properties: bool, optional
949
+ Whether to replace all properties with those provided in the body or to merge with existing properties.
950
+
951
+ Returns
952
+ -------
953
+
954
+ None
955
+
956
+ Raises
957
+ ------
958
+ InvalidParameterException
959
+ one of the parameters is null or invalid or
960
+ PropertyServerException
961
+ There is a problem adding the element properties to the metadata repository or
962
+ UserNotAuthorizedException
963
+ the requesting user is not authorized to issue this request.
964
+
965
+ Notes
966
+ ----
967
+
968
+ Body structure:
969
+ {
970
+ "externalSourceGUID": "string",
971
+ "externalSourceName": "string",
972
+ "forLineage": true,
973
+ "forDuplicateProcessing": true,
974
+ "effectiveTime": "2025-06-13T14:57:32.040Z",
975
+ "status": "GovernanceDefinitionStatus : Draft"
976
+ }
977
+ """
978
+ loop = asyncio.get_event_loop()
979
+ loop.run_until_complete(
980
+ self._async_update_governance_definition_status(guid, url_marker, body, replace_all_properties))
981
+
982
+ async def _async_link_peer_definitions(self, url_marker: str, definition_guid1: str, relationship_type: str,
983
+ definition_guid2: str, body: dict) -> None:
984
+ """ Attach two peer governance definitions. Async Version.
985
+
986
+ Parameters
987
+ ----------
988
+ url_marker: str
989
+ Indicates which service should be used to link the governance definition.
990
+ definition_guid1: str
991
+ guid of the first governance definition to link.
992
+ definition_guid2: str
993
+ guid of the second governance definition to link.
994
+ relationship_type: str
995
+ Relationship type name linking the governance definitions..
996
+ body: dict
997
+ The body describing the link between the two segments.
998
+
999
+ Returns
1000
+ -------
1001
+ None
1002
+
1003
+ Raises
1004
+ ------
1005
+ InvalidParameterException
1006
+ one of the parameters is null or invalid or
1007
+ PropertyServerException
1008
+ There is a problem adding the element properties to the metadata repository or
1009
+ UserNotAuthorizedException
1010
+ the requesting user is not authorized to issue this request.
1011
+
1012
+ Notes
1013
+ ----
1014
+
1015
+ Body structure:
1016
+ {
1017
+ "externalSourceGUID": "string",
1018
+ "externalSourceName": "string",
1019
+ "forLineage": true,
1020
+ "forDuplicateProcessing": true,
1021
+ "effectiveTime": "2025-06-13T15:03:28.505Z",
1022
+ "properties": {
1023
+ "effectiveFrom": "2025-06-13T15:03:28.505Z",
1024
+ "effectiveTo": "2025-06-13T15:03:28.505Z",
1025
+ "typeName": "string",
1026
+ "extendedProperties": {
1027
+ "additionalProp1": {},
1028
+ "additionalProp2": {},
1029
+ "additionalProp3": {}
1030
+ },
1031
+ "class": "string",
1032
+ "description": "string"
1033
+ }
1034
+ }
1035
+ """
1036
+ validate_guid(definition_guid1)
1037
+ validate_guid(definition_guid2)
1038
+
1039
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance-definitions/"
1040
+ f"{definition_guid1}/peer-definitions/{relationship_type}/{definition_guid2}/attach")
1041
+
1042
+ await self._async_make_request("POST", url, body_slimmer(body))
1043
+
1044
+ def link_peer_definitions(self, url_marker: str, definition_guid1: str, relationship_type: str,
1045
+ definition_guid2: str, body: dict) -> None:
1046
+ """ Attach two peer governance definitions. Async Version.
1047
+
1048
+ Parameters
1049
+ ----------
1050
+ url_marker: str
1051
+ Indicates which service should be used to link the governance definition.
1052
+ definition_guid1: str
1053
+ guid of the first governance definition to link.
1054
+ definition_guid2: str
1055
+ guid of the second governance definition to link.
1056
+ relationship_type: str
1057
+ Relationship type name linking the governance definitions..
1058
+ body: dict
1059
+ The body describing the link between the two segments.
1060
+
1061
+ Returns
1062
+ -------
1063
+ None
1064
+
1065
+ Raises
1066
+ ------
1067
+ InvalidParameterException
1068
+ one of the parameters is null or invalid or
1069
+ PropertyServerException
1070
+ There is a problem adding the element properties to the metadata repository or
1071
+ UserNotAuthorizedException
1072
+ the requesting user is not authorized to issue this request.
1073
+
1074
+ Notes
1075
+ ----
1076
+
1077
+ Body structure:
1078
+ {
1079
+ "externalSourceGUID": "string",
1080
+ "externalSourceName": "string",
1081
+ "forLineage": true,
1082
+ "forDuplicateProcessing": true,
1083
+ "effectiveTime": "2025-06-13T15:03:28.505Z",
1084
+ "properties": {
1085
+ "effectiveFrom": "2025-06-13T15:03:28.505Z",
1086
+ "effectiveTo": "2025-06-13T15:03:28.505Z",
1087
+ "typeName": "string",
1088
+ "extendedProperties": {
1089
+ "additionalProp1": {},
1090
+ "additionalProp2": {},
1091
+ "additionalProp3": {}
1092
+ },
1093
+ "class": "string",
1094
+ "description": "string"
1095
+ }
1096
+ }
1097
+ """
1098
+ loop = asyncio.get_event_loop()
1099
+ loop.run_until_complete(
1100
+ self._async_link_peer_definitions(url_marker, definition_guid1, relationship_type, definition_guid2, body))
1101
+
1102
+ async def _async_detach_peer_definitions(self, url_marker: str, definition_guid1: str, relationship_type: str,
1103
+ definition_guid2: str, body: dict) -> None:
1104
+ """ Detach two peer governance definitions. Async Version.
1105
+
1106
+ Parameters
1107
+ ----------
1108
+ url_marker: str
1109
+ Indicates which service should be used to link the governance definition.
1110
+ definition_guid1: str
1111
+ guid of the first governance definition to link.
1112
+ definition_guid2: str
1113
+ guid of the second governance definition to link.
1114
+ relationship_type: str
1115
+ Relationship type name linking the governance definitions..
1116
+ body: dict
1117
+ The body describing the link between the two segments.
1118
+
1119
+ Returns
1120
+ -------
1121
+ None
1122
+
1123
+ Raises
1124
+ ------
1125
+ InvalidParameterException
1126
+ one of the parameters is null or invalid or
1127
+ PropertyServerException
1128
+ There is a problem adding the element properties to the metadata repository or
1129
+ UserNotAuthorizedException
1130
+ the requesting user is not authorized to issue this request.
1131
+
1132
+ Notes
1133
+ ----
1134
+
1135
+ Body structure:
1136
+ {
1137
+ "externalSourceGUID": "string",
1138
+ "externalSourceName": "string",
1139
+ "forLineage": true,
1140
+ "forDuplicateProcessing": true,
1141
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
1142
+ }
1143
+ """
1144
+ validate_guid(definition_guid1)
1145
+ validate_guid(definition_guid2)
1146
+
1147
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance-definitions/"
1148
+ f"{definition_guid1}/peer-definitions/{relationship_type}/{definition_guid2}/detach")
1149
+
1150
+ await self._async_make_request("POST", url, body_slimmer(body))
1151
+
1152
+ def detach_peer_definitions(self, url_marker: str, definition_guid1: str, relationship_type: str,
1153
+ definition_guid2: str, body: dict) -> None:
1154
+ """ Detach two peer governance definitions.
1155
+
1156
+ Parameters
1157
+ ----------
1158
+ url_marker: str
1159
+ Indicates which service should be used to link the governance definition.
1160
+ definition_guid1: str
1161
+ guid of the first governance definition to link.
1162
+ definition_guid2: str
1163
+ guid of the second governance definition to link.
1164
+ relationship_type: str
1165
+ Relationship type name linking the governance definitions..
1166
+ body: dict
1167
+ The body describing the link between the two segments.
1168
+
1169
+ Returns
1170
+ -------
1171
+ None
1172
+
1173
+ Raises
1174
+ ------
1175
+ InvalidParameterException
1176
+ one of the parameters is null or invalid or
1177
+ PropertyServerException
1178
+ There is a problem adding the element properties to the metadata repository or
1179
+ UserNotAuthorizedException
1180
+ the requesting user is not authorized to issue this request.
1181
+
1182
+ Notes
1183
+ ----
1184
+
1185
+ Body structure:
1186
+ {
1187
+ "externalSourceGUID": "string",
1188
+ "externalSourceName": "string",
1189
+ "forLineage": true,
1190
+ "forDuplicateProcessing": true,
1191
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
1192
+ }
1193
+ """
1194
+ loop = asyncio.get_event_loop()
1195
+ loop.run_until_complete(
1196
+ self._async_detach_peer_definitions(url_marker, definition_guid1, relationship_type, definition_guid2,
1197
+ body))
1198
+
1199
+ async def _async_link_supporting_definitions(self, url_marker: str, definition_guid1: str, relationship_type: str,
1200
+ definition_guid2: str, body: dict) -> None:
1201
+ """ Attach a supporting governance definition. Async Version.
1202
+
1203
+ Parameters
1204
+ ----------
1205
+ url_marker: str
1206
+ Indicates which service should be used to link the governance definition.
1207
+ definition_guid1: str
1208
+ guid of the first governance definition to link.
1209
+ definition_guid2: str
1210
+ guid of the second governance definition to link.
1211
+ relationship_type: str
1212
+ Relationship type name linking the governance definitions..
1213
+ body: dict
1214
+ The body describing the link between the two segments.
1215
+
1216
+ Returns
1217
+ -------
1218
+ None
1219
+
1220
+ Raises
1221
+ ------
1222
+ InvalidParameterException
1223
+ one of the parameters is null or invalid or
1224
+ PropertyServerException
1225
+ There is a problem adding the element properties to the metadata repository or
1226
+ UserNotAuthorizedException
1227
+ the requesting user is not authorized to issue this request.
1228
+
1229
+ Notes
1230
+ ----
1231
+
1232
+ Body structure:
1233
+ {
1234
+ "externalSourceGUID": "string",
1235
+ "externalSourceName": "string",
1236
+ "forLineage": true,
1237
+ "forDuplicateProcessing": true,
1238
+ "effectiveTime": "2025-06-13T18:04:45.117Z",
1239
+ "properties": {
1240
+ "effectiveFrom": "2025-06-13T18:04:45.117Z",
1241
+ "effectiveTo": "2025-06-13T18:04:45.117Z",
1242
+ "typeName": "string",
1243
+ "extendedProperties": {
1244
+ "additionalProp1": {},
1245
+ "additionalProp2": {},
1246
+ "additionalProp3": {}
1247
+ },
1248
+ "class": "string",
1249
+ "rationale": "string"
1250
+ }
1251
+ }
1252
+ """
1253
+ validate_guid(definition_guid1)
1254
+ validate_guid(definition_guid2)
1255
+
1256
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance-definitions/"
1257
+ f"{definition_guid1}/supporting-definitions/{relationship_type}/{definition_guid2}/attach")
1258
+
1259
+ await self._async_make_request("POST", url, body_slimmer(body))
1260
+
1261
+ def link_supporting_definitions(self, url_marker: str, definition_guid1: str, relationship_type: str,
1262
+ definition_guid2: str, body: dict) -> None:
1263
+ """ Attach a supporting governance definition.
1264
+
1265
+ Parameters
1266
+ ----------
1267
+ url_marker: str
1268
+ Indicates which service should be used to link the governance definition.
1269
+ definition_guid1: str
1270
+ guid of the first governance definition to link.
1271
+ definition_guid2: str
1272
+ guid of the second governance definition to link.
1273
+ relationship_type: str
1274
+ Relationship type name linking the governance definitions..
1275
+ body: dict
1276
+ The body describing the link between the two segments.
1277
+
1278
+ Returns
1279
+ -------
1280
+ None
1281
+
1282
+ Raises
1283
+ ------
1284
+ InvalidParameterException
1285
+ one of the parameters is null or invalid or
1286
+ PropertyServerException
1287
+ There is a problem adding the element properties to the metadata repository or
1288
+ UserNotAuthorizedException
1289
+ the requesting user is not authorized to issue this request.
1290
+
1291
+ Notes
1292
+ ----
1293
+
1294
+ Body structure:
1295
+ {
1296
+ "externalSourceGUID": "string",
1297
+ "externalSourceName": "string",
1298
+ "forLineage": true,
1299
+ "forDuplicateProcessing": true,
1300
+ "effectiveTime": "2025-06-13T18:04:45.117Z",
1301
+ "properties": {
1302
+ "effectiveFrom": "2025-06-13T18:04:45.117Z",
1303
+ "effectiveTo": "2025-06-13T18:04:45.117Z",
1304
+ "typeName": "string",
1305
+ "extendedProperties": {
1306
+ "additionalProp1": {},
1307
+ "additionalProp2": {},
1308
+ "additionalProp3": {}
1309
+ },
1310
+ "class": "string",
1311
+ "rationale": "string"
1312
+ }
1313
+ }
1314
+ """
1315
+ loop = asyncio.get_event_loop()
1316
+ loop.run_until_complete(
1317
+ self._async_link_supporting_definitions(url_marker, definition_guid1, relationship_type, definition_guid2,
1318
+ body))
1319
+
1320
+ async def _async_detach_supporting_definitions(self, url_marker: str, definition_guid1: str, relationship_type: str,
1321
+ definition_guid2: str, body: dict) -> None:
1322
+ """ Detach a governance definition from a supporting governance definition. Async Version.
1323
+
1324
+ Parameters
1325
+ ----------
1326
+ url_marker: str
1327
+ Indicates which service should be used to link the governance definition.
1328
+ definition_guid1: str
1329
+ guid of the first governance definition to unlink.
1330
+ definition_guid2: str
1331
+ guid of the second governance definition to unlink.
1332
+ relationship_type: str
1333
+ Relationship type name linking the governance definitions..
1334
+ body: dict
1335
+ The body describing the link between the two segments.
1336
+
1337
+ Returns
1338
+ -------
1339
+ None
1340
+
1341
+ Raises
1342
+ ------
1343
+ InvalidParameterException
1344
+ one of the parameters is null or invalid or
1345
+ PropertyServerException
1346
+ There is a problem adding the element properties to the metadata repository or
1347
+ UserNotAuthorizedException
1348
+ the requesting user is not authorized to issue this request.
1349
+
1350
+ Notes
1351
+ ----
1352
+
1353
+ Body structure:
1354
+ {
1355
+ "externalSourceGUID": "string",
1356
+ "externalSourceName": "string",
1357
+ "forLineage": true,
1358
+ "forDuplicateProcessing": true,
1359
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
1360
+ }
1361
+ """
1362
+ validate_guid(definition_guid1)
1363
+ validate_guid(definition_guid2)
1364
+
1365
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance-definitions/"
1366
+ f"{definition_guid1}/supporting-definitions/{relationship_type}/{definition_guid2}/detach")
1367
+
1368
+ await self._async_make_request("POST", url, body_slimmer(body))
1369
+
1370
+ def detach_supporting_definitions(self, url_marker: str, definition_guid1: str, relationship_type: str,
1371
+ definition_guid2: str, body: dict) -> None:
1372
+ """ Detach a governance definition from a supporting governance definition.
1373
+
1374
+ Parameters
1375
+ ----------
1376
+ url_marker: str
1377
+ Indicates which service should be used to link the governance definition.
1378
+ definition_guid1: str
1379
+ guid of the first governance definition to unlink.
1380
+ definition_guid2: str
1381
+ guid of the second governance definition to unlink.
1382
+ relationship_type: str
1383
+ Relationship type name linking the governance definitions..
1384
+ body: dict
1385
+ The body describing the link between the two segments.
1386
+
1387
+ Returns
1388
+ -------
1389
+ None
1390
+
1391
+ Raises
1392
+ ------
1393
+ InvalidParameterException
1394
+ one of the parameters is null or invalid or
1395
+ PropertyServerException
1396
+ There is a problem adding the element properties to the metadata repository or
1397
+ UserNotAuthorizedException
1398
+ the requesting user is not authorized to issue this request.
1399
+
1400
+ Notes
1401
+ ----
1402
+
1403
+ Body structure:
1404
+ {
1405
+ "externalSourceGUID": "string",
1406
+ "externalSourceName": "string",
1407
+ "forLineage": true,
1408
+ "forDuplicateProcessing": true,
1409
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
1410
+ }
1411
+ """
1412
+ loop = asyncio.get_event_loop()
1413
+ loop.run_until_complete(
1414
+ self._async_detach_supporting_definitions(url_marker, definition_guid1, relationship_type, definition_guid2,
1415
+ body))
1416
+
1417
+ async def _async_link_definition_implementation(self, url_marker: str, technical_control_guid: str,
1418
+ relationship_type: str, implementation_guid: str,
1419
+ body: dict) -> None:
1420
+ """ Attach a governance definition to its implementation. Async Version.
1421
+
1422
+ Parameters
1423
+ ----------
1424
+ url_marker: str
1425
+ Indicates which service should be used to link the governance definition.
1426
+ technical_control_guid: str
1427
+ guid of the technical control to link.
1428
+ relationship_type: str
1429
+ Relationship type name linking the governance definitions.
1430
+ implementation_guid: str
1431
+ guid of the implementation definition to link.
1432
+ body: dict
1433
+ The body describing the link between the two segments.
1434
+
1435
+ Returns
1436
+ -------
1437
+ None
1438
+
1439
+ Raises
1440
+ ------
1441
+ InvalidParameterException
1442
+ one of the parameters is null or invalid or
1443
+ PropertyServerException
1444
+ There is a problem adding the element properties to the metadata repository or
1445
+ UserNotAuthorizedException
1446
+ the requesting user is not authorized to issue this request.
1447
+
1448
+ Notes
1449
+ ----
1450
+
1451
+ Body structure:
1452
+ {
1453
+ "externalSourceGUID": "string",
1454
+ "externalSourceName": "string",
1455
+ "forLineage": true,
1456
+ "forDuplicateProcessing": true,
1457
+ "effectiveTime": "2025-06-13T18:04:45.117Z",
1458
+ "properties": {
1459
+ "effectiveFrom": "2025-06-13T18:04:45.117Z",
1460
+ "effectiveTo": "2025-06-13T18:04:45.117Z",
1461
+ "typeName": "string",
1462
+ "extendedProperties": {
1463
+ "additionalProp1": {},
1464
+ "additionalProp2": {},
1465
+ "additionalProp3": {}
1466
+ },
1467
+ "class": "string",
1468
+ "notes": "string"
1469
+ }
1470
+ }
1471
+ """
1472
+ validate_guid(technical_control_guid)
1473
+ validate_guid(implementation_guid)
1474
+
1475
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance-definitions/"
1476
+ f"{technical_control_guid}/governance-implementation/{relationship_type}/{implementation_guid}/attach")
1477
+
1478
+ await self._async_make_request("POST", url, body_slimmer(body))
1479
+
1480
+ def link_definition_implementation(self, url_marker: str, technical_control_guid: str, relationship_type: str,
1481
+ implementation_guid: str, body: dict) -> None:
1482
+ """ Attach a governance definition to its implementation.
1483
+
1484
+ Parameters
1485
+ ----------
1486
+ url_marker: str
1487
+ Indicates which service should be used to link the governance definition.
1488
+ technical_control_guid: str
1489
+ guid of the technical control to link.
1490
+ relationship_type: str
1491
+ Relationship type name linking the governance definitions..
1492
+ implementation_guid: str
1493
+ guid of the implementation definition to link.
1494
+ body: dict
1495
+ The body describing the link between the two segments.
1496
+
1497
+ Returns
1498
+ -------
1499
+ None
1500
+
1501
+ Raises
1502
+ ------
1503
+ InvalidParameterException
1504
+ one of the parameters is null or invalid or
1505
+ PropertyServerException
1506
+ There is a problem adding the element properties to the metadata repository or
1507
+ UserNotAuthorizedException
1508
+ the requesting user is not authorized to issue this request.
1509
+
1510
+ Notes
1511
+ ----
1512
+
1513
+ Body structure:
1514
+ {
1515
+ "externalSourceGUID": "string",
1516
+ "externalSourceName": "string",
1517
+ "forLineage": true,
1518
+ "forDuplicateProcessing": true,
1519
+ "effectiveTime": "2025-06-13T18:04:45.117Z",
1520
+ "properties": {
1521
+ "effectiveFrom": "2025-06-13T18:04:45.117Z",
1522
+ "effectiveTo": "2025-06-13T18:04:45.117Z",
1523
+ "typeName": "string",
1524
+ "extendedProperties": {
1525
+ "additionalProp1": {},
1526
+ "additionalProp2": {},
1527
+ "additionalProp3": {}
1528
+ },
1529
+ "class": "string",
1530
+ "notes": "string"
1531
+ }
1532
+ }
1533
+ """
1534
+ loop = asyncio.get_event_loop()
1535
+ loop.run_until_complete(
1536
+ self._async_link_definition_implementation(url_marker, technical_control_guid, relationship_type,
1537
+ implementation_guid, body))
1538
+
1539
+ async def _async_detach_definition_implementation(self, url_marker: str, technical_control_guid: str,
1540
+ relationship_type: str, implementation_guid: str,
1541
+ body: dict) -> None:
1542
+ """ Detach a governance definition from its implementation. Async Version.
1543
+
1544
+ Parameters
1545
+ ----------
1546
+ url_marker: str
1547
+ Indicates which service should be used to unlink the governance definition.
1548
+ technical_control_guid: str
1549
+ guid of the technical control to link.
1550
+ relationship_type: str
1551
+ Relationship type name linking the governance definitions.
1552
+ implementation_guid: str
1553
+ guid of the implementation definition to unlink.
1554
+ body: dict
1555
+ The body describing the link between the two segments.
1556
+
1557
+ Returns
1558
+ -------
1559
+ None
1560
+
1561
+ Raises
1562
+ ------
1563
+ InvalidParameterException
1564
+ one of the parameters is null or invalid or
1565
+ PropertyServerException
1566
+ There is a problem adding the element properties to the metadata repository or
1567
+ UserNotAuthorizedException
1568
+ the requesting user is not authorized to issue this request.
1569
+
1570
+ Notes
1571
+ ----
1572
+
1573
+ Body structure:
1574
+ {
1575
+ "externalSourceGUID": "string",
1576
+ "externalSourceName": "string",
1577
+ "forLineage": true,
1578
+ "forDuplicateProcessing": true,
1579
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
1580
+ }
1581
+ """
1582
+ validate_guid(technical_control_guid)
1583
+ validate_guid(implementation_guid)
1584
+
1585
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance-definitions/"
1586
+ f"{technical_control_guid}/governance-implementation/{relationship_type}/{implementation_guid}/detach")
1587
+
1588
+ await self._async_make_request("POST", url, body_slimmer(body))
1589
+
1590
+ def detach_definition_implementation(self, url_marker: str, technical_control_guid: str, relationship_type: str,
1591
+ implementation_guid: str, body: dict) -> None:
1592
+ """ Detach a governance definition from its implementation.
1593
+
1594
+ Parameters
1595
+ ----------
1596
+ url_marker: str
1597
+ Indicates which service should be used to link the governance definition.
1598
+ technical_control_guid: str
1599
+ guid of the technical control to unlink.
1600
+ relationship_type: str
1601
+ Relationship type name linking the governance definitions..
1602
+ implementation_guid: str
1603
+ guid of the implementation definition to unlink.
1604
+ body: dict
1605
+ The body describing the link between the two segments.
1606
+
1607
+ Returns
1608
+ -------
1609
+ None
1610
+
1611
+ Raises
1612
+ ------
1613
+ InvalidParameterException
1614
+ one of the parameters is null or invalid or
1615
+ PropertyServerException
1616
+ There is a problem adding the element properties to the metadata repository or
1617
+ UserNotAuthorizedException
1618
+ the requesting user is not authorized to issue this request.
1619
+
1620
+ Notes
1621
+ ----
1622
+
1623
+ Body structure:
1624
+ {
1625
+ "externalSourceGUID": "string",
1626
+ "externalSourceName": "string",
1627
+ "forLineage": true,
1628
+ "forDuplicateProcessing": true,
1629
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
1630
+ }
1631
+ """
1632
+ loop = asyncio.get_event_loop()
1633
+ loop.run_until_complete(
1634
+ self._async_detach_definition_implementation(url_marker, technical_control_guid, relationship_type,
1635
+ implementation_guid, body))
1636
+
1637
+ async def _async_get_governance_definitions_by_name(self, url_marker: str, search_filter: str, body: dict = None,
1638
+ start_from: int = 0, page_size: int = max_paging_size,
1639
+ output_format: str = "JSON") -> dict | str:
1640
+ """ Returns the list of governance definitions with a particular name. Async Version.
1641
+
1642
+ Parameters
1643
+ ----------
1644
+ url_marker: str
1645
+ Indicates which service should be used.
1646
+ search_filter: str
1647
+ name of the information supply chain to retrieve.
1648
+ body: dict, optional
1649
+ A dictionary containing parameters of the retrieval.
1650
+ output_format: str, default = 'JSON'
1651
+ Type of output to produce:
1652
+ JSON - output standard json
1653
+ MD - output standard markdown with no preamble
1654
+ FORM - output markdown with a preamble for a form
1655
+ REPORT - output markdown with a preamble for a report
1656
+ MERMAID - output mermaid markdown
1657
+
1658
+ Returns
1659
+ -------
1660
+ [dict] | str
1661
+ A list of information supply chains matching the name.
1662
+
1663
+ Raises
1664
+ ------
1665
+ InvalidParameterException
1666
+ one of the parameters is null or invalid or
1667
+ PropertyServerException
1668
+ There is a problem adding the element properties to the metadata repository or
1669
+ UserNotAuthorizedException
1670
+ the requesting user is not authorized to issue this request.
1671
+
1672
+ Notes
1673
+ -----
1674
+ Body structure:
1675
+ {
1676
+ "class": "FilterRequestBody",
1677
+ "asOfTime": {{isotime}},
1678
+ "effectiveTime": {{isotime}},
1679
+ "forLineage": false,
1680
+ "forDuplicateProcessing": false,
1681
+ "limitResultsByStatus": ["ACTIVE"],
1682
+ "sequencingOrder": "PROPERTY_ASCENDING",
1683
+ "sequencingProperty": "qualifiedName",
1684
+ "filter": "Add name here",
1685
+ "templateFilter": "NO_TEMPLATES"
1686
+ }
1687
+
1688
+ """
1689
+ possible_query_params = query_string([("startFrom", start_from), ("pageSize", page_size)])
1690
+
1691
+ if body is None:
1692
+ body = {
1693
+ "filter": search_filter,
1694
+ }
1695
+ else:
1696
+ body["filter"] = search_filter
1697
+
1698
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance-definitions/"
1699
+ f"by-name{possible_query_params}")
1700
+
1701
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
1702
+ element = response.json().get("elements", NO_ELEMENTS_FOUND)
1703
+ if element == NO_ELEMENTS_FOUND:
1704
+ return NO_ELEMENTS_FOUND
1705
+ if output_format != 'JSON': # return a simplified markdown representation
1706
+ return self.generate_governance_definition_output(element, None, output_format)
1707
+ return response.json().get("elements", NO_ELEMENTS_FOUND)
1708
+
1709
+ def get_governance_definitions_by_name(self, url_marker: str, search_filter: str, body: dict = None,
1710
+ start_from: int = 0, page_size: int = max_paging_size,
1711
+ output_format: str = "JSON") -> dict | str:
1712
+ """ Returns the list of information supply chains with a particular name. Async Version.
1713
+
1714
+ Parameters
1715
+ ----------
1716
+ url_marker: str
1717
+ Indicates which service should be used.
1718
+ search_filter: str
1719
+ name of the information supply chain to retrieve.
1720
+ body: dict, optional
1721
+ A dictionary containing parameters of the retrieval.
1722
+ add_implementation: bool, optional
1723
+ Whether to add the implementation details to the response.
1724
+ start_from: int, [default=0], optional
1725
+ When multiple pages of results are available, the page number to start from.
1726
+ page_size: int, [default=max_paging_size], optional
1727
+ The number of items to return in a single page. If not specified, the default will be taken from
1728
+ the class instance.
1729
+ output_format: str, default = 'JSON'
1730
+ Type of output to produce:
1731
+ JSON - output standard json
1732
+ MD - output standard markdown with no preamble
1733
+ FORM - output markdown with a preamble for a form
1734
+ REPORT - output markdown with a preamble for a report
1735
+ MERMAID - output mermaid markdown
1736
+
1737
+ Returns
1738
+ -------
1739
+ [dict] | str
1740
+ A list of information supply chains matching the name.
1741
+
1742
+ Raises
1743
+ ------
1744
+ InvalidParameterException
1745
+ one of the parameters is null or invalid or
1746
+ PropertyServerException
1747
+ There is a problem adding the element properties to the metadata repository or
1748
+ UserNotAuthorizedException
1749
+ the requesting user is not authorized to issue this request.
1750
+
1751
+ Notes
1752
+ -----
1753
+ Body structure:
1754
+ {
1755
+ "class": "FilterRequestBody",
1756
+ "asOfTime": {{isotime}},
1757
+ "effectiveTime": {{isotime}},
1758
+ "forLineage": false,
1759
+ "forDuplicateProcessing": false,
1760
+ "limitResultsByStatus": ["ACTIVE"],
1761
+ "sequencingOrder": "PROPERTY_ASCENDING",
1762
+ "sequencingProperty": "qualifiedName",
1763
+ "filter": "Add name here",
1764
+ "templateFilter": "NO_TEMPLATES"
1765
+ }
1766
+
1767
+ """
1768
+ loop = asyncio.get_event_loop()
1769
+ response = loop.run_until_complete(
1770
+ self._async_get_governance_definitions_by_name(url_marker, search_filter, body, start_from, page_size,
1771
+ output_format))
1772
+ return response
1773
+
1774
+ async def _async_find_governance_definitions(self, url_marker: str, search_filter: str = "*",
1775
+ starts_with: bool = True, ends_with: bool = False,
1776
+ ignore_case: bool = False, start_from: int = 0,
1777
+ page_size: int = max_paging_size, body: dict = None,
1778
+ output_format: str = 'JSON') -> list[dict] | str:
1779
+ """ Retrieve the list of governance definition metadata elements that contain the search string.
1780
+ Async version.
1781
+
1782
+ Parameters
1783
+ ----------
1784
+ url_marker: str
1785
+ Indicates which service should be used.
1786
+ search_filter : str
1787
+ - search_filter string to search for.
1788
+ starts_with : bool, [default=False], optional
1789
+ Starts with the supplied string.
1790
+ ends_with : bool, [default=False], optional
1791
+ Ends with the supplied string
1792
+ ignore_case : bool, [default=False], optional
1793
+ Ignore case when searching
1794
+ body: dict, optional, default = None
1795
+ - additional optional specifications for the search.
1796
+ output_format: str, default = 'JSON'
1797
+ Type of output to produce:
1798
+ JSON - output standard json
1799
+ MD - output standard markdown with no preamble
1800
+ FORM - output markdown with a preamble for a form
1801
+ REPORT - output markdown with a preamble for a report
1802
+ Mermaid - output markdown with a mermaid graph
1803
+
1804
+ Returns
1805
+ -------
1806
+ list[dict] | str
1807
+ A list of information supply chain structures or a string if there are no elements found.
1808
+
1809
+ Raises
1810
+ ------
1811
+ InvalidParameterException
1812
+ one of the parameters is null or invalid or
1813
+ PropertyServerException
1814
+ There is a problem adding the element properties to the metadata repository or
1815
+ UserNotAuthorizedException
1816
+ the requesting user is not authorized to issue this request.
1817
+
1818
+ Notes
1819
+ -----
1820
+ Body structure:
1821
+ {
1822
+ "class": "FilterRequestBody",
1823
+ "asOfTime": {{isotime}},
1824
+ "effectiveTime": {{isotime}},
1825
+ "forLineage": false,
1826
+ "forDuplicateProcessing": false,
1827
+ "limitResultsByStatus": ["ACTIVE"],
1828
+ "sequencingOrder": "PROPERTY_ASCENDING",
1829
+ "sequencingProperty": "qualifiedName",
1830
+ "filter": "Add name here",
1831
+ "templateFilter": "NO_TEMPLATES"
1832
+ }
1833
+ """
1834
+
1835
+ possible_query_params = query_string(
1836
+ [("startFrom", start_from), ("pageSize", page_size), ("startsWith", starts_with), ("endsWith", ends_with),
1837
+ ("ignoreCase", ignore_case), ])
1838
+
1839
+ if search_filter is None or search_filter == "*":
1840
+ search_filter = None
1841
+
1842
+ if body is None:
1843
+ body = {
1844
+ "filter": search_filter,
1845
+ }
1846
+ else:
1847
+ body["filter"] = search_filter
1848
+
1849
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance-definitions/"
1850
+ f"by-search-string{possible_query_params}")
1851
+
1852
+ response: Response = await self._async_make_request("POST", url, body_slimmer(body))
1853
+ element = response.json().get("elements", NO_ELEMENTS_FOUND)
1854
+ if element == NO_ELEMENTS_FOUND:
1855
+ return NO_ELEMENTS_FOUND
1856
+ if output_format != 'JSON': # return a simplified markdown representation
1857
+ return self.generate_info_supply_chain_output(element, search_filter, output_format)
1858
+ return response.json().get("elements", NO_ELEMENTS_FOUND)
1859
+
1860
+ def find_information_supply_chains(self, url_marker: str, search_filter: str = "*", starts_with: bool = True,
1861
+ ends_with: bool = False, ignore_case: bool = False, start_from: int = 0,
1862
+ page_size: int = max_paging_size, body: dict = None,
1863
+ output_format: str = 'JSON', ) -> list[dict] | str:
1864
+ """ Retrieve the list of governance definition metadata elements that contain the search string.
1865
+
1866
+ Parameters
1867
+ ----------
1868
+ url_marker: str
1869
+ Indicates which service should be used.
1870
+ search_filter : str
1871
+ - search_filter string to search for.
1872
+ starts_with : bool, [default=False], optional
1873
+ Starts with the supplied string.
1874
+ ends_with : bool, [default=False], optional
1875
+ Ends with the supplied string
1876
+ ignore_case : bool, [default=False], optional
1877
+ Ignore case when searching
1878
+ body: dict, optional, default = None
1879
+ - additional optional specifications for the search.
1880
+ output_format: str, default = 'JSON'
1881
+ Type of output to produce:
1882
+ JSON - output standard json
1883
+ MD - output standard markdown with no preamble
1884
+ FORM - output markdown with a preamble for a form
1885
+ REPORT - output markdown with a preamble for a report
1886
+ Mermaid - output markdown with a mermaid graph
1887
+
1888
+ Returns
1889
+ -------
1890
+ list[dict] | str
1891
+ A list of information supply chain structures or a string if there are no elements found.
1892
+
1893
+ Raises
1894
+ ------
1895
+ InvalidParameterException
1896
+ one of the parameters is null or invalid or
1897
+ PropertyServerException
1898
+ There is a problem adding the element properties to the metadata repository or
1899
+ UserNotAuthorizedException
1900
+ the requesting user is not authorized to issue this request.
1901
+
1902
+ Notes
1903
+ -----
1904
+ Body structure:
1905
+ {
1906
+ "class": "FilterRequestBody",
1907
+ "asOfTime": {{isotime}},
1908
+ "effectiveTime": {{isotime}},
1909
+ "forLineage": false,
1910
+ "forDuplicateProcessing": false,
1911
+ "limitResultsByStatus": ["ACTIVE"],
1912
+ "sequencingOrder": "PROPERTY_ASCENDING",
1913
+ "sequencingProperty": "qualifiedName",
1914
+ "filter": "Add name here",
1915
+ "templateFilter": "NO_TEMPLATES"
1916
+ }
1917
+ """
1918
+
1919
+ loop = asyncio.get_event_loop()
1920
+ response = loop.run_until_complete(
1921
+ self._async_find_governance_definitions(url_marker, filter, starts_with, ends_with, ignore_case, start_from,
1922
+ page_size, body, output_format))
1923
+ return response
1924
+
1925
+
1926
+ async def _async_create_governance_definition_from_template(self, url_marker: str, body: dict) -> str:
1927
+ """ Create a new metadata element to represent a governance definition using an existing metadata element
1928
+ as a template. The template defines additional classifications and relationships that should be added to
1929
+ the new element. Async version.
1930
+
1931
+ Parameters
1932
+ ----------
1933
+ url_marker: str
1934
+ Indicates which service should be used to create the governance definition.
1935
+ body: dict
1936
+ A dictionary containing the definition of the supply chain to create.
1937
+
1938
+ Returns
1939
+ -------
1940
+
1941
+ str - guid of the supply chain created.
1942
+
1943
+ Raises
1944
+ ------
1945
+ InvalidParameterException
1946
+ one of the parameters is null or invalid or
1947
+ PropertyServerException
1948
+ There is a problem adding the element properties to the metadata repository or
1949
+ UserNotAuthorizedException
1950
+ the requesting user is not authorized to issue this request.
1951
+
1952
+ Notes
1953
+ ----
1954
+ https://egeria-project.org/concepts/governance-definition
1955
+
1956
+ Body structure:
1957
+ {
1958
+ "externalSourceGUID": "string",
1959
+ "externalSourceName": "string",
1960
+ "forLineage": true,
1961
+ "forDuplicateProcessing": true,
1962
+ "effectiveTime": "2025-06-13T19:06:56.874Z",
1963
+ "typeName": "string",
1964
+ "initialStatus": "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}",
1965
+ "initialClassifications": {
1966
+ "additionalProp1": {
1967
+ "propertyValueMap": {
1968
+ "additionalProp1": {
1969
+ "typeName": "string",
1970
+ "class": "string",
1971
+ "arrayCount": 0,
1972
+ "arrayValues": "string"
1973
+ },
1974
+ "additionalProp2": {
1975
+ "typeName": "string",
1976
+ "class": "string",
1977
+ "arrayCount": 0,
1978
+ "arrayValues": "string"
1979
+ },
1980
+ "additionalProp3": {
1981
+ "typeName": "string",
1982
+ "class": "string",
1983
+ "arrayCount": 0,
1984
+ "arrayValues": "string"
1985
+ }
1986
+ },
1987
+ "propertyCount": 0,
1988
+ "propertiesAsStrings": {
1989
+ "additionalProp1": "string",
1990
+ "additionalProp2": "string",
1991
+ "additionalProp3": "string"
1992
+ },
1993
+ "propertyNames": {}
1994
+ },
1995
+ "additionalProp2": {
1996
+ "propertyValueMap": {
1997
+ "additionalProp1": {
1998
+ "typeName": "string",
1999
+ "class": "string",
2000
+ "arrayCount": 0,
2001
+ "arrayValues": "string"
2002
+ },
2003
+ "additionalProp2": {
2004
+ "typeName": "string",
2005
+ "class": "string",
2006
+ "arrayCount": 0,
2007
+ "arrayValues": "string"
2008
+ },
2009
+ "additionalProp3": {
2010
+ "typeName": "string",
2011
+ "class": "string",
2012
+ "arrayCount": 0,
2013
+ "arrayValues": "string"
2014
+ }
2015
+ },
2016
+ "propertyCount": 0,
2017
+ "propertiesAsStrings": {
2018
+ "additionalProp1": "string",
2019
+ "additionalProp2": "string",
2020
+ "additionalProp3": "string"
2021
+ },
2022
+ "propertyNames": {}
2023
+ },
2024
+ "additionalProp3": {
2025
+ "propertyValueMap": {
2026
+ "additionalProp1": {
2027
+ "typeName": "string",
2028
+ "class": "string",
2029
+ "arrayCount": 0,
2030
+ "arrayValues": "string"
2031
+ },
2032
+ "additionalProp2": {
2033
+ "typeName": "string",
2034
+ "class": "string",
2035
+ "arrayCount": 0,
2036
+ "arrayValues": "string"
2037
+ },
2038
+ "additionalProp3": {
2039
+ "typeName": "string",
2040
+ "class": "string",
2041
+ "arrayCount": 0,
2042
+ "arrayValues": "string"
2043
+ }
2044
+ },
2045
+ "propertyCount": 0,
2046
+ "propertiesAsStrings": {
2047
+ "additionalProp1": "string",
2048
+ "additionalProp2": "string",
2049
+ "additionalProp3": "string"
2050
+ },
2051
+ "propertyNames": {}
2052
+ }
2053
+ },
2054
+ "anchorGUID": "string",
2055
+ "isOwnAnchor": true,
2056
+ "anchorScopeGUID": "string",
2057
+ "allowRetrieve": true,
2058
+ "effectiveFrom": "2025-06-13T19:06:56.874Z",
2059
+ "effectiveTo": "2025-06-13T19:06:56.874Z",
2060
+ "templateGUID": "string",
2061
+ "replacementProperties": {
2062
+ "propertyValueMap": {
2063
+ "additionalProp1": {
2064
+ "typeName": "string",
2065
+ "class": "string",
2066
+ "arrayCount": 0,
2067
+ "arrayValues": "string"
2068
+ },
2069
+ "additionalProp2": {
2070
+ "typeName": "string",
2071
+ "class": "string",
2072
+ "arrayCount": 0,
2073
+ "arrayValues": "string"
2074
+ },
2075
+ "additionalProp3": {
2076
+ "typeName": "string",
2077
+ "class": "string",
2078
+ "arrayCount": 0,
2079
+ "arrayValues": "string"
2080
+ }
2081
+ },
2082
+ "propertyCount": 0,
2083
+ "propertiesAsStrings": {
2084
+ "additionalProp1": "string",
2085
+ "additionalProp2": "string",
2086
+ "additionalProp3": "string"
2087
+ },
2088
+ "propertyNames": {}
2089
+ },
2090
+ "placeholderPropertyValues": {
2091
+ "additionalProp1": "string",
2092
+ "additionalProp2": "string",
2093
+ "additionalProp3": "string"
2094
+ },
2095
+ "parentGUID": "string",
2096
+ "parentRelationshipTypeName": "string",
2097
+ "parentRelationshipProperties": {
2098
+ "propertyValueMap": {
2099
+ "additionalProp1": {
2100
+ "typeName": "string",
2101
+ "class": "string",
2102
+ "arrayCount": 0,
2103
+ "arrayValues": "string"
2104
+ },
2105
+ "additionalProp2": {
2106
+ "typeName": "string",
2107
+ "class": "string",
2108
+ "arrayCount": 0,
2109
+ "arrayValues": "string"
2110
+ },
2111
+ "additionalProp3": {
2112
+ "typeName": "string",
2113
+ "class": "string",
2114
+ "arrayCount": 0,
2115
+ "arrayValues": "string"
2116
+ }
2117
+ },
2118
+ "propertyCount": 0,
2119
+ "propertiesAsStrings": {
2120
+ "additionalProp1": "string",
2121
+ "additionalProp2": "string",
2122
+ "additionalProp3": "string"
2123
+ },
2124
+ "propertyNames": {}
2125
+ },
2126
+ "parentAtEnd1": true
2127
+ }
2128
+
2129
+ """
2130
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
2131
+ f"{url_marker}/governance_definitions/from-template")
2132
+
2133
+ response = await self._async_make_request("POST", url, body_slimmer(body))
2134
+
2135
+ return response.json().get("guid", "Governance definition not created")
2136
+
2137
+
2138
+ def create_governance_definition_from_template(self, url_marker: str, body: dict) -> str:
2139
+ """ Create a new metadata element to represent a governance definition using an existing metadata element
2140
+ as a template. The template defines additional classifications and relationships that should be added to
2141
+ the new element.
2142
+
2143
+ Parameters
2144
+ ----------
2145
+ url_marker: str
2146
+ Indicates which service should be used to create the governance definition.
2147
+ body: dict
2148
+ A dictionary containing the definition of the supply chain to create.
2149
+
2150
+ Returns
2151
+ -------
2152
+
2153
+ str - guid of the supply chain created.
2154
+
2155
+ Raises
2156
+ ------
2157
+ InvalidParameterException
2158
+ one of the parameters is null or invalid or
2159
+ PropertyServerException
2160
+ There is a problem adding the element properties to the metadata repository or
2161
+ UserNotAuthorizedException
2162
+ the requesting user is not authorized to issue this request.
2163
+
2164
+ Notes
2165
+ ----
2166
+ https://egeria-project.org/concepts/governance-definition
2167
+
2168
+ Body structure:
2169
+ {
2170
+ "externalSourceGUID": "string",
2171
+ "externalSourceName": "string",
2172
+ "forLineage": true,
2173
+ "forDuplicateProcessing": true,
2174
+ "effectiveTime": "2025-06-13T19:06:56.874Z",
2175
+ "typeName": "string",
2176
+ "initialStatus": "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}",
2177
+ "initialClassifications": {
2178
+ "additionalProp1": {
2179
+ "propertyValueMap": {
2180
+ "additionalProp1": {
2181
+ "typeName": "string",
2182
+ "class": "string",
2183
+ "arrayCount": 0,
2184
+ "arrayValues": "string"
2185
+ },
2186
+ "additionalProp2": {
2187
+ "typeName": "string",
2188
+ "class": "string",
2189
+ "arrayCount": 0,
2190
+ "arrayValues": "string"
2191
+ },
2192
+ "additionalProp3": {
2193
+ "typeName": "string",
2194
+ "class": "string",
2195
+ "arrayCount": 0,
2196
+ "arrayValues": "string"
2197
+ }
2198
+ },
2199
+ "propertyCount": 0,
2200
+ "propertiesAsStrings": {
2201
+ "additionalProp1": "string",
2202
+ "additionalProp2": "string",
2203
+ "additionalProp3": "string"
2204
+ },
2205
+ "propertyNames": {}
2206
+ },
2207
+ "additionalProp2": {
2208
+ "propertyValueMap": {
2209
+ "additionalProp1": {
2210
+ "typeName": "string",
2211
+ "class": "string",
2212
+ "arrayCount": 0,
2213
+ "arrayValues": "string"
2214
+ },
2215
+ "additionalProp2": {
2216
+ "typeName": "string",
2217
+ "class": "string",
2218
+ "arrayCount": 0,
2219
+ "arrayValues": "string"
2220
+ },
2221
+ "additionalProp3": {
2222
+ "typeName": "string",
2223
+ "class": "string",
2224
+ "arrayCount": 0,
2225
+ "arrayValues": "string"
2226
+ }
2227
+ },
2228
+ "propertyCount": 0,
2229
+ "propertiesAsStrings": {
2230
+ "additionalProp1": "string",
2231
+ "additionalProp2": "string",
2232
+ "additionalProp3": "string"
2233
+ },
2234
+ "propertyNames": {}
2235
+ },
2236
+ "additionalProp3": {
2237
+ "propertyValueMap": {
2238
+ "additionalProp1": {
2239
+ "typeName": "string",
2240
+ "class": "string",
2241
+ "arrayCount": 0,
2242
+ "arrayValues": "string"
2243
+ },
2244
+ "additionalProp2": {
2245
+ "typeName": "string",
2246
+ "class": "string",
2247
+ "arrayCount": 0,
2248
+ "arrayValues": "string"
2249
+ },
2250
+ "additionalProp3": {
2251
+ "typeName": "string",
2252
+ "class": "string",
2253
+ "arrayCount": 0,
2254
+ "arrayValues": "string"
2255
+ }
2256
+ },
2257
+ "propertyCount": 0,
2258
+ "propertiesAsStrings": {
2259
+ "additionalProp1": "string",
2260
+ "additionalProp2": "string",
2261
+ "additionalProp3": "string"
2262
+ },
2263
+ "propertyNames": {}
2264
+ }
2265
+ },
2266
+ "anchorGUID": "string",
2267
+ "isOwnAnchor": true,
2268
+ "anchorScopeGUID": "string",
2269
+ "allowRetrieve": true,
2270
+ "effectiveFrom": "2025-06-13T19:06:56.874Z",
2271
+ "effectiveTo": "2025-06-13T19:06:56.874Z",
2272
+ "templateGUID": "string",
2273
+ "replacementProperties": {
2274
+ "propertyValueMap": {
2275
+ "additionalProp1": {
2276
+ "typeName": "string",
2277
+ "class": "string",
2278
+ "arrayCount": 0,
2279
+ "arrayValues": "string"
2280
+ },
2281
+ "additionalProp2": {
2282
+ "typeName": "string",
2283
+ "class": "string",
2284
+ "arrayCount": 0,
2285
+ "arrayValues": "string"
2286
+ },
2287
+ "additionalProp3": {
2288
+ "typeName": "string",
2289
+ "class": "string",
2290
+ "arrayCount": 0,
2291
+ "arrayValues": "string"
2292
+ }
2293
+ },
2294
+ "propertyCount": 0,
2295
+ "propertiesAsStrings": {
2296
+ "additionalProp1": "string",
2297
+ "additionalProp2": "string",
2298
+ "additionalProp3": "string"
2299
+ },
2300
+ "propertyNames": {}
2301
+ },
2302
+ "placeholderPropertyValues": {
2303
+ "additionalProp1": "string",
2304
+ "additionalProp2": "string",
2305
+ "additionalProp3": "string"
2306
+ },
2307
+ "parentGUID": "string",
2308
+ "parentRelationshipTypeName": "string",
2309
+ "parentRelationshipProperties": {
2310
+ "propertyValueMap": {
2311
+ "additionalProp1": {
2312
+ "typeName": "string",
2313
+ "class": "string",
2314
+ "arrayCount": 0,
2315
+ "arrayValues": "string"
2316
+ },
2317
+ "additionalProp2": {
2318
+ "typeName": "string",
2319
+ "class": "string",
2320
+ "arrayCount": 0,
2321
+ "arrayValues": "string"
2322
+ },
2323
+ "additionalProp3": {
2324
+ "typeName": "string",
2325
+ "class": "string",
2326
+ "arrayCount": 0,
2327
+ "arrayValues": "string"
2328
+ }
2329
+ },
2330
+ "propertyCount": 0,
2331
+ "propertiesAsStrings": {
2332
+ "additionalProp1": "string",
2333
+ "additionalProp2": "string",
2334
+ "additionalProp3": "string"
2335
+ },
2336
+ "propertyNames": {}
2337
+ },
2338
+ "parentAtEnd1": true
2339
+ }
2340
+
2341
+ """
2342
+
2343
+ loop = asyncio.get_event_loop()
2344
+ response = loop.run_until_complete(self._async_create_governance_definition_from_template(url_marker, body))
2345
+ return response
2346
+
2347
+
2348
+ if __name__ == "__main__":
2349
+ print("Main-Metadata Explorer")