pyegeria 5.4.0.dev11__py3-none-any.whl → 5.4.0.dev12__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 (28) hide show
  1. commands/cat/debug_log +6004 -19655
  2. commands/cat/debug_log.2025-07-01_15-22-20_102237.zip +0 -0
  3. commands/cat/debug_log.2025-07-04_15-43-28_460900.zip +0 -0
  4. commands/cat/debug_log.2025-07-06_20-48-04_338314.zip +0 -0
  5. commands/cat/debug_log.2025-07-09_10-17-09_526262.zip +0 -0
  6. commands/cat/dr_egeria_md.py +23 -13
  7. commands/cat/list_collections.py +9 -2
  8. md_processing/__init__.py +3 -1
  9. md_processing/data/commands.json +7842 -2231
  10. md_processing/md_commands/data_designer_commands.py +29 -19
  11. md_processing/md_commands/glossary_commands.py +3 -1
  12. md_processing/md_commands/product_manager_commands.py +1746 -0
  13. md_processing/md_commands/solution_architect_commands.py +390 -236
  14. md_processing/md_processing_utils/common_md_proc_utils.py +7 -5
  15. md_processing/md_processing_utils/md_processing_constants.py +25 -4
  16. pyegeria/__init__.py +1 -0
  17. pyegeria/_client.py +0 -1
  18. pyegeria/collection_manager_omvs.py +156 -117
  19. pyegeria/data_designer_omvs.py +16 -8
  20. pyegeria/egeria_tech_client.py +9 -25
  21. pyegeria/governance_officer_omvs.py +1446 -1343
  22. pyegeria/output_formatter.py +96 -8
  23. pyegeria/solution_architect_omvs.py +2278 -1728
  24. {pyegeria-5.4.0.dev11.dist-info → pyegeria-5.4.0.dev12.dist-info}/METADATA +1 -1
  25. {pyegeria-5.4.0.dev11.dist-info → pyegeria-5.4.0.dev12.dist-info}/RECORD +28 -23
  26. {pyegeria-5.4.0.dev11.dist-info → pyegeria-5.4.0.dev12.dist-info}/LICENSE +0 -0
  27. {pyegeria-5.4.0.dev11.dist-info → pyegeria-5.4.0.dev12.dist-info}/WHEEL +0 -0
  28. {pyegeria-5.4.0.dev11.dist-info → pyegeria-5.4.0.dev12.dist-info}/entry_points.txt +0 -0
@@ -13,9 +13,10 @@ from typing import Dict, List, Union
13
13
 
14
14
  from httpx import Response
15
15
 
16
- from pyegeria import validate_guid
17
- from pyegeria._client import Client, max_paging_size
16
+ from pyegeria._validators import validate_guid
17
+ from pyegeria._client import Client
18
18
  from pyegeria._globals import NO_ELEMENTS_FOUND
19
+ from pyegeria.output_formatter import generate_output, extract_mermaid_only
19
20
  from pyegeria.utils import body_slimmer
20
21
 
21
22
  sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
@@ -46,7 +47,7 @@ def query_string(params):
46
47
 
47
48
 
48
49
  def base_path(client, view_server: str):
49
- return f"{client.platform_url}/servers/{view_server}/api/open-metadata/metadata-explorer"
50
+ return f"{client.platform_url}/servers/governance-officer/api/open-metadata/metadata-explorer"
50
51
 
51
52
 
52
53
  class GovernanceOfficer(Client):
@@ -76,15 +77,59 @@ class GovernanceOfficer(Client):
76
77
  self.user_id = user_id
77
78
  self.user_pwd = user_pwd
78
79
 
79
- Client.__init__(self, view_server, platform_url, user_id=user_id, user_pwd=user_pwd, token=token, )
80
+ Client.__init__(self, view_server, platform_url, user_id=user_id, user_pwd=user_pwd, token=token)
81
+ self.url_marker = "governance-officer"
80
82
 
81
83
  #
82
84
  # Extract properties functions
83
85
  #
86
+ def generate_governance_definition_output(self, elements: list | dict, search_string: str,
87
+ output_format: str = 'MD') -> str | list:
88
+ """
89
+ Generate output for solution components in the specified format.
90
+
91
+ Given a set of elements representing solution components (either as a list or a dictionary),
92
+ this function generates output in the specified format. The output includes various
93
+ attributes of the solution components, such as their names, descriptions, types, and
94
+ related information like blueprints, parents, and extended properties.
95
+
96
+ Args:
97
+ elements: Dictionary or list of dictionaries containing solution component elements
98
+ search_string: The search string used to find the elements
99
+ output_format: The desired output format (MD, FORM, REPORT, LIST, DICT, MERMAID, HTML)
100
+
101
+ Returns:
102
+ Formatted output as string or list of dictionaries
103
+ """
104
+ # Handle MERMAID and DICT formats
105
+ if output_format == "MERMAID":
106
+ return extract_mermaid_only(elements)
107
+ elif output_format == "DICT":
108
+ return self._extract_gov_def_list(elements) # return extract_basic_dict(elements) # add more to the body
109
+ elif output_format == "HTML":
110
+ return generate_output(elements=elements, search_string=search_string, entity_type="Governance Definition",
111
+ output_format="HTML", extract_properties_func=self._extract_gov_def_properties)
112
+ # For other formats (MD, FORM, REPORT, LIST), use generate_output
113
+ elif output_format in ["MD", "FORM", "REPORT", "LIST"]:
114
+ # Define columns for LIST format
115
+ columns = [{'name': 'Governance Definition', 'key': 'title'}, {'name': 'Type Name', 'key': 'typeName'},
116
+ {'name': 'Scope', 'key': 'scope'}, {'name': 'Qualified Name', 'key': 'documentIdentifier'},
117
+ {'name': 'Summary', 'key': 'summary', 'format': True}, {'name': 'Importance', 'key': 'importance'}, ]
118
+
119
+ return generate_output(elements=elements, search_string=search_string, entity_type="Governance Definition",
120
+ output_format=output_format, extract_properties_func=self._extract_gov_def_properties,
121
+ columns=columns if output_format == 'LIST' else None)
122
+
123
+ # Default case
124
+ return None
125
+
126
+ #
127
+ #
128
+ #
84
129
 
85
- def _extract_supply_chain_list(self, element: Union[Dict, List[Dict]]) -> List[Dict]:
130
+ def _extract_gov_def_list(self, element: Union[Dict, List[Dict]]) -> List[Dict]:
86
131
  """
87
- Normalize supply chain response for a list of dictionaries.
132
+ Normalize governance definition response for a list of dictionaries.
88
133
  Args:
89
134
  element: Dict or List
90
135
 
@@ -93,18 +138,18 @@ class GovernanceOfficer(Client):
93
138
 
94
139
  """
95
140
  if isinstance(element, dict):
96
- return [self._extract_info_supply_chain_properties(element)]
141
+ return [self._extract_gov_def_properties(element)]
97
142
  elif isinstance(element, list):
98
143
  comp_list = []
99
144
  for i in range(len(element)):
100
- comp_list.append(self._extract_info_supply_chain_properties(element[i]))
145
+ comp_list.append(self._extract_gov_def_properties(element[i]))
101
146
  return comp_list
102
147
  else:
103
148
  return []
104
149
 
105
- def _extract_info_supply_chain_properties(self, element: dict) -> dict:
150
+ def _extract_gov_def_properties(self, element: dict) -> dict:
106
151
  """
107
- Extract properties from an information supply chain element.
152
+ Extract properties from an information governance definition element.
108
153
 
109
154
  Args:
110
155
  element: Dictionary containing element data
@@ -114,43 +159,25 @@ class GovernanceOfficer(Client):
114
159
  """
115
160
  guid = element['elementHeader'].get("guid", None)
116
161
  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
- }
162
+ properties['GUID'] = guid
163
+ del properties['class']
164
+
165
+ #
166
+ #
167
+ # qualified_name = properties.get("qualifiedName", None)
168
+ # display_name = properties.get("displayName", None)
169
+ # description = properties.get("description", None)
170
+ # scope = properties.get("scope", None)
171
+ # purposes = properties.get("purposes", [])
172
+ # purpose_md = ""
173
+ # if len(purposes) > 0:
174
+ # for purpose in purposes:
175
+ # purpose_md += f"{purpose},\n"
176
+ # extended_properties = properties.get("extendedProperties", {})
177
+ # additional_properties = properties.get("additionalProperties", {})
178
+ #
179
+
180
+ return properties
154
181
 
155
182
  def _extract_solution_blueprint_properties(self, element: dict) -> dict:
156
183
  """
@@ -218,7 +245,7 @@ class GovernanceOfficer(Client):
218
245
  'solution_components': solution_components_md
219
246
  }
220
247
 
221
- def _extract_component_list(self, element: Union[Dict, List[Dict]]) -> List[Dict]:
248
+ def _extract_gov_def_list(self, element: Union[Dict, List[Dict]]) -> List[Dict]:
222
249
  """
223
250
  Normalize for a list of dictionaries.
224
251
  Args:
@@ -231,10 +258,10 @@ class GovernanceOfficer(Client):
231
258
  if isinstance(element, dict):
232
259
  return [self._extract_solution_components_properties(element)]
233
260
  elif isinstance(element, list):
234
- comp_list = []
261
+ def_list = []
235
262
  for i in range(len(element)):
236
- comp_list.append(self._extract_solution_components_properties(element[i]))
237
- return comp_list
263
+ def_list.append(self._extract_gov_def_properties(element[i]))
264
+ return def_list
238
265
  else:
239
266
  return []
240
267
 
@@ -321,20 +348,32 @@ class GovernanceOfficer(Client):
321
348
  # Markdown output support
322
349
  #
323
350
 
324
- async def _async_create_governance_definition(self, url_marker: str, body: dict) -> str:
325
- """Create an information supply. Async version.
351
+ async def _async_create_governance_definition(self, body: dict) -> str:
352
+ """ Create a governance definition. There are many kinds of governance definition and
353
+ while the overall body structure is the same, many will have different property
354
+ structures nested within them. A list is shown in the notes below.
355
+
356
+ It may be of type:
357
+ * BusinessImperative
358
+ * RegulationArticle
359
+ * Threat
360
+ * GovernancePrinciple
361
+ * GovernanceObligation
362
+ * GovernanceApproach
363
+ * GovernanceProcessingPurpose
364
+ The type is added to the "typeName" property.
365
+
366
+ Async Version.
326
367
 
327
368
  Parameters
328
369
  ----------
329
- url_marker: str
330
- Indicates which service should be used to create the governance definition.
331
370
  body: dict
332
- A dictionary containing the definition of the supply chain to create.
371
+ A dictionary containing the definition of the governance definition to create.
333
372
 
334
373
  Returns
335
374
  -------
336
375
 
337
- str - guid of the supply chain created.
376
+ str - guid of the definition created.
338
377
 
339
378
  Raises
340
379
  ------
@@ -347,106 +386,126 @@ class GovernanceOfficer(Client):
347
386
 
348
387
  Notes
349
388
  ----
