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