pyegeria 5.4.0.22__py3-none-any.whl → 5.4.0.24__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 (130) hide show
  1. commands/cat/.DS_Store +0 -0
  2. commands/cat/.env +8 -0
  3. commands/cat/debug_log +2046 -465
  4. commands/cat/debug_log.2025-08-15_09-14-07_444802.zip +0 -0
  5. commands/cat/debug_log.2025-08-16_10-21-59_388912.zip +0 -0
  6. commands/cat/debug_log.log +0 -0
  7. commands/cat/dr_egeria_md.py +16 -3
  8. commands/cat/list_collections.py +15 -6
  9. commands/cat/list_format_set.py +90 -85
  10. commands/cli/debug_log.log +0 -0
  11. commands/ops/logs/pyegeria.log +0 -0
  12. md_processing/.DS_Store +0 -0
  13. md_processing/__init__.py +5 -3
  14. md_processing/data/commands.json +8310 -903
  15. md_processing/dr-egeria-outbox/Collections-2025-08-12-13-30-37.md +163 -0
  16. md_processing/dr-egeria-outbox/Collections-2025-08-12-13-35-58.md +474 -0
  17. md_processing/dr_egeria_inbox/Derive-Dr-Gov-Defs.md +8 -0
  18. md_processing/dr_egeria_inbox/Dr.Egeria Templates.md +873 -0
  19. md_processing/dr_egeria_inbox/arch_test.md +57 -0
  20. md_processing/dr_egeria_inbox/archive/dr_egeria_intro.md +254 -0
  21. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_more_terms.md +696 -0
  22. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part1.md +254 -0
  23. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part2.md +298 -0
  24. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part3.md +608 -0
  25. md_processing/dr_egeria_inbox/archive/dr_egeria_intro_part4.md +94 -0
  26. md_processing/dr_egeria_inbox/archive/freddie_intro.md +284 -0
  27. md_processing/dr_egeria_inbox/archive/freddie_intro_orig.md +275 -0
  28. md_processing/dr_egeria_inbox/archive/test-term.md +110 -0
  29. md_processing/dr_egeria_inbox/cat_test.md +100 -0
  30. md_processing/dr_egeria_inbox/collections.md +39 -0
  31. md_processing/dr_egeria_inbox/data_designer_debug.log +6 -0
  32. md_processing/dr_egeria_inbox/data_designer_out.md +60 -0
  33. md_processing/dr_egeria_inbox/data_designer_search_test.md +11 -0
  34. md_processing/dr_egeria_inbox/data_field.md +54 -0
  35. md_processing/dr_egeria_inbox/data_spec.md +77 -0
  36. md_processing/dr_egeria_inbox/data_spec_test.md +2406 -0
  37. md_processing/dr_egeria_inbox/data_test.md +179 -0
  38. md_processing/dr_egeria_inbox/data_test2.md +429 -0
  39. md_processing/dr_egeria_inbox/data_test3.md +462 -0
  40. md_processing/dr_egeria_inbox/dr_egeria_data_designer_1.md +124 -0
  41. md_processing/dr_egeria_inbox/dr_egeria_intro_categories.md +168 -0
  42. md_processing/dr_egeria_inbox/dr_egeria_intro_part1.md +280 -0
  43. md_processing/dr_egeria_inbox/dr_egeria_intro_part2.md +313 -0
  44. md_processing/dr_egeria_inbox/dr_egeria_intro_part3.md +1073 -0
  45. md_processing/dr_egeria_inbox/dr_egeria_isc1.md +44 -0
  46. md_processing/dr_egeria_inbox/generated_help_report.md +9 -0
  47. md_processing/dr_egeria_inbox/glossary_list.md +5 -0
  48. md_processing/dr_egeria_inbox/glossary_search_test.md +40 -0
  49. md_processing/dr_egeria_inbox/glossary_test1.md +324 -0
  50. md_processing/dr_egeria_inbox/gov_def.md +482 -0
  51. md_processing/dr_egeria_inbox/gov_def2.md +447 -0
  52. md_processing/dr_egeria_inbox/img.png +0 -0
  53. md_processing/dr_egeria_inbox/product.md +162 -0
  54. md_processing/dr_egeria_inbox/rel.md +8 -0
  55. md_processing/dr_egeria_inbox/sb.md +119 -0
  56. md_processing/dr_egeria_inbox/solution-components.md +136 -0
  57. md_processing/dr_egeria_inbox/solution_blueprints.md +118 -0
  58. md_processing/dr_egeria_inbox/synonym_test.md +42 -0
  59. md_processing/dr_egeria_inbox/t2.md +268 -0
  60. md_processing/dr_egeria_outbox/.obsidian/app.json +1 -0
  61. md_processing/dr_egeria_outbox/.obsidian/appearance.json +1 -0
  62. md_processing/dr_egeria_outbox/.obsidian/community-plugins.json +6 -0
  63. md_processing/dr_egeria_outbox/.obsidian/core-plugins.json +31 -0
  64. md_processing/dr_egeria_outbox/.obsidian/plugins/calendar/data.json +10 -0
  65. md_processing/dr_egeria_outbox/.obsidian/plugins/calendar/main.js +4459 -0
  66. md_processing/dr_egeria_outbox/.obsidian/plugins/calendar/manifest.json +10 -0
  67. md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-kanban/data.json +3 -0
  68. md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-kanban/main.js +153 -0
  69. md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-kanban/manifest.json +11 -0
  70. md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-kanban/styles.css +1 -0
  71. md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-tasks-plugin/main.js +500 -0
  72. md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-tasks-plugin/manifest.json +12 -0
  73. md_processing/dr_egeria_outbox/.obsidian/plugins/obsidian-tasks-plugin/styles.css +1 -0
  74. md_processing/dr_egeria_outbox/.obsidian/plugins/templater-obsidian/main.js +37 -0
  75. md_processing/dr_egeria_outbox/.obsidian/plugins/templater-obsidian/manifest.json +11 -0
  76. md_processing/dr_egeria_outbox/.obsidian/plugins/templater-obsidian/styles.css +220 -0
  77. md_processing/dr_egeria_outbox/.obsidian/types.json +28 -0
  78. md_processing/dr_egeria_outbox/.obsidian/workspace.json +220 -0
  79. md_processing/dr_egeria_outbox/Untitled.canvas +1 -0
  80. md_processing/dr_egeria_outbox/monday/processed-2025-07-14 12:38-data_designer_out.md +663 -0
  81. md_processing/dr_egeria_outbox/monday/processed-2025-07-21 10:52-generated_help_report.md +2744 -0
  82. md_processing/dr_egeria_outbox/monday/processed-2025-07-21 18:38-collections.md +62 -0
  83. md_processing/dr_egeria_outbox/monday/processed-2025-08-01 11:34-gov_def.md +444 -0
  84. md_processing/dr_egeria_outbox/monday/processed-2025-08-17 21:04-product.md +97 -0
  85. md_processing/dr_egeria_outbox/sunday/processed-2025-07-20 14:55-product.md +77 -0
  86. md_processing/dr_egeria_outbox/sunday/processed-2025-07-20 15:05-product.md +75 -0
  87. md_processing/dr_egeria_outbox/sunday/processed-2025-07-20 15:11-product.md +74 -0
  88. md_processing/dr_egeria_outbox/sunday/processed-2025-07-20 20:40-collections.md +49 -0
  89. md_processing/dr_egeria_outbox/thursday/processed-2025-07-17 15:00-Derive-Dr-Gov-Defs.md +719 -0
  90. md_processing/dr_egeria_outbox/thursday/processed-2025-07-17 20:13-Derive-Dr-Gov-Defs.md +41 -0
  91. md_processing/dr_egeria_outbox/thursday/processed-2025-07-17 20:14-Derive-Dr-Gov-Defs.md +33 -0
  92. md_processing/dr_egeria_outbox/thursday/processed-2025-07-17 20:50-Derive-Dr-Gov-Defs.md +192 -0
  93. md_processing/dr_egeria_outbox/thursday/processed-2025-07-17 22:08-gov_def2.md +486 -0
  94. md_processing/dr_egeria_outbox/thursday/processed-2025-07-17 22:10-gov_def2.md +486 -0
  95. md_processing/dr_egeria_outbox/thursday/processed-2025-07-18 08:53-gov_def2.md +486 -0
  96. md_processing/dr_egeria_outbox/thursday/processed-2025-07-18 08:54-gov_def2.md +486 -0
  97. md_processing/dr_egeria_outbox/thursday/processed-2025-07-18 09:03-gov_def2.md +486 -0
  98. md_processing/dr_egeria_outbox/thursday/processed-2025-07-18 09:06-gov_def2.md +486 -0
  99. md_processing/dr_egeria_outbox/thursday/processed-2025-07-18 09:10-gov_def2.md +486 -0
  100. md_processing/dr_egeria_outbox/tuesday/processed-2025-07-16 19:15-gov_def2.md +527 -0
  101. md_processing/dr_egeria_outbox/tuesday/processed-2025-07-17 12:08-gov_def2.md +527 -0
  102. md_processing/dr_egeria_outbox/tuesday/processed-2025-07-17 14:27-gov_def2.md +485 -0
  103. md_processing/md_commands/governance_officer_commands.py +291 -150
  104. md_processing/md_commands/product_manager_commands.py +309 -401
  105. md_processing/md_processing_utils/common_md_proc_utils.py +110 -7
  106. md_processing/md_processing_utils/common_md_utils.py +112 -26
  107. md_processing/md_processing_utils/debug_log.log +0 -0
  108. md_processing/md_processing_utils/md_processing_constants.py +8 -5
  109. md_processing/md_processing_utils/solution_architect_log.log +0 -0
  110. pyegeria/.DS_Store +0 -0
  111. pyegeria/__init__.py +3 -3
  112. pyegeria/_client_new.py +48 -51
  113. pyegeria/_exceptions_new.py +6 -0
  114. pyegeria/_output_format_models.py +22 -17
  115. pyegeria/_output_formats.py +122 -34
  116. pyegeria/collection_manager.py +154 -50
  117. pyegeria/collection_manager_omvs.py +47 -18
  118. pyegeria/egeria_cat_client.py +1 -1
  119. pyegeria/egeria_client.py +6 -0
  120. pyegeria/egeria_tech_client.py +6 -1
  121. pyegeria/governance_officer.py +2513 -0
  122. pyegeria/load_config.py +1 -1
  123. pyegeria/models.py +48 -5
  124. pyegeria/output_formatter.py +298 -79
  125. pyegeria/utils.py +1 -1
  126. {pyegeria-5.4.0.22.dist-info → pyegeria-5.4.0.24.dist-info}/METADATA +1 -1
  127. {pyegeria-5.4.0.22.dist-info → pyegeria-5.4.0.24.dist-info}/RECORD +130 -30
  128. {pyegeria-5.4.0.22.dist-info → pyegeria-5.4.0.24.dist-info}/LICENSE +0 -0
  129. {pyegeria-5.4.0.22.dist-info → pyegeria-5.4.0.24.dist-info}/WHEEL +0 -0
  130. {pyegeria-5.4.0.22.dist-info → pyegeria-5.4.0.24.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,2513 @@
1
+ """PDX-License-Identifier: Apache-2.0
2
+ Copyright Contributors to the ODPi Egeria project.
3
+
4
+ This module provides access to the Governance Officer OMVS module.
5
+
6
+
7
+ """
8
+
9
+ import asyncio
10
+ import os
11
+ import sys
12
+ from typing import Annotated, Literal, Union
13
+ from typing import Dict, List
14
+
15
+ from loguru import logger
16
+ from pydantic import Field
17
+
18
+ from pyegeria._client_new import Client2
19
+ from pyegeria.output_formatter import (
20
+ extract_mermaid_only,
21
+ generate_output,
22
+ _extract_referenceable_properties,
23
+ populate_columns_from_properties,
24
+ get_required_relationships,
25
+ )
26
+ from pyegeria._output_formats import select_output_format_set, get_output_format_type_match
27
+
28
+ sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
29
+ from pyegeria._exceptions_new import PyegeriaInvalidParameterException
30
+ from pyegeria._globals import NO_GUID_RETURNED
31
+ from pyegeria.load_config import get_app_config
32
+ from pyegeria.models import (SearchStringRequestBody, FilterRequestBody, NewElementRequestBody,
33
+ ReferenceableProperties, TemplateRequestBody,
34
+ UpdateElementRequestBody, UpdateStatusRequestBody, NewRelationshipRequestBody,
35
+ DeleteRequestBody)
36
+ from pyegeria.utils import dynamic_catch
37
+
38
+ GOV_DEF_PROPERTIES_LIST = ["GovernanceDefinitionProperties", "GovernanceStrategyProperties", "RegulationProperties",
39
+ "GovernanceControlProperties", "SecurityGroupProperties", "NamingStandardRuleProperties",
40
+ "CertificationTypeProperties", "LicenseTypeProperties", "GovernanceApproachProperties",
41
+ "GovernanceStrategyProperties", "GovernanceProcessingPurposeProperties",
42
+ "BusinessImperativeProperties", "RegulationArticleProperties", "ThreatProperties",]
43
+
44
+ GOV_BASIC_TYPES = ["BusinessImperative", "RegulationArticle", "Threat", "GovernancePrinciple", "GovernanceObligation",
45
+ "GovernanceApproach", "GovernanceProcessingPurpose"]
46
+
47
+
48
+ app_settings = get_app_config()
49
+ EGERIA_LOCAL_QUALIFIER = app_settings.User_Profile.egeria_local_qualifier
50
+ DEFAULT_BODY_SKELETON = {
51
+ "effective_time": None, "limitResultsByStatus": ["ACTIVE"], "asOfTime": None, "sequencingOrder": None,
52
+ "sequencingProperty": None, "filter": None,
53
+ }
54
+
55
+
56
+ def base_path(client, view_server: str):
57
+ return f"{client.platform_url}/servers/governance-officer/api/open-metadata/metadata-explorer"
58
+
59
+
60
+ class GovernanceDefinitionProperties(ReferenceableProperties):
61
+ class_: Annotated[Literal["GovernanceDefinitionProperties"], Field(alias="class")]
62
+ identifier: str | None = None
63
+ domainIdentifier: int | None = None
64
+ summary: str | None = None
65
+ scope: str | None = None
66
+ usage: str | None = None
67
+ importance: str | None = None
68
+ implications: list[str] | None = None
69
+ outcomes: list[str] | None = None
70
+ results: list[str] | None = None
71
+ userDefinedStatus: str | None = None
72
+
73
+
74
+ class GovernanceOfficer(Client2):
75
+ """GovernanceOfficer is a class that extends the Client class. The Governance Officer OMVS provides APIs for
76
+ defining and managing governance definitions.
77
+
78
+ Attributes:
79
+
80
+ view_server: str
81
+ The name of the View Server to connect to.
82
+ platform_url : str
83
+ URL of the server platform to connect to
84
+ user_id : str
85
+ The identity of the user calling the method - this sets a
86
+ default optionally used by the methods when the user
87
+ doesn't pass the user_id on a method call.
88
+ user_pwd: str
89
+ The password associated with the user_id. Defaults to None
90
+
91
+
92
+ """
93
+
94
+ def __init__(self, view_server: str, platform_url: str, user_id: str = None, user_pwd: str = None,
95
+ token: str = None, ):
96
+ self.view_server = view_server
97
+ self.platform_url = platform_url
98
+ self.user_id = user_id
99
+ self.user_pwd = user_pwd
100
+
101
+ Client2.__init__(self, view_server, platform_url, user_id=user_id, user_pwd=user_pwd, token=token)
102
+ self.url_marker = "governance-officer"
103
+
104
+ #
105
+ # Extract properties functions
106
+ #
107
+ def _generate_governance_definition_output(self, elements: list | dict, search_string: str, element_type_name: str = None,
108
+ output_format: str = 'DICT', output_format_set: dict | str = None
109
+ ) -> str | list:
110
+ """
111
+ Generate output for governance definitions in the specified format, using output format sets.
112
+
113
+ Args:
114
+ elements: Dictionary or list of dictionaries containing governance definition elements
115
+ search_string: The search string used to find the elements
116
+ output_format: The desired output format (MD, FORM, REPORT, LIST, DICT, MERMAID, HTML)
117
+ output_format_set: Optional format set name or structure to control columns
118
+
119
+ Returns:
120
+ Formatted output as string or list of dictionaries
121
+ """
122
+ # Ensure elements handled consistently for MERMAID
123
+ if output_format == "MERMAID":
124
+ return extract_mermaid_only(elements)
125
+
126
+ entity_type = element_type_name if element_type_name else "Governance Definition"
127
+ # Resolve columns_struct via output format sets
128
+ if output_format_set:
129
+ if isinstance(output_format_set, str):
130
+ output_formats = select_output_format_set(output_format_set, output_format)
131
+ elif isinstance(output_format_set, dict):
132
+ output_formats = get_output_format_type_match(output_format_set, output_format)
133
+ else:
134
+ output_formats = None
135
+ else:
136
+ # Default to the Governance Definitions format set
137
+ output_formats = select_output_format_set("Governance Definitions", output_format)
138
+ if output_formats is None:
139
+ output_formats = select_output_format_set("Default", output_format)
140
+
141
+ logger.trace(f"Executing generate_governance_definition_output: {output_formats}")
142
+ return generate_output(
143
+ elements=elements,
144
+ search_string=search_string,
145
+ entity_type=entity_type,
146
+ output_format=output_format,
147
+ extract_properties_func=self._extract_gov_def_properties,
148
+ get_additional_props_func=None,
149
+ columns_struct=output_formats,
150
+ )
151
+
152
+ #
153
+ #
154
+ #
155
+
156
+ def _extract_gov_def_properties(self, element: dict, columns_struct: dict) -> dict:
157
+ """
158
+ Extract and populate governance definition properties into columns_struct.
159
+
160
+ This follows the columns_struct pattern: fill from element.properties (camelCase), overlay header
161
+ attributes, and derive any relationship-based columns that are explicitly requested.
162
+
163
+ Args:
164
+ element: The governance definition element
165
+ columns_struct: The columns structure to populate
166
+
167
+ Returns:
168
+ dict: columns_struct with populated 'value' fields
169
+ """
170
+ col_data = populate_columns_from_properties(element, columns_struct)
171
+ columns_list = col_data.get('formats', {}).get('columns', [])
172
+
173
+ # Header-derived values (GUID, type_name, etc.)
174
+ header_props = _extract_referenceable_properties(element)
175
+ for column in columns_list:
176
+ key = column.get('key')
177
+ if key in header_props:
178
+ column['value'] = header_props.get(key)
179
+ elif isinstance(key, str) and key.lower() == 'guid':
180
+ column['value'] = header_props.get('GUID')
181
+
182
+ # Populate requested relationship-based columns generically
183
+ col_data = get_required_relationships(element, col_data)
184
+
185
+ # Mermaid graph if requested
186
+ for column in columns_list:
187
+ if column.get('key') == 'mermaid':
188
+ column['value'] = element.get('mermaidGraph', '') or ''
189
+ break
190
+
191
+ return col_data
192
+
193
+ def _extract_gov_def_list(self, element: Union[Dict, List[Dict]]) -> List[Dict]:
194
+ """
195
+ Normalize for a list of dictionaries.
196
+ Args:
197
+ element: Dict or List
198
+
199
+ Returns:
200
+ list of Dict
201
+
202
+ """
203
+ if isinstance(element, dict):
204
+ return [self._extract_gov_def_properties(element)]
205
+ elif isinstance(element, list):
206
+ def_list = []
207
+ for i in range(len(element)):
208
+ def_list.append(self._extract_gov_def_properties(element[i]))
209
+ return def_list
210
+ else:
211
+ return []
212
+
213
+ def _extract_solution_components_properties(self, element: Union[Dict, List[Dict]]) -> dict:
214
+ """
215
+ Extract properties from a solution component element.
216
+
217
+ Args:
218
+ element: Dictionary containing element data
219
+
220
+ Returns:
221
+ Dictionary with extracted properties
222
+ """
223
+
224
+ guid = element['elementHeader'].get("guid", None)
225
+ properties = element.get('glossaryCategoryProperties', element.get('properties', {}))
226
+ display_name = properties.get("displayName", None)
227
+ description = properties.get("description", None)
228
+ component_type = properties.get("solutionComponentType", properties.get("componentType", None))
229
+ version = properties.get("version", None)
230
+ qualified_name = properties.get("qualifiedName", None)
231
+
232
+ # Extract extended properties
233
+ extended_props = properties.get("extendedProperties", None)
234
+ extended_props_md = ""
235
+ if extended_props:
236
+ for key in extended_props.keys():
237
+ extended_props_md += "{" + f" {key}: {extended_props[key]}" + " }, "
238
+
239
+ # Extract additional properties
240
+ additional_props = properties.get("additionalProperties", None)
241
+ additional_props_md = ""
242
+ if additional_props:
243
+ for key in additional_props.keys():
244
+ additional_props_md += "{" + f" {key}: {additional_props[key]}" + " }, "
245
+
246
+ # Extract blueprints
247
+ blueprints_md = ""
248
+ blueprints = element.get('blueprints', None)
249
+ if blueprints:
250
+ for blueprint in blueprints:
251
+ if 'relatedElement' in blueprint:
252
+ bp_q_name = blueprint["relatedElement"]['properties']['qualifiedName']
253
+ blueprints_md += f" {bp_q_name}, \n"
254
+ elif 'blueprint' in blueprint:
255
+ bp_prop = blueprint['blueprint']['properties']
256
+ bp_name = bp_prop.get("displayName", None)
257
+ bp_desc = bp_prop.get("description", None)
258
+ blueprints_md += "{" + f" {bp_name}:\t {bp_desc}" + " },\n"
259
+
260
+ # Extract parent components
261
+ parent_comp_md = ""
262
+ context = element.get("context", None)
263
+ if context:
264
+ parent_components = element.get('parentComponents', None)
265
+ if parent_components:
266
+ for parent_component in parent_components:
267
+ parent_comp_prop = parent_component['parentComponent']['properties']
268
+ parent_comp_name = parent_comp_prop.get("name", None)
269
+ parent_comp_desc = parent_comp_prop.get("description", None)
270
+ parent_comp_md += f" {parent_comp_name}"
271
+
272
+ # Extract sub components
273
+ sub_comp_md = ""
274
+ sub_components = element.get('subComponents', None)
275
+ if sub_components:
276
+ for sub_component in sub_components:
277
+ sub_comp_prop = sub_component['properties']
278
+ sub_comp_name = sub_comp_prop.get("displayName", None)
279
+ sub_comp_desc = sub_comp_prop.get("description", None)
280
+ sub_comp_md += f" {sub_comp_name}"
281
+
282
+ comp_graph = element.get('mermaidGraph', None)
283
+
284
+ return {
285
+ 'guid': guid, 'qualified_name': qualified_name, 'display_name': display_name, 'description': description,
286
+ 'component_type': component_type, 'version': version, 'blueprints': blueprints_md,
287
+ 'parent_components': parent_comp_md, 'sub_components': sub_comp_md,
288
+ 'additional_properties': additional_props_md, 'extended_properties': extended_props_md,
289
+ 'mermaid_graph': comp_graph
290
+ }
291
+
292
+ #
293
+ # Markdown output support
294
+ #
295
+ @dynamic_catch
296
+ async def _async_create_governance_definition(self, body: dict | NewElementRequestBody) -> str:
297
+ """ Create a governance definition. There are many kinds of governance definition and
298
+ while the overall body structure is the same, many will have different property
299
+ structures nested within them. A list is shown in the notes below.
300
+
301
+ It may be of type:
302
+ * BusinessImperative
303
+ * RegulationArticle
304
+ * Threat
305
+ * GovernancePrinciple
306
+ * GovernanceObligation
307
+ * GovernanceApproach
308
+ * GovernanceProcessingPurpose
309
+ The type is added to the "typeName" property.
310
+
311
+ Async Version.
312
+
313
+ Parameters
314
+ ----------
315
+ body: dict
316
+ A dictionary containing the definition of the governance definition to create.
317
+
318
+ Returns
319
+ -------
320
+
321
+ str - guid of the definition created.
322
+
323
+ Raises
324
+ ------
325
+ InvalidParameterException
326
+ one of the parameters is null or invalid or
327
+ PropertyServerException
328
+ There is a problem adding the element properties to the metadata repository or
329
+ UserNotAuthorizedException
330
+ the requesting user is not authorized to issue this request.
331
+
332
+ Notes
333
+ ----
334
+ Governance definitions can be simple or anchored to a parent element - Both are shown below. depending on
335
+ which structure is used for the body.
336
+
337
+ Many kinds of governance definition have additional properties added. Details are described in the UML diagrams
338
+ on the website and summarized in the table below which shows the property class name and which types
339
+ of governance definitions use it. The test_governance_officer module offers some usage examples.
340
+
341
+ Property Class Name | Definition Types
342
+ ===================================================================================
343
+ GovernanceDefinitionProperties | BusinessImperative, RegulationArticle, Threat, GovernanceProcessingPurpose,
344
+ | GovernancePrinciple, GovernanceObligation, GovernanceApproach
345
+ GovernanceStrategyProperties | GovernanceStrategy
346
+ RegulationProperties | Regulation
347
+ GovernanceControlProperties | GovernanceControl
348
+ SecurityGroupProperties | SecurityGroup
349
+ NamingStandardRuleProperties | NamingStandardRule
350
+ CertificationTypeProperties | CertificationType
351
+ LicenseTyoeProperties | LicenseType
352
+ GovernanceApproachProperties | GovernanceApproach
353
+
354
+
355
+ Generic simple governance body structure:
356
+ {
357
+ "class": "NewElementRequestBody",
358
+ "properties": {
359
+ "class" : "GovernanceDefinitionProperties",
360
+ "typeName" : "enter the type of the governance definition",
361
+ "domainIdentifier": 0,
362
+ "documentIdentifier": "add unique name here",
363
+ "title": "add short name here",
364
+ "summary": "add summary here",
365
+ "description": "add description here",
366
+ "scope": "add scope of effect for this definition",
367
+ "importance": "add importance for this definition",
368
+ "implications": [],
369
+ "outcomes": [],
370
+ "results": [],
371
+ "additionalProperties": {
372
+ "property1" : "propertyValue1",
373
+ "property2" : "propertyValue2"
374
+ }
375
+ },
376
+ "initialStatus": "DRAFT"
377
+ }
378
+
379
+ Generic governance Body structure with Parent:
380
+ {
381
+ "class" : "NewGovernanceDefinitionRequestBody",
382
+ "externalSourceGUID": "add guid here",
383
+ "externalSourceName": "add qualified name here",
384
+ "effectiveTime" : "{{$isoTimestamp}}",
385
+ "forLineage" : false,
386
+ "forDuplicateProcessing" : false,
387
+ "anchorGUID" : "add guid here",
388
+ "isOwnAnchor": false,
389
+ "parentGUID": "add guid here",
390
+ "parentRelationshipTypeName": "add type name here",
391
+ "parentRelationshipProperties": {
392
+ "class": "ElementProperties",
393
+ "propertyValueMap" : {
394
+ "description" : {
395
+ "class": "PrimitiveTypePropertyValue",
396
+ "typeName": "string",
397
+ "primitiveValue" : "New description"
398
+ }
399
+ }
400
+ },
401
+ "parentAtEnd1": false,
402
+ "properties": {
403
+ "class" : "GovernanceDefinitionProperties",
404
+ "typeName" : "enter the type of the governance definition",
405
+ "domainIdentifier": 0,
406
+ "documentIdentifier": "add unique name here",
407
+ "title": "add short name here",
408
+ "summary": "add summary here",
409
+ "description": "add description here",
410
+ "scope": "add scope of effect for this definition",
411
+ "importance": "add importance for this definition",
412
+ "implications": [],
413
+ "outcomes": [],
414
+ "results": [],
415
+ "additionalProperties": {
416
+ "property1" : "propertyValue1",
417
+ "property2" : "propertyValue2"
418
+ },
419
+ "effectiveFrom": "{{$isoTimestamp}}",
420
+ "effectiveTo": "{{$isoTimestamp}}"
421
+ },
422
+ "initialStatus": "DRAFT"
423
+ }
424
+
425
+ """
426
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
427
+ f"{self.url_marker}/governance-definitions")
428
+ return await self._async_create_element_body_request(url, GOV_DEF_PROPERTIES_LIST, body)
429
+
430
+ @dynamic_catch
431
+ def create_governance_definition(self, body: dict | NewElementRequestBody) -> str:
432
+ """ Create a governance definition. It may be of type:
433
+ * BusinessImperative
434
+ * RegulationArticle
435
+ * Threat
436
+ * GovernancePrinciple
437
+ * GovernanceObligation
438
+ * GovernanceApproach
439
+ * GovernanceProcessingPurpose
440
+ The type is added to the "typeName" property.
441
+
442
+ Parameters
443
+ ----------
444
+
445
+ body: dict
446
+ A dictionary containing the definition of the governance definition to create.
447
+
448
+ Returns
449
+ -------
450
+
451
+ str - guid of the definition created.
452
+
453
+ Raises
454
+ ------
455
+ InvalidParameterException
456
+ one of the parameters is null or invalid or
457
+ PropertyServerException
458
+ There is a problem adding the element properties to the metadata repository or
459
+ UserNotAuthorizedException
460
+ the requesting user is not authorized to issue this request.
461
+
462
+ Notes
463
+ ----
464
+ Governance definitions can be simple or anchored to a parent element - Both are shown below. depending on
465
+ which structure is used for the body.
466
+
467
+ Many kinds of governance definition have additional properties added. Details are described in the UML diagrams
468
+ on the website and summarized in the table below which shows the property class name and which types
469
+ of governance definitions use it. The test_governance_officer module offers some usage examples.
470
+
471
+ Property Class Name | Definition Types
472
+ ===================================================================================
473
+ GovernanceDefinitionProperties | BusinessImperative, RegulationArticle, Threat, GovernanceProcessingPurpose,
474
+ | GovernancePrinciple, GovernanceObligation, GovernanceApproach
475
+ GovernanceStrategyProperties | GovernanceStrategy
476
+ RegulationProperties | Regulation
477
+ GovernanceControlProperties | GovernanceControl
478
+ SecurityGroupProperties | SecurityGroup
479
+ NamingStandardRuleProperties | NamingStandardRule
480
+ CertificationTypeProperties | CertificationType
481
+ LicenseTyoeProperties | LicenseType
482
+ GovernanceApproachProperties | GovernanceApproach
483
+
484
+ Simple body structure:
485
+ {
486
+ "class": "NewElementRequestBody",
487
+ "properties": {
488
+ "class" : "GovernanceDefinitionProperties",
489
+ "typeName" : "enter the type of the governance definition",
490
+ "domainIdentifier": 0,
491
+ "documentIdentifier": "add unique name here",
492
+ "title": "add short name here",
493
+ "summary": "add summary here",
494
+ "description": "add description here",
495
+ "scope": "add scope of effect for this definition",
496
+ "importance": "add importance for this definition",
497
+ "implications": [],
498
+ "outcomes": [],
499
+ "results": [],
500
+ "additionalProperties": {
501
+ "property1" : "propertyValue1",
502
+ "property2" : "propertyValue2"
503
+ }
504
+ },
505
+ "initialStatus": "DRAFT"
506
+ }
507
+
508
+ Body structure with Parent:
509
+ {
510
+ "class" : "NewGovernanceDefinitionRequestBody",
511
+ "externalSourceGUID": "add guid here",
512
+ "externalSourceName": "add qualified name here",
513
+ "effectiveTime" : "{{$isoTimestamp}}",
514
+ "forLineage" : false,
515
+ "forDuplicateProcessing" : false,
516
+ "anchorGUID" : "add guid here",
517
+ "isOwnAnchor": false,
518
+ "parentGUID": "add guid here",
519
+ "parentRelationshipTypeName": "add type name here",
520
+ "parentRelationshipProperties": {
521
+ "class": "ElementProperties",
522
+ "propertyValueMap" : {
523
+ "description" : {
524
+ "class": "PrimitiveTypePropertyValue",
525
+ "typeName": "string",
526
+ "primitiveValue" : "New description"
527
+ }
528
+ }
529
+ },
530
+ "parentAtEnd1": false,
531
+ "properties": {
532
+ "class" : "GovernanceDefinitionProperties",
533
+ "typeName" : "enter the type of the governance definition",
534
+ "domainIdentifier": 0,
535
+ "documentIdentifier": "add unique name here",
536
+ "title": "add short name here",
537
+ "summary": "add summary here",
538
+ "description": "add description here",
539
+ "scope": "add scope of effect for this definition",
540
+ "importance": "add importance for this definition",
541
+ "implications": [],
542
+ "outcomes": [],
543
+ "results": [],
544
+ "additionalProperties": {
545
+ "property1" : "propertyValue1",
546
+ "property2" : "propertyValue2"
547
+ },
548
+ "effectiveFrom": "{{$isoTimestamp}}",
549
+ "effectiveTo": "{{$isoTimestamp}}"
550
+ },
551
+ "initialStatus": "DRAFT"
552
+ }
553
+
554
+
555
+ """
556
+
557
+ loop = asyncio.get_event_loop()
558
+ response = loop.run_until_complete(self._async_create_governance_definition(body))
559
+ return response
560
+
561
+ @dynamic_catch
562
+ async def _async_create_governance_definition_from_template(self, body: dict | TemplateRequestBody) -> str:
563
+ """ Create a new metadata element to represent a governance definition using an existing metadata element
564
+ as a template. The template defines additional classifications and relationships that should be added to
565
+ the new element. Async version.
566
+
567
+ Parameters
568
+ ----------
569
+
570
+ body: dict
571
+ A dictionary containing the definition of the governance definition to create.
572
+
573
+ Returns
574
+ -------
575
+
576
+ str - guid of the governance definition created.
577
+
578
+ Raises
579
+ ------
580
+ InvalidParameterException
581
+ one of the parameters is null or invalid or
582
+ PropertyServerException
583
+ There is a problem adding the element properties to the metadata repository or
584
+ UserNotAuthorizedException
585
+ the requesting user is not authorized to issue this request.
586
+
587
+ Notes
588
+ ----
589
+ https://egeria-project.org/concepts/governance-definition
590
+
591
+ Body structure:
592
+
593
+ {
594
+ "class" : "TemplateRequestBody",
595
+ "externalSourceGUID": "add guid here",
596
+ "externalSourceName": "add qualified name here",
597
+ "effectiveTime" : "{{$isoTimestamp}}",
598
+ "forLineage" : false,
599
+ "forDuplicateProcessing" : false,
600
+ "anchorGUID" : "add guid here",
601
+ "isOwnAnchor": false,
602
+ "parentGUID": "add guid here",
603
+ "parentRelationshipTypeName": "add type name here",
604
+ "parentRelationshipProperties": {
605
+ "class": "ElementProperties",
606
+ "propertyValueMap" : {
607
+ "description" : {
608
+ "class": "PrimitiveTypePropertyValue",
609
+ "typeName": "string",
610
+ "primitiveValue" : "New description"
611
+ }
612
+ }
613
+ },
614
+ "parentAtEnd1": false,
615
+ "templateGUID": "add guid here",
616
+ "replacementProperties": {
617
+ "class": "ElementProperties",
618
+ "propertyValueMap" : {
619
+ "description" : {
620
+ "class": "PrimitiveTypePropertyValue",
621
+ "typeName": "string",
622
+ "primitiveValue" : "New description"
623
+ }
624
+ }
625
+ },
626
+ "placeholderPropertyValues": {
627
+ "placeholder1" : "propertyValue1",
628
+ "placeholder2" : "propertyValue2"
629
+ }
630
+ }
631
+
632
+ """
633
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
634
+ f"{self.url_marker}/governance-definitions/from-template")
635
+
636
+ if isinstance(body, TemplateRequestBody):
637
+ validated_body = body
638
+ elif isinstance(body, dict):
639
+ validated_body = self._template_request_adapter.validate_python(body)
640
+ else:
641
+ raise PyegeriaInvalidParameterException(
642
+ additional_info={"reason": "body must be a dict or TemplateRequestBody"})
643
+
644
+ json_body = validated_body.model_dump_json(indent=2, exclude_none=True)
645
+ logger.info(json_body)
646
+ resp = await self._async_make_request("POST", url, json_body, is_json=True)
647
+ logger.info(f"Created governance definition from template with GUID: {resp.json().get('guid')}")
648
+ return resp.json().get("guid", NO_GUID_RETURNED)
649
+
650
+ @dynamic_catch
651
+ def create_governance_definition_from_template(self, body: dict | TemplateRequestBody) -> str:
652
+ """ Create a new metadata element to represent a governance definition using an existing metadata element
653
+ as a template. The template defines additional classifications and relationships that should be added to
654
+ the new element.
655
+
656
+ Parameters
657
+ ----------
658
+
659
+ body: dict
660
+ A dictionary containing the definition of the governance definition to create.
661
+
662
+ Returns
663
+ -------
664
+
665
+ str - guid of the governance definition created.
666
+
667
+ Raises
668
+ ------
669
+ InvalidParameterException
670
+ one of the parameters is null or invalid or
671
+ PropertyServerException
672
+ There is a problem adding the element properties to the metadata repository or
673
+ UserNotAuthorizedException
674
+ the requesting user is not authorized to issue this request.
675
+
676
+ Notes
677
+ ----
678
+ https://egeria-project.org/concepts/governance-definition
679
+
680
+ Body structure:
681
+
682
+ {
683
+ "class" : "TemplateRequestBody",
684
+ "externalSourceGUID": "add guid here",
685
+ "externalSourceName": "add qualified name here",
686
+ "effectiveTime" : "{{$isoTimestamp}}",
687
+ "forLineage" : false,
688
+ "forDuplicateProcessing" : false,
689
+ "anchorGUID" : "add guid here",
690
+ "isOwnAnchor": false,
691
+ "parentGUID": "add guid here",
692
+ "parentRelationshipTypeName": "add type name here",
693
+ "parentRelationshipProperties": {
694
+ "class": "ElementProperties",
695
+ "propertyValueMap" : {
696
+ "description" : {
697
+ "class": "PrimitiveTypePropertyValue",
698
+ "typeName": "string",
699
+ "primitiveValue" : "New description"
700
+ }
701
+ }
702
+ },
703
+ "parentAtEnd1": false,
704
+ "templateGUID": "add guid here",
705
+ "replacementProperties": {
706
+ "class": "ElementProperties",
707
+ "propertyValueMap" : {
708
+ "description" : {
709
+ "class": "PrimitiveTypePropertyValue",
710
+ "typeName": "string",
711
+ "primitiveValue" : "New description"
712
+ }
713
+ }
714
+ },
715
+ "placeholderPropertyValues": {
716
+ "placeholder1" : "propertyValue1",
717
+ "placeholder2" : "propertyValue2"
718
+ }
719
+ }
720
+
721
+ """
722
+
723
+ loop = asyncio.get_event_loop()
724
+ response = loop.run_until_complete(self._async_create_governance_definition_from_template(body))
725
+ return response
726
+
727
+ @dynamic_catch
728
+ async def _async_update_governance_definition(self, guid: str, body: dict | UpdateElementRequestBody) -> None:
729
+ """ Update the properties of a governance definition. Async Version.
730
+
731
+ Parameters
732
+ ----------
733
+ guid: str
734
+ guid of the governance definition to update.
735
+ body: dict
736
+ A dictionary containing the updates to the governance definition.
737
+ replace_all_properties: bool, optional
738
+ Whether to replace all properties with those provided in the body or to merge with existing properties.
739
+
740
+ Returns
741
+ -------
742
+
743
+ None
744
+
745
+ Raises
746
+ ------
747
+ InvalidParameterException
748
+ one of the parameters is null or invalid or
749
+ PropertyServerException
750
+ There is a problem adding the element properties to the metadata repository or
751
+ UserNotAuthorizedException
752
+ the requesting user is not authorized to issue this request.
753
+
754
+ Notes
755
+ ----
756
+
757
+ Body structure:
758
+ {
759
+ "class" : "UpdateElementRequestBody",
760
+ "externalSourceGUID": "add guid here",
761
+ "externalSourceName": "add qualified name here",
762
+ "effectiveTime" : "{{$isoTimestamp}}",
763
+ "forLineage" : false,
764
+ "forDuplicateProcessing" : false,
765
+ "properties": {
766
+ "class" : "GovernanceDefinitionProperties",
767
+ "typeName" : "Add type name here",
768
+ "qualifiedName": "add unique name here",
769
+ "displayName": "add short name here",
770
+ "description": "add description here",
771
+ "namespace": "add namespace for this structure",
772
+ "versionIdentifier": "add version for this structure",
773
+ "additionalProperties": {
774
+ "property1" : "propertyValue1",
775
+ "property2" : "propertyValue2"
776
+ },
777
+ "extendedProperties": {
778
+ "property1" : "propertyValue1",
779
+ "property2" : "propertyValue2"
780
+ },
781
+ "effectiveFrom": "{{$isoTimestamp}}",
782
+ "effectiveTo": "{{$isoTimestamp}}"
783
+ }
784
+ }
785
+ """
786
+
787
+ url = (
788
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
789
+ f"{self.url_marker}/governance-definitions/"
790
+ f"{guid}/update")
791
+ await self._async_update_element_body_request(url, GOV_DEF_PROPERTIES_LIST, body)
792
+
793
+ @dynamic_catch
794
+ async def _async_update_governance_definition(self, guid: str, body: dict | UpdateElementRequestBody) -> None:
795
+ """ Update a governance definition. Async Version."""
796
+
797
+ def update_governance_definition(self, guid: str, body: dict | UpdateStatusRequestBody) -> None:
798
+ """ Update the properties of a governance definition.
799
+
800
+ Parameters
801
+ ----------
802
+ guid: str
803
+ guid of the governance definition to update.
804
+ body: dict
805
+ A dictionary containing the updates to the governance definition.
806
+ replace_all_properties: bool, optional
807
+ Whether to replace all properties with those provided in the body or to merge with existing properties.
808
+
809
+ Returns
810
+ -------
811
+
812
+ None
813
+
814
+ Raises
815
+ ------
816
+ InvalidParameterException
817
+ one of the parameters is null or invalid or
818
+ PropertyServerException
819
+ There is a problem adding the element properties to the metadata repository or
820
+ UserNotAuthorizedException
821
+ the requesting user is not authorized to issue this request.
822
+
823
+ Notes
824
+ ----
825
+
826
+ Body structure:
827
+ {
828
+ "class" : "UpdateElementRequestBody",
829
+ "externalSourceGUID": "add guid here",
830
+ "externalSourceName": "add qualified name here",
831
+ "effectiveTime" : "{{$isoTimestamp}}",
832
+ "forLineage" : false,
833
+ "forDuplicateProcessing" : false,
834
+ "properties": {
835
+ "class" : "GovernanceDefinitionProperties",
836
+ "typeName" : "Add type name here",
837
+ "qualifiedName": "add unique name here",
838
+ "displayName": "add short name here",
839
+ "description": "add description here",
840
+ "namespace": "add namespace for this structure",
841
+ "versionIdentifier": "add version for this structure",
842
+ "additionalProperties": {
843
+ "property1" : "propertyValue1",
844
+ "property2" : "propertyValue2"
845
+ },
846
+ "extendedProperties": {
847
+ "property1" : "propertyValue1",
848
+ "property2" : "propertyValue2"
849
+ },
850
+ "effectiveFrom": "{{$isoTimestamp}}",
851
+ "effectiveTo": "{{$isoTimestamp}}"
852
+ }
853
+ }
854
+ """
855
+ loop = asyncio.get_event_loop()
856
+ loop.run_until_complete(self._async_update_governance_definition(guid, body))
857
+
858
+ @dynamic_catch
859
+ async def _async_update_governance_definition_status(self, guid: str, status: str = None,
860
+ body: dict | UpdateStatusRequestBody = None) -> None:
861
+ """ Update the status of a governance definition. Async Version.
862
+
863
+ Parameters
864
+ ----------
865
+ guid: str
866
+ guid of the governance definition to update.
867
+ status: str, optional, default is None
868
+ The status to update the governance definition to. Superseded by the body definition if present.
869
+ body: dict
870
+ A dictionary containing the updates to the governance definition.
871
+
872
+ Returns
873
+ -------
874
+
875
+ None
876
+
877
+ Raises
878
+ ------
879
+ InvalidParameterException
880
+ one of the parameters is null or invalid or
881
+ PropertyServerException
882
+ There is a problem adding the element properties to the metadata repository or
883
+ UserNotAuthorizedException
884
+ the requesting user is not authorized to issue this request.
885
+
886
+ Notes
887
+ ----
888
+
889
+ Body structure:
890
+ {
891
+ "class": "UpdateGovernanceDefinitionRequestBody",
892
+ "externalSourceGUID": "add guid here",
893
+ "externalSourceName": "add qualified name here",
894
+ "effectiveTime": "{{$isoTimestamp}}",
895
+ "forLineage": false,
896
+ "forDuplicateProcessing": false,
897
+ "status": "ACTIVE"
898
+ }
899
+ """
900
+
901
+ url = (
902
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/governance-defnitions/"
903
+ f"{guid}/update-status")
904
+
905
+ await self._async_update_status_request(url, status, body)
906
+
907
+ def update_governance_definition_status(self, guid: str, status: str = None,
908
+ body: dict | UpdateStatusRequestBody = None) -> None:
909
+ """ Update the status of a governance definition.
910
+
911
+ Parameters
912
+ ----------
913
+ guid: str
914
+ guid of the information governance definition to update.
915
+ status: str, optional, default is None
916
+ The status to update the governance definition to. Superseded by the body definition if present.
917
+ body: dict
918
+ A dictionary containing the updates to the governance definition.
919
+
920
+ Returns
921
+ -------
922
+
923
+ None
924
+
925
+ Raises
926
+ ------
927
+ InvalidParameterException
928
+ one of the parameters is null or invalid or
929
+ PropertyServerException
930
+ There is a problem adding the element properties to the metadata repository or
931
+ UserNotAuthorizedException
932
+ the requesting user is not authorized to issue this request.
933
+
934
+ Notes
935
+ ----
936
+
937
+ Body structure:
938
+ {
939
+ "class" : "UpdateGovernanceDefinitionRequestBody",
940
+ "externalSourceGUID": "add guid here",
941
+ "externalSourceName": "add qualified name here",
942
+ "effectiveTime" : "{{$isoTimestamp}}",
943
+ "forLineage" : false,
944
+ "forDuplicateProcessing" : false,
945
+ "status": "ACTIVE"
946
+ }
947
+ """
948
+ loop = asyncio.get_event_loop()
949
+ loop.run_until_complete(self._async_update_governance_definition_status(guid, status, body))
950
+
951
+ @dynamic_catch
952
+ async def _async_delete_governance_definition(self, definition_guid: str,
953
+ body: dict | DeleteRequestBody = None,
954
+ cascade: bool = False) -> None:
955
+ """ Delete a governance definition. Async Version.
956
+
957
+ Parameters
958
+ ----------
959
+ definition_guid: str
960
+ The guid of the governance definition to delete.
961
+
962
+ cascade: bool, optional, defaults to True
963
+ If true, a cascade delete is performed.
964
+
965
+ body: dict DeleteRequestBodyt, optional, default = None
966
+ A dict representing the details of the relationship.
967
+
968
+ Returns
969
+ -------
970
+ Nothing
971
+
972
+ Raises
973
+ ------
974
+ PyegeriaInvalidParameterException
975
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
976
+ ValidationException
977
+ Raised by pydantic when the request body is invalid.
978
+ NotAuthorizedException
979
+ The principle specified by the user_id does not have authorization for the requested action
980
+
981
+ Notes
982
+ _____
983
+ JSON Structure looks like:
984
+ {
985
+ "class" : "MetadataSourceRequestBody",
986
+ "externalSourceGUID": "add guid here",
987
+ "externalSourceName": "add qualified name here",
988
+ "effectiveTime" : "{{$isoTimestamp}}",
989
+ "forLineage" : false,
990
+ "forDuplicateProcessing" : false
991
+ }
992
+ """
993
+ url = (
994
+ f"{self.platform_url}/s"
995
+ f"ervers/{self.view_server}/api/open-metadata/governance-officer/governance-definitions/"
996
+ f"{definition_guid}/delete")
997
+ await self._async_delete_request(url, body, cascade)
998
+ logger.info(f"Deleted collection {definition_guid} with cascade {cascade}")
999
+
1000
+ def delete_governance_definition(self, definition_guid: str, body: dict | DeleteRequestBody = None,
1001
+ cascade: bool = False) -> None:
1002
+ """Delete a governance definition.
1003
+
1004
+ Parameters
1005
+ ----------
1006
+ definition_guid: str
1007
+ The guid of the governance definition to delete.
1008
+
1009
+ cascade: bool, optional, defaults to True
1010
+ If true, a cascade delete is performed.
1011
+
1012
+ body: dict DeleteRequestBodyt, optional, default = None
1013
+ A dict representing the details of the relationship.
1014
+
1015
+ Returns
1016
+ -------
1017
+ Nothing
1018
+
1019
+ Raises
1020
+ ------
1021
+ PyegeriaInvalidParameterException
1022
+ If the client passes incorrect parameters on the request - such as bad URLs or invalid values
1023
+ ValidationException
1024
+ Raised by pydantic when the request body is invalid.
1025
+ NotAuthorizedException
1026
+ The principle specified by the user_id does not have authorization for the requested action
1027
+
1028
+ Notes
1029
+ _____
1030
+ JSON Structure looks like:
1031
+ {
1032
+ "class" : "MetadataSourceRequestBody",
1033
+ "externalSourceGUID": "add guid here",
1034
+ "externalSourceName": "add qualified name here",
1035
+ "effectiveTime" : "{{$isoTimestamp}}",
1036
+ "forLineage" : false,
1037
+ "forDuplicateProcessing" : false
1038
+ }
1039
+ """
1040
+ loop = asyncio.get_event_loop()
1041
+ loop.run_until_complete(self._async_delete_governance_definition(definition_guid, body, cascade))
1042
+
1043
+ @dynamic_catch
1044
+ async def _async_link_peer_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
1045
+ body: dict = None | NewRelationshipRequestBody) -> None:
1046
+ """ Attach two peer governance definitions. Request body is optional. Async Version.
1047
+
1048
+ Parameters
1049
+ ----------
1050
+ definition_guid1: str
1051
+ guid of the first governance definition to link.
1052
+ definition_guid2: str
1053
+ guid of the second governance definition to link.
1054
+ relationship_type: str
1055
+ Relationship type name linking the governance definitions..
1056
+ body: dict
1057
+ The body describing the link between the two segments.
1058
+
1059
+ Returns
1060
+ -------
1061
+ None
1062
+
1063
+ Raises
1064
+ ------
1065
+ InvalidParameterException
1066
+ one of the parameters is null or invalid or
1067
+ PropertyServerException
1068
+ There is a problem adding the element properties to the metadata repository or
1069
+ UserNotAuthorizedException
1070
+ the requesting user is not authorized to issue this request.
1071
+
1072
+ Notes
1073
+ ----
1074
+ The relationshipTypeNme can be:
1075
+ * GovernanceDriverLink between governance drivers (GovernanceStrategy, BusinessImperative, Regulation,
1076
+ RegulationArticle, Threat).
1077
+ * GovernancePolicyLink between governance policies (GovernancePrinciple, GovernanceObligation,
1078
+ GovernanceApproach).
1079
+ * GovernanceControlLink between governance controls (GovernanceRule, GovernanceProcess,
1080
+ GovernanceResponsibility, GovernanceProcedure, SecurityAccessControl, SecurityGroup).
1081
+
1082
+ Body structure:
1083
+ {
1084
+ "class" : "RelationshipRequestBody",
1085
+ "externalSourceGUID": "add guid here",
1086
+ "externalSourceName": "add qualified name here",
1087
+ "effectiveTime" : "{{$isoTimestamp}}",
1088
+ "forLineage" : false,
1089
+ "forDuplicateProcessing" : false,
1090
+ "properties": {
1091
+ "class": "PeerDefinitionProperties",
1092
+ "description": "",
1093
+ "effectiveFrom": "{{$isoTimestamp}}",
1094
+ "effectiveTo": "{{$isoTimestamp}}"
1095
+ }
1096
+ }
1097
+ """
1098
+ url = (
1099
+ f"{self.platform_url}/s"
1100
+ f"ervers/{self.view_server}/api/open-metadata/governance-officer/governance-definitions/"
1101
+ f"{definition_guid1}/peer-definitions/{relationship_type}/{definition_guid2}/attach")
1102
+
1103
+ await self._async_new_relationship_request(url, "PeerDefinitionProperties", body)
1104
+ logger.info(f"Linked {definition_guid1} -> {definition_guid2}")
1105
+
1106
+ @dynamic_catch
1107
+ def link_peer_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
1108
+ body: dict | NewElementRequestBody = None) -> None:
1109
+ """ Attach two peer governance definitions. Async Version.
1110
+
1111
+ Parameters
1112
+ ----------
1113
+ definition_guid1: str
1114
+ guid of the first governance definition to link.
1115
+ definition_guid2: str
1116
+ guid of the second governance definition to link.
1117
+ relationship_type: str
1118
+ Relationship type name linking the governance definitions..
1119
+ body: dict
1120
+ The body describing the link between the two segments.
1121
+
1122
+ Returns
1123
+ -------
1124
+ None
1125
+
1126
+ Raises
1127
+ ------
1128
+ InvalidParameterException
1129
+ one of the parameters is null or invalid or
1130
+ PropertyServerException
1131
+ There is a problem adding the element properties to the metadata repository or
1132
+ UserNotAuthorizedException
1133
+ the requesting user is not authorized to issue this request.
1134
+
1135
+ Notes
1136
+ ----
1137
+ The relationshipTypeNme can be:
1138
+ * GovernanceDriverLink between governance drivers (GovernanceStrategy, BusinessImperitive, Regulation,
1139
+ RegulationArticle, Threat).
1140
+ * GovernancePolicyLink between governance policies (GovernancePrinciple, GovernanceObligation,
1141
+ GovernanceApproach).
1142
+ * GovernanceControlLink between governance controls (GovernanceRule, GovernanceProcess,
1143
+ GovernanceResponsibility, GovernanceProcedure, SecurityAccessControl, SecurityGroup).
1144
+
1145
+ Body structure:
1146
+ {
1147
+ "class" : "RelationshipRequestBody",
1148
+ "externalSourceGUID": "add guid here",
1149
+ "externalSourceName": "add qualified name here",
1150
+ "effectiveTime" : "{{$isoTimestamp}}",
1151
+ "forLineage" : false,
1152
+ "forDuplicateProcessing" : false,
1153
+ "properties": {
1154
+ "class": "PeerDefinitionProperties",
1155
+ "description": "",
1156
+ "effectiveFrom": "{{$isoTimestamp}}",
1157
+ "effectiveTo": "{{$isoTimestamp}}"
1158
+ }
1159
+ }
1160
+ """
1161
+ loop = asyncio.get_event_loop()
1162
+ loop.run_until_complete(
1163
+ self._async_link_peer_definitions(definition_guid1, relationship_type, definition_guid2, body))
1164
+
1165
+ @dynamic_catch
1166
+ async def _async_detach_peer_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
1167
+ body: dict | DeleteRequestBody = None) -> None:
1168
+ """ Detach two peer governance definitions. Request body is optional. Async Version.
1169
+
1170
+ Parameters
1171
+ ----------
1172
+ definition_guid1: str
1173
+ guid of the first governance definition to link.
1174
+ definition_guid2: str
1175
+ guid of the second governance definition to link.
1176
+ relationship_type: str
1177
+ Relationship type name linking the governance definitions..
1178
+ body: dict, optional
1179
+ The body describing the link between the two segments.
1180
+
1181
+ Returns
1182
+ -------
1183
+ None
1184
+
1185
+ Raises
1186
+ ------
1187
+ InvalidParameterException
1188
+ one of the parameters is null or invalid or
1189
+ PropertyServerException
1190
+ There is a problem adding the element properties to the metadata repository or
1191
+ UserNotAuthorizedException
1192
+ the requesting user is not authorized to issue this request.
1193
+
1194
+ Notes
1195
+ ----
1196
+
1197
+ Body structure:
1198
+
1199
+ {
1200
+ "class": "MetadataSourceRequestBody",
1201
+ "externalSourceGUID": "add guid here",
1202
+ "externalSourceName": "add qualified name here",
1203
+ "effectiveTime": "{{$isoTimestamp}}",
1204
+ "forLineage": false,
1205
+ "forDuplicateProcessing": false
1206
+ }
1207
+ """
1208
+ url = (
1209
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1210
+ f"{self.url_marker}/governance-definitions/"
1211
+ f"{definition_guid1}/peer-definitions/{relationship_type}/{definition_guid2}/detach")
1212
+ await self._async_delete_request(url, body)
1213
+ logger.info(f"Detached peer definitions: {definition_guid1} -> {definition_guid2}")
1214
+
1215
+ @dynamic_catch
1216
+ def detach_peer_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
1217
+ body: dict = None | DeleteRequestBody) -> None:
1218
+ """ Detach two peer governance definitions. Request body is optional.
1219
+
1220
+ Parameters
1221
+ ----------
1222
+ definition_guid1: str
1223
+ guid of the first governance definition to link.
1224
+ definition_guid2: str
1225
+ guid of the second governance definition to link.
1226
+ relationship_type: str
1227
+ Relationship type name linking the governance definitions..
1228
+ body: dict, optional
1229
+ The body describing the link between the two segments.
1230
+
1231
+ Returns
1232
+ -------
1233
+ None
1234
+
1235
+ Raises
1236
+ ------
1237
+ InvalidParameterException
1238
+ one of the parameters is null or invalid or
1239
+ PropertyServerException
1240
+ There is a problem adding the element properties to the metadata repository or
1241
+ UserNotAuthorizedException
1242
+ the requesting user is not authorized to issue this request.
1243
+
1244
+ Notes
1245
+ ----
1246
+
1247
+ Body structure:
1248
+
1249
+ {
1250
+ "class": "MetadataSourceRequestBody",
1251
+ "externalSourceGUID": "add guid here",
1252
+ "externalSourceName": "add qualified name here",
1253
+ "effectiveTime": "{{$isoTimestamp}}",
1254
+ "forLineage": false,
1255
+ "forDuplicateProcessing": false
1256
+ }
1257
+ """
1258
+ loop = asyncio.get_event_loop()
1259
+ loop.run_until_complete(
1260
+ self._async_detach_peer_definitions(definition_guid1, relationship_type, definition_guid2, body))
1261
+
1262
+ @dynamic_catch
1263
+ async def _async_attach_supporting_definitions(self, definition_guid1: str, relationship_type: str,
1264
+ definition_guid2: str,
1265
+ body: dict | NewRelationshipRequestBody = None) -> None:
1266
+ """ Attach a supporting governance definition. Request body is optional.
1267
+ The relationshipTypeNme can be:
1268
+ * GovernanceResponse between governance drivers (GovernanceStrategy, BusinessImperative, Regulation,
1269
+ RegulationArticle, Threat) and governance policies (GovernancePrinciple, GovernanceObligation,
1270
+ GovernanceApproach).
1271
+ * GovernanceImplementation between governance policies (GovernancePrinciple, GovernanceObligation,
1272
+ GovernanceApproach) and governance controls (GovernanceRule, GovernanceProcess, GovernanceResponsibility,
1273
+ GovernanceProcedure, SecurityAccessControl, SecurityGroup).
1274
+
1275
+ Async Version.
1276
+
1277
+ Parameters
1278
+ ----------
1279
+ definition_guid1: str
1280
+ guid of the first governance definition to link.
1281
+ definition_guid2: str
1282
+ guid of the second governance definition to link.
1283
+ relationship_type: str
1284
+ Relationship type name linking the governance definitions..
1285
+ body: dict
1286
+ The body describing the link between the two segments.
1287
+
1288
+ Returns
1289
+ -------
1290
+ None
1291
+
1292
+ Raises
1293
+ ------
1294
+ InvalidParameterException
1295
+ one of the parameters is null or invalid or
1296
+ PropertyServerException
1297
+ There is a problem adding the element properties to the metadata repository or
1298
+ UserNotAuthorizedException
1299
+ the requesting user is not authorized to issue this request.
1300
+
1301
+ Notes
1302
+ ----
1303
+
1304
+ Body structure:
1305
+ {
1306
+ "class" : "RelationshipRequestBody",
1307
+ "externalSourceGUID": "add guid here",
1308
+ "externalSourceName": "add qualified name here",
1309
+ "effectiveTime" : "{{$isoTimestamp}}",
1310
+ "forLineage" : false,
1311
+ "forDuplicateProcessing" : false,
1312
+ "properties": {
1313
+ "class": "SupportingDefinitionProperties",
1314
+ "rationale": "",
1315
+ "effectiveFrom": "{{$isoTimestamp}}",
1316
+ "effectiveTo": "{{$isoTimestamp}}"
1317
+ }
1318
+ }
1319
+ """
1320
+ url = (
1321
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1322
+ f"{self.url_marker}/governance-definitions/"
1323
+ f"{definition_guid1}/supporting-definitions/{relationship_type}/{definition_guid2}/attach")
1324
+ await self._async_new_relationship_request(url, "SupportingDefinitionProperties", body)
1325
+ logger.info(f"Linked {definition_guid1} -> {definition_guid2}")
1326
+
1327
+ @dynamic_catch
1328
+ def attach_supporting_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
1329
+ body: dict | NewRelationshipRequestBody = None) -> None:
1330
+ """ Attach a supporting governance definition. Request body is optional.
1331
+ The relationshipTypeNme can be:
1332
+ * GovernanceResponse between governance drivers (GovernanceStrategy, BusinessImperative, Regulation,
1333
+ RegulationArticle, Threat) and governance policies (GovernancePrinciple, GovernanceObligation,
1334
+ GovernanceApproach).
1335
+ * GovernanceImplementation between governance policies (GovernancePrinciple, GovernanceObligation,
1336
+ GovernanceApproach) and governance controls (GovernanceRule, GovernanceProcess, GovernanceResponsibility,
1337
+ GovernanceProcedure, SecurityAccessControl, SecurityGroup).
1338
+
1339
+ Parameters
1340
+ ----------
1341
+ definition_guid1: str
1342
+ guid of the first governance definition to link.
1343
+ definition_guid2: str
1344
+ guid of the second governance definition to link.
1345
+ relationship_type: str
1346
+ Relationship type name linking the governance definitions..
1347
+ body: dict
1348
+ The body describing the link between the two segments.
1349
+
1350
+ Returns
1351
+ -------
1352
+ None
1353
+
1354
+ Raises
1355
+ ------
1356
+ InvalidParameterException
1357
+ one of the parameters is null or invalid or
1358
+ PropertyServerException
1359
+ There is a problem adding the element properties to the metadata repository or
1360
+ UserNotAuthorizedException
1361
+ the requesting user is not authorized to issue this request.
1362
+
1363
+ Notes
1364
+ ----
1365
+
1366
+ Body structure:
1367
+ {
1368
+ "class" : "RelationshipRequestBody",
1369
+ "externalSourceGUID": "add guid here",
1370
+ "externalSourceName": "add qualified name here",
1371
+ "effectiveTime" : "{{$isoTimestamp}}",
1372
+ "forLineage" : false,
1373
+ "forDuplicateProcessing" : false,
1374
+ "properties": {
1375
+ "class": "SupportingDefinitionProperties",
1376
+ "rationale": "",
1377
+ "effectiveFrom": "{{$isoTimestamp}}",
1378
+ "effectiveTo": "{{$isoTimestamp}}"
1379
+ }
1380
+ }
1381
+ """
1382
+ loop = asyncio.get_event_loop()
1383
+ loop.run_until_complete(
1384
+ self._async_attach_supporting_definitions(definition_guid1, relationship_type, definition_guid2, body))
1385
+
1386
+ @dynamic_catch
1387
+ async def _async_detach_supporting_definitions(self, definition_guid1: str, relationship_type: str,
1388
+ definition_guid2: str,
1389
+ body: dict | DeleteRequestBody = None) -> None:
1390
+ """ Detach a governance definition from a supporting governance definition.
1391
+ Request body is optional. Async Version.
1392
+
1393
+ Parameters
1394
+ ----------
1395
+ definition_guid1: str
1396
+ guid of the first governance definition to unlink.
1397
+ definition_guid2: str
1398
+ guid of the second governance definition to unlink.
1399
+ relationship_type: str
1400
+ Relationship type name linking the governance definitions..
1401
+ body: dict, optional
1402
+ The body describing the link between the two segments.
1403
+
1404
+ Returns
1405
+ -------
1406
+ None
1407
+
1408
+ Raises
1409
+ ------
1410
+ InvalidParameterException
1411
+ one of the parameters is null or invalid or
1412
+ PropertyServerException
1413
+ There is a problem adding the element properties to the metadata repository or
1414
+ UserNotAuthorizedException
1415
+ the requesting user is not authorized to issue this request.
1416
+
1417
+ Notes
1418
+ ----
1419
+
1420
+ Body structure:
1421
+ {
1422
+ "class": "MetadataSourceRequestBody",
1423
+ "externalSourceGUID": "add guid here",
1424
+ "externalSourceName": "add qualified name here",
1425
+ "effectiveTime": "{{$isoTimestamp}}",
1426
+ "forLineage": false,
1427
+ "forDuplicateProcessing": false
1428
+ }
1429
+ """
1430
+ url = (
1431
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1432
+ f"{self.url_marker}/governance-definitions/"
1433
+ f"{definition_guid1}/supporting-definitions/{relationship_type}/{definition_guid2}/detach"
1434
+ )
1435
+ await self._async_delete_request(url, body)
1436
+ logger.info(f"Detached digital supporting definitions: {definition_guid1} -> {definition_guid2}")
1437
+
1438
+ @dynamic_catch
1439
+ def detach_supporting_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
1440
+ body: dict | DeleteRequestBody = None) -> None:
1441
+ """ Detach a governance definition from a supporting governance definition.
1442
+ Request body is optional.
1443
+
1444
+ Parameters
1445
+ ----------
1446
+ definition_guid1: str
1447
+ guid of the first governance definition to unlink.
1448
+ definition_guid2: str
1449
+ guid of the second governance definition to unlink.
1450
+ relationship_type: str
1451
+ Relationship type name linking the governance definitions..
1452
+ body: dict, optional
1453
+ The body describing the link between the two segments.
1454
+
1455
+ Returns
1456
+ -------
1457
+ None
1458
+
1459
+ Raises
1460
+ ------
1461
+ InvalidParameterException
1462
+ one of the parameters is null or invalid or
1463
+ PropertyServerException
1464
+ There is a problem adding the element properties to the metadata repository or
1465
+ UserNotAuthorizedException
1466
+ the requesting user is not authorized to issue this request.
1467
+
1468
+ Notes
1469
+ ----
1470
+
1471
+ Body structure:
1472
+ {
1473
+ "class" : "MetadataSourceRequestBody",
1474
+ "externalSourceGUID": "add guid here",
1475
+ "externalSourceName": "add qualified name here",
1476
+ "effectiveTime" : "{{$isoTimestamp}}",
1477
+ "forLineage" : false,
1478
+ "forDuplicateProcessing" : false
1479
+ }
1480
+ """
1481
+ loop = asyncio.get_event_loop()
1482
+ loop.run_until_complete(
1483
+ self._async_detach_supporting_definitions(definition_guid1, relationship_type, definition_guid2, body))
1484
+
1485
+ @dynamic_catch
1486
+ async def _async_delete_governance_definition(self, guid: str, body: dict | DeleteRequestBody = None) -> None:
1487
+ """ Delete an information supply. Async version.
1488
+
1489
+ Parameters
1490
+ ----------
1491
+ guid: str
1492
+ GUID of the governance definition to delete.
1493
+
1494
+ body: dict, optional
1495
+ A dictionary containing the definition of the governance definition to create.
1496
+
1497
+ Returns
1498
+ -------
1499
+
1500
+ str - guid of the governance definition created.
1501
+
1502
+ Raises
1503
+ ------
1504
+ InvalidParameterException
1505
+ one of the parameters is null or invalid or
1506
+ PropertyServerException
1507
+ There is a problem adding the element properties to the metadata repository or
1508
+ UserNotAuthorizedException
1509
+ the requesting user is not authorized to issue this request.
1510
+
1511
+ Notes
1512
+ ----
1513
+ https://egeria-project.org/concepts/governance-definition
1514
+
1515
+ Body structure:
1516
+ {
1517
+ "class": "MetadataSourceRequestBody",
1518
+ "externalSourceGUID": "add guid here",
1519
+ "externalSourceName": "add qualified name here",
1520
+ "effectiveTime": "{{$isoTimestamp}}",
1521
+ "forLineage": false,
1522
+ "forDuplicateProcessing": false
1523
+ }
1524
+
1525
+ """
1526
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1527
+ f"{self.url_marker}/governance-definitions/{guid}/delete")
1528
+ await self._async_delete_request(url, body)
1529
+ logger.info(f"Deleted governance definition: {guid} ")
1530
+
1531
+ @dynamic_catch
1532
+ def delete_governance_definition(self, guid: str, body: dict | DeleteRequestBody = None) -> None:
1533
+ """ Delete an information supply. Request body is optional. Async version.
1534
+
1535
+ Parameters
1536
+ ----------
1537
+ guid: str
1538
+ GUID of the governance definition to delete.
1539
+
1540
+ body: dict, optionl
1541
+ A dictionary containing the definition of the governance definition to create.
1542
+
1543
+ Returns
1544
+ -------
1545
+
1546
+ str - guid of the governance definition created.
1547
+
1548
+ Raises
1549
+ ------
1550
+ InvalidParameterException
1551
+ one of the parameters is null or invalid or
1552
+ PropertyServerException
1553
+ There is a problem adding the element properties to the metadata repository or
1554
+ UserNotAuthorizedException
1555
+ the requesting user is not authorized to issue this request.
1556
+
1557
+ Notes
1558
+ ----
1559
+ https://egeria-project.org/concepts/governance-definition
1560
+
1561
+ Body structure:
1562
+ {
1563
+ "class": "MetadataSourceRequestBody",
1564
+ "externalSourceGUID": "add guid here",
1565
+ "externalSourceName": "add qualified name here",
1566
+ "effectiveTime": "{{$isoTimestamp}}",
1567
+ "forLineage": false,
1568
+ "forDuplicateProcessing": false
1569
+ }
1570
+
1571
+ """
1572
+
1573
+ loop = asyncio.get_event_loop()
1574
+ loop.run_until_complete(self._async_delete_governance_definition(guid, body))
1575
+
1576
+ @dynamic_catch
1577
+ async def _async_find_governance_definitions(self, search_string: str = "*", classification_names: list[str] = None,
1578
+ metadata_element_types: list[str] = None,
1579
+ starts_with: bool = True,
1580
+ ends_with: bool = False, ignore_case: bool = False,
1581
+ start_from: int = 0, page_size: int = 0,
1582
+ output_format: str = 'JSON', output_format_set: dict = None,
1583
+ body: dict | SearchStringRequestBody = None,
1584
+ ) -> list | str:
1585
+ """ Retrieve the list of governance definition metadata elements that contain the search string.
1586
+ Async version.
1587
+
1588
+ Parameters
1589
+ ----------
1590
+ search_string : str
1591
+ - string to search for.
1592
+ starts_with : bool, [default=False], optional
1593
+ Starts with the supplied string.
1594
+ ends_with : bool, [default=False], optional
1595
+ Ends with the supplied string
1596
+ ignore_case : bool, [default=False], optional
1597
+ Ignore case when searching
1598
+ body: dict, optional, default = None
1599
+ - additional optional specifications for the search.
1600
+ output_format: str, default = 'JSON'
1601
+ Type of output to produce:
1602
+ JSON - output standard json
1603
+ MD - output standard markdown with no preamble
1604
+ FORM - output markdown with a preamble for a form
1605
+ REPORT - output markdown with a preamble for a report
1606
+ Mermaid - output markdown with a mermaid graph
1607
+
1608
+ Returns
1609
+ -------
1610
+ list[dict] | str
1611
+ A list of information governance definition structures or a string if there are no elements found.
1612
+
1613
+ Raises
1614
+ ------
1615
+ InvalidParameterException
1616
+ one of the parameters is null or invalid or
1617
+ PropertyServerException
1618
+ There is a problem adding the element properties to the metadata repository or
1619
+ UserNotAuthorizedException
1620
+ the requesting user is not authorized to issue this request.
1621
+
1622
+ Notes
1623
+ -----
1624
+ If a body is provided it overrides the filter_string parameter.
1625
+
1626
+ Body structure:
1627
+ {
1628
+ "class": "FilterRequestBody",
1629
+ "asOfTime": {{isotime}},
1630
+ "effectiveTime": {{isotime}},
1631
+ "forLineage": false,
1632
+ "forDuplicateProcessing": false,
1633
+ "limitResultsByStatus": ["ACTIVE"],
1634
+ "sequencingOrder": "PROPERTY_ASCENDING",
1635
+ "sequencingProperty": "qualifiedName",
1636
+ "filter": "Add name here",
1637
+ "templateFilter": "NO_TEMPLATES"
1638
+ }
1639
+ """
1640
+
1641
+ url = (
1642
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1643
+ f"{self.url_marker}/governance-definitions/"
1644
+ f"by-search-string")
1645
+ return await self._async_find_request(url, _type="GovernanceDefinition",
1646
+ _gen_output=self._generate_governance_definition_output,
1647
+ search_string=search_string, classification_names=classification_names,
1648
+ metadata_element_types=metadata_element_types,
1649
+ starts_with=starts_with, ends_with=ends_with, ignore_case=ignore_case,
1650
+ start_from=start_from, page_size=page_size,
1651
+ output_format=output_format, output_format_set=output_format_set,
1652
+ body=body)
1653
+
1654
+ @dynamic_catch
1655
+ def find_governance_definitions(self, search_string: str = "*", classification_names: list[str] = None,
1656
+ metadata_element_types: list[str] = None,
1657
+ starts_with: bool = True, ends_with: bool = False,
1658
+ ignore_case: bool = False, start_from: int = 0, page_size: int = 0,
1659
+ output_format: str = 'JSON', output_format_set: dict = None,
1660
+ body: dict | SearchStringRequestBody = None, ) -> list | str:
1661
+ """ Retrieve the list of governance definition metadata elements that contain the search string.
1662
+
1663
+ Parameters
1664
+ ----------
1665
+ search_string : str
1666
+ - filter_string string to search for.
1667
+ starts_with : bool, [default=False], optional
1668
+ Starts with the supplied string.
1669
+ ends_with : bool, [default=False], optional
1670
+ Ends with the supplied string
1671
+ ignore_case : bool, [default=False], optional
1672
+ Ignore case when searching
1673
+ body: dict, optional, default = None
1674
+ - additional optional specifications for the search.
1675
+ output_format: str, default = 'JSON'
1676
+ Type of output to produce:
1677
+ JSON - output standard json
1678
+ MD - output standard markdown with no preamble
1679
+ FORM - output markdown with a preamble for a form
1680
+ REPORT - output markdown with a preamble for a report
1681
+ Mermaid - output markdown with a mermaid graph
1682
+
1683
+ Returns
1684
+ -------
1685
+ list[dict] | str
1686
+ A list of information governance definition structures or a string if there are no elements found.
1687
+
1688
+ Raises
1689
+ ------
1690
+ InvalidParameterException
1691
+ one of the parameters is null or invalid or
1692
+ PropertyServerException
1693
+ There is a problem adding the element properties to the metadata repository or
1694
+ UserNotAuthorizedException
1695
+ the requesting user is not authorized to issue this request.
1696
+
1697
+ Notes
1698
+ -----
1699
+ If a body is provided it overrides the filter_string parameter.
1700
+
1701
+ Body structure:
1702
+ {
1703
+ "class": "FilterRequestBody",
1704
+ "asOfTime": {{isotime}},
1705
+ "effectiveTime": {{isotime}},
1706
+ "forLineage": false,
1707
+ "forDuplicateProcessing": false,
1708
+ "limitResultsByStatus": ["ACTIVE"],
1709
+ "sequencingOrder": "PROPERTY_ASCENDING",
1710
+ "sequencingProperty": "qualifiedName",
1711
+ "filter": "Add name here",
1712
+ "templateFilter": "NO_TEMPLATES"
1713
+ }
1714
+ """
1715
+
1716
+ loop = asyncio.get_event_loop()
1717
+ response = loop.run_until_complete(
1718
+ self._async_find_governance_definitions(search_string, classification_names, metadata_element_types,
1719
+ starts_with, ends_with, ignore_case, start_from,
1720
+ page_size, output_format, output_format_set, body))
1721
+ return response
1722
+
1723
+ @dynamic_catch
1724
+ async def _async_get_governance_definitions_by_name(self, filter_string: str,
1725
+ classification_names: list[str] = None,
1726
+ body: dict | FilterRequestBody = None,
1727
+ start_from: int = 0, page_size: int = 0,
1728
+ output_format: str = "JSON",
1729
+ output_format_set: dict = None) -> list | str:
1730
+ """ Returns the list of governance definitions with a particular name. Async Version.
1731
+
1732
+ Parameters
1733
+ ----------
1734
+ filter_string: str
1735
+ name of the information governance definition to retrieve.
1736
+ body: dict, optional
1737
+ A dictionary containing parameters of the retrieval.
1738
+ output_format: str, default = 'JSON'
1739
+ Type of output to produce include:
1740
+ JSON - output standard json
1741
+ MD - output standard markdown with no preamble
1742
+ FORM - output markdown with a preamble for a form
1743
+ REPORT - output markdown with a preamble for a report
1744
+ MERMAID - output mermaid markdown
1745
+
1746
+ Returns
1747
+ -------
1748
+ [dict] | str
1749
+ A list of information governance definitions matching the name.
1750
+
1751
+ Raises
1752
+ ------
1753
+ InvalidParameterException
1754
+ one of the parameters is null or invalid or
1755
+ PropertyServerException
1756
+ There is a problem adding the element properties to the metadata repository or
1757
+ UserNotAuthorizedException
1758
+ the requesting user is not authorized to issue this request.
1759
+
1760
+ Notes
1761
+ -----
1762
+ If a body is provided it overrides the filter_string parameter.
1763
+ Body structure:
1764
+ {
1765
+ "class": "FilterRequestBody",
1766
+ "asOfTime": {{isotime}},
1767
+ "effectiveTime": {{isotime}},
1768
+ "forLineage": false,
1769
+ "forDuplicateProcessing": false,
1770
+ "limitResultsByStatus": ["ACTIVE"],
1771
+ "sequencingOrder": "PROPERTY_ASCENDING",
1772
+ "sequencingProperty": "qualifiedName",
1773
+ "filter": "Add name here",
1774
+ "templateFilter": "NO_TEMPLATES"
1775
+ }
1776
+
1777
+ """
1778
+
1779
+ url = (
1780
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1781
+ f"{self.url_marker}/governance-definitions/by-name")
1782
+ response = await self._async_get_name_request(url, _type="GovernanceDefinition",
1783
+ _gen_output=self._generate_governance_definition_output,
1784
+ filter_string=filter_string,
1785
+ classification_names=classification_names,
1786
+ start_from=start_from, page_size=page_size,
1787
+ output_format=output_format, output_format_set=output_format_set,
1788
+ body=body)
1789
+
1790
+ return response
1791
+
1792
+ @dynamic_catch
1793
+ def get_governance_definitions_by_name(self, filter_string: str, classification_names: list[str] = None,
1794
+ body: dict | FilterRequestBody = None,
1795
+ start_from: int = 0, page_size: int = 0,
1796
+ output_format: str = "JSON",
1797
+ output_format_set: dict = None) -> list | str:
1798
+ """ Returns the list of governance definitions with a particular name."""
1799
+
1800
+ """ Returns the list of information governance definitions with a particular name. Async Version.
1801
+
1802
+ Parameters
1803
+ ----------
1804
+ filter_string: str
1805
+ name of the information governance definition to retrieve.
1806
+ body: dict, optional
1807
+ A dictionary containing parameters of the retrieval.
1808
+ add_implementation: bool, optional
1809
+ Whether to add the implementation details to the response.
1810
+ start_from: int, [default=0], optional
1811
+ When multiple pages of results are available, the page number to start from.
1812
+ page_size: int, [default=0], optional
1813
+ The number of items to return in a single page. If not specified, the default will be taken from
1814
+ the class instance.
1815
+ output_format: str, default = 'JSON'
1816
+ Type of output to produce:
1817
+ JSON - output standard json
1818
+ MD - output standard markdown with no preamble
1819
+ FORM - output markdown with a preamble for a form
1820
+ REPORT - output markdown with a preamble for a report
1821
+ MERMAID - output mermaid markdown
1822
+
1823
+ Returns
1824
+ -------
1825
+ [dict] | str
1826
+ A list of information governance definitions matching the name.
1827
+
1828
+ Raises
1829
+ ------
1830
+ InvalidParameterException
1831
+ one of the parameters is null or invalid or
1832
+ PropertyServerException
1833
+ There is a problem adding the element properties to the metadata repository or
1834
+ UserNotAuthorizedException
1835
+ the requesting user is not authorized to issue this request.
1836
+
1837
+ Notes
1838
+ -----
1839
+ Body structure:
1840
+ {
1841
+ "class": "FilterRequestBody",
1842
+ "asOfTime": {{isotime}},
1843
+ "effectiveTime": {{isotime}},
1844
+ "forLineage": false,
1845
+ "forDuplicateProcessing": false,
1846
+ "limitResultsByStatus": ["ACTIVE"],
1847
+ "sequencingOrder": "PROPERTY_ASCENDING",
1848
+ "sequencingProperty": "qualifiedName",
1849
+ "filter": "Add name here",
1850
+ "templateFilter": "NO_TEMPLATES"
1851
+ }
1852
+
1853
+ """
1854
+ loop = asyncio.get_event_loop()
1855
+ response = loop.run_until_complete(
1856
+ self._async_get_governance_definitions_by_name(filter_string, classification_names, body,
1857
+ start_from, page_size, output_format, output_format_set))
1858
+ return response
1859
+
1860
+ @dynamic_catch
1861
+ async def _async_get_governance_definition_by_guid(self, guid: str, element_type: str = None,
1862
+ body: dict | FilterRequestBody = None,
1863
+ output_format: str = "JSON",
1864
+ output_format_set: dict = None) -> dict | str:
1865
+
1866
+ """ Get governance definition by guid.
1867
+ Async version.
1868
+
1869
+ Parameters
1870
+ ----------
1871
+ guid: str
1872
+ GUID of the governance definition to get.
1873
+
1874
+ body: dict, optional
1875
+ A dictionary containing the definition of the governance definition to create.
1876
+ output_format: str
1877
+ The output format to use.
1878
+
1879
+ Returns
1880
+ -------
1881
+
1882
+ dict | str
1883
+ A list of information governance definition structures or a string if there are no elements found.
1884
+
1885
+
1886
+ Raises
1887
+ ------
1888
+ InvalidParameterException
1889
+ one of the parameters is null or invalid or
1890
+ PropertyServerException
1891
+ There is a problem adding the element properties to the metadata repository or
1892
+ UserNotAuthorizedException
1893
+ the requesting user is not authorized to issue this request.
1894
+
1895
+ Notes
1896
+ ----
1897
+ https://egeria-project.org/concepts/governance-definition
1898
+
1899
+ Body structure:
1900
+ {
1901
+ "class" : "GetRequestBody",
1902
+ "asOfTime" : "{{$isoTimestamp}}",
1903
+ "effectiveTime" : "{{$isoTimestamp}}",
1904
+ "forLineage" : false,
1905
+ "forDuplicateProcessing" : false
1906
+ }
1907
+
1908
+ """
1909
+
1910
+ url = (
1911
+ f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
1912
+ f"{self.url_marker}/governance-definitions/"
1913
+ f"{guid}/retrieve")
1914
+ type = element_type if element_type else "GovernanceDefinition"
1915
+
1916
+ response = await self._async_get_guid_request(url, _type=type,
1917
+ _gen_output=self._generate_governance_definition_output,
1918
+ output_format=output_format, output_format_set=output_format_set,
1919
+ body=body)
1920
+
1921
+ return response
1922
+
1923
+ @dynamic_catch
1924
+ def get_governance_definition_by_guid(self, guid: str, element_type: str = None, body: dict = None,
1925
+ output_format: str = "JSON",
1926
+ output_format_set: dict = None) -> dict | str:
1927
+
1928
+ """ Get governance definition by guid.
1929
+
1930
+ Parameters
1931
+ ----------
1932
+ guid: str
1933
+ GUID of the governance definition to get.
1934
+
1935
+ body: dict, optional
1936
+ A dictionary containing the definition of the governance definition to create.
1937
+ output_format: str, default = "JSON"
1938
+ The output format to use.
1939
+
1940
+ Returns
1941
+ -------
1942
+
1943
+ dict | str
1944
+ A list of information governance definition structures or a string if there are no elements found.
1945
+
1946
+
1947
+ Raises
1948
+ ------
1949
+ InvalidParameterException
1950
+ one of the parameters is null or invalid or
1951
+ PropertyServerException
1952
+ There is a problem adding the element properties to the metadata repository or
1953
+ UserNotAuthorizedException
1954
+ the requesting user is not authorized to issue this request.
1955
+
1956
+ Notes
1957
+ ----
1958
+ https://egeria-project.org/concepts/governance-definition
1959
+ Body structure:
1960
+ {
1961
+ "class" : "GetRequestBody",
1962
+ "asOfTime" : "{{$isoTimestamp}}",
1963
+ "effectiveTime" : "{{$isoTimestamp}}",
1964
+ "forLineage" : false,
1965
+ "forDuplicateProcessing" : false
1966
+ }
1967
+
1968
+ """
1969
+
1970
+ loop = asyncio.get_event_loop()
1971
+ response = loop.run_until_complete(self._async_get_governance_definition_by_guid(guid, element_type, body,
1972
+ output_format,
1973
+ output_format_set))
1974
+ return response
1975
+
1976
+ @dynamic_catch
1977
+ async def _async_link_design_to_implementation(self, design_desc_guid: str, implementation_guid: str,
1978
+ body: dict | NewRelationshipRequestBody = None) -> None:
1979
+ """ Attach a design object such as a solution component or governance definition to its implementation via the
1980
+ ImplementedBy relationship. Request body is optional. Async Version.
1981
+ https://egeria-project.org/types/7/0737-Solution-Implementation/
1982
+
1983
+ Parameters
1984
+ ----------
1985
+ design_desc_guid: str
1986
+ guid of the design element to link.
1987
+ implementation_guid: str
1988
+ guid of the implementation definition to link.
1989
+ body: dict, optional
1990
+ The body describing the link between the two segments.
1991
+
1992
+ Returns
1993
+ -------
1994
+ None
1995
+
1996
+ Raises
1997
+ ------
1998
+ InvalidParameterException
1999
+ one of the parameters is null or invalid or
2000
+ PropertyServerException
2001
+ There is a problem adding the element properties to the metadata repository or
2002
+ UserNotAuthorizedException
2003
+ the requesting user is not authorized to issue this request.
2004
+
2005
+ Notes
2006
+ ----
2007
+
2008
+ Body structure:
2009
+ {
2010
+ "class" : "RelationshipRequestBody",
2011
+ "externalSourceGUID": "add guid here",
2012
+ "externalSourceName": "add qualified name here",
2013
+ "effectiveTime" : "{{$isoTimestamp}}",
2014
+ "forLineage" : false,
2015
+ "forDuplicateProcessing" : false,
2016
+ "properties": {
2017
+ "class": "ImplementedByProperties",
2018
+ "designStep": "",
2019
+ "role": "",
2020
+ "transformation": "",
2021
+ "description": "",
2022
+ "iscQualifiedName": "",
2023
+ "effectiveFrom": "{{$isoTimestamp}}",
2024
+ "effectiveTo": "{{$isoTimestamp}}"
2025
+ }
2026
+ }
2027
+ """
2028
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/designs/"
2029
+ f"{design_desc_guid}/implementations/{implementation_guid}/attach")
2030
+ await self._async_new_relationship_request(url, "ImplementedByProperties", body)
2031
+ logger.info(f"Linked design to implementation: {design_desc_guid} -> {implementation_guid}")
2032
+
2033
+ @dynamic_catch
2034
+ def link_design_to_implementation(self, design_desc_guid: str, implementation_guid: str,
2035
+ body: dict | NewRelationshipRequestBody = None) -> None:
2036
+ """ Attach a design object such as a solution component or governance definition to its implementation via the
2037
+ ImplementedBy relationship. Request body is optional.
2038
+ https://egeria-project.org/types/7/0737-Solution-Implementation/
2039
+
2040
+ Parameters
2041
+ ----------
2042
+ design_desc_guid: str
2043
+ guid of the design element to link.
2044
+ implementation_guid: str
2045
+ guid of the implementation definition to link.
2046
+ body: dict, optional
2047
+ The body describing the link between the two segments.
2048
+
2049
+ Returns
2050
+ -------
2051
+ None
2052
+
2053
+ Raises
2054
+ ------
2055
+ InvalidParameterException
2056
+ one of the parameters is null or invalid or
2057
+ PropertyServerException
2058
+ There is a problem adding the element properties to the metadata repository or
2059
+ UserNotAuthorizedException
2060
+ the requesting user is not authorized to issue this request.
2061
+
2062
+ Notes
2063
+ ----
2064
+
2065
+ Body structure:
2066
+ {
2067
+ "class" : "RelationshipRequestBody",
2068
+ "externalSourceGUID": "add guid here",
2069
+ "externalSourceName": "add qualified name here",
2070
+ "effectiveTime" : "{{$isoTimestamp}}",
2071
+ "forLineage" : false,
2072
+ "forDuplicateProcessing" : false,
2073
+ "properties": {
2074
+ "class": "ImplementedByProperties",
2075
+ "designStep": "",
2076
+ "role": "",
2077
+ "transformation": "",
2078
+ "description": "",
2079
+ "iscQualifiedName": "",
2080
+ "effectiveFrom": "{{$isoTimestamp}}",
2081
+ "effectiveTo": "{{$isoTimestamp}}"
2082
+ }
2083
+ }
2084
+ """
2085
+ loop = asyncio.get_event_loop()
2086
+ loop.run_until_complete(self._async_link_design_to_implementation(design_desc_guid, implementation_guid, body))
2087
+
2088
+ @dynamic_catch
2089
+ async def _async_detach_design_from_implementation(self, design_desc_guid: str, implementation_guid: str,
2090
+ body: dict | DeleteRequestBody = None) -> None:
2091
+ """ Detach a governance definition from its implementation. Async Version.
2092
+
2093
+ Parameters
2094
+ ----------
2095
+ design_desc_guid: str
2096
+ guid of the technical control to link.
2097
+ implementation_guid: str
2098
+ guid of the implementation definition to unlink.
2099
+ body: dict
2100
+ The body describing the link between the two segments.
2101
+
2102
+ Returns
2103
+ -------
2104
+ None
2105
+
2106
+ Raises
2107
+ ------
2108
+ InvalidParameterException
2109
+ one of the parameters is null or invalid or
2110
+ PropertyServerException
2111
+ There is a problem adding the element properties to the metadata repository or
2112
+ UserNotAuthorizedException
2113
+ the requesting user is not authorized to issue this request.
2114
+
2115
+ Notes
2116
+ ----
2117
+
2118
+ Body structure:
2119
+ {
2120
+ "class": "MetadataSourceRequestBody",
2121
+ "externalSourceGUID": "string",
2122
+ "externalSourceName": "string",
2123
+ "forLineage": true,
2124
+ "forDuplicateProcessing": true,
2125
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
2126
+ }
2127
+ """
2128
+
2129
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/designs/"
2130
+ f"{design_desc_guid}/implementations/{implementation_guid}/detach")
2131
+ await self._async_delete_request(url, body)
2132
+ logger.info(
2133
+ f"Detached design from implementation: {design_desc_guid} -> {implementation_guid}")
2134
+
2135
+ @dynamic_catch
2136
+ def detach_design_from_implementation(self, design_desc_guid: str, implementation_guid: str,
2137
+ body: dict | DeleteRequestBody = None) -> None:
2138
+ """ Detach a governance definition from its implementation. Request body is optional.
2139
+
2140
+ Parameters
2141
+ ----------
2142
+ design_descl_guid: str
2143
+ guid of the technical control to unlink.
2144
+ implementation_guid: str
2145
+ guid of the implementation definition to unlink.
2146
+ body: dict, optional
2147
+ The body describing the link between the two segments.
2148
+
2149
+ Returns
2150
+ -------
2151
+ None
2152
+
2153
+ Raises
2154
+ ------
2155
+ InvalidParameterException
2156
+ one of the parameters is null or invalid or
2157
+ PropertyServerException
2158
+ There is a problem adding the element properties to the metadata repository or
2159
+ UserNotAuthorizedException
2160
+ the requesting user is not authorized to issue this request.
2161
+
2162
+ Notes
2163
+ ----
2164
+
2165
+ Body structure:
2166
+ {
2167
+ "externalSourceGUID": "string",
2168
+ "externalSourceName": "string",
2169
+ "forLineage": true,
2170
+ "forDuplicateProcessing": true,
2171
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
2172
+ }
2173
+ """
2174
+ loop = asyncio.get_event_loop()
2175
+ loop.run_until_complete(
2176
+ self._async_detach_design_from_implementation(design_desc_guid, implementation_guid, body))
2177
+
2178
+ @dynamic_catch
2179
+ async def _async_link_implementation_resource(self, design_desc_guid: str, implementation_guid: str,
2180
+ body: dict | NewRelationshipRequestBody = None) -> None:
2181
+ """ Attach a design object such as a solution component or governance definition to one of its implementation
2182
+ resource via the ImplementationResource relationship. Request body is optional.
2183
+ https://egeria-project.org/types/7/0737-Solution-Implementation/
2184
+
2185
+ Parameters
2186
+ ----------
2187
+ design_desc_guid: str
2188
+ guid of the design element to link.
2189
+ implementation_guid: str
2190
+ guid of the implementation definition to link.
2191
+ body: dict, optional
2192
+ The body describing the link between the two segments.
2193
+
2194
+ Returns
2195
+ -------
2196
+ None
2197
+
2198
+ Raises
2199
+ ------
2200
+ InvalidParameterException
2201
+ one of the parameters is null or invalid or
2202
+ PropertyServerException
2203
+ There is a problem adding the element properties to the metadata repository or
2204
+ UserNotAuthorizedException
2205
+ the requesting user is not authorized to issue this request.
2206
+
2207
+ Notes
2208
+ ----
2209
+
2210
+ Body structure:
2211
+ {
2212
+ "class" : "RelationshipRequestBody",
2213
+ "externalSourceGUID": "add guid here",
2214
+ "externalSourceName": "add qualified name here",
2215
+ "effectiveTime" : "{{$isoTimestamp}}",
2216
+ "forLineage" : false,
2217
+ "forDuplicateProcessing" : false,
2218
+ "properties": {
2219
+ "class": "ImplementedByProperties",
2220
+ "designStep": "",
2221
+ "role": "",
2222
+ "transformation": "",
2223
+ "description": "",
2224
+ "iscQualifiedName": "",
2225
+ "effectiveFrom": "{{$isoTimestamp}}",
2226
+ "effectiveTo": "{{$isoTimestamp}}"
2227
+ }
2228
+ }
2229
+ """
2230
+
2231
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/designs/"
2232
+ f"{design_desc_guid}/implementation-resources/{implementation_guid}/attach")
2233
+ await self._async_new_relationship_request(url, "ImplementationResourceProperties", body)
2234
+ logger.info(f"Linked design to implementation resource: {design_desc_guid} -> {implementation_guid}")
2235
+
2236
+ @dynamic_catch
2237
+ def link_implementation_resource(self, design_desc_guid: str, implementation_guid: str,
2238
+ body: dict | NewRelationshipRequestBody = None) -> None:
2239
+ """ Attach a design object such as a solution component or governance definition to its implementation via the
2240
+ ImplementedBy relationship. Request body is optional.
2241
+ https://egeria-project.org/types/7/0737-Solution-Implementation/
2242
+
2243
+ Parameters
2244
+ ----------
2245
+ design_desc_guid: str
2246
+ guid of the design element to link.
2247
+ implementation_guid: str
2248
+ guid of the implementation definition to link.
2249
+ body: dict, optional
2250
+ The body describing the link between the two segments.
2251
+
2252
+ Returns
2253
+ -------
2254
+ None
2255
+
2256
+ Raises
2257
+ ------
2258
+ InvalidParameterException
2259
+ one of the parameters is null or invalid or
2260
+ PropertyServerException
2261
+ There is a problem adding the element properties to the metadata repository or
2262
+ UserNotAuthorizedException
2263
+ the requesting user is not authorized to issue this request.
2264
+
2265
+ Notes
2266
+ ----
2267
+
2268
+ Body structure:
2269
+ {
2270
+ "class" : "RelationshipRequestBody",
2271
+ "externalSourceGUID": "add guid here",
2272
+ "externalSourceName": "add qualified name here",
2273
+ "effectiveTime" : "{{$isoTimestamp}}",
2274
+ "forLineage" : false,
2275
+ "forDuplicateProcessing" : false,
2276
+ "properties": {
2277
+ "class": "ImplementedByProperties",
2278
+ "designStep": "",
2279
+ "role": "",
2280
+ "transformation": "",
2281
+ "description": "",
2282
+ "iscQualifiedName": "",
2283
+ "effectiveFrom": "{{$isoTimestamp}}",
2284
+ "effectiveTo": "{{$isoTimestamp}}"
2285
+ }
2286
+ }
2287
+ """
2288
+ loop = asyncio.get_event_loop()
2289
+ loop.run_until_complete(self._async_link_implementation_resource(design_desc_guid, implementation_guid, body))
2290
+
2291
+ @dynamic_catch
2292
+ async def _async_detach_implementation_resource(self, design_desc_guid: str, implementation_guid: str,
2293
+ body: dict | DeleteRequestBody = None) -> None:
2294
+ """ Detach a design object such as a solution component or governance definition from one of its implementation
2295
+ resources. Request body is optional. Async version.
2296
+
2297
+ Parameters
2298
+ ----------
2299
+ design_desc_guid: str
2300
+ guid of the technical control to link.
2301
+ implementation_guid: str
2302
+ guid of the implementation definition to unlink.
2303
+ body: dict
2304
+ The body describing the link between the two segments.
2305
+
2306
+ Returns
2307
+ -------
2308
+ None
2309
+
2310
+ Raises
2311
+ ------
2312
+ InvalidParameterException
2313
+ one of the parameters is null or invalid or
2314
+ PropertyServerException
2315
+ There is a problem adding the element properties to the metadata repository or
2316
+ UserNotAuthorizedException
2317
+ the requesting user is not authorized to issue this request.
2318
+
2319
+ Notes
2320
+ ----
2321
+
2322
+ Body structure:
2323
+ {
2324
+ "class": "MetadataSourceRequestBody",
2325
+ "externalSourceGUID": "string",
2326
+ "externalSourceName": "string",
2327
+ "forLineage": true,
2328
+ "forDuplicateProcessing": true,
2329
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
2330
+ }
2331
+ """
2332
+
2333
+ url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/designs/"
2334
+ f"{design_desc_guid}/implementation-resources/{implementation_guid}/detach")
2335
+ await self._async_delete_request(url, body)
2336
+ logger.info(
2337
+ f"Detached design from implementation resource: {design_desc_guid} -> {implementation_guid}")
2338
+
2339
+ def detach_implementation_resource(self, design_desc_guid: str, implementation_guid: str,
2340
+ body: dict | DeleteRequestBody = None) -> None:
2341
+ """ Detach a design object such as a solution component or governance definition from one of its implementation
2342
+ resources. Request body is optional.
2343
+
2344
+ Parameters
2345
+ ----------
2346
+ design_desc_guid: str
2347
+ guid of the technical control to link.
2348
+ implementation_guid: str
2349
+ guid of the implementation definition to unlink.
2350
+ body: dict, optional
2351
+ The body describing the link between the two segments.
2352
+
2353
+ Returns
2354
+ -------
2355
+ None
2356
+
2357
+ Raises
2358
+ ------
2359
+ InvalidParameterException
2360
+ one of the parameters is null or invalid or
2361
+ PropertyServerException
2362
+ There is a problem adding the element properties to the metadata repository or
2363
+ UserNotAuthorizedException
2364
+ the requesting user is not authorized to issue this request.
2365
+
2366
+ Notes
2367
+ ----
2368
+
2369
+ Body structure:
2370
+ {
2371
+ "class": "MetadataSourceRequestBody",
2372
+ "externalSourceGUID": "string",
2373
+ "externalSourceName": "string",
2374
+ "forLineage": true,
2375
+ "forDuplicateProcessing": true,
2376
+ "effectiveTime": "2025-06-13T15:13:31.339Z"
2377
+ }
2378
+ """
2379
+ loop = asyncio.get_event_loop()
2380
+ loop.run_until_complete(self._async_detach_implementation_resource(design_desc_guid, implementation_guid, body))
2381
+
2382
+ # async def _async_get_gov_def_in_context(self, guid: str, body: dict = None, output_format: str = "JSON",
2383
+ # start_from: int = 0,
2384
+ # page_size: int = 0) -> list[dict] | str:
2385
+ # """ Get governance definition in context. Brings back the graph.
2386
+ # Async version.
2387
+ #
2388
+ # Parameters
2389
+ # ----------
2390
+ # guid: str
2391
+ # GUID of the governance definition to get.
2392
+ #
2393
+ # body: dict
2394
+ # A dictionary containing the definition of the governance definition to get.
2395
+ # output_format: str
2396
+ # The output format to use.
2397
+ # start_from: int, default= 0
2398
+ # Indicates the start of the page range.
2399
+ # page_size: int, default = 0
2400
+ # The page size to use.
2401
+ #
2402
+ # Returns
2403
+ # -------
2404
+ #
2405
+ # list[dict] | str
2406
+ # A list of information governance definition structures or a string if there are no elements found.
2407
+ #
2408
+ #
2409
+ # Raises
2410
+ # ------
2411
+ # InvalidParameterException
2412
+ # one of the parameters is null or invalid or
2413
+ # PropertyServerException
2414
+ # There is a problem adding the element properties to the metadata repository or
2415
+ # UserNotAuthorizedException
2416
+ # the requesting user is not authorized to issue this request.
2417
+ #
2418
+ # Notes
2419
+ # ----
2420
+ # https://egeria-project.org/concepts/governance-definition
2421
+ #
2422
+ # Body structure:
2423
+ # {
2424
+ # "forLineage": true,
2425
+ # "forDuplicateProcessing": true,
2426
+ # "effectiveTime": "2025-06-13T14:12:44.896Z",
2427
+ # "limitResultsByStatus": [
2428
+ # "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}"
2429
+ # ],
2430
+ # "asOfTime": "2025-06-13T14:12:44.896Z",
2431
+ # "sequencingOrder": "SequencingOrder{Any Order}",
2432
+ # "sequencingProperty": "string"
2433
+ # }
2434
+ #
2435
+ # """
2436
+ # possible_query_params = query_string([("startFrom", start_from), ("pageSize", page_size)])
2437
+ #
2438
+ # url = (
2439
+ # f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
2440
+ # f"{self.url_marker}/governance-definitions/"
2441
+ # f"{guid}/in-context{possible_query_params}")
2442
+ #
2443
+ # if body:
2444
+ # response = await self._async_make_request("POST", url, body_slimmer(body))
2445
+ # else:
2446
+ # response = await self._async_make_request("POST", url)
2447
+ #
2448
+ # element = response.json().get("element", NO_ELEMENTS_FOUND)
2449
+ # if output_format != 'JSON': # return a simplified markdown representation
2450
+ # return self.generate_governance_definition_output(element, "", output_format)
2451
+ # return response.json().get("element", NO_ELEMENTS_FOUND)
2452
+ #
2453
+ # def get_gov_def_in_context(self, guid: str, body: dict = None, output_format: str = "JSON", start_from: int = 0,
2454
+ # page_size: int = 0) -> list[dict] | str:
2455
+ # """ Get governance definition in context. Brings back the graph.
2456
+ #
2457
+ # Parameters
2458
+ # ----------
2459
+ # guid: str
2460
+ # GUID of the governance definition to get.
2461
+ #
2462
+ # body: dict
2463
+ # A dictionary containing the definition of the governance definition to get.
2464
+ # output_format: str
2465
+ # The output format to use.
2466
+ # start_from: int, default= 0
2467
+ # Indicates the start of the page range.
2468
+ # page_size: int, default = 0
2469
+ # The page size to use.
2470
+ #
2471
+ # Returns
2472
+ # -------
2473
+ #
2474
+ # list[dict] | str
2475
+ # A list of information governance definition structures or a string if there are no elements found.
2476
+ #
2477
+ #
2478
+ # Raises
2479
+ # ------
2480
+ # InvalidParameterException
2481
+ # one of the parameters is null or invalid or
2482
+ # PropertyServerException
2483
+ # There is a problem adding the element properties to the metadata repository or
2484
+ # UserNotAuthorizedException
2485
+ # the requesting user is not authorized to issue this request.
2486
+ #
2487
+ # Notes
2488
+ # ----
2489
+ # https://egeria-project.org/concepts/governance-definition
2490
+ #
2491
+ # Body structure:
2492
+ # {
2493
+ # "forLineage": true,
2494
+ # "forDuplicateProcessing": true,
2495
+ # "effectiveTime": "2025-06-13T14:12:44.896Z",
2496
+ # "limitResultsByStatus": [
2497
+ # "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}"
2498
+ # ],
2499
+ # "asOfTime": "2025-06-13T14:12:44.896Z",
2500
+ # "sequencingOrder": "SequencingOrder{Any Order}",
2501
+ # "sequencingProperty": "string"
2502
+ # }
2503
+ #
2504
+ # """
2505
+ #
2506
+ # loop = asyncio.get_event_loop()
2507
+ # response = loop.run_until_complete(
2508
+ # self._async_get_gov_def_in_context(guid, body, output_format, start_from, page_size))
2509
+ # return response
2510
+
2511
+
2512
+ if __name__ == "__main__":
2513
+ print("Main-Metadata Explorer")