350
- https://egeria-project.org/concepts/governance-definition
389
+ Governance definitions can be simple or anchored to a parent element - Both are shown below. depending on
390
+ which structure is used for the body.
391
+
392
+ Many kinds of governance definition have additional properties added. Details are described in the UML diagrams
393
+ on the website and summarized in the table below which shows the property class name and which types
394
+ of governance definitions use it. The test_governance_officer module offers some usage examples.
395
+
396
+ Property Class Name | Definition Types
397
+ ===================================================================================
398
+ GovernanceDefinitionProperties | BusinessImperative, RegulationArticle, Threat, GovernanceProcessingPurpose,
399
+ | GovernancePrinciple, GovernanceObligation, GovernanceApproach
400
+ GovernanceStrategyProperties | GovernanceStrategy
401
+ RegulationProperties | Regulation
402
+ GovernanceControlProperties | GovernanceControl
403
+ SecurityGroupProperties | SecurityGroup
404
+ NamingStandardRuleProperties | NamingStandardRule
405
+ CertificationTypeProperties | CertificationType
406
+ LicenseTyoeProperties | LicenseType
407
+ GovernanceApproachProperties | GovernanceApproach
408
+
409
+
410
+ Generic simple governance body structure:
411
+ {
412
+ "class": "NewElementRequestBody",
413
+ "properties": {
414
+ "class" : "GovernanceDefinitionProperties",
415
+ "typeName" : "enter the type of the governance definition",
416
+ "domainIdentifier": 0,
417
+ "documentIdentifier": "add unique name here",
418
+ "title": "add short name here",
419
+ "summary": "add summary here",
420
+ "description": "add description here",
421
+ "scope": "add scope of effect for this definition",
422
+ "importance": "add importance for this definition",
423
+ "implications": [],
424
+ "outcomes": [],
425
+ "results": [],
426
+ "additionalProperties": {
427
+ "property1" : "propertyValue1",
428
+ "property2" : "propertyValue2"
429
+ }
430
+ },
431
+ "initialStatus": "DRAFT"
432
+ }
351
433
 
352
- Body structure:
434
+ Generic governance Body structure with Parent:
353
435
  {
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",
436
+ "class" : "NewGovernanceDefinitionRequestBody",
437
+ "externalSourceGUID": "add guid here",
438
+ "externalSourceName": "add qualified name here",
439
+ "effectiveTime" : "{{$isoTimestamp}}",
440
+ "forLineage" : false,
441
+ "forDuplicateProcessing" : false,
442
+ "anchorGUID" : "add guid here",
443
+ "isOwnAnchor": false,
444
+ "parentGUID": "add guid here",
445
+ "parentRelationshipTypeName": "add type name here",
364
446
  "parentRelationshipProperties": {
365
- "propertyValueMap": {
366
- "additionalProp1": {
367
- "typeName": "string",
368
- "class": "string",
369
- "arrayCount": 0,
370
- "arrayValues": "string"
371
- },
372
- "additionalProp2": {
447
+ "class": "ElementProperties",
448
+ "propertyValueMap" : {
449
+ "description" : {
450
+ "class": "PrimitiveTypePropertyValue",
373
451
  "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"
452
+ "primitiveValue" : "New description"
383
453
  }
384
- },
385
- "propertyCount": 0,
386
- "propertiesAsStrings": {
387
- "additionalProp1": "string",
388
- "additionalProp2": "string",
389
- "additionalProp3": "string"
390
- },
391
- "propertyNames": {}
454
+ }
392
455
  },
393
- "parentAtEnd1": true,
456
+ "parentAtEnd1": false,
394
457
  "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",
458
+ "class" : "GovernanceDefinitionProperties",
459
+ "typeName" : "enter the type of the governance definition",
460
+ "domainIdentifier": 0,
461
+ "documentIdentifier": "add unique name here",
462
+ "title": "add short name here",
463
+ "summary": "add summary here",
464
+ "description": "add description here",
465
+ "scope": "add scope of effect for this definition",
466
+ "importance": "add importance for this definition",
467
+ "implications": [],
468
+ "outcomes": [],
469
+ "results": [],
404
470
  "additionalProperties": {
405
- "additionalProp1": "string",
406
- "additionalProp2": "string",
407
- "additionalProp3": "string"
471
+ "property1" : "propertyValue1",
472
+ "property2" : "propertyValue2"
408
473
  },
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"
474
+ "effectiveFrom": "{{$isoTimestamp}}",
475
+ "effectiveTo": "{{$isoTimestamp}}"
425
476
  },
426
- "initialStatus": "GovernanceDefinitionStatus : Draft"
477
+ "initialStatus": "DRAFT"
427
478
  }
428
479
 
429
480
  """
430
- url = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance_definitions"
481
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
482
+ f"{self.url_marker}/governance-definitions")
431
483
 
432
484
  response = await self._async_make_request("POST", url, body_slimmer(body))
433
485
 
434
- return response.json().get("guid", "Supply Chain not created")
486
+ return response.json().get("guid", "Governance Definition not created")
435
487
 
436
- def create_governance_definition(self, url_marker: str, body: dict) -> str:
437
- """Create a governance definition.
488
+ def create_governance_definition(self, body: dict) -> str:
489
+ """ Create a governance definition. It may be of type:
490
+ * BusinessImperative
491
+ * RegulationArticle
492
+ * Threat
493
+ * GovernancePrinciple
494
+ * GovernanceObligation
495
+ * GovernanceApproach
496
+ * GovernanceProcessingPurpose
497
+ The type is added to the "typeName" property.
438
498
 
439
499
  Parameters
440
500
  ----------
441
- url_marker: str
442
- Indicates which service should be used to create the governance definition.
501
+
443
502
  body: dict
444
- A dictionary containing the definition of the supply chain to create.
503
+ A dictionary containing the definition of the governance definition to create.
445
504
 
446
505
  Returns
447
506
  -------
448
507
 
449
- str - guid of the supply chain created.
508
+ str - guid of the definition created.
450
509
 
451
510
  Raises
452
511
  ------
@@ -459,106 +518,118 @@ class GovernanceOfficer(Client):
459
518
 
460
519
  Notes
461
520
  ----
521
+ Governance definitions can be simple or anchored to a parent element - Both are shown below. depending on
522
+ which structure is used for the body.
523
+
524
+ Many kinds of governance definition have additional properties added. Details are described in the UML diagrams
525
+ on the website and summarized in the table below which shows the property class name and which types
526
+ of governance definitions use it. The test_governance_officer module offers some usage examples.
527
+
528
+ Property Class Name | Definition Types
529
+ ===================================================================================
530
+ GovernanceDefinitionProperties | BusinessImperative, RegulationArticle, Threat, GovernanceProcessingPurpose,
531
+ | GovernancePrinciple, GovernanceObligation, GovernanceApproach
532
+ GovernanceStrategyProperties | GovernanceStrategy
533
+ RegulationProperties | Regulation
534
+ GovernanceControlProperties | GovernanceControl
535
+ SecurityGroupProperties | SecurityGroup
536
+ NamingStandardRuleProperties | NamingStandardRule
537
+ CertificationTypeProperties | CertificationType
538
+ LicenseTyoeProperties | LicenseType
539
+ GovernanceApproachProperties | GovernanceApproach
540
+
541
+ Simple body structure:
542
+ {
543
+ "class": "NewElementRequestBody",
544
+ "properties": {
545
+ "class" : "GovernanceDefinitionProperties",
546
+ "typeName" : "enter the type of the governance definition",
547
+ "domainIdentifier": 0,
548
+ "documentIdentifier": "add unique name here",
549
+ "title": "add short name here",
550
+ "summary": "add summary here",
551
+ "description": "add description here",
552
+ "scope": "add scope of effect for this definition",
553
+ "importance": "add importance for this definition",
554
+ "implications": [],
555
+ "outcomes": [],
556
+ "results": [],
557
+ "additionalProperties": {
558
+ "property1" : "propertyValue1",
559
+ "property2" : "propertyValue2"
560
+ }
561
+ },
562
+ "initialStatus": "DRAFT"
563
+ }
462
564
 
463
- Body structure:
565
+ Body structure with Parent:
464
566
  {
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",
567
+ "class" : "NewGovernanceDefinitionRequestBody",
568
+ "externalSourceGUID": "add guid here",
569
+ "externalSourceName": "add qualified name here",
570
+ "effectiveTime" : "{{$isoTimestamp}}",
571
+ "forLineage" : false,
572
+ "forDuplicateProcessing" : false,
573
+ "anchorGUID" : "add guid here",
574
+ "isOwnAnchor": false,
575
+ "parentGUID": "add guid here",
576
+ "parentRelationshipTypeName": "add type name here",
475
577
  "parentRelationshipProperties": {
476
- "propertyValueMap": {
477
- "additionalProp1": {
478
- "typeName": "string",
479
- "class": "string",
480
- "arrayCount": 0,
481
- "arrayValues": "string"
482
- },
483
- "additionalProp2": {
578
+ "class": "ElementProperties",
579
+ "propertyValueMap" : {
580
+ "description" : {
581
+ "class": "PrimitiveTypePropertyValue",
484
582
  "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"
583
+ "primitiveValue" : "New description"
494
584
  }
495
- },
496
- "propertyCount": 0,
497
- "propertiesAsStrings": {
498
- "additionalProp1": "string",
499
- "additionalProp2": "string",
500
- "additionalProp3": "string"
501
- },
502
- "propertyNames": {}
585
+ }
503
586
  },
504
- "parentAtEnd1": true,
587
+ "parentAtEnd1": false,
505
588
  "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",
589
+ "class" : "GovernanceDefinitionProperties",
590
+ "typeName" : "enter the type of the governance definition",
591
+ "domainIdentifier": 0,
592
+ "documentIdentifier": "add unique name here",
593
+ "title": "add short name here",
594
+ "summary": "add summary here",
595
+ "description": "add description here",
596
+ "scope": "add scope of effect for this definition",
597
+ "importance": "add importance for this definition",
598
+ "implications": [],
599
+ "outcomes": [],
600
+ "results": [],
515
601
  "additionalProperties": {
516
- "additionalProp1": "string",
517
- "additionalProp2": "string",
518
- "additionalProp3": "string"
602
+ "property1" : "propertyValue1",
603
+ "property2" : "propertyValue2"
519
604
  },
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"
605
+ "effectiveFrom": "{{$isoTimestamp}}",
606
+ "effectiveTo": "{{$isoTimestamp}}"
536
607
  },
537
- "initialStatus": "GovernanceDefinitionStatus : Draft"
608
+ "initialStatus": "DRAFT"
538
609
  }
539
610
 
611
+
540
612
  """
541
613
 
542
614
  loop = asyncio.get_event_loop()
543
- response = loop.run_until_complete(self._async_create_governance_definition(url_marker, body))
615
+ response = loop.run_until_complete(self._async_create_governance_definition(body))
544
616
  return response
545
617
 
546
- async def _async_delete_governance_definition(self, guid: str, url_marker: str, body: dict) -> str:
547
- """ Delete an information supply. Async version.
618
+ async def _async_create_governance_definition_from_template(self, body: dict) -> str:
619
+ """ Create a new metadata element to represent a governance definition using an existing metadata element
620
+ as a template. The template defines additional classifications and relationships that should be added to
621
+ the new element. Async version.
548
622
 
549
623
  Parameters
550
624
  ----------
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.
625
+
555
626
  body: dict
556
- A dictionary containing the definition of the supply chain to create.
627
+ A dictionary containing the definition of the governance definition to create.
557
628
 
558
629
  Returns
559
630
  -------
560
631
 
561
- str - guid of the supply chain created.
632
+ str - guid of the governance definition created.
562
633
 
563
634
  Raises
564
635
  ------
@@ -574,38 +645,69 @@ class GovernanceOfficer(Client):
574
645
  https://egeria-project.org/concepts/governance-definition
575
646
 
576
647
  Body structure:
648
+
577
649
  {
578
- "class": "",
579
- "externalSourceGUID": "string",
580
- "externalSourceName": "string",
581
- "forLineage": true,
582
- "forDuplicateProcessing": true,
583
- "effectiveTime": "2025-06-13T01:45:46.235Z"
650
+ "class" : "TemplateRequestBody",
651
+ "externalSourceGUID": "add guid here",
652
+ "externalSourceName": "add qualified name here",
653
+ "effectiveTime" : "{{$isoTimestamp}}",
654
+ "forLineage" : false,
655
+ "forDuplicateProcessing" : false,
656
+ "anchorGUID" : "add guid here",
657
+ "isOwnAnchor": false,
658
+ "parentGUID": "add guid here",
659
+ "parentRelationshipTypeName": "add type name here",
660
+ "parentRelationshipProperties": {
661
+ "class": "ElementProperties",
662
+ "propertyValueMap" : {
663
+ "description" : {
664
+ "class": "PrimitiveTypePropertyValue",
665
+ "typeName": "string",
666
+ "primitiveValue" : "New description"
667
+ }
668
+ }
669
+ },
670
+ "parentAtEnd1": false,
671
+ "templateGUID": "add guid here",
672
+ "replacementProperties": {
673
+ "class": "ElementProperties",
674
+ "propertyValueMap" : {
675
+ "description" : {
676
+ "class": "PrimitiveTypePropertyValue",
677
+ "typeName": "string",
678
+ "primitiveValue" : "New description"
679
+ }
680
+ }
681
+ },
682
+ "placeholderPropertyValues": {
683
+ "placeholder1" : "propertyValue1",
684
+ "placeholder2" : "propertyValue2"
685
+ }
584
686
  }
687
+
585
688
  """
586
689
  url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
587
- f"{url_marker}/governance_definitions/delete")
690
+ f"{self.url_marker}/governance-definitions/from-template")
588
691
 
589
692
  response = await self._async_make_request("POST", url, body_slimmer(body))
590
693
 
591
- return
694
+ return response.json().get("guid", "Governance definition not created")
592
695
 
593
- def create_delete_governance_definition(self, guid: str, url_marker: str, body: dict) -> str:
594
- """ Delete an information supply. Async version.
696
+ def create_governance_definition_from_template(self, body: dict) -> str:
697
+ """ Create a new metadata element to represent a governance definition using an existing metadata element
698
+ as a template. The template defines additional classifications and relationships that should be added to
699
+ the new element.
595
700
 
596
701
  Parameters
597
702
  ----------
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.
703
+
602
704
  body: dict
603
- A dictionary containing the definition of the supply chain to create.
705
+ A dictionary containing the definition of the governance definition to create.
604
706
 
605
707
  Returns
606
708
  -------
607
709
 
608
- str - guid of the supply chain created.
710
+ str - guid of the governance definition created.
609
711
 
610
712
  Raises
611
713
  ------
@@ -621,47 +723,69 @@ class GovernanceOfficer(Client):
621
723
  https://egeria-project.org/concepts/governance-definition
622
724
 
623
725
  Body structure:
726
+
624
727
  {
625
- "class": "",
626
- "externalSourceGUID": "string",
627
- "externalSourceName": "string",
628
- "forLineage": true,
629
- "forDuplicateProcessing": true,
630
- "effectiveTime": "2025-06-13T01:45:46.235Z"
728
+ "class" : "TemplateRequestBody",
729
+ "externalSourceGUID": "add guid here",
730
+ "externalSourceName": "add qualified name here",
731
+ "effectiveTime" : "{{$isoTimestamp}}",
732
+ "forLineage" : false,
733
+ "forDuplicateProcessing" : false,
734
+ "anchorGUID" : "add guid here",
735
+ "isOwnAnchor": false,
736
+ "parentGUID": "add guid here",
737
+ "parentRelationshipTypeName": "add type name here",
738
+ "parentRelationshipProperties": {
739
+ "class": "ElementProperties",
740
+ "propertyValueMap" : {
741
+ "description" : {
742
+ "class": "PrimitiveTypePropertyValue",
743
+ "typeName": "string",
744
+ "primitiveValue" : "New description"
745
+ }
746
+ }
747
+ },
748
+ "parentAtEnd1": false,
749
+ "templateGUID": "add guid here",
750
+ "replacementProperties": {
751
+ "class": "ElementProperties",
752
+ "propertyValueMap" : {
753
+ "description" : {
754
+ "class": "PrimitiveTypePropertyValue",
755
+ "typeName": "string",
756
+ "primitiveValue" : "New description"
757
+ }
758
+ }
759
+ },
760
+ "placeholderPropertyValues": {
761
+ "placeholder1" : "propertyValue1",
762
+ "placeholder2" : "propertyValue2"
763
+ }
631
764
  }
765
+
632
766
  """
633
767
 
634
768
  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:
769
+ response = loop.run_until_complete(self._async_create_governance_definition_from_template(body))
770
+ return response
640
771
 
641
- """ Get governance definition in context.
642
- Async version.
772
+ async def _async_update_governance_definition(self, guid: str, body: dict,
773
+ replace_all_properties: bool = False) -> None:
774
+ """ Update the properties of a governance definition. Async Version.
643
775
 
644
776
  Parameters
645
777
  ----------
646
778
  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.
779
+ guid of the governance definition to update.
650
780
  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.
781
+ A dictionary containing the updates to the governance definition.
782
+ replace_all_properties: bool, optional
783
+ Whether to replace all properties with those provided in the body or to merge with existing properties.
658
784
 
659
785
  Returns
660
786
  -------
661
787
 
662
- list[dict] | str
663
- A list of information supply chain structures or a string if there are no elements found.
664
-
788
+ None
665
789
 
666
790
  Raises
667
791
  ------
@@ -674,65 +798,62 @@ class GovernanceOfficer(Client):
674
798
 
675
799
  Notes
676
800
  ----
677
- https://egeria-project.org/concepts/governance-definition
678
801
 
679
802
  Body structure:
680
803
  {
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"
804
+ "class" : "UpdateElementRequestBody",
805
+ "externalSourceGUID": "add guid here",
806
+ "externalSourceName": "add qualified name here",
807
+ "effectiveTime" : "{{$isoTimestamp}}",
808
+ "forLineage" : false,
809
+ "forDuplicateProcessing" : false,
810
+ "properties": {
811
+ "class" : "GovernanceDefinitionProperties",
812
+ "typeName" : "Add type name here",
813
+ "qualifiedName": "add unique name here",
814
+ "displayName": "add short name here",
815
+ "description": "add description here",
816
+ "namespace": "add namespace for this structure",
817
+ "versionIdentifier": "add version for this structure",
818
+ "additionalProperties": {
819
+ "property1" : "propertyValue1",
820
+ "property2" : "propertyValue2"
821
+ },
822
+ "extendedProperties": {
823
+ "property1" : "propertyValue1",
824
+ "property2" : "propertyValue2"
825
+ },
826
+ "effectiveFrom": "{{$isoTimestamp}}",
827
+ "effectiveTo": "{{$isoTimestamp}}"
828
+ }
690
829
  }
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
-
830
+ """
831
+ validate_guid(guid)
832
+ replace_all_properties_s = str(replace_all_properties).lower()
833
+ url = (
834
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/governance-definitions/"
835
+ f"{guid}/update?replaceAllProperties={replace_all_properties_s}")
698
836
  if body:
699
- response = await self._async_make_request("POST", url, body_slimmer(body))
837
+ await self._async_make_request("POST", url, body_slimmer(body))
700
838
  else:
701
- response = await self._async_make_request("POST", url)
839
+ await self._async_make_request("POST", url)
702
840
 
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.
841
+ def update_governance_definition(self, guid: str, body: dict, replace_all_properties: bool = False) -> None:
842
+ """ Update the properties of a governance definition.
714
843
 
715
844
  Parameters
716
845
  ----------
717
846
  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.
847
+ guid of the governance definition to update.
721
848
  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.
849
+ A dictionary containing the updates to the governance definition.
850
+ replace_all_properties: bool, optional
851
+ Whether to replace all properties with those provided in the body or to merge with existing properties.
729
852
 
730
853
  Returns
731
854
  -------
732
855
 
733
- list[dict] | str
734
- A list of information supply chain structures or a string if there are no elements found.
735
-
856
+ None
736
857
 
737
858
  Raises
738
859
  ------
@@ -745,51 +866,57 @@ class GovernanceOfficer(Client):
745
866
 
746
867
  Notes
747
868
  ----
748
- https://egeria-project.org/concepts/governance-definition
749
869
 
750
870
  Body structure:
751
871
  {
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"
872
+ "class" : "UpdateElementRequestBody",
873
+ "externalSourceGUID": "add guid here",
874
+ "externalSourceName": "add qualified name here",
875
+ "effectiveTime" : "{{$isoTimestamp}}",
876
+ "forLineage" : false,
877
+ "forDuplicateProcessing" : false,
878
+ "properties": {
879
+ "class" : "GovernanceDefinitionProperties",
880
+ "typeName" : "Add type name here",
881
+ "qualifiedName": "add unique name here",
882
+ "displayName": "add short name here",
883
+ "description": "add description here",
884
+ "namespace": "add namespace for this structure",
885
+ "versionIdentifier": "add version for this structure",
886
+ "additionalProperties": {
887
+ "property1" : "propertyValue1",
888
+ "property2" : "propertyValue2"
889
+ },
890
+ "extendedProperties": {
891
+ "property1" : "propertyValue1",
892
+ "property2" : "propertyValue2"
893
+ },
894
+ "effectiveFrom": "{{$isoTimestamp}}",
895
+ "effectiveTo": "{{$isoTimestamp}}"
896
+ }
761
897
  }
762
-
763
- """
764
-
898
+ """
765
899
  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
900
+ loop.run_until_complete(self._async_update_governance_definition(guid, body, replace_all_properties))
769
901
 
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.
902
+ async def _async_update_governance_definition_status(self, guid: str, body: dict,
903
+ replace_all_properties: bool = False) -> None:
904
+ """ Update the status of a governance definition. Async Version.
775
905
 
776
906
  Parameters
777
907
  ----------
778
908
  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.
909
+ guid of the governance definition to update.
910
+
782
911
  body: dict
783
- A dictionary containing the definition of the supply chain to create.
784
- output_format: str
785
- The output format to use.
912
+ A dictionary containing the updates to the governance definition.
913
+ replace_all_properties: bool, optional
914
+ Whether to replace all properties with those provided in the body or to merge with existing properties.
786
915
 
787
916
  Returns
788
917
  -------
789
918
 
790
- dict | str
791
- A list of information supply chain structures or a string if there are no elements found.
792
-
919
+ None
793
920
 
794
921
  Raises
795
922
  ------
@@ -802,55 +929,87 @@ class GovernanceOfficer(Client):
802
929
 
803
930
  Notes
804
931
  ----
805
- https://egeria-project.org/concepts/governance-definition
806
932
 
807
933
  Body structure:
808
934
  {
809
- "effectiveTime": "2025-06-13T14:43:32.194Z",
810
- "asOfTime": "2025-06-13T14:43:32.194Z",
811
- "forLineage": true,
812
- "forDuplicateProcessing": true
935
+ "class": "UpdateGovernanceDefinitionRequestBody",
936
+ "externalSourceGUID": "add guid here",
937
+ "externalSourceName": "add qualified name here",
938
+ "effectiveTime": "{{$isoTimestamp}}",
939
+ "forLineage": false,
940
+ "forDuplicateProcessing": false,
941
+ "status": "ACTIVE"
813
942
  }
943
+ """
944
+ validate_guid(guid)
945
+ replace_all_properties_s = str(replace_all_properties).lower()
946
+ url = (
947
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/governance-defnitions/"
948
+ f"{guid}/update-status?replaceAllProperties={replace_all_properties_s}")
814
949
 
815
- """
816
- possible_query_params = query_string([("startFrom", start_from), ("pageSize", page_size)])
950
+ await self._async_make_request("POST", url, body_slimmer(body))
817
951
 
818
- url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance_definitions/"
819
- f"retrieve")
952
+ def update_governance_definition_status(self, guid: str, body: dict, replace_all_properties: bool = False) -> None:
953
+ """ Update the status of a governance definition.
820
954
 
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)
955
+ Parameters
956
+ ----------
957
+ guid: str
958
+ guid of the information governance definition to update.
959
+ body: dict
960
+ A dictionary containing the updates to the governance definition.
961
+ replace_all_properties: bool, optional
962
+ Whether to replace all properties with those provided in the body or to merge with existing properties.
825
963
 
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)
964
+ Returns
965
+ -------
832
966
 
833
- def get_gov_def_by_guid(self, guid: str, url_marker: str, body: dict, output_format: str) -> dict | str:
967
+ None
834
968
 
835
- """ Get governance definition by guid.
969
+ Raises
970
+ ------
971
+ InvalidParameterException
972
+ one of the parameters is null or invalid or
973
+ PropertyServerException
974
+ There is a problem adding the element properties to the metadata repository or
975
+ UserNotAuthorizedException
976
+ the requesting user is not authorized to issue this request.
977
+
978
+ Notes
979
+ ----
980
+
981
+ Body structure:
982
+ {
983
+ "class" : "UpdateGovernanceDefinitionRequestBody",
984
+ "externalSourceGUID": "add guid here",
985
+ "externalSourceName": "add qualified name here",
986
+ "effectiveTime" : "{{$isoTimestamp}}",
987
+ "forLineage" : false,
988
+ "forDuplicateProcessing" : false,
989
+ "status": "ACTIVE"
990
+ }
991
+ """
992
+ loop = asyncio.get_event_loop()
993
+ loop.run_until_complete(self._async_update_governance_definition_status(guid, body, replace_all_properties))
994
+
995
+ async def _async_link_peer_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
996
+ body: dict = None) -> None:
997
+ """ Attach two peer governance definitions. Request body is optional. Async Version.
836
998
 
837
999
  Parameters
838
1000
  ----------
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.
1001
+ definition_guid1: str
1002
+ guid of the first governance definition to link.
1003
+ definition_guid2: str
1004
+ guid of the second governance definition to link.
1005
+ relationship_type: str
1006
+ Relationship type name linking the governance definitions..
843
1007
  body: dict
844
- A dictionary containing the definition of the supply chain to create.
845
- output_format: str
846
- The output format to use.
1008
+ The body describing the link between the two segments.
847
1009
 
848
1010
  Returns
849
1011
  -------
850
-
851
- dict | str
852
- A list of information supply chain structures or a string if there are no elements found.
853
-
1012
+ None
854
1013
 
855
1014
  Raises
856
1015
  ------
@@ -863,192 +1022,43 @@ class GovernanceOfficer(Client):
863
1022
 
864
1023
  Notes
865
1024
  ----
866
- https://egeria-project.org/concepts/governance-definition
1025
+ The relationshipTypeNme can be:
1026
+ * GovernanceDriverLink between governance drivers (GovernanceStrategy, BusinessImperitive, Regulation, RegulationArticle, Threat).
1027
+ * GovernancePolicyLink between governance policies (GovernancePrinciple, GovernanceObligation, GovernanceApproach).
1028
+ * GovernanceControlLink between governance controls (GovernanceRule, GovernanceProcess, GovernanceResponsibility, GovernanceProcedure, SecurityAccessControl, SecurityGroup).
867
1029
 
868
1030
  Body structure:
869
1031
  {
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"
1032
+ "class" : "RelationshipRequestBody",
1033
+ "externalSourceGUID": "add guid here",
1034
+ "externalSourceName": "add qualified name here",
1035
+ "effectiveTime" : "{{$isoTimestamp}}",
1036
+ "forLineage" : false,
1037
+ "forDuplicateProcessing" : false,
1038
+ "properties": {
1039
+ "class": "PeerDefinitionProperties",
1040
+ "description": "",
1041
+ "effectiveFrom": "{{$isoTimestamp}}",
1042
+ "effectiveTo": "{{$isoTimestamp}}"
1043
+ }
879
1044
  }
1045
+ """
1046
+ validate_guid(definition_guid1)
1047
+ validate_guid(definition_guid2)
880
1048
 
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")
1049
+ url = (
1050
+ f"{self.platform_url}/s"
1051
+ f"ervers/{self.view_server}/api/open-metadata/goverance-officer/governance-definitions/"
1052
+ f"{definition_guid1}/peer-definitions/{relationship_type}/{definition_guid2}/attach")
1041
1053
 
1042
1054
  await self._async_make_request("POST", url, body_slimmer(body))
1043
1055
 
1044
- def link_peer_definitions(self, url_marker: str, definition_guid1: str, relationship_type: str,
1045
- definition_guid2: str, body: dict) -> None:
1056
+ def link_peer_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
1057
+ body: dict = None) -> None:
1046
1058
  """ Attach two peer governance definitions. Async Version.
1047
1059
 
1048
1060
  Parameters
1049
1061
  ----------
1050
- url_marker: str
1051
- Indicates which service should be used to link the governance definition.
1052
1062
  definition_guid1: str
1053
1063
  guid of the first governance definition to link.
1054
1064
  definition_guid2: str
@@ -1073,47 +1083,44 @@ class GovernanceOfficer(Client):
1073
1083
 
1074
1084
  Notes
1075
1085
  ----
1086
+ The relationshipTypeNme can be:
1087
+ * GovernanceDriverLink between governance drivers (GovernanceStrategy, BusinessImperitive, Regulation, RegulationArticle, Threat).
1088
+ * GovernancePolicyLink between governance policies (GovernancePrinciple, GovernanceObligation, GovernanceApproach).
1089
+ * GovernanceControlLink between governance controls (GovernanceRule, GovernanceProcess, GovernanceResponsibility, GovernanceProcedure, SecurityAccessControl, SecurityGroup).
1076
1090
 
1077
1091
  Body structure:
1078
1092
  {
1079
- "externalSourceGUID": "string",
1080
- "externalSourceName": "string",
1081
- "forLineage": true,
1082
- "forDuplicateProcessing": true,
1083
- "effectiveTime": "2025-06-13T15:03:28.505Z",
1093
+ "class" : "RelationshipRequestBody",
1094
+ "externalSourceGUID": "add guid here",
1095
+ "externalSourceName": "add qualified name here",
1096
+ "effectiveTime" : "{{$isoTimestamp}}",
1097
+ "forLineage" : false,
1098
+ "forDuplicateProcessing" : false,
1084
1099
  "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"
1100
+ "class": "PeerDefinitionProperties",
1101
+ "description": "",
1102
+ "effectiveFrom": "{{$isoTimestamp}}",
1103
+ "effectiveTo": "{{$isoTimestamp}}"
1095
1104
  }
1096
1105
  }
1097
1106
  """
1098
1107
  loop = asyncio.get_event_loop()
1099
1108
  loop.run_until_complete(
1100
- self._async_link_peer_definitions(url_marker, definition_guid1, relationship_type, definition_guid2, body))
1109
+ self._async_link_peer_definitions(definition_guid1, relationship_type, definition_guid2, body))
1101
1110
 
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.
1111
+ async def _async_detach_peer_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
1112
+ body: dict = None) -> None:
1113
+ """ Detach two peer governance definitions. Request body is optional. Async Version.
1105
1114
 
1106
1115
  Parameters
1107
1116
  ----------
1108
- url_marker: str
1109
- Indicates which service should be used to link the governance definition.
1110
1117
  definition_guid1: str
1111
1118
  guid of the first governance definition to link.
1112
1119
  definition_guid2: str
1113
1120
  guid of the second governance definition to link.
1114
1121
  relationship_type: str
1115
1122
  Relationship type name linking the governance definitions..
1116
- body: dict
1123
+ body: dict, optional
1117
1124
  The body describing the link between the two segments.
1118
1125
 
1119
1126
  Returns
@@ -1133,37 +1140,39 @@ class GovernanceOfficer(Client):
1133
1140
  ----
1134
1141
 
1135
1142
  Body structure:
1143
+
1136
1144
  {
1137
- "externalSourceGUID": "string",
1138
- "externalSourceName": "string",
1139
- "forLineage": true,
1140
- "forDuplicateProcessing": true,
1141
- "effectiveTime": "2025-06-13T15:13:31.339Z"
1145
+ "class": "MetadataSourceRequestBody",
1146
+ "externalSourceGUID": "add guid here",
1147
+ "externalSourceName": "add qualified name here",
1148
+ "effectiveTime": "{{$isoTimestamp}}",
1149
+ "forLineage": false,
1150
+ "forDuplicateProcessing": false
1142
1151
  }
1143
1152
  """
1144
1153
  validate_guid(definition_guid1)
1145
1154
  validate_guid(definition_guid2)
1146
1155
 
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")
1156
+ url = (
1157
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1158
+ f"{self.url_marker}/governance-definitions/"
1159
+ f"{definition_guid1}/peer-definitions/{relationship_type}/{definition_guid2}/detach")
1149
1160
 
1150
1161
  await self._async_make_request("POST", url, body_slimmer(body))
1151
1162
 
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.
1163
+ def detach_peer_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
1164
+ body: dict = None) -> None:
1165
+ """ Detach two peer governance definitions. Request body is optional.
1155
1166
 
1156
1167
  Parameters
1157
1168
  ----------
1158
- url_marker: str
1159
- Indicates which service should be used to link the governance definition.
1160
1169
  definition_guid1: str
1161
1170
  guid of the first governance definition to link.
1162
1171
  definition_guid2: str
1163
1172
  guid of the second governance definition to link.
1164
1173
  relationship_type: str
1165
1174
  Relationship type name linking the governance definitions..
1166
- body: dict
1175
+ body: dict, optional
1167
1176
  The body describing the link between the two segments.
1168
1177
 
1169
1178
  Returns
@@ -1183,27 +1192,35 @@ class GovernanceOfficer(Client):
1183
1192
  ----
1184
1193
 
1185
1194
  Body structure:
1195
+
1186
1196
  {
1187
- "externalSourceGUID": "string",
1188
- "externalSourceName": "string",
1189
- "forLineage": true,
1190
- "forDuplicateProcessing": true,
1191
- "effectiveTime": "2025-06-13T15:13:31.339Z"
1197
+ "class": "MetadataSourceRequestBody",
1198
+ "externalSourceGUID": "add guid here",
1199
+ "externalSourceName": "add qualified name here",
1200
+ "effectiveTime": "{{$isoTimestamp}}",
1201
+ "forLineage": false,
1202
+ "forDuplicateProcessing": false
1192
1203
  }
1193
1204
  """
1194
1205
  loop = asyncio.get_event_loop()
1195
1206
  loop.run_until_complete(
1196
- self._async_detach_peer_definitions(url_marker, definition_guid1, relationship_type, definition_guid2,
1197
- body))
1207
+ self._async_detach_peer_definitions(definition_guid1, relationship_type, definition_guid2, body))
1208
+
1209
+ async def _async_attach_supporting_definitions(self, definition_guid1: str, relationship_type: str,
1210
+ definition_guid2: str, body: dict = None) -> None:
1211
+ """ Attach a supporting governance definition. Request body is optional.
1212
+ The relationshipTypeNme can be:
1213
+ * GovernanceResponse between governance drivers (GovernanceStrategy, BusinessImperitive, Regulation,
1214
+ RegulationArticle, Threat) and governance policies (GovernancePrinciple, GovernanceObligation,
1215
+ GovernanceApproach).
1216
+ * GovernanceImplementation between governance policies (GovernancePrinciple, GovernanceObligation,
1217
+ GovernanceApproach) and governance controls (GovernanceRule, GovernanceProcess, GovernanceResponsibility,
1218
+ GovernanceProcedure, SecurityAccessControl, SecurityGroup).
1198
1219
 
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.
1220
+ Async Version.
1202
1221
 
1203
1222
  Parameters
1204
1223
  ----------
1205
- url_marker: str
1206
- Indicates which service should be used to link the governance definition.
1207
1224
  definition_guid1: str
1208
1225
  guid of the first governance definition to link.
1209
1226
  definition_guid2: str
@@ -1230,42 +1247,44 @@ class GovernanceOfficer(Client):
1230
1247
  ----
1231
1248
 
1232
1249
  Body structure:
1233
- {
1234
- "externalSourceGUID": "string",
1235
- "externalSourceName": "string",
1236
- "forLineage": true,
1237
- "forDuplicateProcessing": true,
1238
- "effectiveTime": "2025-06-13T18:04:45.117Z",
1250
+ {
1251
+ "class" : "RelationshipRequestBody",
1252
+ "externalSourceGUID": "add guid here",
1253
+ "externalSourceName": "add qualified name here",
1254
+ "effectiveTime" : "{{$isoTimestamp}}",
1255
+ "forLineage" : false,
1256
+ "forDuplicateProcessing" : false,
1239
1257
  "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"
1258
+ "class": "SupportingDefinitionProperties",
1259
+ "rationale": "",
1260
+ "effectiveFrom": "{{$isoTimestamp}}",
1261
+ "effectiveTo": "{{$isoTimestamp}}"
1250
1262
  }
1251
1263
  }
1252
1264
  """
1253
1265
  validate_guid(definition_guid1)
1254
1266
  validate_guid(definition_guid2)
1255
1267
 
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")
1268
+ url = (
1269
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1270
+ f"{self.url_marker}/governance-definitions/"
1271
+ f"{definition_guid1}/supporting-definitions/{relationship_type}/{definition_guid2}/attach")
1258
1272
 
1259
1273
  await self._async_make_request("POST", url, body_slimmer(body))
1260
1274
 
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.
1275
+ def attach_supporting_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
1276
+ body: dict = None) -> None:
1277
+ """ Attach a supporting governance definition. Request body is optional.
1278
+ The relationshipTypeNme can be:
1279
+ * GovernanceResponse between governance drivers (GovernanceStrategy, BusinessImperitive, Regulation,
1280
+ RegulationArticle, Threat) and governance policies (GovernancePrinciple, GovernanceObligation,
1281
+ GovernanceApproach).
1282
+ * GovernanceImplementation between governance policies (GovernancePrinciple, GovernanceObligation,
1283
+ GovernanceApproach) and governance controls (GovernanceRule, GovernanceProcess, GovernanceResponsibility,
1284
+ GovernanceProcedure, SecurityAccessControl, SecurityGroup).
1264
1285
 
1265
1286
  Parameters
1266
1287
  ----------
1267
- url_marker: str
1268
- Indicates which service should be used to link the governance definition.
1269
1288
  definition_guid1: str
1270
1289
  guid of the first governance definition to link.
1271
1290
  definition_guid2: str
@@ -1293,45 +1312,38 @@ class GovernanceOfficer(Client):
1293
1312
 
1294
1313
  Body structure:
1295
1314
  {
1296
- "externalSourceGUID": "string",
1297
- "externalSourceName": "string",
1298
- "forLineage": true,
1299
- "forDuplicateProcessing": true,
1300
- "effectiveTime": "2025-06-13T18:04:45.117Z",
1315
+ "class" : "RelationshipRequestBody",
1316
+ "externalSourceGUID": "add guid here",
1317
+ "externalSourceName": "add qualified name here",
1318
+ "effectiveTime" : "{{$isoTimestamp}}",
1319
+ "forLineage" : false,
1320
+ "forDuplicateProcessing" : false,
1301
1321
  "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"
1322
+ "class": "SupportingDefinitionProperties",
1323
+ "rationale": "",
1324
+ "effectiveFrom": "{{$isoTimestamp}}",
1325
+ "effectiveTo": "{{$isoTimestamp}}"
1312
1326
  }
1313
1327
  }
1314
1328
  """
1315
1329
  loop = asyncio.get_event_loop()
1316
1330
  loop.run_until_complete(
1317
- self._async_link_supporting_definitions(url_marker, definition_guid1, relationship_type, definition_guid2,
1318
- body))
1331
+ self._async_attach_supporting_definitions(definition_guid1, relationship_type, definition_guid2, body))
1319
1332
 
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.
1333
+ async def _async_detach_supporting_definitions(self, definition_guid1: str, relationship_type: str,
1334
+ definition_guid2: str, body: dict = None) -> None:
1335
+ """ Detach a governance definition from a supporting governance definition.
1336
+ Request body is optional. Async Version.
1323
1337
 
1324
1338
  Parameters
1325
1339
  ----------
1326
- url_marker: str
1327
- Indicates which service should be used to link the governance definition.
1328
1340
  definition_guid1: str
1329
1341
  guid of the first governance definition to unlink.
1330
1342
  definition_guid2: str
1331
1343
  guid of the second governance definition to unlink.
1332
1344
  relationship_type: str
1333
1345
  Relationship type name linking the governance definitions..
1334
- body: dict
1346
+ body: dict, optional
1335
1347
  The body describing the link between the two segments.
1336
1348
 
1337
1349
  Returns
@@ -1352,36 +1364,38 @@ class GovernanceOfficer(Client):
1352
1364
 
1353
1365
  Body structure:
1354
1366
  {
1355
- "externalSourceGUID": "string",
1356
- "externalSourceName": "string",
1357
- "forLineage": true,
1358
- "forDuplicateProcessing": true,
1359
- "effectiveTime": "2025-06-13T15:13:31.339Z"
1367
+ "class": "MetadataSourceRequestBody",
1368
+ "externalSourceGUID": "add guid here",
1369
+ "externalSourceName": "add qualified name here",
1370
+ "effectiveTime": "{{$isoTimestamp}}",
1371
+ "forLineage": false,
1372
+ "forDuplicateProcessing": false
1360
1373
  }
1361
1374
  """
1362
1375
  validate_guid(definition_guid1)
1363
1376
  validate_guid(definition_guid2)
1364
1377
 
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")
1378
+ url = (
1379
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1380
+ f"{self.url_marker}/governance-definitions/"
1381
+ f"{definition_guid1}/supporting-definitions/{relationship_type}/{definition_guid2}/detach")
1367
1382
 
1368
1383
  await self._async_make_request("POST", url, body_slimmer(body))
1369
1384
 
1370
- def detach_supporting_definitions(self, url_marker: str, definition_guid1: str, relationship_type: str,
1371
- definition_guid2: str, body: dict) -> None:
1385
+ def detach_supporting_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
1386
+ body: dict = None) -> None:
1372
1387
  """ Detach a governance definition from a supporting governance definition.
1388
+ Request body is optional.
1373
1389
 
1374
1390
  Parameters
1375
1391
  ----------
1376
- url_marker: str
1377
- Indicates which service should be used to link the governance definition.
1378
1392
  definition_guid1: str
1379
1393
  guid of the first governance definition to unlink.
1380
1394
  definition_guid2: str
1381
1395
  guid of the second governance definition to unlink.
1382
1396
  relationship_type: str
1383
1397
  Relationship type name linking the governance definitions..
1384
- body: dict
1398
+ body: dict, optional
1385
1399
  The body describing the link between the two segments.
1386
1400
 
1387
1401
  Returns
@@ -1402,39 +1416,33 @@ class GovernanceOfficer(Client):
1402
1416
 
1403
1417
  Body structure:
1404
1418
  {
1405
- "externalSourceGUID": "string",
1406
- "externalSourceName": "string",
1407
- "forLineage": true,
1408
- "forDuplicateProcessing": true,
1409
- "effectiveTime": "2025-06-13T15:13:31.339Z"
1419
+ "class" : "MetadataSourceRequestBody",
1420
+ "externalSourceGUID": "add guid here",
1421
+ "externalSourceName": "add qualified name here",
1422
+ "effectiveTime" : "{{$isoTimestamp}}",
1423
+ "forLineage" : false,
1424
+ "forDuplicateProcessing" : false
1410
1425
  }
1411
1426
  """
1412
1427
  loop = asyncio.get_event_loop()
1413
1428
  loop.run_until_complete(
1414
- self._async_detach_supporting_definitions(url_marker, definition_guid1, relationship_type, definition_guid2,
1415
- body))
1429
+ self._async_detach_supporting_definitions(definition_guid1, relationship_type, definition_guid2, body))
1416
1430
 
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.
1431
+ async def _async_delete_governance_definition(self, guid: str, body: dict = None) -> str:
1432
+ """ Delete an information supply. Async version.
1421
1433
 
1422
1434
  Parameters
1423
1435
  ----------
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.
1436
+ guid: str
1437
+ GUID of the governance definition to delete.
1438
+
1439
+ body: dict, optional
1440
+ A dictionary containing the definition of the governance definition to create.
1434
1441
 
1435
1442
  Returns
1436
1443
  -------
1437
- None
1444
+
1445
+ str - guid of the governance definition created.
1438
1446
 
1439
1447
  Raises
1440
1448
  ------
@@ -1447,56 +1455,39 @@ class GovernanceOfficer(Client):
1447
1455
 
1448
1456
  Notes
1449
1457
  ----
1458
+ https://egeria-project.org/concepts/governance-definition
1450
1459
 
1451
1460
  Body structure:
1452
1461
  {
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
- }
1462
+ "class": "MetadataSourceRequestBody",
1463
+ "externalSourceGUID": "add guid here",
1464
+ "externalSourceName": "add qualified name here",
1465
+ "effectiveTime": "{{$isoTimestamp}}",
1466
+ "forLineage": false,
1467
+ "forDuplicateProcessing": false
1470
1468
  }
1471
- """
1472
- validate_guid(technical_control_guid)
1473
- validate_guid(implementation_guid)
1474
1469
 
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")
1470
+ """
1471
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1472
+ f"{self.url_marker}/governance-definitions/{guid}/delete")
1477
1473
 
1478
1474
  await self._async_make_request("POST", url, body_slimmer(body))
1479
1475
 
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.
1476
+ def delete_governance_definition(self, guid: str, body: dict = None) -> str:
1477
+ """ Delete an information supply. Request body is optional. Async version.
1483
1478
 
1484
1479
  Parameters
1485
1480
  ----------
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.
1481
+ guid: str
1482
+ GUID of the governance definition to delete.
1483
+
1484
+ body: dict, optionl
1485
+ A dictionary containing the definition of the governance definition to create.
1496
1486
 
1497
1487
  Returns
1498
1488
  -------
1499
- None
1489
+
1490
+ str - guid of the governance definition created.
1500
1491
 
1501
1492
  Raises
1502
1493
  ------
@@ -1509,156 +1500,54 @@ class GovernanceOfficer(Client):
1509
1500
 
1510
1501
  Notes
1511
1502
  ----
1503
+ https://egeria-project.org/concepts/governance-definition
1512
1504
 
1513
1505
  Body structure:
1514
1506
  {
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
- }
1507
+ "class": "MetadataSourceRequestBody",
1508
+ "externalSourceGUID": "add guid here",
1509
+ "externalSourceName": "add qualified name here",
1510
+ "effectiveTime": "{{$isoTimestamp}}",
1511
+ "forLineage": false,
1512
+ "forDuplicateProcessing": false
1532
1513
  }
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
1514
 
1557
- Returns
1558
- -------
1559
- None
1515
+ """
1560
1516
 
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.
1517
+ loop = asyncio.get_event_loop()
1518
+ loop.run_until_complete(self._async_delete_governance_definition(guid, body))
1569
1519
 
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.
1520
+ async def _async_find_governance_definitions(self, search_filter: str = "*", starts_with: bool = True,
1521
+ ends_with: bool = False, ignore_case: bool = False,
1522
+ start_from: int = 0, page_size: int = 0, body: dict = None,
1523
+ output_format: str = 'JSON') -> list[dict] | str:
1524
+ """ Retrieve the list of governance definition metadata elements that contain the search string.
1525
+ Async version.
1641
1526
 
1642
1527
  Parameters
1643
1528
  ----------
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.
1529
+ search_filter : str
1530
+ - search_filter string to search for.
1531
+ starts_with : bool, [default=False], optional
1532
+ Starts with the supplied string.
1533
+ ends_with : bool, [default=False], optional
1534
+ Ends with the supplied string
1535
+ ignore_case : bool, [default=False], optional
1536
+ Ignore case when searching
1537
+ body: dict, optional, default = None
1538
+ - additional optional specifications for the search.
1650
1539
  output_format: str, default = 'JSON'
1651
1540
  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
1541
+ JSON - output standard json
1542
+ MD - output standard markdown with no preamble
1543
+ FORM - output markdown with a preamble for a form
1544
+ REPORT - output markdown with a preamble for a report
1545
+ Mermaid - output markdown with a mermaid graph
1657
1546
 
1658
1547
  Returns
1659
1548
  -------
1660
- [dict] | str
1661
- A list of information supply chains matching the name.
1549
+ list[dict] | str
1550
+ A list of information governance definition structures or a string if there are no elements found.
1662
1551
 
1663
1552
  Raises
1664
1553
  ------
@@ -1671,6 +1560,8 @@ class GovernanceOfficer(Client):
1671
1560
 
1672
1561
  Notes
1673
1562
  -----
1563
+ If a body is provided it overrides the search_filter parameter.
1564
+
1674
1565
  Body structure:
1675
1566
  {
1676
1567
  "class": "FilterRequestBody",
@@ -1684,60 +1575,62 @@ class GovernanceOfficer(Client):
1684
1575
  "filter": "Add name here",
1685
1576
  "templateFilter": "NO_TEMPLATES"
1686
1577
  }
1578
+ """
1687
1579
 
1688
- """
1689
- possible_query_params = query_string([("startFrom", start_from), ("pageSize", page_size)])
1580
+ possible_query_params = query_string(
1581
+ [("startFrom", start_from), ("pageSize", page_size), ("startsWith", str(starts_with).lower()),
1582
+ ("endsWith", str(ends_with).lower()), ("ignoreCase", str(ignore_case).lower()), ])
1583
+
1584
+ if search_filter == "*":
1585
+ search_filter = None
1690
1586
 
1691
1587
  if body is None:
1692
1588
  body = {
1693
1589
  "filter": search_filter,
1694
1590
  }
1695
- else:
1696
- body["filter"] = search_filter
1697
1591
 
1698
- url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{url_marker}/governance-definitions/"
1699
- f"by-name{possible_query_params}")
1592
+ url = (
1593
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1594
+ f"{self.url_marker}/governance-definitions/"
1595
+ f"by-search-string{possible_query_params}")
1700
1596
 
1701
1597
  response: Response = await self._async_make_request("POST", url, body_slimmer(body))
1702
1598
  element = response.json().get("elements", NO_ELEMENTS_FOUND)
1703
1599
  if element == NO_ELEMENTS_FOUND:
1704
1600
  return NO_ELEMENTS_FOUND
1705
1601
  if output_format != 'JSON': # return a simplified markdown representation
1706
- return self.generate_governance_definition_output(element, None, output_format)
1602
+ return self.generate_governance_definition_output(element, search_filter, output_format)
1707
1603
  return response.json().get("elements", NO_ELEMENTS_FOUND)
1708
1604
 
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.
1605
+ def find_governance_definitions(self, search_filter: str = "*", starts_with: bool = True, ends_with: bool = False,
1606
+ ignore_case: bool = False, start_from: int = 0, page_size: int = 0,
1607
+ body: dict = None, output_format: str = 'JSON') -> list[dict] | str:
1608
+ """ Retrieve the list of governance definition metadata elements that contain the search string.
1713
1609
 
1714
1610
  Parameters
1715
1611
  ----------
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.
1612
+ search_filter : str
1613
+ - search_filter string to search for.
1614
+ starts_with : bool, [default=False], optional
1615
+ Starts with the supplied string.
1616
+ ends_with : bool, [default=False], optional
1617
+ Ends with the supplied string
1618
+ ignore_case : bool, [default=False], optional
1619
+ Ignore case when searching
1620
+ body: dict, optional, default = None
1621
+ - additional optional specifications for the search.
1729
1622
  output_format: str, default = 'JSON'
1730
1623
  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
1624
+ JSON - output standard json
1625
+ MD - output standard markdown with no preamble
1626
+ FORM - output markdown with a preamble for a form
1627
+ REPORT - output markdown with a preamble for a report
1628
+ Mermaid - output markdown with a mermaid graph
1736
1629
 
1737
1630
  Returns
1738
1631
  -------
1739
- [dict] | str
1740
- A list of information supply chains matching the name.
1632
+ list[dict] | str
1633
+ A list of information governance definition structures or a string if there are no elements found.
1741
1634
 
1742
1635
  Raises
1743
1636
  ------
@@ -1750,6 +1643,8 @@ class GovernanceOfficer(Client):
1750
1643
 
1751
1644
  Notes
1752
1645
  -----
1646
+ If a body is provided it overrides the search_filter parameter.
1647
+
1753
1648
  Body structure:
1754
1649
  {
1755
1650
  "class": "FilterRequestBody",
@@ -1763,48 +1658,37 @@ class GovernanceOfficer(Client):
1763
1658
  "filter": "Add name here",
1764
1659
  "templateFilter": "NO_TEMPLATES"
1765
1660
  }
1661
+ """
1766
1662
 
1767
- """
1768
1663
  loop = asyncio.get_event_loop()
1769
1664
  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))
1665
+ self._async_find_governance_definitions(search_filter, starts_with, ends_with, ignore_case, start_from,
1666
+ page_size, body, output_format))
1772
1667
  return response
1773
1668
 
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.
1669
+ async def _async_get_governance_definitions_by_name(self, search_filter: str, body: dict = None,
1670
+ start_from: int = 0, page_size: int = 0,
1671
+ output_format: str = "JSON") -> dict | str:
1672
+ """ Returns the list of governance definitions with a particular name. Async Version.
1781
1673
 
1782
1674
  Parameters
1783
1675
  ----------
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.
1676
+ search_filter: str
1677
+ name of the information governance definition to retrieve.
1678
+ body: dict, optional
1679
+ A dictionary containing parameters of the retrieval.
1796
1680
  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
1681
+ Type of output to produce include:
1682
+ JSON - output standard json
1683
+ MD - output standard markdown with no preamble
1684
+ FORM - output markdown with a preamble for a form
1685
+ REPORT - output markdown with a preamble for a report
1686
+ MERMAID - output mermaid markdown
1803
1687
 
1804
1688
  Returns
1805
1689
  -------
1806
- list[dict] | str
1807
- A list of information supply chain structures or a string if there are no elements found.
1690
+ [dict] | str
1691
+ A list of information governance definitions matching the name.
1808
1692
 
1809
1693
  Raises
1810
1694
  ------
@@ -1817,6 +1701,7 @@ class GovernanceOfficer(Client):
1817
1701
 
1818
1702
  Notes
1819
1703
  -----
1704
+ If a body is provided it overrides the search_filter parameter.
1820
1705
  Body structure:
1821
1706
  {
1822
1707
  "class": "FilterRequestBody",
@@ -1830,65 +1715,57 @@ class GovernanceOfficer(Client):
1830
1715
  "filter": "Add name here",
1831
1716
  "templateFilter": "NO_TEMPLATES"
1832
1717
  }
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
1718
 
1839
- if search_filter is None or search_filter == "*":
1840
- search_filter = None
1719
+ """
1720
+ possible_query_params = query_string([("startFrom", start_from), ("pageSize", page_size)])
1841
1721
 
1842
1722
  if body is None:
1843
1723
  body = {
1844
1724
  "filter": search_filter,
1845
1725
  }
1846
- else:
1847
- body["filter"] = search_filter
1848
1726
 
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}")
1727
+ url = (
1728
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1729
+ f"{self.url_marker}/governance-definitions/"
1730
+ f"by-name{possible_query_params}")
1851
1731
 
1852
1732
  response: Response = await self._async_make_request("POST", url, body_slimmer(body))
1853
1733
  element = response.json().get("elements", NO_ELEMENTS_FOUND)
1854
1734
  if element == NO_ELEMENTS_FOUND:
1855
1735
  return NO_ELEMENTS_FOUND
1856
1736
  if output_format != 'JSON': # return a simplified markdown representation
1857
- return self.generate_info_supply_chain_output(element, search_filter, output_format)
1737
+ return self.generate_governance_definition_output(element, None, output_format)
1858
1738
  return response.json().get("elements", NO_ELEMENTS_FOUND)
1859
1739
 
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.
1740
+ def get_governance_definitions_by_name(self, search_filter: str, body: dict = None, start_from: int = 0,
1741
+ page_size: int = 0, output_format: str = "JSON") -> dict | str:
1742
+ """ Returns the list of information governance definitions with a particular name. Async Version.
1865
1743
 
1866
1744
  Parameters
1867
1745
  ----------
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.
1746
+ search_filter: str
1747
+ name of the information governance definition to retrieve.
1748
+ body: dict, optional
1749
+ A dictionary containing parameters of the retrieval.
1750
+ add_implementation: bool, optional
1751
+ Whether to add the implementation details to the response.
1752
+ start_from: int, [default=0], optional
1753
+ When multiple pages of results are available, the page number to start from.
1754
+ page_size: int, [default=0], optional
1755
+ The number of items to return in a single page. If not specified, the default will be taken from
1756
+ the class instance.
1880
1757
  output_format: str, default = 'JSON'
1881
1758
  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
1759
+ JSON - output standard json
1760
+ MD - output standard markdown with no preamble
1761
+ FORM - output markdown with a preamble for a form
1762
+ REPORT - output markdown with a preamble for a report
1763
+ MERMAID - output mermaid markdown
1887
1764
 
1888
1765
  Returns
1889
1766
  -------
1890
- list[dict] | str
1891
- A list of information supply chain structures or a string if there are no elements found.
1767
+ [dict] | str
1768
+ A list of information governance definitions matching the name.
1892
1769
 
1893
1770
  Raises
1894
1771
  ------
@@ -1914,435 +1791,661 @@ class GovernanceOfficer(Client):
1914
1791
  "filter": "Add name here",
1915
1792
  "templateFilter": "NO_TEMPLATES"
1916
1793
  }
1917
- """
1918
1794
 
1795
+ """
1919
1796
  loop = asyncio.get_event_loop()
1920
1797
  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))
1798
+ self._async_get_governance_definitions_by_name(search_filter, body, start_from, page_size, output_format))
1923
1799
  return response
1924
1800
 
1801
+ async def _async_get_governance_definition_by_guid(self, guid: str, body: dict = None, output_format: str = "JSON") -> dict | str:
1925
1802
 
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
- }
1803
+ """ Get governance definition by guid.
1804
+ Async version.
2128
1805
 
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
- }
1806
+ Parameters
1807
+ ----------
1808
+ guid: str
1809
+ GUID of the governance definition to get.
1810
+
1811
+ body: dict, optional
1812
+ A dictionary containing the definition of the governance definition to create.
1813
+ output_format: str
1814
+ The output format to use.
1815
+
1816
+ Returns
1817
+ -------
1818
+
1819
+ dict | str
1820
+ A list of information governance definition structures or a string if there are no elements found.
2340
1821
 
2341
- """
2342
1822
 
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
1823
+ Raises
1824
+ ------
1825
+ InvalidParameterException
1826
+ one of the parameters is null or invalid or
1827
+ PropertyServerException
1828
+ There is a problem adding the element properties to the metadata repository or
1829
+ UserNotAuthorizedException
1830
+ the requesting user is not authorized to issue this request.
1831
+
1832
+ Notes
1833
+ ----
1834
+ https://egeria-project.org/concepts/governance-definition
1835
+
1836
+ Body structure:
1837
+ {
1838
+ "class": "AnyTimeRequestBody",
1839
+ "asOfTime": "{{$isoTimestamp}}",
1840
+ "effectiveTime": "{{$isoTimestamp}}",
1841
+ "forLineage": false,
1842
+ "forDuplicateProcessing": false
1843
+ }
1844
+
1845
+ """
1846
+
1847
+ url = (
1848
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1849
+ f"{self.url_marker}/governance-definitions/"
1850
+ f"{guid}/retrieve")
1851
+
1852
+ if body:
1853
+ response = await self._async_make_request("POST", url, body_slimmer(body))
1854
+ else:
1855
+ response = await self._async_make_request("POST", url)
1856
+
1857
+ element = response.json().get("element", NO_ELEMENTS_FOUND)
1858
+ if element == NO_ELEMENTS_FOUND:
1859
+ return NO_ELEMENTS_FOUND
1860
+ if output_format != 'JSON': # return a simplified markdown representation
1861
+ return self.generate_governance_definition_output(element, guid, output_format)
1862
+ return response.json().get("element", NO_ELEMENTS_FOUND)
1863
+
1864
+ def get_governance_definition_by_guid(self, guid: str, body: dict = None, output_format: str = "JSON") -> dict | str:
1865
+
1866
+ """ Get governance definition by guid.
1867
+
1868
+ Parameters
1869
+ ----------
1870
+ guid: str
1871
+ GUID of the governance definition to get.
1872
+
1873
+ body: dict, optional
1874
+ A dictionary containing the definition of the governance definition to create.
1875
+ output_format: str, default = "JSON"
1876
+ The output format to use.
1877
+
1878
+ Returns
1879
+ -------
1880
+
1881
+ dict | str
1882
+ A list of information governance definition structures or a string if there are no elements found.
1883
+
1884
+
1885
+ Raises
1886
+ ------
1887
+ InvalidParameterException
1888
+ one of the parameters is null or invalid or
1889
+ PropertyServerException
1890
+ There is a problem adding the element properties to the metadata repository or
1891
+ UserNotAuthorizedException
1892
+ the requesting user is not authorized to issue this request.
1893
+
1894
+ Notes
1895
+ ----
1896
+ https://egeria-project.org/concepts/governance-definition
1897
+ Body structure:
1898
+ {
1899
+ "class": "AnyTimeRequestBody",
1900
+ "asOfTime": "{{$isoTimestamp}}",
1901
+ "effectiveTime": "{{$isoTimestamp}}",
1902
+ "forLineage": false,
1903
+ "forDuplicateProcessing": false
1904
+ }
1905
+
1906
+ """
1907
+
1908
+ loop = asyncio.get_event_loop()
1909
+ response = loop.run_until_complete(self._async_get_governance_definition_by_guid(guid, body, output_format))
1910
+ return response
1911
+
1912
+ async def _async_link_design_to_implementation(self, design_desc_guid: str, implementation_guid: str,
1913
+ body: dict = None) -> None:
1914
+ """ Attach a design object such as a solution component or governance definition to its implementation via the
1915
+ ImplementedBy relationship. Request body is optional. Async Version.
1916
+ https://egeria-project.org/types/7/0737-Solution-Implementation/
1917
+
1918
+ Parameters
1919
+ ----------
1920
+ design_desc_guid: str
1921
+ guid of the design element to link.
1922
+ implementation_guid: str
1923
+ guid of the implementation definition to link.
1924
+ body: dict, optional
1925
+ The body describing the link between the two segments.
1926
+
1927
+ Returns
1928
+ -------
1929
+ None
1930
+
1931
+ Raises
1932
+ ------
1933
+ InvalidParameterException
1934
+ one of the parameters is null or invalid or
1935
+ PropertyServerException
1936
+ There is a problem adding the element properties to the metadata repository or
1937
+ UserNotAuthorizedException
1938
+ the requesting user is not authorized to issue this request.
1939
+
1940
+ Notes
1941
+ ----
1942
+
1943
+ Body structure:
1944
+ {
1945
+ "class" : "RelationshipRequestBody",
1946
+ "externalSourceGUID": "add guid here",
1947
+ "externalSourceName": "add qualified name here",
1948
+ "effectiveTime" : "{{$isoTimestamp}}",
1949
+ "forLineage" : false,
1950
+ "forDuplicateProcessing" : false,
1951
+ "properties": {
1952
+ "class": "ImplementedByProperties",
1953
+ "designStep": "",
1954
+ "role": "",
1955
+ "transformation": "",
1956
+ "description": "",
1957
+ "iscQualifiedName": "",
1958
+ "effectiveFrom": "{{$isoTimestamp}}",
1959
+ "effectiveTo": "{{$isoTimestamp}}"
1960
+ }
1961
+ }
1962
+ """
1963
+ validate_guid(design_desc_guid)
1964
+ validate_guid(implementation_guid)
1965
+
1966
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/designs/"
1967
+ f"{design_desc_guid}/implementations/{implementation_guid}/attach")
1968
+
1969
+ if body:
1970
+ await self._async_make_request("POST", url, body_slimmer(body))
1971
+ else:
1972
+ await self._async_make_request("POST", url)
1973
+
1974
+ def link_design_to_implementation(self, design_desc_guid: str, implementation_guid: str, body: dict = None) -> None:
1975
+ """ Attach a design object such as a solution component or governance definition to its implementation via the
1976
+ ImplementedBy relationship. Request body is optional.
1977
+ https://egeria-project.org/types/7/0737-Solution-Implementation/
1978
+
1979
+ Parameters
1980
+ ----------
1981
+ design_desc_guid: str
1982
+ guid of the design element to link.
1983
+ implementation_guid: str
1984
+ guid of the implementation definition to link.
1985
+ body: dict, optional
1986
+ The body describing the link between the two segments.
1987
+
1988
+ Returns
1989
+ -------
1990
+ None
1991
+
1992
+ Raises
1993
+ ------
1994
+ InvalidParameterException
1995
+ one of the parameters is null or invalid or
1996
+ PropertyServerException
1997
+ There is a problem adding the element properties to the metadata repository or
1998
+ UserNotAuthorizedException
1999
+ the requesting user is not authorized to issue this request.
2000
+
2001
+ Notes
2002
+ ----
2003
+
2004
+ Body structure:
2005
+ {
2006
+ "class" : "RelationshipRequestBody",
2007
+ "externalSourceGUID": "add guid here",
2008
+ "externalSourceName": "add qualified name here",
2009
+ "effectiveTime" : "{{$isoTimestamp}}",
2010
+ "forLineage" : false,
2011
+ "forDuplicateProcessing" : false,
2012
+ "properties": {
2013
+ "class": "ImplementedByProperties",
2014
+ "designStep": "",
2015
+ "role": "",
2016
+ "transformation": "",
2017
+ "description": "",
2018
+ "iscQualifiedName": "",
2019
+ "effectiveFrom": "{{$isoTimestamp}}",
2020
+ "effectiveTo": "{{$isoTimestamp}}"
2021
+ }
2022
+ }
2023
+ """
2024
+ loop = asyncio.get_event_loop()
2025
+ loop.run_until_complete(self._async_link_design_to_implementation(design_desc_guid, implementation_guid, body))
2026
+
2027
+ async def _async_detach_design_from_implementation(self, design_desc_guid: str, implementation_guid: str,
2028
+ body: dict = None) -> None:
2029
+ """ Detach a governance definition from its implementation. Async Version.
2030
+
2031
+ Parameters
2032
+ ----------
2033
+ design_desc_guid: str
2034
+ guid of the technical control to link.
2035
+ implementation_guid: str
2036
+ guid of the implementation definition to unlink.
2037
+ body: dict
2038
+ The body describing the link between the two segments.
2039
+
2040
+ Returns
2041
+ -------
2042
+ None
2043
+
2044
+ Raises
2045
+ ------
2046
+ InvalidParameterException
2047
+ one of the parameters is null or invalid or
2048
+ PropertyServerException
2049
+ There is a problem adding the element properties to the metadata repository or
2050
+ UserNotAuthorizedException
2051
+ the requesting user is not authorized to issue this request.
2052
+
2053
+ Notes
2054
+ ----
2055
+
2056
+ Body structure:
2057
+ {
2058
+ "class": "MetadataSourceRequestBody",
2059
+ "externalSourceGUID": "string",
2060
+ "externalSourceName": "string",
2061
+ "forLineage": true,
2062
+ "forDuplicateProcessing": true,
2063
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
2064
+ }
2065
+ """
2066
+ validate_guid(design_desc_guid)
2067
+ validate_guid(implementation_guid)
2068
+
2069
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/designs/"
2070
+ f"{design_desc_guid}/implementations/{implementation_guid}/detach")
2071
+
2072
+ await self._async_make_request("POST", url, body_slimmer(body))
2073
+
2074
+ def detach_design_from_implementation(self, technical_control_guid: str, implementation_guid: str,
2075
+ body: dict = None) -> None:
2076
+ """ Detach a governance definition from its implementation. Request body is optional.
2077
+
2078
+ Parameters
2079
+ ----------
2080
+ technical_control_guid: str
2081
+ guid of the technical control to unlink.
2082
+ relationship_type: str
2083
+ Relationship type name linking the governance definitions..
2084
+ implementation_guid: str
2085
+ guid of the implementation definition to unlink.
2086
+ body: dict, optional
2087
+ The body describing the link between the two segments.
2088
+
2089
+ Returns
2090
+ -------
2091
+ None
2092
+
2093
+ Raises
2094
+ ------
2095
+ InvalidParameterException
2096
+ one of the parameters is null or invalid or
2097
+ PropertyServerException
2098
+ There is a problem adding the element properties to the metadata repository or
2099
+ UserNotAuthorizedException
2100
+ the requesting user is not authorized to issue this request.
2101
+
2102
+ Notes
2103
+ ----
2104
+
2105
+ Body structure:
2106
+ {
2107
+ "externalSourceGUID": "string",
2108
+ "externalSourceName": "string",
2109
+ "forLineage": true,
2110
+ "forDuplicateProcessing": true,
2111
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
2112
+ }
2113
+ """
2114
+ loop = asyncio.get_event_loop()
2115
+ loop.run_until_complete(
2116
+ self._async_detach_design_from_implementation(technical_control_guid, implementation_guid, body))
2117
+
2118
+ async def _async_link_implementation_resource(self, design_desc_guid: str, implementation_guid: str,
2119
+ body: dict = None) -> None:
2120
+ """ Attach a design object such as a solution component or governance definition to one of its implementation
2121
+ resource via the ImplementationResource relationship. Request body is optional.
2122
+ https://egeria-project.org/types/7/0737-Solution-Implementation/
2123
+
2124
+ Parameters
2125
+ ----------
2126
+ design_desc_guid: str
2127
+ guid of the design element to link.
2128
+ implementation_guid: str
2129
+ guid of the implementation definition to link.
2130
+ body: dict, optional
2131
+ The body describing the link between the two segments.
2132
+
2133
+ Returns
2134
+ -------
2135
+ None
2136
+
2137
+ Raises
2138
+ ------
2139
+ InvalidParameterException
2140
+ one of the parameters is null or invalid or
2141
+ PropertyServerException
2142
+ There is a problem adding the element properties to the metadata repository or
2143
+ UserNotAuthorizedException
2144
+ the requesting user is not authorized to issue this request.
2145
+
2146
+ Notes
2147
+ ----
2148
+
2149
+ Body structure:
2150
+ {
2151
+ "class" : "RelationshipRequestBody",
2152
+ "externalSourceGUID": "add guid here",
2153
+ "externalSourceName": "add qualified name here",
2154
+ "effectiveTime" : "{{$isoTimestamp}}",
2155
+ "forLineage" : false,
2156
+ "forDuplicateProcessing" : false,
2157
+ "properties": {
2158
+ "class": "ImplementedByProperties",
2159
+ "designStep": "",
2160
+ "role": "",
2161
+ "transformation": "",
2162
+ "description": "",
2163
+ "iscQualifiedName": "",
2164
+ "effectiveFrom": "{{$isoTimestamp}}",
2165
+ "effectiveTo": "{{$isoTimestamp}}"
2166
+ }
2167
+ }
2168
+ """
2169
+ validate_guid(design_desc_guid)
2170
+ validate_guid(implementation_guid)
2171
+
2172
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/designs/"
2173
+ f"{design_desc_guid}/implementation-resources/{implementation_guid}/attach")
2174
+
2175
+ await self._async_make_request("POST", url, body_slimmer(body))
2176
+
2177
+ def link_implementation_resource(self, design_desc_guid: str, implementation_guid: str, body: dict = None) -> None:
2178
+ """ Attach a design object such as a solution component or governance definition to its implementation via the
2179
+ ImplementedBy relationship. Request body is optional.
2180
+ https://egeria-project.org/types/7/0737-Solution-Implementation/
2181
+
2182
+ Parameters
2183
+ ----------
2184
+ design_desc_guid: str
2185
+ guid of the design element to link.
2186
+ implementation_guid: str
2187
+ guid of the implementation definition to link.
2188
+ body: dict, optional
2189
+ The body describing the link between the two segments.
2190
+
2191
+ Returns
2192
+ -------
2193
+ None
2194
+
2195
+ Raises
2196
+ ------
2197
+ InvalidParameterException
2198
+ one of the parameters is null or invalid or
2199
+ PropertyServerException
2200
+ There is a problem adding the element properties to the metadata repository or
2201
+ UserNotAuthorizedException
2202
+ the requesting user is not authorized to issue this request.
2203
+
2204
+ Notes
2205
+ ----
2206
+
2207
+ Body structure:
2208
+ {
2209
+ "class" : "RelationshipRequestBody",
2210
+ "externalSourceGUID": "add guid here",
2211
+ "externalSourceName": "add qualified name here",
2212
+ "effectiveTime" : "{{$isoTimestamp}}",
2213
+ "forLineage" : false,
2214
+ "forDuplicateProcessing" : false,
2215
+ "properties": {
2216
+ "class": "ImplementedByProperties",
2217
+ "designStep": "",
2218
+ "role": "",
2219
+ "transformation": "",
2220
+ "description": "",
2221
+ "iscQualifiedName": "",
2222
+ "effectiveFrom": "{{$isoTimestamp}}",
2223
+ "effectiveTo": "{{$isoTimestamp}}"
2224
+ }
2225
+ }
2226
+ """
2227
+ loop = asyncio.get_event_loop()
2228
+ loop.run_until_complete(self._async_link_implementation_resource(design_desc_guid, implementation_guid, body))
2229
+
2230
+ async def _async_detach_implementation_resource(self, design_desc_guid: str, implementation_guid: str,
2231
+ body: dict = None) -> None:
2232
+ """ Detach a design object such as a solution component or governance definition from one of its implementation
2233
+ resources. Request body is optional. Async version.
2234
+
2235
+ Parameters
2236
+ ----------
2237
+ design_desc_guid: str
2238
+ guid of the technical control to link.
2239
+ implementation_guid: str
2240
+ guid of the implementation definition to unlink.
2241
+ body: dict
2242
+ The body describing the link between the two segments.
2243
+
2244
+ Returns
2245
+ -------
2246
+ None
2247
+
2248
+ Raises
2249
+ ------
2250
+ InvalidParameterException
2251
+ one of the parameters is null or invalid or
2252
+ PropertyServerException
2253
+ There is a problem adding the element properties to the metadata repository or
2254
+ UserNotAuthorizedException
2255
+ the requesting user is not authorized to issue this request.
2256
+
2257
+ Notes
2258
+ ----
2259
+
2260
+ Body structure:
2261
+ {
2262
+ "class": "MetadataSourceRequestBody",
2263
+ "externalSourceGUID": "string",
2264
+ "externalSourceName": "string",
2265
+ "forLineage": true,
2266
+ "forDuplicateProcessing": true,
2267
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
2268
+ }
2269
+ """
2270
+ validate_guid(design_desc_guid)
2271
+ validate_guid(implementation_guid)
2272
+
2273
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/designs/"
2274
+ f"{design_desc_guid}/implementation-resources/{implementation_guid}/detach")
2275
+
2276
+ await self._async_make_request("POST", url, body_slimmer(body))
2277
+
2278
+ def detach_implmentation_resource(self, design_desc_guid: str, implementation_guid: str, body: dict = None) -> None:
2279
+ """ Detach a design object such as a solution component or governance definition from one of its implementation
2280
+ resources. Request body is optional.
2281
+
2282
+ Parameters
2283
+ ----------
2284
+ design_desc_guid: str
2285
+ guid of the technical control to link.
2286
+ implementation_guid: str
2287
+ guid of the implementation definition to unlink.
2288
+ body: dict, optional
2289
+ The body describing the link between the two segments.
2290
+
2291
+ Returns
2292
+ -------
2293
+ None
2294
+
2295
+ Raises
2296
+ ------
2297
+ InvalidParameterException
2298
+ one of the parameters is null or invalid or
2299
+ PropertyServerException
2300
+ There is a problem adding the element properties to the metadata repository or
2301
+ UserNotAuthorizedException
2302
+ the requesting user is not authorized to issue this request.
2303
+
2304
+ Notes
2305
+ ----
2306
+
2307
+ Body structure:
2308
+ {
2309
+ "class": "MetadataSourceRequestBody",
2310
+ "externalSourceGUID": "string",
2311
+ "externalSourceName": "string",
2312
+ "forLineage": true,
2313
+ "forDuplicateProcessing": true,
2314
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
2315
+ }
2316
+ """
2317
+ loop = asyncio.get_event_loop()
2318
+ loop.run_until_complete(self._async_detach_implementation_resource(design_desc_guid, implementation_guid, body))
2319
+
2320
+ async def _async_get_gov_def_in_context(self, guid: str, body: dict, output_format: str, start_from: int = 0,
2321
+ page_size: int = 0) -> list[dict] | str:
2322
+ """ Get governance definition in context.
2323
+ Async version.
2324
+
2325
+ Parameters
2326
+ ----------
2327
+ guid: str
2328
+ GUID of the governance definition to get.
2329
+
2330
+ body: dict
2331
+ A dictionary containing the definition of the governance definition to get.
2332
+ output_format: str
2333
+ The output format to use.
2334
+ start_from: int, default= 0
2335
+ Indicates the start of the page range.
2336
+ page_size: int, default = 0
2337
+ The page size to use.
2338
+
2339
+ Returns
2340
+ -------
2341
+
2342
+ list[dict] | str
2343
+ A list of information governance definition structures or a string if there are no elements found.
2344
+
2345
+
2346
+ Raises
2347
+ ------
2348
+ InvalidParameterException
2349
+ one of the parameters is null or invalid or
2350
+ PropertyServerException
2351
+ There is a problem adding the element properties to the metadata repository or
2352
+ UserNotAuthorizedException
2353
+ the requesting user is not authorized to issue this request.
2354
+
2355
+ Notes
2356
+ ----
2357
+ https://egeria-project.org/concepts/governance-definition
2358
+
2359
+ Body structure:
2360
+ {
2361
+ "forLineage": true,
2362
+ "forDuplicateProcessing": true,
2363
+ "effectiveTime": "2025-06-13T14:12:44.896Z",
2364
+ "limitResultsByStatus": [
2365
+ "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}"
2366
+ ],
2367
+ "asOfTime": "2025-06-13T14:12:44.896Z",
2368
+ "sequencingOrder": "SequencingOrder{Any Order}",
2369
+ "sequencingProperty": "string"
2370
+ }
2371
+
2372
+ """
2373
+ possible_query_params = query_string([("startFrom", start_from), ("pageSize", page_size)])
2374
+
2375
+ url = (
2376
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
2377
+ f"{self.url_marker}/governance-definitions/"
2378
+ f"{guid}/in-context{possible_query_params}")
2379
+
2380
+ if body:
2381
+ response = await self._async_make_request("POST", url, body_slimmer(body))
2382
+ else:
2383
+ response = await self._async_make_request("POST", url)
2384
+
2385
+ element = response.json().get("elements", NO_ELEMENTS_FOUND)
2386
+ if element == NO_ELEMENTS_FOUND:
2387
+ return NO_ELEMENTS_FOUND
2388
+ if output_format != 'JSON': # return a simplified markdown representation
2389
+ return self.generate_governance_definitions_output(element, guid, output_format)
2390
+ return response.json().get("elements", NO_ELEMENTS_FOUND)
2391
+
2392
+ def get_gov_def_in_context(self, guid: str, body: dict, output_format: str, start_from: int = 0,
2393
+ page_size: int = 0) -> list[dict] | str:
2394
+ """ Get governance definition in context.
2395
+
2396
+ Parameters
2397
+ ----------
2398
+ guid: str
2399
+ GUID of the governance definition to get.
2400
+
2401
+ body: dict
2402
+ A dictionary containing the definition of the governance definition to get.
2403
+ output_format: str
2404
+ The output format to use.
2405
+ start_from: int, default= 0
2406
+ Indicates the start of the page range.
2407
+ page_size: int, default = 0
2408
+ The page size to use.
2409
+
2410
+ Returns
2411
+ -------
2412
+
2413
+ list[dict] | str
2414
+ A list of information governance definition structures or a string if there are no elements found.
2415
+
2416
+
2417
+ Raises
2418
+ ------
2419
+ InvalidParameterException
2420
+ one of the parameters is null or invalid or
2421
+ PropertyServerException
2422
+ There is a problem adding the element properties to the metadata repository or
2423
+ UserNotAuthorizedException
2424
+ the requesting user is not authorized to issue this request.
2425
+
2426
+ Notes
2427
+ ----
2428
+ https://egeria-project.org/concepts/governance-definition
2429
+
2430
+ Body structure:
2431
+ {
2432
+ "forLineage": true,
2433
+ "forDuplicateProcessing": true,
2434
+ "effectiveTime": "2025-06-13T14:12:44.896Z",
2435
+ "limitResultsByStatus": [
2436
+ "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}"
2437
+ ],
2438
+ "asOfTime": "2025-06-13T14:12:44.896Z",
2439
+ "sequencingOrder": "SequencingOrder{Any Order}",
2440
+ "sequencingProperty": "string"
2441
+ }
2442
+
2443
+ """
2444
+
2445
+ loop = asyncio.get_event_loop()
2446
+ response = loop.run_until_complete(
2447
+ self._async_get_gov_def_in_context(guid, body, output_format, start_from, page_size))
2448
+ return response
2346
2449
 
2347
2450
 
2348
2451
  if __name__ == "__main__":