pyegeria 5.3.9.9.3__py3-none-any.whl → 5.5.3.3__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.
Potentially problematic release.
This version of pyegeria might be problematic. Click here for more details.
- commands/__init__.py +24 -0
- commands/cat/Dr-Egeria_md-orig.py +2 -2
- commands/cat/__init__.py +1 -17
- commands/cat/collection_actions.py +197 -0
- commands/cat/dr_egeria_command_help.py +372 -0
- commands/cat/dr_egeria_jupyter.py +7 -7
- commands/cat/dr_egeria_md.py +27 -182
- commands/cat/exp_list_glossaries.py +11 -14
- commands/cat/get_asset_graph.py +37 -267
- commands/cat/{get_collection.py → get_collection_tree.py} +10 -18
- commands/cat/get_project_dependencies.py +14 -14
- commands/cat/get_project_structure.py +15 -14
- commands/cat/get_tech_type_elements.py +16 -116
- commands/cat/glossary_actions.py +145 -298
- commands/cat/list_assets.py +3 -11
- commands/cat/list_cert_types.py +17 -63
- commands/cat/list_collections.py +46 -138
- commands/cat/list_deployed_catalogs.py +15 -27
- commands/cat/list_deployed_database_schemas.py +27 -43
- commands/cat/list_deployed_databases.py +16 -31
- commands/cat/list_deployed_servers.py +35 -54
- commands/cat/list_glossaries.py +18 -17
- commands/cat/list_projects.py +10 -12
- commands/cat/list_tech_type_elements.py +21 -37
- commands/cat/list_tech_types.py +13 -25
- commands/cat/list_terms.py +38 -79
- commands/cat/list_todos.py +4 -11
- commands/cat/list_user_ids.py +3 -10
- commands/cat/my_reports.py +559 -0
- commands/cat/run_report.py +394 -0
- commands/cat/run_report_orig.py +528 -0
- commands/cli/egeria.py +222 -247
- commands/cli/egeria_cat.py +68 -81
- commands/cli/egeria_my.py +13 -0
- commands/cli/egeria_ops.py +69 -74
- commands/cli/egeria_tech.py +17 -93
- commands/cli/ops_config.py +3 -6
- commands/{cat/list_categories.py → deprecated/list_data_designer.py} +53 -64
- commands/{cat/list_data_structures.py → deprecated/list_data_structures_full.py} +3 -6
- commands/deprecated/old_get_asset_graph.py +315 -0
- commands/my/__init__.py +0 -2
- commands/my/list_my_profile.py +27 -34
- commands/my/list_my_roles.py +1 -7
- commands/my/monitor_my_todos.py +1 -7
- commands/my/monitor_open_todos.py +6 -7
- commands/my/todo_actions.py +4 -5
- commands/ops/__init__.py +0 -2
- commands/ops/gov_server_actions.py +17 -21
- commands/ops/list_archives.py +17 -38
- commands/ops/list_catalog_targets.py +33 -40
- commands/ops/load_archive.py +35 -26
- commands/ops/{monitor_engine_activity_c.py → monitor_active_engine_activity.py} +51 -82
- commands/ops/{monitor_integ_daemon_status.py → monitor_daemon_status.py} +35 -55
- commands/ops/monitor_engine_activity.py +79 -77
- commands/ops/{monitor_gov_eng_status.py → monitor_engine_status.py} +10 -7
- commands/ops/monitor_platform_status.py +38 -50
- commands/ops/monitor_server_startup.py +6 -11
- commands/ops/monitor_server_status.py +7 -11
- commands/ops/orig_monitor_server_list.py +8 -8
- commands/ops/orig_monitor_server_status.py +1 -5
- commands/ops/refresh_integration_daemon.py +5 -5
- commands/ops/restart_integration_daemon.py +5 -5
- commands/ops/table_integ_daemon_status.py +6 -6
- commands/ops/x_engine_actions.py +7 -7
- commands/tech/__init__.py +0 -2
- commands/tech/{generic_actions.py → element_actions.py} +6 -11
- commands/tech/get_element_info.py +20 -29
- commands/tech/get_guid_info.py +23 -42
- commands/tech/get_tech_details.py +20 -35
- commands/tech/get_tech_type_template.py +28 -39
- commands/tech/list_all_om_type_elements.py +24 -30
- commands/tech/list_all_om_type_elements_x.py +22 -28
- commands/tech/list_all_related_elements.py +19 -28
- commands/tech/list_anchored_elements.py +22 -30
- commands/tech/list_asset_types.py +19 -24
- commands/tech/list_elements_by_classification_by_property_value.py +26 -32
- commands/tech/list_elements_by_property_value.py +19 -25
- commands/tech/list_elements_by_property_value_x.py +20 -28
- commands/tech/list_elements_for_classification.py +28 -41
- commands/tech/list_gov_action_processes.py +16 -27
- commands/tech/list_information_supply_chains.py +22 -30
- commands/tech/list_registered_services.py +14 -26
- commands/tech/list_related_elements_with_prop_value.py +15 -25
- commands/tech/list_related_specification.py +1 -4
- commands/tech/list_relationship_types.py +15 -25
- commands/tech/list_relationships.py +20 -36
- commands/tech/list_solution_blueprints.py +28 -33
- commands/tech/list_solution_components.py +23 -29
- commands/tech/list_solution_roles.py +21 -32
- commands/tech/list_tech_templates.py +51 -54
- commands/tech/list_valid_metadata_values.py +5 -9
- commands/tech/table_tech_templates.py +2 -6
- commands/tech/x_list_related_elements.py +1 -4
- examples/GeoSpatial Products Example.py +524 -0
- examples/Jupyter Notebooks/P-egeria-server-config.ipynb +2137 -0
- examples/Jupyter Notebooks/README.md +2 -0
- examples/Jupyter Notebooks/common/P-environment-check.ipynb +115 -0
- examples/Jupyter Notebooks/common/__init__.py +14 -0
- examples/Jupyter Notebooks/common/common-functions.ipynb +4694 -0
- examples/Jupyter Notebooks/common/environment-check.ipynb +52 -0
- examples/Jupyter Notebooks/common/globals.ipynb +184 -0
- examples/Jupyter Notebooks/common/globals.py +154 -0
- examples/Jupyter Notebooks/common/orig_globals.py +152 -0
- examples/format_sets/all_format_sets.json +910 -0
- examples/format_sets/custom_format_sets.json +268 -0
- examples/format_sets/subset_format_sets.json +187 -0
- examples/format_sets_save_load_example.py +291 -0
- examples/jacquard_data_sets.py +129 -0
- examples/output_formats_example.py +193 -0
- examples/test_jacquard_data_sets.py +54 -0
- examples/test_jacquard_data_sets_scenarios.py +94 -0
- md_processing/__init__.py +90 -0
- md_processing/command_dispatcher.py +33 -0
- md_processing/command_mapping.py +221 -0
- md_processing/data/commands/commands_data_designer.json +537 -0
- md_processing/data/commands/commands_external_reference.json +733 -0
- md_processing/data/commands/commands_feedback.json +155 -0
- md_processing/data/commands/commands_general.json +204 -0
- md_processing/data/commands/commands_glossary.json +218 -0
- md_processing/data/commands/commands_governance.json +3678 -0
- md_processing/data/commands/commands_product_manager.json +865 -0
- md_processing/data/commands/commands_project.json +642 -0
- md_processing/data/commands/commands_solution_architect.json +366 -0
- md_processing/data/commands.json +17568 -0
- md_processing/data/commands_working.json +30641 -0
- md_processing/data/gened_report_specs.py +6584 -0
- md_processing/data/generated_format_sets.json +6533 -0
- md_processing/data/generated_format_sets_old.json +4137 -0
- md_processing/data/generated_format_sets_old.py +45 -0
- md_processing/dr_egeria.py +182 -0
- md_processing/md_commands/__init__.py +3 -0
- md_processing/md_commands/data_designer_commands.py +1276 -0
- md_processing/md_commands/ext_ref_commands.py +530 -0
- md_processing/md_commands/feedback_commands.py +726 -0
- md_processing/md_commands/glossary_commands.py +684 -0
- md_processing/md_commands/governance_officer_commands.py +600 -0
- md_processing/md_commands/product_manager_commands.py +1266 -0
- md_processing/md_commands/project_commands.py +383 -0
- md_processing/md_commands/solution_architect_commands.py +1184 -0
- md_processing/md_commands/view_commands.py +295 -0
- md_processing/md_processing_utils/__init__.py +4 -0
- md_processing/md_processing_utils/common_md_proc_utils.py +1249 -0
- md_processing/md_processing_utils/common_md_utils.py +578 -0
- md_processing/md_processing_utils/determine_width.py +103 -0
- md_processing/md_processing_utils/extraction_utils.py +547 -0
- md_processing/md_processing_utils/gen_report_specs.py +643 -0
- md_processing/md_processing_utils/generate_dr_help.py +193 -0
- md_processing/md_processing_utils/generate_md_cmd_templates.py +144 -0
- md_processing/md_processing_utils/generate_md_templates.py +83 -0
- md_processing/md_processing_utils/md_processing_constants.py +1228 -0
- md_processing/md_processing_utils/message_constants.py +19 -0
- pyegeria/__init__.py +201 -443
- pyegeria/core/__init__.py +40 -0
- pyegeria/core/_base_platform_client.py +574 -0
- pyegeria/core/_base_server_client.py +573 -0
- pyegeria/core/_exceptions.py +457 -0
- pyegeria/core/_globals.py +60 -0
- pyegeria/core/_server_client.py +6073 -0
- pyegeria/core/_validators.py +257 -0
- pyegeria/core/config.py +654 -0
- pyegeria/{create_tech_guid_lists.py → core/create_tech_guid_lists.py} +0 -1
- pyegeria/core/load_config.py +37 -0
- pyegeria/core/logging_configuration.py +207 -0
- pyegeria/core/mcp_adapter.py +144 -0
- pyegeria/core/mcp_server.py +212 -0
- pyegeria/core/utils.py +405 -0
- pyegeria/deprecated/__init__.py +0 -0
- pyegeria/{_client.py → deprecated/_client.py} +62 -24
- pyegeria/{_deprecated_gov_engine.py → deprecated/_deprecated_gov_engine.py} +16 -16
- pyegeria/{classification_manager_omvs.py → deprecated/classification_manager_omvs.py} +1988 -1878
- pyegeria/deprecated/output_formatter_with_machine_keys.py +1127 -0
- pyegeria/{runtime_manager_omvs.py → deprecated/runtime_manager_omvs.py} +216 -229
- pyegeria/{valid_metadata_omvs.py → deprecated/valid_metadata_omvs.py} +93 -93
- pyegeria/{x_action_author_omvs.py → deprecated/x_action_author_omvs.py} +2 -3
- pyegeria/egeria_cat_client.py +25 -51
- pyegeria/egeria_client.py +140 -98
- pyegeria/egeria_config_client.py +48 -24
- pyegeria/egeria_tech_client.py +170 -83
- pyegeria/models/__init__.py +150 -0
- pyegeria/models/collection_models.py +168 -0
- pyegeria/models/models.py +654 -0
- pyegeria/omvs/__init__.py +84 -0
- pyegeria/omvs/action_author.py +342 -0
- pyegeria/omvs/actor_manager.py +5980 -0
- pyegeria/omvs/asset_catalog.py +842 -0
- pyegeria/omvs/asset_maker.py +2736 -0
- pyegeria/omvs/automated_curation.py +4403 -0
- pyegeria/omvs/classification_manager.py +11213 -0
- pyegeria/omvs/collection_manager.py +5780 -0
- pyegeria/omvs/community_matters_omvs.py +468 -0
- pyegeria/{core_omag_server_config.py → omvs/core_omag_server_config.py} +157 -157
- pyegeria/{data_designer_omvs.py → omvs/data_designer.py} +1991 -1691
- pyegeria/omvs/data_discovery.py +869 -0
- pyegeria/omvs/data_engineer.py +372 -0
- pyegeria/omvs/digital_business.py +1133 -0
- pyegeria/omvs/external_links.py +1752 -0
- pyegeria/omvs/feedback_manager.py +834 -0
- pyegeria/{full_omag_server_config.py → omvs/full_omag_server_config.py} +73 -69
- pyegeria/omvs/glossary_manager.py +3231 -0
- pyegeria/omvs/governance_officer.py +3009 -0
- pyegeria/omvs/lineage_linker.py +314 -0
- pyegeria/omvs/location_arena.py +1525 -0
- pyegeria/omvs/metadata_expert.py +668 -0
- pyegeria/omvs/metadata_explorer_omvs.py +2943 -0
- pyegeria/omvs/my_profile.py +1042 -0
- pyegeria/omvs/notification_manager.py +358 -0
- pyegeria/omvs/people_organizer.py +394 -0
- pyegeria/{platform_services.py → omvs/platform_services.py} +113 -193
- pyegeria/omvs/product_manager.py +1825 -0
- pyegeria/omvs/project_manager.py +1907 -0
- pyegeria/omvs/reference_data.py +1140 -0
- pyegeria/omvs/registered_info.py +334 -0
- pyegeria/omvs/runtime_manager.py +2817 -0
- pyegeria/omvs/schema_maker.py +446 -0
- pyegeria/{server_operations.py → omvs/server_operations.py} +27 -26
- pyegeria/omvs/solution_architect.py +6490 -0
- pyegeria/omvs/specification_properties.py +37 -0
- pyegeria/omvs/subject_area.py +1042 -0
- pyegeria/omvs/template_manager_omvs.py +236 -0
- pyegeria/omvs/time_keeper.py +1761 -0
- pyegeria/omvs/valid_metadata.py +3221 -0
- pyegeria/omvs/valid_metadata_lists.py +37 -0
- pyegeria/omvs/valid_type_lists.py +37 -0
- pyegeria/view/__init__.py +28 -0
- pyegeria/view/_output_format_models.py +514 -0
- pyegeria/view/_output_formats.py +14 -0
- pyegeria/view/base_report_formats.py +2719 -0
- pyegeria/view/dr_egeria_reports.py +56 -0
- pyegeria/view/format_set_executor.py +397 -0
- pyegeria/{md_processing_utils.py → view/md_processing_utils.py} +5 -5
- pyegeria/{mermaid_utilities.py → view/mermaid_utilities.py} +2 -154
- pyegeria/view/output_formatter.py +1297 -0
- pyegeria-5.5.3.3.dist-info/METADATA +218 -0
- pyegeria-5.5.3.3.dist-info/RECORD +241 -0
- {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.5.3.3.dist-info}/WHEEL +2 -1
- pyegeria-5.5.3.3.dist-info/entry_points.txt +103 -0
- pyegeria-5.5.3.3.dist-info/top_level.txt +4 -0
- commands/cat/.DS_Store +0 -0
- commands/cat/README.md +0 -16
- commands/cli/txt_custom_v2.tcss +0 -19
- commands/my/README.md +0 -17
- commands/ops/README.md +0 -24
- commands/ops/monitor_asset_events.py +0 -108
- commands/tech/README.md +0 -24
- pyegeria/.DS_Store +0 -0
- pyegeria/README.md +0 -35
- pyegeria/_globals.py +0 -47
- pyegeria/_validators.py +0 -385
- pyegeria/asset_catalog_omvs.py +0 -864
- pyegeria/automated_curation_omvs.py +0 -3765
- pyegeria/collection_manager_omvs.py +0 -2744
- pyegeria/dr.egeria spec.md +0 -9
- pyegeria/egeria_my_client.py +0 -56
- pyegeria/feedback_manager_omvs.py +0 -4573
- pyegeria/glossary_browser_omvs.py +0 -3728
- pyegeria/glossary_manager_omvs.py +0 -2440
- pyegeria/m_test.py +0 -118
- pyegeria/md_processing_helpers.py +0 -58
- pyegeria/md_processing_utils_orig.py +0 -1103
- pyegeria/metadata_explorer_omvs.py +0 -2326
- pyegeria/my_profile_omvs.py +0 -1022
- pyegeria/output_formatter.py +0 -389
- pyegeria/project_manager_omvs.py +0 -1933
- pyegeria/registered_info.py +0 -167
- pyegeria/solution_architect_omvs.py +0 -2156
- pyegeria/template_manager_omvs.py +0 -1414
- pyegeria/utils.py +0 -197
- pyegeria-5.3.9.9.3.dist-info/METADATA +0 -72
- pyegeria-5.3.9.9.3.dist-info/RECORD +0 -143
- pyegeria-5.3.9.9.3.dist-info/entry_points.txt +0 -99
- /pyegeria/{_exceptions.py → deprecated/_exceptions.py} +0 -0
- {pyegeria-5.3.9.9.3.dist-info → pyegeria-5.5.3.3.dist-info/licenses}/LICENSE +0 -0
|
@@ -0,0 +1,3009 @@
|
|
|
1
|
+
"""PDX-License-Identifier: Apache-2.0
|
|
2
|
+
Copyright Contributors to the ODPi Egeria project.
|
|
3
|
+
|
|
4
|
+
This module provides access to the Governance Officer OMVS module.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import asyncio
|
|
10
|
+
import os
|
|
11
|
+
import sys
|
|
12
|
+
from typing import Annotated, Literal, Union
|
|
13
|
+
from typing import Dict, List, Optional
|
|
14
|
+
|
|
15
|
+
from loguru import logger
|
|
16
|
+
from pydantic import Field
|
|
17
|
+
|
|
18
|
+
from pyegeria.core._server_client import ServerClient
|
|
19
|
+
from pyegeria.view.base_report_formats import select_report_spec, get_report_spec_match
|
|
20
|
+
from pyegeria.view.output_formatter import (
|
|
21
|
+
extract_mermaid_only,
|
|
22
|
+
generate_output,
|
|
23
|
+
populate_common_columns,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
|
|
27
|
+
from pyegeria.core._exceptions import PyegeriaInvalidParameterException
|
|
28
|
+
from pyegeria.core._globals import NO_GUID_RETURNED
|
|
29
|
+
from pyegeria.core.config import settings as app_settings
|
|
30
|
+
from pyegeria.models import (GetRequestBody, SearchStringRequestBody, FilterRequestBody, NewElementRequestBody,
|
|
31
|
+
ReferenceableProperties, TemplateRequestBody,
|
|
32
|
+
UpdateElementRequestBody, NewRelationshipRequestBody,
|
|
33
|
+
DeleteElementRequestBody, DeleteRelationshipRequestBody)
|
|
34
|
+
from pyegeria.core.utils import dynamic_catch
|
|
35
|
+
|
|
36
|
+
GOV_DEF_PROPERTIES_LIST = ["GovernanceDefinitionProperties", "GovernanceStrategyProperties", "RegulationProperties",
|
|
37
|
+
"GovernanceControlProperties", "SecurityGroupProperties", "NamingStandardRuleProperties",
|
|
38
|
+
"CertificationTypeProperties", "LicenseTypeProperties", "GovernanceApproachProperties",
|
|
39
|
+
"GovernanceStrategyProperties", "GovernanceProcessingPurposeProperties",
|
|
40
|
+
"BusinessImperativeProperties", "RegulationArticleProperties", "ThreatProperties",]
|
|
41
|
+
|
|
42
|
+
GOV_BASIC_TYPES = ["BusinessImperative", "RegulationArticle", "Threat", "GovernancePrinciple", "GovernanceObligation",
|
|
43
|
+
"GovernanceApproach", "GovernanceProcessingPurpose"]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
EGERIA_LOCAL_QUALIFIER = app_settings.User_Profile.egeria_local_qualifier
|
|
48
|
+
DEFAULT_BODY_SKELETON = {
|
|
49
|
+
"effective_time": None, "limitResultsByStatus": ["ACTIVE"], "asOfTime": None, "sequencingOrder": None,
|
|
50
|
+
"sequencingProperty": None, "filter": None,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def base_path(client, view_server: str):
|
|
55
|
+
return f"{client.platform_url}/servers/governance-officer/api/open-metadata/metadata-explorer"
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class GovernanceDefinitionProperties(ReferenceableProperties):
|
|
59
|
+
class_: Annotated[Literal["GovernanceDefinitionProperties"], Field(alias="class")]
|
|
60
|
+
identifier: str | None = None
|
|
61
|
+
domainIdentifier: int | None = None
|
|
62
|
+
summary: str | None = None
|
|
63
|
+
scope: str | None = None
|
|
64
|
+
usage: str | None = None
|
|
65
|
+
importance: str | None = None
|
|
66
|
+
implications: list[str] | None = None
|
|
67
|
+
outcomes: list[str] | None = None
|
|
68
|
+
results: list[str] | None = None
|
|
69
|
+
userDefinedStatus: str | None = None
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class GovernanceOfficer(ServerClient):
|
|
73
|
+
"""
|
|
74
|
+
Client for the Governance Officer View Service.
|
|
75
|
+
|
|
76
|
+
The Governance Officer View Service provides methods to manage governance
|
|
77
|
+
definitions, peer definitions, and governance results.
|
|
78
|
+
|
|
79
|
+
Attributes
|
|
80
|
+
----------
|
|
81
|
+
view_server : str
|
|
82
|
+
The name of the View Server to use.
|
|
83
|
+
platform_url : str
|
|
84
|
+
URL of the server platform to connect to.
|
|
85
|
+
user_id : str
|
|
86
|
+
The identity of the user calling the method.
|
|
87
|
+
user_pwd : str
|
|
88
|
+
The password associated with the user_id. Defaults to None.
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
def __init__(self, view_server: str, platform_url: str, user_id: Optional[str] = None, user_pwd: Optional[str] = None,
|
|
92
|
+
token: Optional[str] = None, ):
|
|
93
|
+
self.view_server = view_server
|
|
94
|
+
self.platform_url = platform_url
|
|
95
|
+
self.user_id = user_id
|
|
96
|
+
self.user_pwd = user_pwd
|
|
97
|
+
|
|
98
|
+
ServerClient.__init__(self, view_server, platform_url, user_id=user_id, user_pwd=user_pwd, token=token)
|
|
99
|
+
self.url_marker = "governance-officer"
|
|
100
|
+
|
|
101
|
+
#
|
|
102
|
+
# Extract properties functions
|
|
103
|
+
#
|
|
104
|
+
def _generate_governance_definition_output(self, elements: list | dict, search_string: str, element_type_name: Optional[str] = None,
|
|
105
|
+
output_format: str = 'DICT', report_spec: dict | str = None
|
|
106
|
+
) -> str | list:
|
|
107
|
+
"""
|
|
108
|
+
Render governance definitions using the shared output pipeline.
|
|
109
|
+
|
|
110
|
+
Parameters
|
|
111
|
+
----------
|
|
112
|
+
elements : dict | list[dict]
|
|
113
|
+
Element(s) returned by the OMVS.
|
|
114
|
+
search_string : str
|
|
115
|
+
The search string used to retrieve these elements (shown in preamble for some formats).
|
|
116
|
+
element_type_name : str, optional
|
|
117
|
+
Friendly type label to display (defaults to "Governance Definition").
|
|
118
|
+
output_format : str
|
|
119
|
+
One of: MD, FORM, REPORT, LIST, DICT, MERMAID, HTML.
|
|
120
|
+
report_spec : dict | str, optional
|
|
121
|
+
Either a label for a format set or a concrete format-set dict. When omitted, a sensible
|
|
122
|
+
default for Governance Definitions is chosen, falling back to "Default".
|
|
123
|
+
|
|
124
|
+
Returns
|
|
125
|
+
-------
|
|
126
|
+
str | list
|
|
127
|
+
Rendered output in the requested format.
|
|
128
|
+
"""
|
|
129
|
+
# Ensure elements handled consistently for MERMAID
|
|
130
|
+
if output_format == "MERMAID":
|
|
131
|
+
return extract_mermaid_only(elements)
|
|
132
|
+
|
|
133
|
+
entity_type = element_type_name if element_type_name else "Governance Definition"
|
|
134
|
+
# Resolve columns_struct via output format sets
|
|
135
|
+
if report_spec:
|
|
136
|
+
if isinstance(report_spec, str):
|
|
137
|
+
output_formats = select_report_spec(report_spec, output_format)
|
|
138
|
+
elif isinstance(report_spec, dict):
|
|
139
|
+
output_formats = get_report_spec_match(report_spec, output_format)
|
|
140
|
+
else:
|
|
141
|
+
output_formats = None
|
|
142
|
+
else:
|
|
143
|
+
# Default to the Governance Definitions format set
|
|
144
|
+
output_formats = select_report_spec("Governance Definitions", output_format)
|
|
145
|
+
if output_formats is None:
|
|
146
|
+
output_formats = select_report_spec("Default", output_format)
|
|
147
|
+
|
|
148
|
+
logger.trace(f"Executing generate_governance_definition_output: {output_formats}")
|
|
149
|
+
return generate_output(
|
|
150
|
+
elements=elements,
|
|
151
|
+
search_string=search_string,
|
|
152
|
+
entity_type=entity_type,
|
|
153
|
+
output_format=output_format,
|
|
154
|
+
extract_properties_func=self._extract_gov_def_properties,
|
|
155
|
+
get_additional_props_func=None,
|
|
156
|
+
columns_struct=output_formats,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
#
|
|
160
|
+
#
|
|
161
|
+
#
|
|
162
|
+
|
|
163
|
+
def _extract_gov_def_properties(self, element: dict, columns_struct: dict) -> dict:
|
|
164
|
+
"""
|
|
165
|
+
Extract and populate governance definition properties into columns_struct.
|
|
166
|
+
|
|
167
|
+
This follows the columns_struct pattern: fill from element.properties (camelCase), overlay header
|
|
168
|
+
attributes, and derive any relationship-based columns that are explicitly requested.
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
element: The governance definition element
|
|
172
|
+
columns_struct: The columns structure to populate
|
|
173
|
+
|
|
174
|
+
Returns:
|
|
175
|
+
dict: columns_struct with populated 'value' fields
|
|
176
|
+
"""
|
|
177
|
+
# Use the common population pipeline to reduce duplication
|
|
178
|
+
col_data = populate_common_columns(element, columns_struct,
|
|
179
|
+
include_header=True,
|
|
180
|
+
include_relationships=True,
|
|
181
|
+
include_subject_area=True,
|
|
182
|
+
mermaid_source_key='mermaidGraph',
|
|
183
|
+
mermaid_dest_key='mermaid')
|
|
184
|
+
return col_data
|
|
185
|
+
|
|
186
|
+
def _extract_gov_def_list(self, element: Union[Dict, List[Dict]]) -> List[Dict]:
|
|
187
|
+
"""
|
|
188
|
+
Normalize for a list of dictionaries.
|
|
189
|
+
Args:
|
|
190
|
+
element: Dict or List
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
list of Dict
|
|
194
|
+
|
|
195
|
+
"""
|
|
196
|
+
if isinstance(element, dict):
|
|
197
|
+
return [self._extract_gov_def_properties(element)]
|
|
198
|
+
elif isinstance(element, list):
|
|
199
|
+
def_list = []
|
|
200
|
+
for i in range(len(element)):
|
|
201
|
+
def_list.append(self._extract_gov_def_properties(element[i]))
|
|
202
|
+
return def_list
|
|
203
|
+
else:
|
|
204
|
+
return []
|
|
205
|
+
|
|
206
|
+
def _extract_solution_components_properties(self, element: Union[Dict, List[Dict]]) -> dict:
|
|
207
|
+
"""
|
|
208
|
+
Extract properties from a solution component element.
|
|
209
|
+
|
|
210
|
+
Args:
|
|
211
|
+
element: Dictionary containing element data
|
|
212
|
+
|
|
213
|
+
Returns:
|
|
214
|
+
Dictionary with extracted properties
|
|
215
|
+
"""
|
|
216
|
+
|
|
217
|
+
guid = element['elementHeader'].get("guid", None)
|
|
218
|
+
properties = element.get('glossaryCategoryProperties', element.get('properties', {}))
|
|
219
|
+
display_name = properties.get("displayName", None)
|
|
220
|
+
description = properties.get("description", None)
|
|
221
|
+
component_type = properties.get("solutionComponentType", properties.get("componentType", None))
|
|
222
|
+
version = properties.get("version", None)
|
|
223
|
+
qualified_name = properties.get("qualifiedName", None)
|
|
224
|
+
|
|
225
|
+
# Extract extended properties
|
|
226
|
+
extended_props = properties.get("extendedProperties", None)
|
|
227
|
+
extended_props_md = ""
|
|
228
|
+
if extended_props:
|
|
229
|
+
for key in extended_props.keys():
|
|
230
|
+
extended_props_md += "{" + f" {key}: {extended_props[key]}" + " }, "
|
|
231
|
+
|
|
232
|
+
# Extract additional properties
|
|
233
|
+
additional_props = properties.get("additionalProperties", None)
|
|
234
|
+
additional_props_md = ""
|
|
235
|
+
if additional_props:
|
|
236
|
+
for key in additional_props.keys():
|
|
237
|
+
additional_props_md += "{" + f" {key}: {additional_props[key]}" + " }, "
|
|
238
|
+
|
|
239
|
+
# Extract blueprints
|
|
240
|
+
blueprints_md = ""
|
|
241
|
+
blueprints = element.get('blueprints', None)
|
|
242
|
+
if blueprints:
|
|
243
|
+
for blueprint in blueprints:
|
|
244
|
+
if 'relatedElement' in blueprint:
|
|
245
|
+
bp_q_name = blueprint["relatedElement"]['properties']['qualifiedName']
|
|
246
|
+
blueprints_md += f" {bp_q_name}, \n"
|
|
247
|
+
elif 'blueprint' in blueprint:
|
|
248
|
+
bp_prop = blueprint['blueprint']['properties']
|
|
249
|
+
bp_name = bp_prop.get("displayName", None)
|
|
250
|
+
bp_desc = bp_prop.get("description", None)
|
|
251
|
+
blueprints_md += "{" + f" {bp_name}:\t {bp_desc}" + " },\n"
|
|
252
|
+
|
|
253
|
+
# Extract parent components
|
|
254
|
+
parent_comp_md = ""
|
|
255
|
+
context = element.get("context", None)
|
|
256
|
+
if context:
|
|
257
|
+
parent_components = element.get('parentComponents', None)
|
|
258
|
+
if parent_components:
|
|
259
|
+
for parent_component in parent_components:
|
|
260
|
+
parent_comp_prop = parent_component['parentComponent']['properties']
|
|
261
|
+
parent_comp_name = parent_comp_prop.get("name", None)
|
|
262
|
+
parent_comp_desc = parent_comp_prop.get("description", None)
|
|
263
|
+
parent_comp_md += f" {parent_comp_name}"
|
|
264
|
+
|
|
265
|
+
# Extract sub components
|
|
266
|
+
sub_comp_md = ""
|
|
267
|
+
sub_components = element.get('subComponents', None)
|
|
268
|
+
if sub_components:
|
|
269
|
+
for sub_component in sub_components:
|
|
270
|
+
sub_comp_prop = sub_component['properties']
|
|
271
|
+
sub_comp_name = sub_comp_prop.get("displayName", None)
|
|
272
|
+
sub_comp_desc = sub_comp_prop.get("description", None)
|
|
273
|
+
sub_comp_md += f" {sub_comp_name}"
|
|
274
|
+
|
|
275
|
+
comp_graph = element.get('mermaidGraph', None)
|
|
276
|
+
|
|
277
|
+
return {
|
|
278
|
+
'guid': guid, 'qualified_name': qualified_name, 'display_name': display_name, 'description': description,
|
|
279
|
+
'component_type': component_type, 'version': version, 'blueprints': blueprints_md,
|
|
280
|
+
'parent_components': parent_comp_md, 'sub_components': sub_comp_md,
|
|
281
|
+
'additional_properties': additional_props_md, 'extended_properties': extended_props_md,
|
|
282
|
+
'mermaid_graph': comp_graph
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
#
|
|
286
|
+
# Markdown output support
|
|
287
|
+
#
|
|
288
|
+
@dynamic_catch
|
|
289
|
+
async def _async_create_governance_definition(self, body: dict | NewElementRequestBody) -> str:
|
|
290
|
+
""" Create a governance definition. There are many kinds of governance definition and
|
|
291
|
+
while the overall body structure is the same, many will have different property
|
|
292
|
+
structures nested within them. A list is shown in the notes below.
|
|
293
|
+
|
|
294
|
+
It may be of type:
|
|
295
|
+
* BusinessImperative
|
|
296
|
+
* RegulationArticle
|
|
297
|
+
* Threat
|
|
298
|
+
* GovernancePrinciple
|
|
299
|
+
* GovernanceObligation
|
|
300
|
+
* GovernanceApproach
|
|
301
|
+
* GovernanceProcessingPurpose
|
|
302
|
+
The type is added to the "typeName" property.
|
|
303
|
+
|
|
304
|
+
Async Version.
|
|
305
|
+
|
|
306
|
+
Parameters
|
|
307
|
+
----------
|
|
308
|
+
body: dict
|
|
309
|
+
A dictionary containing the definition of the governance definition to create.
|
|
310
|
+
|
|
311
|
+
Returns
|
|
312
|
+
-------
|
|
313
|
+
|
|
314
|
+
str - guid of the definition created.
|
|
315
|
+
|
|
316
|
+
Raises
|
|
317
|
+
------
|
|
318
|
+
PyegeriaInvalidParameterException
|
|
319
|
+
one of the parameters is null or invalid or
|
|
320
|
+
PyegeriaAPIException
|
|
321
|
+
There is a problem adding the element properties to the metadata repository or
|
|
322
|
+
PyegeriaUnauthorizedException
|
|
323
|
+
the requesting user is not authorized to issue this request.
|
|
324
|
+
|
|
325
|
+
Notes
|
|
326
|
+
----
|
|
327
|
+
Governance definitions can be simple or anchored to a parent element - Both are shown below. depending on
|
|
328
|
+
which structure is used for the body.
|
|
329
|
+
|
|
330
|
+
Many kinds of governance definition have additional properties added. Details are described in the UML diagrams
|
|
331
|
+
on the website and summarized in the table below which shows the property class name and which types
|
|
332
|
+
of governance definitions use it. The test_governance_officer module offers some usage examples.
|
|
333
|
+
|
|
334
|
+
Property Class Name | Definition Types
|
|
335
|
+
===================================================================================
|
|
336
|
+
GovernanceDefinitionProperties | BusinessImperative, RegulationArticle, Threat, GovernanceProcessingPurpose,
|
|
337
|
+
| GovernancePrinciple, GovernanceObligation, GovernanceApproach
|
|
338
|
+
GovernanceStrategyProperties | GovernanceStrategy
|
|
339
|
+
RegulationProperties | Regulation
|
|
340
|
+
GovernanceControlProperties | GovernanceControl
|
|
341
|
+
SecurityGroupProperties | SecurityGroup
|
|
342
|
+
NamingStandardRuleProperties | NamingStandardRule
|
|
343
|
+
CertificationTypeProperties | CertificationType
|
|
344
|
+
LicenseTyoeProperties | LicenseType
|
|
345
|
+
GovernanceApproachProperties | GovernanceApproach
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
Generic simple governance body structure:
|
|
349
|
+
{
|
|
350
|
+
"class": "NewElementRequestBody",
|
|
351
|
+
"properties": {
|
|
352
|
+
"class" : "GovernanceDefinitionProperties",
|
|
353
|
+
"typeName" : "enter the type of the governance definition",
|
|
354
|
+
"domainIdentifier": 0,
|
|
355
|
+
"documentIdentifier": "add unique name here",
|
|
356
|
+
"title": "add short name here",
|
|
357
|
+
"summary": "add summary here",
|
|
358
|
+
"description": "add description here",
|
|
359
|
+
"scope": "add scope of effect for this definition",
|
|
360
|
+
"importance": "add importance for this definition",
|
|
361
|
+
"implications": [],
|
|
362
|
+
"outcomes": [],
|
|
363
|
+
"results": [],
|
|
364
|
+
"additionalProperties": {
|
|
365
|
+
"property1" : "propertyValue1",
|
|
366
|
+
"property2" : "propertyValue2"
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
"initialStatus": "DRAFT"
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
Generic governance Body structure with Parent:
|
|
373
|
+
{
|
|
374
|
+
"class" : "NewGovernanceDefinitionRequestBody",
|
|
375
|
+
"externalSourceGUID": "add guid here",
|
|
376
|
+
"externalSourceName": "add qualified name here",
|
|
377
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
378
|
+
"forLineage" : false,
|
|
379
|
+
"forDuplicateProcessing" : false,
|
|
380
|
+
"anchorGUID" : "add guid here",
|
|
381
|
+
"isOwnAnchor": false,
|
|
382
|
+
"parentGUID": "add guid here",
|
|
383
|
+
"parentRelationshipTypeName": "add type name here",
|
|
384
|
+
"parentRelationshipProperties": {
|
|
385
|
+
"class": "ElementProperties",
|
|
386
|
+
"propertyValueMap" : {
|
|
387
|
+
"description" : {
|
|
388
|
+
"class": "PrimitiveTypePropertyValue",
|
|
389
|
+
"typeName": "string",
|
|
390
|
+
"primitiveValue" : "New description"
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
"parentAtEnd1": false,
|
|
395
|
+
"properties": {
|
|
396
|
+
"class" : "GovernanceDefinitionProperties",
|
|
397
|
+
"typeName" : "enter the type of the governance definition",
|
|
398
|
+
"domainIdentifier": 0,
|
|
399
|
+
"documentIdentifier": "add unique name here",
|
|
400
|
+
"title": "add short name here",
|
|
401
|
+
"summary": "add summary here",
|
|
402
|
+
"description": "add description here",
|
|
403
|
+
"scope": "add scope of effect for this definition",
|
|
404
|
+
"importance": "add importance for this definition",
|
|
405
|
+
"implications": [],
|
|
406
|
+
"outcomes": [],
|
|
407
|
+
"results": [],
|
|
408
|
+
"additionalProperties": {
|
|
409
|
+
"property1" : "propertyValue1",
|
|
410
|
+
"property2" : "propertyValue2"
|
|
411
|
+
},
|
|
412
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
413
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
414
|
+
},
|
|
415
|
+
"initialStatus": "DRAFT"
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
"""
|
|
419
|
+
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
420
|
+
f"{self.url_marker}/governance-definitions")
|
|
421
|
+
return await self._async_create_element_body_request(url, GOV_DEF_PROPERTIES_LIST, body)
|
|
422
|
+
|
|
423
|
+
@dynamic_catch
|
|
424
|
+
def create_governance_definition(self, body: dict | NewElementRequestBody) -> str:
|
|
425
|
+
""" Create a governance definition. It may be of type:
|
|
426
|
+
* BusinessImperative
|
|
427
|
+
* RegulationArticle
|
|
428
|
+
* Threat
|
|
429
|
+
* GovernancePrinciple
|
|
430
|
+
* GovernanceObligation
|
|
431
|
+
* GovernanceApproach
|
|
432
|
+
* GovernanceProcessingPurpose
|
|
433
|
+
The type is added to the "typeName" property.
|
|
434
|
+
|
|
435
|
+
Parameters
|
|
436
|
+
----------
|
|
437
|
+
|
|
438
|
+
body: dict
|
|
439
|
+
A dictionary containing the definition of the governance definition to create.
|
|
440
|
+
|
|
441
|
+
Returns
|
|
442
|
+
-------
|
|
443
|
+
|
|
444
|
+
str - guid of the definition created.
|
|
445
|
+
|
|
446
|
+
Raises
|
|
447
|
+
------
|
|
448
|
+
PyegeriaInvalidParameterException
|
|
449
|
+
one of the parameters is null or invalid or
|
|
450
|
+
PyegeriaAPIException
|
|
451
|
+
There is a problem adding the element properties to the metadata repository or
|
|
452
|
+
PyegeriaUnauthorizedException
|
|
453
|
+
the requesting user is not authorized to issue this request.
|
|
454
|
+
|
|
455
|
+
Notes
|
|
456
|
+
----
|
|
457
|
+
Governance definitions can be simple or anchored to a parent element - Both are shown below. depending on
|
|
458
|
+
which structure is used for the body.
|
|
459
|
+
|
|
460
|
+
Many kinds of governance definition have additional properties added. Details are described in the UML diagrams
|
|
461
|
+
on the website and summarized in the table below which shows the property class name and which types
|
|
462
|
+
of governance definitions use it. The test_governance_officer module offers some usage examples.
|
|
463
|
+
|
|
464
|
+
Property Class Name | Definition Types
|
|
465
|
+
===================================================================================
|
|
466
|
+
GovernanceDefinitionProperties | BusinessImperative, RegulationArticle, Threat, GovernanceProcessingPurpose,
|
|
467
|
+
| GovernancePrinciple, GovernanceObligation, GovernanceApproach
|
|
468
|
+
GovernanceStrategyProperties | GovernanceStrategy
|
|
469
|
+
RegulationProperties | Regulation
|
|
470
|
+
GovernanceControlProperties | GovernanceControl
|
|
471
|
+
SecurityGroupProperties | SecurityGroup
|
|
472
|
+
NamingStandardRuleProperties | NamingStandardRule
|
|
473
|
+
CertificationTypeProperties | CertificationType
|
|
474
|
+
LicenseTyoeProperties | LicenseType
|
|
475
|
+
GovernanceApproachProperties | GovernanceApproach
|
|
476
|
+
|
|
477
|
+
Simple body structure:
|
|
478
|
+
{
|
|
479
|
+
"class": "NewElementRequestBody",
|
|
480
|
+
"properties": {
|
|
481
|
+
"class" : "GovernanceDefinitionProperties",
|
|
482
|
+
"typeName" : "enter the type of the governance definition",
|
|
483
|
+
"domainIdentifier": 0,
|
|
484
|
+
"documentIdentifier": "add unique name here",
|
|
485
|
+
"title": "add short name here",
|
|
486
|
+
"summary": "add summary here",
|
|
487
|
+
"description": "add description here",
|
|
488
|
+
"scope": "add scope of effect for this definition",
|
|
489
|
+
"importance": "add importance for this definition",
|
|
490
|
+
"implications": [],
|
|
491
|
+
"outcomes": [],
|
|
492
|
+
"results": [],
|
|
493
|
+
"additionalProperties": {
|
|
494
|
+
"property1" : "propertyValue1",
|
|
495
|
+
"property2" : "propertyValue2"
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
"initialStatus": "DRAFT"
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
Body structure with Parent:
|
|
502
|
+
{
|
|
503
|
+
"class" : "NewGovernanceDefinitionRequestBody",
|
|
504
|
+
"externalSourceGUID": "add guid here",
|
|
505
|
+
"externalSourceName": "add qualified name here",
|
|
506
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
507
|
+
"forLineage" : false,
|
|
508
|
+
"forDuplicateProcessing" : false,
|
|
509
|
+
"anchorGUID" : "add guid here",
|
|
510
|
+
"isOwnAnchor": false,
|
|
511
|
+
"parentGUID": "add guid here",
|
|
512
|
+
"parentRelationshipTypeName": "add type name here",
|
|
513
|
+
"parentRelationshipProperties": {
|
|
514
|
+
"class": "ElementProperties",
|
|
515
|
+
"propertyValueMap" : {
|
|
516
|
+
"description" : {
|
|
517
|
+
"class": "PrimitiveTypePropertyValue",
|
|
518
|
+
"typeName": "string",
|
|
519
|
+
"primitiveValue" : "New description"
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
"parentAtEnd1": false,
|
|
524
|
+
"properties": {
|
|
525
|
+
"class" : "GovernanceDefinitionProperties",
|
|
526
|
+
"typeName" : "enter the type of the governance definition",
|
|
527
|
+
"domainIdentifier": 0,
|
|
528
|
+
"documentIdentifier": "add unique name here",
|
|
529
|
+
"title": "add short name here",
|
|
530
|
+
"summary": "add summary here",
|
|
531
|
+
"description": "add description here",
|
|
532
|
+
"scope": "add scope of effect for this definition",
|
|
533
|
+
"importance": "add importance for this definition",
|
|
534
|
+
"implications": [],
|
|
535
|
+
"outcomes": [],
|
|
536
|
+
"results": [],
|
|
537
|
+
"additionalProperties": {
|
|
538
|
+
"property1" : "propertyValue1",
|
|
539
|
+
"property2" : "propertyValue2"
|
|
540
|
+
},
|
|
541
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
542
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
543
|
+
},
|
|
544
|
+
"initialStatus": "DRAFT"
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
"""
|
|
549
|
+
|
|
550
|
+
loop = asyncio.get_event_loop()
|
|
551
|
+
response = loop.run_until_complete(self._async_create_governance_definition(body))
|
|
552
|
+
return response
|
|
553
|
+
|
|
554
|
+
@dynamic_catch
|
|
555
|
+
async def _async_create_governance_definition_from_template(self, body: dict | TemplateRequestBody) -> str:
|
|
556
|
+
""" Create a new metadata element to represent a governance definition using an existing metadata element
|
|
557
|
+
as a template. The template defines additional classifications and relationships that should be added to
|
|
558
|
+
the new element. Async version.
|
|
559
|
+
|
|
560
|
+
Parameters
|
|
561
|
+
----------
|
|
562
|
+
|
|
563
|
+
body: dict
|
|
564
|
+
A dictionary containing the definition of the governance definition to create.
|
|
565
|
+
|
|
566
|
+
Returns
|
|
567
|
+
-------
|
|
568
|
+
|
|
569
|
+
str - guid of the governance definition created.
|
|
570
|
+
|
|
571
|
+
Raises
|
|
572
|
+
------
|
|
573
|
+
PyegeriaInvalidParameterException
|
|
574
|
+
one of the parameters is null or invalid or
|
|
575
|
+
PyegeriaAPIException
|
|
576
|
+
There is a problem adding the element properties to the metadata repository or
|
|
577
|
+
PyegeriaUnauthorizedException
|
|
578
|
+
the requesting user is not authorized to issue this request.
|
|
579
|
+
|
|
580
|
+
Notes
|
|
581
|
+
----
|
|
582
|
+
https://egeria-project.org/concepts/governance-definition
|
|
583
|
+
|
|
584
|
+
Body structure:
|
|
585
|
+
|
|
586
|
+
{
|
|
587
|
+
"class" : "TemplateRequestBody",
|
|
588
|
+
"externalSourceGUID": "add guid here",
|
|
589
|
+
"externalSourceName": "add qualified name here",
|
|
590
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
591
|
+
"forLineage" : false,
|
|
592
|
+
"forDuplicateProcessing" : false,
|
|
593
|
+
"anchorGUID" : "add guid here",
|
|
594
|
+
"isOwnAnchor": false,
|
|
595
|
+
"parentGUID": "add guid here",
|
|
596
|
+
"parentRelationshipTypeName": "add type name here",
|
|
597
|
+
"parentRelationshipProperties": {
|
|
598
|
+
"class": "ElementProperties",
|
|
599
|
+
"propertyValueMap" : {
|
|
600
|
+
"description" : {
|
|
601
|
+
"class": "PrimitiveTypePropertyValue",
|
|
602
|
+
"typeName": "string",
|
|
603
|
+
"primitiveValue" : "New description"
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
"parentAtEnd1": false,
|
|
608
|
+
"templateGUID": "add guid here",
|
|
609
|
+
"replacementProperties": {
|
|
610
|
+
"class": "ElementProperties",
|
|
611
|
+
"propertyValueMap" : {
|
|
612
|
+
"description" : {
|
|
613
|
+
"class": "PrimitiveTypePropertyValue",
|
|
614
|
+
"typeName": "string",
|
|
615
|
+
"primitiveValue" : "New description"
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
"placeholderPropertyValues": {
|
|
620
|
+
"placeholder1" : "propertyValue1",
|
|
621
|
+
"placeholder2" : "propertyValue2"
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
"""
|
|
626
|
+
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
627
|
+
f"{self.url_marker}/governance-definitions/from-template")
|
|
628
|
+
|
|
629
|
+
if isinstance(body, TemplateRequestBody):
|
|
630
|
+
validated_body = body
|
|
631
|
+
elif isinstance(body, dict):
|
|
632
|
+
validated_body = self._template_request_adapter.validate_python(body)
|
|
633
|
+
else:
|
|
634
|
+
raise PyegeriaInvalidParameterException(
|
|
635
|
+
additional_info={"reason": "body must be a dict or TemplateRequestBody"})
|
|
636
|
+
|
|
637
|
+
json_body = validated_body.model_dump_json(indent=2, exclude_none=True)
|
|
638
|
+
logger.info(json_body)
|
|
639
|
+
resp = await self._async_make_request("POST", url, json_body, is_json=True)
|
|
640
|
+
logger.info(f"Created governance definition from template with GUID: {resp.json().get('guid')}")
|
|
641
|
+
return resp.json().get("guid", NO_GUID_RETURNED)
|
|
642
|
+
|
|
643
|
+
@dynamic_catch
|
|
644
|
+
def create_governance_definition_from_template(self, body: dict | TemplateRequestBody) -> str:
|
|
645
|
+
""" Create a new metadata element to represent a governance definition using an existing metadata element
|
|
646
|
+
as a template. The template defines additional classifications and relationships that should be added to
|
|
647
|
+
the new element.
|
|
648
|
+
|
|
649
|
+
Parameters
|
|
650
|
+
----------
|
|
651
|
+
|
|
652
|
+
body: dict
|
|
653
|
+
A dictionary containing the definition of the governance definition to create.
|
|
654
|
+
|
|
655
|
+
Returns
|
|
656
|
+
-------
|
|
657
|
+
|
|
658
|
+
str - guid of the governance definition created.
|
|
659
|
+
|
|
660
|
+
Raises
|
|
661
|
+
------
|
|
662
|
+
PyegeriaInvalidParameterException
|
|
663
|
+
one of the parameters is null or invalid or
|
|
664
|
+
PyegeriaAPIException
|
|
665
|
+
There is a problem adding the element properties to the metadata repository or
|
|
666
|
+
PyegeriaUnauthorizedException
|
|
667
|
+
the requesting user is not authorized to issue this request.
|
|
668
|
+
|
|
669
|
+
Notes
|
|
670
|
+
----
|
|
671
|
+
https://egeria-project.org/concepts/governance-definition
|
|
672
|
+
|
|
673
|
+
Body structure:
|
|
674
|
+
|
|
675
|
+
{
|
|
676
|
+
"class" : "TemplateRequestBody",
|
|
677
|
+
"externalSourceGUID": "add guid here",
|
|
678
|
+
"externalSourceName": "add qualified name here",
|
|
679
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
680
|
+
"forLineage" : false,
|
|
681
|
+
"forDuplicateProcessing" : false,
|
|
682
|
+
"anchorGUID" : "add guid here",
|
|
683
|
+
"isOwnAnchor": false,
|
|
684
|
+
"parentGUID": "add guid here",
|
|
685
|
+
"parentRelationshipTypeName": "add type name here",
|
|
686
|
+
"parentRelationshipProperties": {
|
|
687
|
+
"class": "ElementProperties",
|
|
688
|
+
"propertyValueMap" : {
|
|
689
|
+
"description" : {
|
|
690
|
+
"class": "PrimitiveTypePropertyValue",
|
|
691
|
+
"typeName": "string",
|
|
692
|
+
"primitiveValue" : "New description"
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
"parentAtEnd1": false,
|
|
697
|
+
"templateGUID": "add guid here",
|
|
698
|
+
"replacementProperties": {
|
|
699
|
+
"class": "ElementProperties",
|
|
700
|
+
"propertyValueMap" : {
|
|
701
|
+
"description" : {
|
|
702
|
+
"class": "PrimitiveTypePropertyValue",
|
|
703
|
+
"typeName": "string",
|
|
704
|
+
"primitiveValue" : "New description"
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
"placeholderPropertyValues": {
|
|
709
|
+
"placeholder1" : "propertyValue1",
|
|
710
|
+
"placeholder2" : "propertyValue2"
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
"""
|
|
715
|
+
|
|
716
|
+
loop = asyncio.get_event_loop()
|
|
717
|
+
response = loop.run_until_complete(self._async_create_governance_definition_from_template(body))
|
|
718
|
+
return response
|
|
719
|
+
|
|
720
|
+
@dynamic_catch
|
|
721
|
+
async def _async_update_governance_definition(self, guid: str, body: dict | UpdateElementRequestBody) -> None:
|
|
722
|
+
""" Update the properties of a governance definition. Async Version.
|
|
723
|
+
|
|
724
|
+
Parameters
|
|
725
|
+
----------
|
|
726
|
+
guid: str
|
|
727
|
+
guid of the governance definition to update.
|
|
728
|
+
body: dict
|
|
729
|
+
A dictionary containing the updates to the governance definition.
|
|
730
|
+
replace_all_properties: bool, optional
|
|
731
|
+
Whether to replace all properties with those provided in the body or to merge with existing properties.
|
|
732
|
+
|
|
733
|
+
Returns
|
|
734
|
+
-------
|
|
735
|
+
|
|
736
|
+
None
|
|
737
|
+
|
|
738
|
+
Raises
|
|
739
|
+
------
|
|
740
|
+
PyegeriaInvalidParameterException
|
|
741
|
+
one of the parameters is null or invalid or
|
|
742
|
+
PyegeriaAPIException
|
|
743
|
+
There is a problem adding the element properties to the metadata repository or
|
|
744
|
+
PyegeriaUnauthorizedException
|
|
745
|
+
the requesting user is not authorized to issue this request.
|
|
746
|
+
|
|
747
|
+
Notes
|
|
748
|
+
----
|
|
749
|
+
|
|
750
|
+
Body structure:
|
|
751
|
+
{
|
|
752
|
+
"class" : "UpdateElementRequestBody",
|
|
753
|
+
"externalSourceGUID": "add guid here",
|
|
754
|
+
"externalSourceName": "add qualified name here",
|
|
755
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
756
|
+
"forLineage" : false,
|
|
757
|
+
"forDuplicateProcessing" : false,
|
|
758
|
+
"properties": {
|
|
759
|
+
"class" : "GovernanceDefinitionProperties",
|
|
760
|
+
"typeName" : "Add type name here",
|
|
761
|
+
"qualifiedName": "add unique name here",
|
|
762
|
+
"displayName": "add short name here",
|
|
763
|
+
"description": "add description here",
|
|
764
|
+
"namespace": "add namespace for this structure",
|
|
765
|
+
"versionIdentifier": "add version for this structure",
|
|
766
|
+
"additionalProperties": {
|
|
767
|
+
"property1" : "propertyValue1",
|
|
768
|
+
"property2" : "propertyValue2"
|
|
769
|
+
},
|
|
770
|
+
"extendedProperties": {
|
|
771
|
+
"property1" : "propertyValue1",
|
|
772
|
+
"property2" : "propertyValue2"
|
|
773
|
+
},
|
|
774
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
775
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
"""
|
|
779
|
+
|
|
780
|
+
url = (
|
|
781
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
782
|
+
f"{self.url_marker}/governance-definitions/"
|
|
783
|
+
f"{guid}/update")
|
|
784
|
+
await self._async_update_element_body_request(url, GOV_DEF_PROPERTIES_LIST, body)
|
|
785
|
+
|
|
786
|
+
def update_governance_definition(self, guid: str, body: dict | UpdateElementRequestBody) -> None:
|
|
787
|
+
""" Update the properties of a governance definition.
|
|
788
|
+
|
|
789
|
+
Parameters
|
|
790
|
+
----------
|
|
791
|
+
guid: str
|
|
792
|
+
guid of the governance definition to update.
|
|
793
|
+
body: dict
|
|
794
|
+
A dictionary containing the updates to the governance definition.
|
|
795
|
+
replace_all_properties: bool, optional
|
|
796
|
+
Whether to replace all properties with those provided in the body or to merge with existing properties.
|
|
797
|
+
|
|
798
|
+
Returns
|
|
799
|
+
-------
|
|
800
|
+
|
|
801
|
+
None
|
|
802
|
+
|
|
803
|
+
Raises
|
|
804
|
+
------
|
|
805
|
+
PyegeriaInvalidParameterException
|
|
806
|
+
one of the parameters is null or invalid or
|
|
807
|
+
PyegeriaAPIException
|
|
808
|
+
There is a problem adding the element properties to the metadata repository or
|
|
809
|
+
PyegeriaUnauthorizedException
|
|
810
|
+
the requesting user is not authorized to issue this request.
|
|
811
|
+
|
|
812
|
+
Notes
|
|
813
|
+
----
|
|
814
|
+
|
|
815
|
+
Body structure:
|
|
816
|
+
{
|
|
817
|
+
"class" : "UpdateElementRequestBody",
|
|
818
|
+
"externalSourceGUID": "add guid here",
|
|
819
|
+
"externalSourceName": "add qualified name here",
|
|
820
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
821
|
+
"forLineage" : false,
|
|
822
|
+
"forDuplicateProcessing" : false,
|
|
823
|
+
"properties": {
|
|
824
|
+
"class" : "GovernanceDefinitionProperties",
|
|
825
|
+
"typeName" : "Add type name here",
|
|
826
|
+
"qualifiedName": "add unique name here",
|
|
827
|
+
"displayName": "add short name here",
|
|
828
|
+
"description": "add description here",
|
|
829
|
+
"namespace": "add namespace for this structure",
|
|
830
|
+
"versionIdentifier": "add version for this structure",
|
|
831
|
+
"additionalProperties": {
|
|
832
|
+
"property1" : "propertyValue1",
|
|
833
|
+
"property2" : "propertyValue2"
|
|
834
|
+
},
|
|
835
|
+
"extendedProperties": {
|
|
836
|
+
"property1" : "propertyValue1",
|
|
837
|
+
"property2" : "propertyValue2"
|
|
838
|
+
},
|
|
839
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
840
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
"""
|
|
844
|
+
loop = asyncio.get_event_loop()
|
|
845
|
+
loop.run_until_complete(self._async_update_governance_definition(guid, body))
|
|
846
|
+
|
|
847
|
+
@dynamic_catch
|
|
848
|
+
async def _async_delete_governance_definition(self, definition_guid: str,
|
|
849
|
+
body: Optional[dict | DeleteElementRequestBody] = None,
|
|
850
|
+
cascade: bool = False) -> None:
|
|
851
|
+
""" Delete a governance definition. Async Version.
|
|
852
|
+
|
|
853
|
+
Parameters
|
|
854
|
+
----------
|
|
855
|
+
definition_guid: str
|
|
856
|
+
The guid of the governance definition to delete.
|
|
857
|
+
|
|
858
|
+
cascade: bool, optional, defaults to True
|
|
859
|
+
If true, a cascade delete is performed.
|
|
860
|
+
|
|
861
|
+
body: dict DeleteElementRequestBodyt, optional, default = None
|
|
862
|
+
A dict representing the details of the relationship.
|
|
863
|
+
|
|
864
|
+
Returns
|
|
865
|
+
-------
|
|
866
|
+
Nothing
|
|
867
|
+
|
|
868
|
+
Raises
|
|
869
|
+
------
|
|
870
|
+
PyegeriaInvalidParameterException
|
|
871
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
|
872
|
+
ValidationException
|
|
873
|
+
Raised by pydantic when the request body is invalid.
|
|
874
|
+
NotAuthorizedException
|
|
875
|
+
The principle specified by the user_id does not have authorization for the requested action
|
|
876
|
+
|
|
877
|
+
Notes
|
|
878
|
+
_____
|
|
879
|
+
JSON Structure looks like:
|
|
880
|
+
{
|
|
881
|
+
"class" : "MetadataSourceRequestBody",
|
|
882
|
+
"externalSourceGUID": "add guid here",
|
|
883
|
+
"externalSourceName": "add qualified name here",
|
|
884
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
885
|
+
"forLineage" : false,
|
|
886
|
+
"forDuplicateProcessing" : false
|
|
887
|
+
}
|
|
888
|
+
"""
|
|
889
|
+
url = (
|
|
890
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/governance-officer/governance-definitions/"
|
|
891
|
+
f"{definition_guid}/delete")
|
|
892
|
+
await self._async_delete_element_request(url, body, cascade)
|
|
893
|
+
logger.info(f"Deleted collection {definition_guid} with cascade {cascade}")
|
|
894
|
+
|
|
895
|
+
def delete_governance_definition(self, definition_guid: str, body: Optional[dict | DeleteElementRequestBody] = None,
|
|
896
|
+
cascade: bool = False) -> None:
|
|
897
|
+
"""Delete a governance definition.
|
|
898
|
+
|
|
899
|
+
Parameters
|
|
900
|
+
----------
|
|
901
|
+
definition_guid: str
|
|
902
|
+
The guid of the governance definition to delete.
|
|
903
|
+
|
|
904
|
+
cascade: bool, optional, defaults to True
|
|
905
|
+
If true, a cascade delete is performed.
|
|
906
|
+
|
|
907
|
+
body: dict DeleteElementRequestBodyt, optional, default = None
|
|
908
|
+
A dict representing the details of the relationship.
|
|
909
|
+
|
|
910
|
+
Returns
|
|
911
|
+
-------
|
|
912
|
+
Nothing
|
|
913
|
+
|
|
914
|
+
Raises
|
|
915
|
+
------
|
|
916
|
+
PyegeriaInvalidParameterException
|
|
917
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
|
918
|
+
ValidationException
|
|
919
|
+
Raised by pydantic when the request body is invalid.
|
|
920
|
+
NotAuthorizedException
|
|
921
|
+
The principle specified by the user_id does not have authorization for the requested action
|
|
922
|
+
|
|
923
|
+
Notes
|
|
924
|
+
_____
|
|
925
|
+
JSON Structure looks like:
|
|
926
|
+
{
|
|
927
|
+
"class" : "MetadataSourceRequestBody",
|
|
928
|
+
"externalSourceGUID": "add guid here",
|
|
929
|
+
"externalSourceName": "add qualified name here",
|
|
930
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
931
|
+
"forLineage" : false,
|
|
932
|
+
"forDuplicateProcessing" : false
|
|
933
|
+
}
|
|
934
|
+
"""
|
|
935
|
+
loop = asyncio.get_event_loop()
|
|
936
|
+
loop.run_until_complete(self._async_delete_governance_definition(definition_guid, body, cascade))
|
|
937
|
+
|
|
938
|
+
@dynamic_catch
|
|
939
|
+
async def _async_link_peer_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
|
|
940
|
+
body: dict = None | NewRelationshipRequestBody) -> None:
|
|
941
|
+
""" Attach two peer governance definitions. Request body is optional. Async Version.
|
|
942
|
+
|
|
943
|
+
Parameters
|
|
944
|
+
----------
|
|
945
|
+
definition_guid1: str
|
|
946
|
+
guid of the first governance definition to link.
|
|
947
|
+
definition_guid2: str
|
|
948
|
+
guid of the second governance definition to link.
|
|
949
|
+
relationship_type: str
|
|
950
|
+
Relationship type name linking the governance definitions..
|
|
951
|
+
body: dict
|
|
952
|
+
The body describing the link between the two segments.
|
|
953
|
+
|
|
954
|
+
Returns
|
|
955
|
+
-------
|
|
956
|
+
None
|
|
957
|
+
|
|
958
|
+
Raises
|
|
959
|
+
------
|
|
960
|
+
PyegeriaInvalidParameterException
|
|
961
|
+
one of the parameters is null or invalid or
|
|
962
|
+
PyegeriaAPIException
|
|
963
|
+
There is a problem adding the element properties to the metadata repository or
|
|
964
|
+
PyegeriaUnauthorizedException
|
|
965
|
+
the requesting user is not authorized to issue this request.
|
|
966
|
+
|
|
967
|
+
Notes
|
|
968
|
+
----
|
|
969
|
+
The relationshipTypeNme can be:
|
|
970
|
+
* GovernanceDriverLink between governance drivers (GovernanceStrategy, BusinessImperative, Regulation,
|
|
971
|
+
RegulationArticle, Threat).
|
|
972
|
+
* GovernancePolicyLink between governance policies (GovernancePrinciple, GovernanceObligation,
|
|
973
|
+
GovernanceApproach).
|
|
974
|
+
* GovernanceControlLink between governance controls (GovernanceRule, GovernanceProcess,
|
|
975
|
+
GovernanceResponsibility, GovernanceProcedure, SecurityAccessControl, SecurityGroup).
|
|
976
|
+
|
|
977
|
+
Body structure:
|
|
978
|
+
{
|
|
979
|
+
"class" : "RelationshipRequestBody",
|
|
980
|
+
"externalSourceGUID": "add guid here",
|
|
981
|
+
"externalSourceName": "add qualified name here",
|
|
982
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
983
|
+
"forLineage" : false,
|
|
984
|
+
"forDuplicateProcessing" : false,
|
|
985
|
+
"properties": {
|
|
986
|
+
"class": "PeerDefinitionProperties",
|
|
987
|
+
"description": "",
|
|
988
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
989
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
"""
|
|
993
|
+
url = (
|
|
994
|
+
f"{self.platform_url}/s"
|
|
995
|
+
f"ervers/{self.view_server}/api/open-metadata/governance-officer/governance-definitions/"
|
|
996
|
+
f"{definition_guid1}/peer-definitions/{relationship_type}/{definition_guid2}/attach")
|
|
997
|
+
|
|
998
|
+
await self._async_new_relationship_request(url, "PeerDefinitionProperties", body)
|
|
999
|
+
logger.info(f"Linked {definition_guid1} -> {definition_guid2}")
|
|
1000
|
+
|
|
1001
|
+
@dynamic_catch
|
|
1002
|
+
def link_peer_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
|
|
1003
|
+
body: Optional[dict | NewElementRequestBody] = None) -> None:
|
|
1004
|
+
""" Attach two peer governance definitions. Async Version.
|
|
1005
|
+
|
|
1006
|
+
Parameters
|
|
1007
|
+
----------
|
|
1008
|
+
definition_guid1: str
|
|
1009
|
+
guid of the first governance definition to link.
|
|
1010
|
+
definition_guid2: str
|
|
1011
|
+
guid of the second governance definition to link.
|
|
1012
|
+
relationship_type: str
|
|
1013
|
+
Relationship type name linking the governance definitions..
|
|
1014
|
+
body: dict
|
|
1015
|
+
The body describing the link between the two segments.
|
|
1016
|
+
|
|
1017
|
+
Returns
|
|
1018
|
+
-------
|
|
1019
|
+
None
|
|
1020
|
+
|
|
1021
|
+
Raises
|
|
1022
|
+
------
|
|
1023
|
+
PyegeriaInvalidParameterException
|
|
1024
|
+
one of the parameters is null or invalid or
|
|
1025
|
+
PyegeriaAPIException
|
|
1026
|
+
There is a problem adding the element properties to the metadata repository or
|
|
1027
|
+
PyegeriaUnauthorizedException
|
|
1028
|
+
the requesting user is not authorized to issue this request.
|
|
1029
|
+
|
|
1030
|
+
Notes
|
|
1031
|
+
----
|
|
1032
|
+
The relationshipTypeNme can be:
|
|
1033
|
+
* GovernanceDriverLink between governance drivers (GovernanceStrategy, BusinessImperitive, Regulation,
|
|
1034
|
+
RegulationArticle, Threat).
|
|
1035
|
+
* GovernancePolicyLink between governance policies (GovernancePrinciple, GovernanceObligation,
|
|
1036
|
+
GovernanceApproach).
|
|
1037
|
+
* GovernanceControlLink between governance controls (GovernanceRule, GovernanceProcess,
|
|
1038
|
+
GovernanceResponsibility, GovernanceProcedure, SecurityAccessControl, SecurityGroup).
|
|
1039
|
+
|
|
1040
|
+
Body structure:
|
|
1041
|
+
{
|
|
1042
|
+
"class" : "RelationshipRequestBody",
|
|
1043
|
+
"externalSourceGUID": "add guid here",
|
|
1044
|
+
"externalSourceName": "add qualified name here",
|
|
1045
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
1046
|
+
"forLineage" : false,
|
|
1047
|
+
"forDuplicateProcessing" : false,
|
|
1048
|
+
"properties": {
|
|
1049
|
+
"class": "PeerDefinitionProperties",
|
|
1050
|
+
"description": "",
|
|
1051
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
1052
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
"""
|
|
1056
|
+
loop = asyncio.get_event_loop()
|
|
1057
|
+
loop.run_until_complete(
|
|
1058
|
+
self._async_link_peer_definitions(definition_guid1, relationship_type, definition_guid2, body))
|
|
1059
|
+
|
|
1060
|
+
@dynamic_catch
|
|
1061
|
+
async def _async_detach_peer_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
|
|
1062
|
+
body: Optional[dict | DeleteRelationshipRequestBody] = None) -> None:
|
|
1063
|
+
""" Detach two peer governance definitions. Request body is optional. Async Version.
|
|
1064
|
+
|
|
1065
|
+
Parameters
|
|
1066
|
+
----------
|
|
1067
|
+
definition_guid1: str
|
|
1068
|
+
guid of the first governance definition to link.
|
|
1069
|
+
definition_guid2: str
|
|
1070
|
+
guid of the second governance definition to link.
|
|
1071
|
+
relationship_type: str
|
|
1072
|
+
Relationship type name linking the governance definitions..
|
|
1073
|
+
body: dict, optional
|
|
1074
|
+
The body describing the link between the two segments.
|
|
1075
|
+
|
|
1076
|
+
Returns
|
|
1077
|
+
-------
|
|
1078
|
+
None
|
|
1079
|
+
|
|
1080
|
+
Raises
|
|
1081
|
+
------
|
|
1082
|
+
PyegeriaInvalidParameterException
|
|
1083
|
+
one of the parameters is null or invalid or
|
|
1084
|
+
PyegeriaAPIException
|
|
1085
|
+
There is a problem adding the element properties to the metadata repository or
|
|
1086
|
+
PyegeriaUnauthorizedException
|
|
1087
|
+
the requesting user is not authorized to issue this request.
|
|
1088
|
+
|
|
1089
|
+
Notes
|
|
1090
|
+
----
|
|
1091
|
+
|
|
1092
|
+
Body structure:
|
|
1093
|
+
|
|
1094
|
+
{
|
|
1095
|
+
"class": "MetadataSourceRequestBody",
|
|
1096
|
+
"externalSourceGUID": "add guid here",
|
|
1097
|
+
"externalSourceName": "add qualified name here",
|
|
1098
|
+
"effectiveTime": "{{$isoTimestamp}}",
|
|
1099
|
+
"forLineage": false,
|
|
1100
|
+
"forDuplicateProcessing": false
|
|
1101
|
+
}
|
|
1102
|
+
"""
|
|
1103
|
+
url = (
|
|
1104
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
1105
|
+
f"{self.url_marker}/governance-definitions/"
|
|
1106
|
+
f"{definition_guid1}/peer-definitions/{relationship_type}/{definition_guid2}/detach")
|
|
1107
|
+
await self._async_delete_relationship_request(url, body)
|
|
1108
|
+
logger.info(f"Detached peer definitions: {definition_guid1} -> {definition_guid2}")
|
|
1109
|
+
|
|
1110
|
+
@dynamic_catch
|
|
1111
|
+
def detach_peer_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
|
|
1112
|
+
body: dict = None | DeleteRelationshipRequestBody) -> None:
|
|
1113
|
+
""" Detach two peer governance definitions. Request body is optional.
|
|
1114
|
+
|
|
1115
|
+
Parameters
|
|
1116
|
+
----------
|
|
1117
|
+
definition_guid1: str
|
|
1118
|
+
guid of the first governance definition to link.
|
|
1119
|
+
definition_guid2: str
|
|
1120
|
+
guid of the second governance definition to link.
|
|
1121
|
+
relationship_type: str
|
|
1122
|
+
Relationship type name linking the governance definitions..
|
|
1123
|
+
body: dict, optional
|
|
1124
|
+
The body describing the link between the two segments.
|
|
1125
|
+
|
|
1126
|
+
Returns
|
|
1127
|
+
-------
|
|
1128
|
+
None
|
|
1129
|
+
|
|
1130
|
+
Raises
|
|
1131
|
+
------
|
|
1132
|
+
PyegeriaInvalidParameterException
|
|
1133
|
+
one of the parameters is null or invalid or
|
|
1134
|
+
PyegeriaAPIException
|
|
1135
|
+
There is a problem adding the element properties to the metadata repository or
|
|
1136
|
+
PyegeriaUnauthorizedException
|
|
1137
|
+
the requesting user is not authorized to issue this request.
|
|
1138
|
+
|
|
1139
|
+
Notes
|
|
1140
|
+
----
|
|
1141
|
+
|
|
1142
|
+
Body structure:
|
|
1143
|
+
|
|
1144
|
+
{
|
|
1145
|
+
"class": "MetadataSourceRequestBody",
|
|
1146
|
+
"externalSourceGUID": "add guid here",
|
|
1147
|
+
"externalSourceName": "add qualified name here",
|
|
1148
|
+
"effectiveTime": "{{$isoTimestamp}}",
|
|
1149
|
+
"forLineage": false,
|
|
1150
|
+
"forDuplicateProcessing": false
|
|
1151
|
+
}
|
|
1152
|
+
"""
|
|
1153
|
+
loop = asyncio.get_event_loop()
|
|
1154
|
+
loop.run_until_complete(
|
|
1155
|
+
self._async_detach_peer_definitions(definition_guid1, relationship_type, definition_guid2, body))
|
|
1156
|
+
|
|
1157
|
+
@dynamic_catch
|
|
1158
|
+
async def _async_attach_supporting_definitions(self, definition_guid1: str, relationship_type: str,
|
|
1159
|
+
definition_guid2: str,
|
|
1160
|
+
body: Optional[dict | NewRelationshipRequestBody] = None) -> None:
|
|
1161
|
+
""" Attach a supporting governance definition. Request body is optional.
|
|
1162
|
+
The relationshipTypeNme can be:
|
|
1163
|
+
* GovernanceResponse between governance drivers (GovernanceStrategy, BusinessImperative, Regulation,
|
|
1164
|
+
RegulationArticle, Threat) and governance policies (GovernancePrinciple, GovernanceObligation,
|
|
1165
|
+
GovernanceApproach).
|
|
1166
|
+
* GovernanceImplementation between governance policies (GovernancePrinciple, GovernanceObligation,
|
|
1167
|
+
GovernanceApproach) and governance controls (GovernanceRule, GovernanceProcess, GovernanceResponsibility,
|
|
1168
|
+
GovernanceProcedure, SecurityAccessControl, SecurityGroup).
|
|
1169
|
+
|
|
1170
|
+
Async Version.
|
|
1171
|
+
|
|
1172
|
+
Parameters
|
|
1173
|
+
----------
|
|
1174
|
+
definition_guid1: str
|
|
1175
|
+
guid of the first governance definition to link.
|
|
1176
|
+
definition_guid2: str
|
|
1177
|
+
guid of the second governance definition to link.
|
|
1178
|
+
relationship_type: str
|
|
1179
|
+
Relationship type name linking the governance definitions..
|
|
1180
|
+
body: dict
|
|
1181
|
+
The body describing the link between the two segments.
|
|
1182
|
+
|
|
1183
|
+
Returns
|
|
1184
|
+
-------
|
|
1185
|
+
None
|
|
1186
|
+
|
|
1187
|
+
Raises
|
|
1188
|
+
------
|
|
1189
|
+
PyegeriaInvalidParameterException
|
|
1190
|
+
one of the parameters is null or invalid or
|
|
1191
|
+
PyegeriaAPIException
|
|
1192
|
+
There is a problem adding the element properties to the metadata repository or
|
|
1193
|
+
PyegeriaUnauthorizedException
|
|
1194
|
+
the requesting user is not authorized to issue this request.
|
|
1195
|
+
|
|
1196
|
+
Notes
|
|
1197
|
+
----
|
|
1198
|
+
|
|
1199
|
+
Body structure:
|
|
1200
|
+
{
|
|
1201
|
+
"class" : "RelationshipRequestBody",
|
|
1202
|
+
"externalSourceGUID": "add guid here",
|
|
1203
|
+
"externalSourceName": "add qualified name here",
|
|
1204
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
1205
|
+
"forLineage" : false,
|
|
1206
|
+
"forDuplicateProcessing" : false,
|
|
1207
|
+
"properties": {
|
|
1208
|
+
"class": "SupportingDefinitionProperties",
|
|
1209
|
+
"rationale": "",
|
|
1210
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
1211
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
"""
|
|
1215
|
+
url = (
|
|
1216
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
1217
|
+
f"{self.url_marker}/governance-definitions/"
|
|
1218
|
+
f"{definition_guid1}/supporting-definitions/{relationship_type}/{definition_guid2}/attach")
|
|
1219
|
+
await self._async_new_relationship_request(url, "SupportingDefinitionProperties", body)
|
|
1220
|
+
logger.info(f"Linked {definition_guid1} -> {definition_guid2}")
|
|
1221
|
+
|
|
1222
|
+
@dynamic_catch
|
|
1223
|
+
def attach_supporting_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
|
|
1224
|
+
body: Optional[dict | NewRelationshipRequestBody] = None) -> None:
|
|
1225
|
+
""" Attach a supporting governance definition. Request body is optional.
|
|
1226
|
+
The relationshipTypeNme can be:
|
|
1227
|
+
* GovernanceResponse between governance drivers (GovernanceStrategy, BusinessImperative, Regulation,
|
|
1228
|
+
RegulationArticle, Threat) and governance policies (GovernancePrinciple, GovernanceObligation,
|
|
1229
|
+
GovernanceApproach).
|
|
1230
|
+
* GovernanceImplementation between governance policies (GovernancePrinciple, GovernanceObligation,
|
|
1231
|
+
GovernanceApproach) and governance controls (GovernanceRule, GovernanceProcess, GovernanceResponsibility,
|
|
1232
|
+
GovernanceProcedure, SecurityAccessControl, SecurityGroup).
|
|
1233
|
+
|
|
1234
|
+
Parameters
|
|
1235
|
+
----------
|
|
1236
|
+
definition_guid1: str
|
|
1237
|
+
guid of the first governance definition to link.
|
|
1238
|
+
definition_guid2: str
|
|
1239
|
+
guid of the second governance definition to link.
|
|
1240
|
+
relationship_type: str
|
|
1241
|
+
Relationship type name linking the governance definitions..
|
|
1242
|
+
body: dict
|
|
1243
|
+
The body describing the link between the two segments.
|
|
1244
|
+
|
|
1245
|
+
Returns
|
|
1246
|
+
-------
|
|
1247
|
+
None
|
|
1248
|
+
|
|
1249
|
+
Raises
|
|
1250
|
+
------
|
|
1251
|
+
PyegeriaInvalidParameterException
|
|
1252
|
+
one of the parameters is null or invalid or
|
|
1253
|
+
PyegeriaAPIException
|
|
1254
|
+
There is a problem adding the element properties to the metadata repository or
|
|
1255
|
+
PyegeriaUnauthorizedException
|
|
1256
|
+
the requesting user is not authorized to issue this request.
|
|
1257
|
+
|
|
1258
|
+
Notes
|
|
1259
|
+
----
|
|
1260
|
+
|
|
1261
|
+
Body structure:
|
|
1262
|
+
{
|
|
1263
|
+
"class" : "RelationshipRequestBody",
|
|
1264
|
+
"externalSourceGUID": "add guid here",
|
|
1265
|
+
"externalSourceName": "add qualified name here",
|
|
1266
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
1267
|
+
"forLineage" : false,
|
|
1268
|
+
"forDuplicateProcessing" : false,
|
|
1269
|
+
"properties": {
|
|
1270
|
+
"class": "SupportingDefinitionProperties",
|
|
1271
|
+
"rationale": "",
|
|
1272
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
1273
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
"""
|
|
1277
|
+
loop = asyncio.get_event_loop()
|
|
1278
|
+
loop.run_until_complete(
|
|
1279
|
+
self._async_attach_supporting_definitions(definition_guid1, relationship_type, definition_guid2, body))
|
|
1280
|
+
|
|
1281
|
+
@dynamic_catch
|
|
1282
|
+
async def _async_detach_supporting_definitions(self, definition_guid1: str, relationship_type: str,
|
|
1283
|
+
definition_guid2: str,
|
|
1284
|
+
body: Optional[dict | DeleteRelationshipRequestBody] = None) -> None:
|
|
1285
|
+
""" Detach a governance definition from a supporting governance definition.
|
|
1286
|
+
Request body is optional. Async Version.
|
|
1287
|
+
|
|
1288
|
+
Parameters
|
|
1289
|
+
----------
|
|
1290
|
+
definition_guid1: str
|
|
1291
|
+
guid of the first governance definition to unlink.
|
|
1292
|
+
definition_guid2: str
|
|
1293
|
+
guid of the second governance definition to unlink.
|
|
1294
|
+
relationship_type: str
|
|
1295
|
+
Relationship type name linking the governance definitions..
|
|
1296
|
+
body: dict, optional
|
|
1297
|
+
The body describing the link between the two segments.
|
|
1298
|
+
|
|
1299
|
+
Returns
|
|
1300
|
+
-------
|
|
1301
|
+
None
|
|
1302
|
+
|
|
1303
|
+
Raises
|
|
1304
|
+
------
|
|
1305
|
+
PyegeriaInvalidParameterException
|
|
1306
|
+
one of the parameters is null or invalid or
|
|
1307
|
+
PyegeriaAPIException
|
|
1308
|
+
There is a problem adding the element properties to the metadata repository or
|
|
1309
|
+
PyegeriaUnauthorizedException
|
|
1310
|
+
the requesting user is not authorized to issue this request.
|
|
1311
|
+
|
|
1312
|
+
Notes
|
|
1313
|
+
----
|
|
1314
|
+
|
|
1315
|
+
Body structure:
|
|
1316
|
+
{
|
|
1317
|
+
"class": "MetadataSourceRequestBody",
|
|
1318
|
+
"externalSourceGUID": "add guid here",
|
|
1319
|
+
"externalSourceName": "add qualified name here",
|
|
1320
|
+
"effectiveTime": "{{$isoTimestamp}}",
|
|
1321
|
+
"forLineage": false,
|
|
1322
|
+
"forDuplicateProcessing": false
|
|
1323
|
+
}
|
|
1324
|
+
"""
|
|
1325
|
+
url = (
|
|
1326
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
1327
|
+
f"{self.url_marker}/governance-definitions/"
|
|
1328
|
+
f"{definition_guid1}/supporting-definitions/{relationship_type}/{definition_guid2}/detach"
|
|
1329
|
+
)
|
|
1330
|
+
await self._async_delete_relationship_request(url, body)
|
|
1331
|
+
logger.info(f"Detached digital supporting definitions: {definition_guid1} -> {definition_guid2}")
|
|
1332
|
+
|
|
1333
|
+
@dynamic_catch
|
|
1334
|
+
def detach_supporting_definitions(self, definition_guid1: str, relationship_type: str, definition_guid2: str,
|
|
1335
|
+
body: Optional[dict | DeleteRelationshipRequestBody] = None) -> None:
|
|
1336
|
+
""" Detach a governance definition from a supporting governance definition.
|
|
1337
|
+
Request body is optional.
|
|
1338
|
+
|
|
1339
|
+
Parameters
|
|
1340
|
+
----------
|
|
1341
|
+
definition_guid1: str
|
|
1342
|
+
guid of the first governance definition to unlink.
|
|
1343
|
+
definition_guid2: str
|
|
1344
|
+
guid of the second governance definition to unlink.
|
|
1345
|
+
relationship_type: str
|
|
1346
|
+
Relationship type name linking the governance definitions..
|
|
1347
|
+
body: dict, optional
|
|
1348
|
+
The body describing the link between the two segments.
|
|
1349
|
+
|
|
1350
|
+
Returns
|
|
1351
|
+
-------
|
|
1352
|
+
None
|
|
1353
|
+
|
|
1354
|
+
Raises
|
|
1355
|
+
------
|
|
1356
|
+
PyegeriaInvalidParameterException
|
|
1357
|
+
one of the parameters is null or invalid or
|
|
1358
|
+
PyegeriaAPIException
|
|
1359
|
+
There is a problem adding the element properties to the metadata repository or
|
|
1360
|
+
PyegeriaUnauthorizedException
|
|
1361
|
+
the requesting user is not authorized to issue this request.
|
|
1362
|
+
|
|
1363
|
+
Notes
|
|
1364
|
+
----
|
|
1365
|
+
|
|
1366
|
+
Body structure:
|
|
1367
|
+
{
|
|
1368
|
+
"class" : "MetadataSourceRequestBody",
|
|
1369
|
+
"externalSourceGUID": "add guid here",
|
|
1370
|
+
"externalSourceName": "add qualified name here",
|
|
1371
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
1372
|
+
"forLineage" : false,
|
|
1373
|
+
"forDuplicateProcessing" : false
|
|
1374
|
+
}
|
|
1375
|
+
"""
|
|
1376
|
+
loop = asyncio.get_event_loop()
|
|
1377
|
+
loop.run_until_complete(
|
|
1378
|
+
self._async_detach_supporting_definitions(definition_guid1, relationship_type, definition_guid2, body))
|
|
1379
|
+
|
|
1380
|
+
|
|
1381
|
+
|
|
1382
|
+
async def _async_attach_governed_by_definition(self, element_guid: str, definition_guid: str,
|
|
1383
|
+
body: Optional[dict | NewRelationshipRequestBody] = None) -> None:
|
|
1384
|
+
""" Link a governance definition to an element using the GovernedBy relationship. Request body is optional.
|
|
1385
|
+
|
|
1386
|
+
Async Version.
|
|
1387
|
+
|
|
1388
|
+
Parameters
|
|
1389
|
+
----------
|
|
1390
|
+
element_guid: str
|
|
1391
|
+
guid of the element to be governed.
|
|
1392
|
+
definition_guid: str
|
|
1393
|
+
the governance definition guid.
|
|
1394
|
+
body: dict
|
|
1395
|
+
The body describing the link between the two.
|
|
1396
|
+
|
|
1397
|
+
Returns
|
|
1398
|
+
-------
|
|
1399
|
+
None
|
|
1400
|
+
|
|
1401
|
+
Raises
|
|
1402
|
+
------
|
|
1403
|
+
PyegeriaException
|
|
1404
|
+
ValidationError
|
|
1405
|
+
|
|
1406
|
+
Notes
|
|
1407
|
+
----
|
|
1408
|
+
|
|
1409
|
+
Body structure:
|
|
1410
|
+
{
|
|
1411
|
+
"class" : "NewRelationshipRequestBody",
|
|
1412
|
+
"properties" : {
|
|
1413
|
+
"class" : "GovernedByProperties",
|
|
1414
|
+
"label" : "add label here",
|
|
1415
|
+
"description" : "add description here"
|
|
1416
|
+
},
|
|
1417
|
+
"externalSourceGUID": "Add guid here",
|
|
1418
|
+
"externalSourceName": "Add qualified name here",
|
|
1419
|
+
"forLineage": false,
|
|
1420
|
+
"forDuplicateProcessing": false,
|
|
1421
|
+
"effectiveTime" : "{{$isoTimestamp}}"
|
|
1422
|
+
}
|
|
1423
|
+
"""
|
|
1424
|
+
url = (
|
|
1425
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
1426
|
+
f"{self.url_marker}/elements/{element_guid}/governed-by/definition/{definition_guid}/attach"
|
|
1427
|
+
)
|
|
1428
|
+
await self._async_new_relationship_request(url, "GovernedByProperties", body)
|
|
1429
|
+
logger.info(f"Linked Governed-By {definition_guid} -> {element_guid}")
|
|
1430
|
+
|
|
1431
|
+
@dynamic_catch
|
|
1432
|
+
def attach_governed_by_definition(self, element_guid: str, definition_guid: str,
|
|
1433
|
+
body: Optional[dict | NewRelationshipRequestBody] = None) -> None:
|
|
1434
|
+
""" Link a governance definition to an element using the GovernedBy relationship. Request body is optional.
|
|
1435
|
+
|
|
1436
|
+
Parameters
|
|
1437
|
+
----------
|
|
1438
|
+
element_guid: str
|
|
1439
|
+
guid of the element to be governed.
|
|
1440
|
+
definition_guid: str
|
|
1441
|
+
the governance definition guid.
|
|
1442
|
+
body: dict
|
|
1443
|
+
The body describing the link between the two.
|
|
1444
|
+
|
|
1445
|
+
Returns
|
|
1446
|
+
-------
|
|
1447
|
+
None
|
|
1448
|
+
|
|
1449
|
+
Raises
|
|
1450
|
+
------
|
|
1451
|
+
PyegeriaException
|
|
1452
|
+
ValidationError
|
|
1453
|
+
|
|
1454
|
+
Notes
|
|
1455
|
+
----
|
|
1456
|
+
|
|
1457
|
+
Body structure:
|
|
1458
|
+
{
|
|
1459
|
+
"class" : "NewRelationshipRequestBody",
|
|
1460
|
+
"properties" : {
|
|
1461
|
+
"class" : "GovernedByProperties",
|
|
1462
|
+
"label" : "add label here",
|
|
1463
|
+
"description" : "add description here"
|
|
1464
|
+
},
|
|
1465
|
+
"externalSourceGUID": "Add guid here",
|
|
1466
|
+
"externalSourceName": "Add qualified name here",
|
|
1467
|
+
"forLineage": false,
|
|
1468
|
+
"forDuplicateProcessing": false,
|
|
1469
|
+
"effectiveTime" : "{{$isoTimestamp}}"
|
|
1470
|
+
}
|
|
1471
|
+
"""
|
|
1472
|
+
loop = asyncio.get_event_loop()
|
|
1473
|
+
loop.run_until_complete(
|
|
1474
|
+
self._async_attach_governed_by_definition(element_guid, definition_guid, body))
|
|
1475
|
+
|
|
1476
|
+
@dynamic_catch
|
|
1477
|
+
async def _async_detach_governed_by_definition(self, element_guid: str, definition_guid: str,
|
|
1478
|
+
body: Optional[dict | DeleteRelationshipRequestBody] = None) -> None:
|
|
1479
|
+
""" Detach a governance definition from a supporting governance definition.
|
|
1480
|
+
Request body is optional. Async Version.
|
|
1481
|
+
|
|
1482
|
+
Parameters
|
|
1483
|
+
----------
|
|
1484
|
+
element_guid: str
|
|
1485
|
+
guid of the element to be governed.
|
|
1486
|
+
definition_guid: str
|
|
1487
|
+
the governance definition guid.
|
|
1488
|
+
body: dict
|
|
1489
|
+
The body describing the link between the two.
|
|
1490
|
+
|
|
1491
|
+
Returns
|
|
1492
|
+
-------
|
|
1493
|
+
None
|
|
1494
|
+
|
|
1495
|
+
Raises
|
|
1496
|
+
------
|
|
1497
|
+
PyegeriaInvalidParameterException
|
|
1498
|
+
one of the parameters is null or invalid or
|
|
1499
|
+
PyegeriaAPIException
|
|
1500
|
+
There is a problem adding the element properties to the metadata repository or
|
|
1501
|
+
PyegeriaUnauthorizedException
|
|
1502
|
+
the requesting user is not authorized to issue this request.
|
|
1503
|
+
|
|
1504
|
+
Notes
|
|
1505
|
+
----
|
|
1506
|
+
|
|
1507
|
+
Body structure:
|
|
1508
|
+
{
|
|
1509
|
+
"class" : "DeleteRelationshipRequestBody",
|
|
1510
|
+
"externalSourceGUID": "add guid here",
|
|
1511
|
+
"externalSourceName": "add qualified name here",
|
|
1512
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
1513
|
+
"forLineage" : false,
|
|
1514
|
+
"forDuplicateProcessing" : false
|
|
1515
|
+
}
|
|
1516
|
+
"""
|
|
1517
|
+
url = (
|
|
1518
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
1519
|
+
f"{self.url_marker}/elements/{element_guid}/governed-by/{definition_guid}/detach"
|
|
1520
|
+
)
|
|
1521
|
+
await self._async_delete_relationship_request(url, body)
|
|
1522
|
+
logger.info(f"Detached governed-by relationshup between: {definition_guid} -> {element_guid}")
|
|
1523
|
+
|
|
1524
|
+
@dynamic_catch
|
|
1525
|
+
def detach_governed_by_definitio(self, element_guid: str, definition_guid: str,
|
|
1526
|
+
body: Optional[dict | DeleteRelationshipRequestBody] = None) -> None:
|
|
1527
|
+
""" Detach a governance definition from a supporting governance definition.
|
|
1528
|
+
Request body is optional.
|
|
1529
|
+
|
|
1530
|
+
Parameters
|
|
1531
|
+
----------
|
|
1532
|
+
element_guid: str
|
|
1533
|
+
guid of the element to be governed.
|
|
1534
|
+
definition_guid: str
|
|
1535
|
+
the governance definition guid.
|
|
1536
|
+
body: dict
|
|
1537
|
+
The body describing the link between the two.
|
|
1538
|
+
|
|
1539
|
+
Returns
|
|
1540
|
+
-------
|
|
1541
|
+
None
|
|
1542
|
+
|
|
1543
|
+
Raises
|
|
1544
|
+
------
|
|
1545
|
+
PyegeriaInvalidParameterException
|
|
1546
|
+
one of the parameters is null or invalid or
|
|
1547
|
+
PyegeriaAPIException
|
|
1548
|
+
There is a problem adding the element properties to the metadata repository or
|
|
1549
|
+
PyegeriaUnauthorizedException
|
|
1550
|
+
the requesting user is not authorized to issue this request.
|
|
1551
|
+
|
|
1552
|
+
Notes
|
|
1553
|
+
----
|
|
1554
|
+
|
|
1555
|
+
Body structure:
|
|
1556
|
+
{
|
|
1557
|
+
"class" : "DeleteRelationshipRequestBody",
|
|
1558
|
+
"externalSourceGUID": "add guid here",
|
|
1559
|
+
"externalSourceName": "add qualified name here",
|
|
1560
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
1561
|
+
"forLineage" : false,
|
|
1562
|
+
"forDuplicateProcessing" : false
|
|
1563
|
+
}
|
|
1564
|
+
"""
|
|
1565
|
+
loop = asyncio.get_event_loop()
|
|
1566
|
+
loop.run_until_complete(
|
|
1567
|
+
self._async_detach_governed_by_definition(element_guid, definition_guid, body))
|
|
1568
|
+
|
|
1569
|
+
|
|
1570
|
+
|
|
1571
|
+
# @dynamic_catch
|
|
1572
|
+
# async def _async_delete_governance_definition(self, guid: str, body: Optional[dict | DeleteElementRequestBody] = None) -> None:
|
|
1573
|
+
# """ Delete an information supply. Async version.
|
|
1574
|
+
|
|
1575
|
+
# Parameters
|
|
1576
|
+
# ----------
|
|
1577
|
+
# guid: str
|
|
1578
|
+
# GUID of the governance definition to delete.
|
|
1579
|
+
|
|
1580
|
+
# body: dict, optional
|
|
1581
|
+
# A dictionary containing the definition of the governance definition to create.
|
|
1582
|
+
|
|
1583
|
+
# Returns
|
|
1584
|
+
# -------
|
|
1585
|
+
|
|
1586
|
+
# str - guid of the governance definition created.
|
|
1587
|
+
|
|
1588
|
+
# Raises
|
|
1589
|
+
# ------
|
|
1590
|
+
# PyegeriaInvalidParameterException
|
|
1591
|
+
# one of the parameters is null or invalid or
|
|
1592
|
+
# PyegeriaAPIException
|
|
1593
|
+
# There is a problem adding the element properties to the metadata repository or
|
|
1594
|
+
# PyegeriaUnauthorizedException
|
|
1595
|
+
# the requesting user is not authorized to issue this request.
|
|
1596
|
+
|
|
1597
|
+
# Notes
|
|
1598
|
+
# ----
|
|
1599
|
+
# https://egeria-project.org/concepts/governance-definition
|
|
1600
|
+
|
|
1601
|
+
# Body structure:
|
|
1602
|
+
# {
|
|
1603
|
+
# "class": "MetadataSourceRequestBody",
|
|
1604
|
+
# "externalSourceGUID": "add guid here",
|
|
1605
|
+
# "externalSourceName": "add qualified name here",
|
|
1606
|
+
# "effectiveTime": "{{$isoTimestamp}}",
|
|
1607
|
+
# "forLineage": false,
|
|
1608
|
+
# "forDuplicateProcessing": false
|
|
1609
|
+
# }
|
|
1610
|
+
|
|
1611
|
+
# """
|
|
1612
|
+
# url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
1613
|
+
# f"{self.url_marker}/governance-definitions/{guid}/delete")
|
|
1614
|
+
# await self._async_delete_element_request(url, body)
|
|
1615
|
+
# logger.info(f"Deleted governance definition: {guid} ")
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
# @dynamic_catch
|
|
1619
|
+
# def delete_governance_definition(self, guid: str, body: Optional[dict | DeleteElementRequestBody] = None) -> None:
|
|
1620
|
+
# """ Delete an information supply. Request body is optional. Async version.
|
|
1621
|
+
|
|
1622
|
+
# Parameters
|
|
1623
|
+
# ----------
|
|
1624
|
+
# guid: str
|
|
1625
|
+
# GUID of the governance definition to delete.
|
|
1626
|
+
|
|
1627
|
+
# body: dict, optionl
|
|
1628
|
+
# A dictionary containing the definition of the governance definition to create.
|
|
1629
|
+
|
|
1630
|
+
# Returns
|
|
1631
|
+
# -------
|
|
1632
|
+
|
|
1633
|
+
# str - guid of the governance definition created.
|
|
1634
|
+
|
|
1635
|
+
# Raises
|
|
1636
|
+
# ------
|
|
1637
|
+
# PyegeriaInvalidParameterException
|
|
1638
|
+
# one of the parameters is null or invalid or
|
|
1639
|
+
# PyegeriaAPIException
|
|
1640
|
+
# There is a problem adding the element properties to the metadata repository or
|
|
1641
|
+
# PyegeriaUnauthorizedException
|
|
1642
|
+
# the requesting user is not authorized to issue this request.
|
|
1643
|
+
|
|
1644
|
+
# Notes
|
|
1645
|
+
# ----
|
|
1646
|
+
# https://egeria-project.org/concepts/governance-definition
|
|
1647
|
+
|
|
1648
|
+
# Body structure:
|
|
1649
|
+
# {
|
|
1650
|
+
# "class": "MetadataSourceRequestBody",
|
|
1651
|
+
# "externalSourceGUID": "add guid here",
|
|
1652
|
+
# "externalSourceName": "add qualified name here",
|
|
1653
|
+
# "effectiveTime": "{{$isoTimestamp}}",
|
|
1654
|
+
# "forLineage": false,
|
|
1655
|
+
# "forDuplicateProcessing": false
|
|
1656
|
+
# }
|
|
1657
|
+
|
|
1658
|
+
# """
|
|
1659
|
+
|
|
1660
|
+
# loop = asyncio.get_event_loop()
|
|
1661
|
+
# loop.run_until_complete(self._async_delete_governance_definition(guid, body))
|
|
1662
|
+
|
|
1663
|
+
@dynamic_catch
|
|
1664
|
+
async def _async_find_governance_definitions(self, search_string: str = "*",
|
|
1665
|
+
starts_with: bool = True, ends_with: bool = False,
|
|
1666
|
+
ignore_case: bool = False,
|
|
1667
|
+
anchor_domain: Optional[str] = None,
|
|
1668
|
+
metadata_element_type: Optional[str] = None,
|
|
1669
|
+
metadata_element_subtypes: Optional[list[str]] = None,
|
|
1670
|
+
skip_relationships: Optional[list[str]] = None,
|
|
1671
|
+
include_only_relationships: Optional[list[str]] = None,
|
|
1672
|
+
skip_classified_elements: Optional[list[str]] = None,
|
|
1673
|
+
include_only_classified_elements: Optional[list[str]] = None,
|
|
1674
|
+
graph_query_depth: int = 3,
|
|
1675
|
+
governance_zone_filter: Optional[list[str]] = None, as_of_time: Optional[str] = None,
|
|
1676
|
+
effective_time: Optional[str] = None, relationship_page_size: int = 0,
|
|
1677
|
+
limit_results_by_status: Optional[list[str]] = None, sequencing_order: Optional[str] = None,
|
|
1678
|
+
sequencing_property: Optional[str] = None,
|
|
1679
|
+
output_format: str = "JSON",
|
|
1680
|
+
report_spec: str | dict = None,
|
|
1681
|
+
start_from: int = 0, page_size: int = 100,
|
|
1682
|
+
property_names: Optional[list[str]] = None,
|
|
1683
|
+
body: Optional[dict | SearchStringRequestBody] = None) -> list | str:
|
|
1684
|
+
""" Retrieve the list of governance definition metadata elements that contain the search string. Async Version.
|
|
1685
|
+
|
|
1686
|
+
Parameters
|
|
1687
|
+
----------
|
|
1688
|
+
search_string: str
|
|
1689
|
+
Search string to match against - None or '*' indicate match against all governance definitions.
|
|
1690
|
+
starts_with : bool, [default=True], optional
|
|
1691
|
+
Starts with the supplied string.
|
|
1692
|
+
ends_with : bool, [default=False], optional
|
|
1693
|
+
Ends with the supplied string
|
|
1694
|
+
ignore_case : bool, [default=False], optional
|
|
1695
|
+
Ignore case when searching
|
|
1696
|
+
anchor_domain: str, optional
|
|
1697
|
+
The anchor domain to search in.
|
|
1698
|
+
metadata_element_type: str, optional
|
|
1699
|
+
The type of metadata element to search for.
|
|
1700
|
+
metadata_element_subtypes: list[str], optional
|
|
1701
|
+
The subtypes of metadata element to search for.
|
|
1702
|
+
skip_relationships: list[str], optional
|
|
1703
|
+
The types of relationships to skip.
|
|
1704
|
+
include_only_relationships: list[str], optional
|
|
1705
|
+
The types of relationships to include.
|
|
1706
|
+
skip_classified_elements: list[str], optional
|
|
1707
|
+
The types of classified elements to skip.
|
|
1708
|
+
include_only_classified_elements: list[str], optional
|
|
1709
|
+
The types of classified elements to include.
|
|
1710
|
+
graph_query_depth: int, [default=3], optional
|
|
1711
|
+
The depth of the graph query.
|
|
1712
|
+
governance_zone_filter: list[str], optional
|
|
1713
|
+
The governance zones to search in.
|
|
1714
|
+
as_of_time: str, optional
|
|
1715
|
+
The time to search as of.
|
|
1716
|
+
effective_time: str, optional
|
|
1717
|
+
The effective time to search at.
|
|
1718
|
+
relationship_page_size: int, [default=0], optional
|
|
1719
|
+
The page size for relationships.
|
|
1720
|
+
limit_results_by_status: list[str], optional
|
|
1721
|
+
The statuses to limit results by.
|
|
1722
|
+
sequencing_order: str, optional
|
|
1723
|
+
The order to sequence results by.
|
|
1724
|
+
sequencing_property: str, optional
|
|
1725
|
+
The property to sequence results by.
|
|
1726
|
+
output_format: str, default = "JSON"
|
|
1727
|
+
- one of "MD", "LIST", "FORM", "REPORT", "DICT", "MERMAID" or "JSON"
|
|
1728
|
+
report_spec: str | dict , optional, default = None
|
|
1729
|
+
- The desired output columns/fields to include.
|
|
1730
|
+
start_from: int, [default=0], optional
|
|
1731
|
+
When multiple pages of results are available, the page number to start from.
|
|
1732
|
+
page_size: int, [default=100]
|
|
1733
|
+
The number of items to return in a single page.
|
|
1734
|
+
property_names: list[str], optional
|
|
1735
|
+
The names of properties to search for.
|
|
1736
|
+
body: dict | SearchStringRequestBody, optional, default = None
|
|
1737
|
+
- if provided, the search parameters in the body will supercede other attributes, such as "search_string"
|
|
1738
|
+
|
|
1739
|
+
Returns
|
|
1740
|
+
-------
|
|
1741
|
+
List | str
|
|
1742
|
+
|
|
1743
|
+
Output depends on the output format specified.
|
|
1744
|
+
|
|
1745
|
+
Raises
|
|
1746
|
+
-------
|
|
1747
|
+
|
|
1748
|
+
ValidationError
|
|
1749
|
+
If the client passes incorrect parameters on the request that don't conform to the data model.
|
|
1750
|
+
PyegeriaException
|
|
1751
|
+
Issues raised in communicating or server side processing.
|
|
1752
|
+
NotAuthorizedException
|
|
1753
|
+
The principle specified by the user_id does not have authorization for the requested action
|
|
1754
|
+
|
|
1755
|
+
"""
|
|
1756
|
+
url = (
|
|
1757
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
1758
|
+
f"{self.url_marker}/governance-definitions/"
|
|
1759
|
+
f"by-search-string")
|
|
1760
|
+
response = await self._async_find_request(url, _type="GovernanceDefinition", _gen_output=self._generate_governance_definition_output,
|
|
1761
|
+
search_string=search_string, starts_with=starts_with,
|
|
1762
|
+
ends_with=ends_with, ignore_case=ignore_case,
|
|
1763
|
+
anchor_domain=anchor_domain,
|
|
1764
|
+
metadata_element_type=metadata_element_type,
|
|
1765
|
+
metadata_element_subtypes=metadata_element_subtypes,
|
|
1766
|
+
skip_relationships=skip_relationships,
|
|
1767
|
+
include_only_relationships=include_only_relationships,
|
|
1768
|
+
skip_classified_elements=skip_classified_elements,
|
|
1769
|
+
include_only_classified_elements=include_only_classified_elements,
|
|
1770
|
+
graph_query_depth=graph_query_depth,
|
|
1771
|
+
governance_zone_filter=governance_zone_filter,
|
|
1772
|
+
as_of_time=as_of_time, effective_time=effective_time,
|
|
1773
|
+
relationship_page_size=relationship_page_size,
|
|
1774
|
+
limit_results_by_status=limit_results_by_status,
|
|
1775
|
+
sequencing_order=sequencing_order,
|
|
1776
|
+
sequencing_property=sequencing_property,
|
|
1777
|
+
output_format=output_format, report_spec=report_spec,
|
|
1778
|
+
start_from=start_from, page_size=page_size,
|
|
1779
|
+
property_names=property_names, body=body)
|
|
1780
|
+
|
|
1781
|
+
return response
|
|
1782
|
+
|
|
1783
|
+
@dynamic_catch
|
|
1784
|
+
def find_governance_definitions(self, search_string: str = "*",
|
|
1785
|
+
starts_with: bool = True, ends_with: bool = False,
|
|
1786
|
+
ignore_case: bool = False,
|
|
1787
|
+
anchor_domain: Optional[str] = None,
|
|
1788
|
+
metadata_element_type: Optional[str] = None,
|
|
1789
|
+
metadata_element_subtypes: Optional[list[str]] = None,
|
|
1790
|
+
skip_relationships: Optional[list[str]] = None,
|
|
1791
|
+
include_only_relationships: Optional[list[str]] = None,
|
|
1792
|
+
skip_classified_elements: Optional[list[str]] = None,
|
|
1793
|
+
include_only_classified_elements: Optional[list[str]] = None,
|
|
1794
|
+
graph_query_depth: int = 3,
|
|
1795
|
+
governance_zone_filter: Optional[list[str]] = None, as_of_time: Optional[str] = None,
|
|
1796
|
+
effective_time: Optional[str] = None, relationship_page_size: int = 0,
|
|
1797
|
+
limit_results_by_status: Optional[list[str]] = None, sequencing_order: Optional[str] = None,
|
|
1798
|
+
sequencing_property: Optional[str] = None,
|
|
1799
|
+
output_format: str = "JSON",
|
|
1800
|
+
report_spec: str | dict = None,
|
|
1801
|
+
start_from: int = 0, page_size: int = 100,
|
|
1802
|
+
property_names: Optional[list[str]] = None,
|
|
1803
|
+
body: Optional[dict | SearchStringRequestBody] = None) -> list | str:
|
|
1804
|
+
""" Retrieve the list of governance definition metadata elements that contain the search string.
|
|
1805
|
+
|
|
1806
|
+
Parameters
|
|
1807
|
+
----------
|
|
1808
|
+
search_string: str
|
|
1809
|
+
Search string to match against - None or '*' indicate match against all governance definitions.
|
|
1810
|
+
starts_with : bool, [default=True], optional
|
|
1811
|
+
Starts with the supplied string.
|
|
1812
|
+
ends_with : bool, [default=False], optional
|
|
1813
|
+
Ends with the supplied string
|
|
1814
|
+
ignore_case : bool, [default=False], optional
|
|
1815
|
+
Ignore case when searching
|
|
1816
|
+
anchor_domain: str, optional
|
|
1817
|
+
The anchor domain to search in.
|
|
1818
|
+
metadata_element_type: str, optional
|
|
1819
|
+
The type of metadata element to search for.
|
|
1820
|
+
metadata_element_subtypes: list[str], optional
|
|
1821
|
+
The subtypes of metadata element to search for.
|
|
1822
|
+
skip_relationships: list[str], optional
|
|
1823
|
+
The types of relationships to skip.
|
|
1824
|
+
include_only_relationships: list[str], optional
|
|
1825
|
+
The types of relationships to include.
|
|
1826
|
+
skip_classified_elements: list[str], optional
|
|
1827
|
+
The types of classified elements to skip.
|
|
1828
|
+
include_only_classified_elements: list[str], optional
|
|
1829
|
+
The types of classified elements to include.
|
|
1830
|
+
graph_query_depth: int, [default=3], optional
|
|
1831
|
+
The depth of the graph query.
|
|
1832
|
+
governance_zone_filter: list[str], optional
|
|
1833
|
+
The governance zones to search in.
|
|
1834
|
+
as_of_time: str, optional
|
|
1835
|
+
The time to search as of.
|
|
1836
|
+
effective_time: str, optional
|
|
1837
|
+
The effective time to search at.
|
|
1838
|
+
relationship_page_size: int, [default=0], optional
|
|
1839
|
+
The page size for relationships.
|
|
1840
|
+
limit_results_by_status: list[str], optional
|
|
1841
|
+
The statuses to limit results by.
|
|
1842
|
+
sequencing_order: str, optional
|
|
1843
|
+
The order to sequence results by.
|
|
1844
|
+
sequencing_property: str, optional
|
|
1845
|
+
The property to sequence results by.
|
|
1846
|
+
output_format: str, default = "JSON"
|
|
1847
|
+
- one of "MD", "LIST", "FORM", "REPORT", "DICT", "MERMAID" or "JSON"
|
|
1848
|
+
report_spec: str | dict , optional, default = None
|
|
1849
|
+
- The desired output columns/fields to include.
|
|
1850
|
+
start_from: int, [default=0], optional
|
|
1851
|
+
When multiple pages of results are available, the page number to start from.
|
|
1852
|
+
page_size: int, [default=100]
|
|
1853
|
+
The number of items to return in a single page.
|
|
1854
|
+
property_names: list[str], optional
|
|
1855
|
+
The names of properties to search for.
|
|
1856
|
+
body: dict | SearchStringRequestBody, optional, default = None
|
|
1857
|
+
- if provided, the search parameters in the body will supercede other attributes, such as "search_string"
|
|
1858
|
+
|
|
1859
|
+
Returns
|
|
1860
|
+
-------
|
|
1861
|
+
List | str
|
|
1862
|
+
|
|
1863
|
+
Output depends on the output format specified.
|
|
1864
|
+
|
|
1865
|
+
Raises
|
|
1866
|
+
-------
|
|
1867
|
+
|
|
1868
|
+
ValidationError
|
|
1869
|
+
If the client passes incorrect parameters on the request that don't conform to the data model.
|
|
1870
|
+
PyegeriaException
|
|
1871
|
+
Issues raised in communicating or server side processing.
|
|
1872
|
+
NotAuthorizedException
|
|
1873
|
+
The principle specified by the user_id does not have authorization for the requested action
|
|
1874
|
+
|
|
1875
|
+
"""
|
|
1876
|
+
loop = asyncio.get_event_loop()
|
|
1877
|
+
return loop.run_until_complete(self._async_find_governance_definitions(search_string=search_string,
|
|
1878
|
+
starts_with=starts_with,
|
|
1879
|
+
ends_with=ends_with,
|
|
1880
|
+
ignore_case=ignore_case,
|
|
1881
|
+
anchor_domain=anchor_domain,
|
|
1882
|
+
metadata_element_type=metadata_element_type,
|
|
1883
|
+
metadata_element_subtypes=metadata_element_subtypes,
|
|
1884
|
+
skip_relationships=skip_relationships,
|
|
1885
|
+
include_only_relationships=include_only_relationships,
|
|
1886
|
+
skip_classified_elements=skip_classified_elements,
|
|
1887
|
+
include_only_classified_elements=include_only_classified_elements,
|
|
1888
|
+
graph_query_depth=graph_query_depth,
|
|
1889
|
+
governance_zone_filter=governance_zone_filter,
|
|
1890
|
+
as_of_time=as_of_time,
|
|
1891
|
+
effective_time=effective_time,
|
|
1892
|
+
relationship_page_size=relationship_page_size,
|
|
1893
|
+
limit_results_by_status=limit_results_by_status,
|
|
1894
|
+
sequencing_order=sequencing_order,
|
|
1895
|
+
sequencing_property=sequencing_property,
|
|
1896
|
+
output_format=output_format,
|
|
1897
|
+
report_spec=report_spec,
|
|
1898
|
+
start_from=start_from,
|
|
1899
|
+
page_size=page_size,
|
|
1900
|
+
property_names=property_names,
|
|
1901
|
+
body=body))
|
|
1902
|
+
|
|
1903
|
+
@dynamic_catch
|
|
1904
|
+
async def _async_get_governance_definitions_by_name(self, filter_string: str,
|
|
1905
|
+
classification_names: Optional[list[str]] = None,
|
|
1906
|
+
body: Optional[dict | FilterRequestBody] = None,
|
|
1907
|
+
start_from: int = 0, page_size: int = 0,
|
|
1908
|
+
output_format: str = "JSON",
|
|
1909
|
+
report_spec: dict = None) -> list | str:
|
|
1910
|
+
""" Returns the list of governance definitions with a particular name. Async Version.
|
|
1911
|
+
|
|
1912
|
+
Parameters
|
|
1913
|
+
----------
|
|
1914
|
+
filter_string: str
|
|
1915
|
+
name of the information governance definition to retrieve.
|
|
1916
|
+
body: dict, optional
|
|
1917
|
+
A dictionary containing parameters of the retrieval.
|
|
1918
|
+
output_format: str, default = 'JSON'
|
|
1919
|
+
Type of output to produce include:
|
|
1920
|
+
JSON - output standard json
|
|
1921
|
+
MD - output standard markdown with no preamble
|
|
1922
|
+
FORM - output markdown with a preamble for a form
|
|
1923
|
+
REPORT - output markdown with a preamble for a report
|
|
1924
|
+
MERMAID - output mermaid markdown
|
|
1925
|
+
|
|
1926
|
+
Returns
|
|
1927
|
+
-------
|
|
1928
|
+
[dict] | str
|
|
1929
|
+
A list of information governance definitions matching the name.
|
|
1930
|
+
|
|
1931
|
+
Raises
|
|
1932
|
+
------
|
|
1933
|
+
PyegeriaInvalidParameterException
|
|
1934
|
+
one of the parameters is null or invalid or
|
|
1935
|
+
PyegeriaAPIException
|
|
1936
|
+
There is a problem adding the element properties to the metadata repository or
|
|
1937
|
+
PyegeriaUnauthorizedException
|
|
1938
|
+
the requesting user is not authorized to issue this request.
|
|
1939
|
+
|
|
1940
|
+
Notes
|
|
1941
|
+
-----
|
|
1942
|
+
If a body is provided it overrides the filter_string parameter.
|
|
1943
|
+
Body structure:
|
|
1944
|
+
{
|
|
1945
|
+
"class": "FilterRequestBody",
|
|
1946
|
+
"asOfTime": {{isotime}},
|
|
1947
|
+
"effectiveTime": {{isotime}},
|
|
1948
|
+
"forLineage": false,
|
|
1949
|
+
"forDuplicateProcessing": false,
|
|
1950
|
+
"limitResultsByStatus": ["ACTIVE"],
|
|
1951
|
+
"sequencingOrder": "PROPERTY_ASCENDING",
|
|
1952
|
+
"sequencingProperty": "qualifiedName",
|
|
1953
|
+
"filter": "Add name here",
|
|
1954
|
+
"templateFilter": "NO_TEMPLATES"
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
"""
|
|
1958
|
+
|
|
1959
|
+
url = (
|
|
1960
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
1961
|
+
f"{self.url_marker}/governance-definitions/by-name")
|
|
1962
|
+
response = await self._async_get_name_request(url, _type="GovernanceDefinition",
|
|
1963
|
+
_gen_output=self._generate_governance_definition_output,
|
|
1964
|
+
filter_string=filter_string,
|
|
1965
|
+
classification_names=classification_names,
|
|
1966
|
+
start_from=start_from, page_size=page_size,
|
|
1967
|
+
output_format=output_format, report_spec=report_spec,
|
|
1968
|
+
body=body)
|
|
1969
|
+
|
|
1970
|
+
return response
|
|
1971
|
+
|
|
1972
|
+
@dynamic_catch
|
|
1973
|
+
def get_governance_definitions_by_name(self, filter_string: str, classification_names: Optional[list[str]] = None,
|
|
1974
|
+
body: Optional[dict | FilterRequestBody] = None,
|
|
1975
|
+
start_from: int = 0, page_size: int = 0,
|
|
1976
|
+
output_format: str = "JSON",
|
|
1977
|
+
report_spec: dict = None) -> list | str:
|
|
1978
|
+
""" Returns the list of governance definitions with a particular name."""
|
|
1979
|
+
|
|
1980
|
+
""" Returns the list of information governance definitions with a particular name. Async Version.
|
|
1981
|
+
|
|
1982
|
+
Parameters
|
|
1983
|
+
----------
|
|
1984
|
+
filter_string: str
|
|
1985
|
+
name of the information governance definition to retrieve.
|
|
1986
|
+
body: dict, optional
|
|
1987
|
+
A dictionary containing parameters of the retrieval.
|
|
1988
|
+
add_implementation: bool, optional
|
|
1989
|
+
Whether to add the implementation details to the response.
|
|
1990
|
+
start_from: int, [default=0], optional
|
|
1991
|
+
When multiple pages of results are available, the page number to start from.
|
|
1992
|
+
page_size: int, [default=0], optional
|
|
1993
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
|
1994
|
+
the class instance.
|
|
1995
|
+
output_format: str, default = 'JSON'
|
|
1996
|
+
Type of output to produce:
|
|
1997
|
+
JSON - output standard json
|
|
1998
|
+
MD - output standard markdown with no preamble
|
|
1999
|
+
FORM - output markdown with a preamble for a form
|
|
2000
|
+
REPORT - output markdown with a preamble for a report
|
|
2001
|
+
MERMAID - output mermaid markdown
|
|
2002
|
+
|
|
2003
|
+
Returns
|
|
2004
|
+
-------
|
|
2005
|
+
[dict] | str
|
|
2006
|
+
A list of information governance definitions matching the name.
|
|
2007
|
+
|
|
2008
|
+
Raises
|
|
2009
|
+
------
|
|
2010
|
+
PyegeriaInvalidParameterException
|
|
2011
|
+
one of the parameters is null or invalid or
|
|
2012
|
+
PyegeriaAPIException
|
|
2013
|
+
There is a problem adding the element properties to the metadata repository or
|
|
2014
|
+
PyegeriaUnauthorizedException
|
|
2015
|
+
the requesting user is not authorized to issue this request.
|
|
2016
|
+
|
|
2017
|
+
Notes
|
|
2018
|
+
-----
|
|
2019
|
+
Body structure:
|
|
2020
|
+
{
|
|
2021
|
+
"class": "FilterRequestBody",
|
|
2022
|
+
"asOfTime": {{isotime}},
|
|
2023
|
+
"effectiveTime": {{isotime}},
|
|
2024
|
+
"forLineage": false,
|
|
2025
|
+
"forDuplicateProcessing": false,
|
|
2026
|
+
"limitResultsByStatus": ["ACTIVE"],
|
|
2027
|
+
"sequencingOrder": "PROPERTY_ASCENDING",
|
|
2028
|
+
"sequencingProperty": "qualifiedName",
|
|
2029
|
+
"filter": "Add name here",
|
|
2030
|
+
"templateFilter": "NO_TEMPLATES"
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
"""
|
|
2034
|
+
loop = asyncio.get_event_loop()
|
|
2035
|
+
response = loop.run_until_complete(
|
|
2036
|
+
self._async_get_governance_definitions_by_name(filter_string, classification_names, body,
|
|
2037
|
+
start_from, page_size, output_format, report_spec))
|
|
2038
|
+
return response
|
|
2039
|
+
|
|
2040
|
+
|
|
2041
|
+
async def _async_get_governance_definition_by_guid(self, definition_guid: str,
|
|
2042
|
+
element_type: Optional[str] = None,
|
|
2043
|
+
body: Optional[dict | GetRequestBody] = None,
|
|
2044
|
+
output_format: str = "JSON",
|
|
2045
|
+
report_spec: dict = None) -> list | str:
|
|
2046
|
+
""" Returns the governance definitions with a particular GUID. Async Version.
|
|
2047
|
+
|
|
2048
|
+
Parameters
|
|
2049
|
+
----------
|
|
2050
|
+
definition_guid: str
|
|
2051
|
+
identity of the information governance definition to retrieve.
|
|
2052
|
+
body: dict, optional
|
|
2053
|
+
A dictionary containing parameters of the retrieval.
|
|
2054
|
+
output_format: str, default = 'JSON'
|
|
2055
|
+
Type of output to produce include:
|
|
2056
|
+
JSON - output standard json
|
|
2057
|
+
MD - output standard markdown with no preamble
|
|
2058
|
+
FORM - output markdown with a preamble for a form
|
|
2059
|
+
REPORT - output markdown with a preamble for a report
|
|
2060
|
+
MERMAID - output mermaid markdown
|
|
2061
|
+
|
|
2062
|
+
Returns
|
|
2063
|
+
-------
|
|
2064
|
+
[dict] | str
|
|
2065
|
+
A list of information governance definitions matching the name.
|
|
2066
|
+
|
|
2067
|
+
Raises
|
|
2068
|
+
------
|
|
2069
|
+
PyegeriaInvalidParameterException
|
|
2070
|
+
one of the parameters is null or invalid or
|
|
2071
|
+
PyegeriaAPIException
|
|
2072
|
+
There is a problem adding the element properties to the metadata repository or
|
|
2073
|
+
PyegeriaUnauthorizedException
|
|
2074
|
+
the requesting user is not authorized to issue this request.
|
|
2075
|
+
|
|
2076
|
+
Notes
|
|
2077
|
+
-----
|
|
2078
|
+
If a body is provided it overrides the filter_string parameter.
|
|
2079
|
+
Body structure:
|
|
2080
|
+
{
|
|
2081
|
+
"class" : "GetRequestBody",
|
|
2082
|
+
"metadataElementTypeName": "GovernancePolicy",
|
|
2083
|
+
"metadataElementSubtypeNames": [],
|
|
2084
|
+
"skipRelationships": [],
|
|
2085
|
+
"includeOnlyRelationships": [],
|
|
2086
|
+
"relationshipsPageSize": 100,
|
|
2087
|
+
"skipClassifiedElements": [],
|
|
2088
|
+
"includeOnlyClassifiedElements": [],
|
|
2089
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
|
2090
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
2091
|
+
"forLineage" : false,
|
|
2092
|
+
"forDuplicateProcessing" : false
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
"""
|
|
2096
|
+
|
|
2097
|
+
url = (
|
|
2098
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
2099
|
+
f"{self.url_marker}/governance-definitions/{definition_guid}/retrieve")
|
|
2100
|
+
|
|
2101
|
+
element_type = element_type if element_type else "GovernanceDefinition"
|
|
2102
|
+
response = await self._async_get_guid_request(url, _type=element_type,
|
|
2103
|
+
_gen_output=self._generate_governance_definition_output,
|
|
2104
|
+
output_format=output_format, report_spec=report_spec,
|
|
2105
|
+
body=body)
|
|
2106
|
+
|
|
2107
|
+
return response
|
|
2108
|
+
|
|
2109
|
+
@dynamic_catch
|
|
2110
|
+
def get_governance_definition_by_guid(self, definition_guid: str,
|
|
2111
|
+
element_type: Optional[str] = None,
|
|
2112
|
+
body: Optional[dict | GetRequestBody] = None,
|
|
2113
|
+
output_format: str = "JSON",
|
|
2114
|
+
report_spec: dict = None) -> list | str:
|
|
2115
|
+
""" Returns the a governance definitions with a particular GUID.
|
|
2116
|
+
|
|
2117
|
+
Parameters
|
|
2118
|
+
----------
|
|
2119
|
+
definition_guid: str
|
|
2120
|
+
GUID of the information governance definition to retrieve.
|
|
2121
|
+
element_type: str
|
|
2122
|
+
Type of element to retrieve.
|
|
2123
|
+
body: dict, optional
|
|
2124
|
+
A dictionary containing parameters of the retrieval.
|
|
2125
|
+
|
|
2126
|
+
output_format: str, default = 'JSON'
|
|
2127
|
+
Type of output to produce:
|
|
2128
|
+
JSON - output standard json
|
|
2129
|
+
MD - output standard markdown with no preamble
|
|
2130
|
+
FORM - output markdown with a preamble for a form
|
|
2131
|
+
REPORT - output markdown with a preamble for a report
|
|
2132
|
+
MERMAID - output mermaid markdown
|
|
2133
|
+
|
|
2134
|
+
Returns
|
|
2135
|
+
-------
|
|
2136
|
+
[dict] | str
|
|
2137
|
+
A list of information governance definitions matching the name.
|
|
2138
|
+
|
|
2139
|
+
Raises
|
|
2140
|
+
------
|
|
2141
|
+
PyegeriaInvalidParameterException
|
|
2142
|
+
one of the parameters is null or invalid or
|
|
2143
|
+
PyegeriaAPIException
|
|
2144
|
+
There is a problem adding the element properties to the metadata repository or
|
|
2145
|
+
PyegeriaUnauthorizedException
|
|
2146
|
+
the requesting user is not authorized to issue this request.
|
|
2147
|
+
|
|
2148
|
+
Notes
|
|
2149
|
+
-----
|
|
2150
|
+
Body structure:
|
|
2151
|
+
{
|
|
2152
|
+
"class" : "GetRequestBody",
|
|
2153
|
+
"metadataElementTypeName": "GovernancePolicy",
|
|
2154
|
+
"metadataElementSubtypeNames": [],
|
|
2155
|
+
"skipRelationships": [],
|
|
2156
|
+
"includeOnlyRelationships": [],
|
|
2157
|
+
"relationshipsPageSize": 100,
|
|
2158
|
+
"skipClassifiedElements": [],
|
|
2159
|
+
"includeOnlyClassifiedElements": [],
|
|
2160
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
|
2161
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
2162
|
+
"forLineage" : false,
|
|
2163
|
+
"forDuplicateProcessing" : false
|
|
2164
|
+
}
|
|
2165
|
+
"""
|
|
2166
|
+
loop = asyncio.get_event_loop()
|
|
2167
|
+
response = loop.run_until_complete(
|
|
2168
|
+
self._async_get_governance_definition_by_guid(definition_guid, element_type, body,
|
|
2169
|
+
output_format, report_spec))
|
|
2170
|
+
return response
|
|
2171
|
+
|
|
2172
|
+
|
|
2173
|
+
|
|
2174
|
+
@dynamic_catch
|
|
2175
|
+
async def _async_get_governance_process_graph(self, guid: str, element_type: Optional[str] = None,
|
|
2176
|
+
body: Optional[dict | FilterRequestBody] = None,
|
|
2177
|
+
output_format: str = "JSON",
|
|
2178
|
+
report_spec: dict = None) -> dict | str:
|
|
2179
|
+
|
|
2180
|
+
""" Retrieve the governance action process metadata element with the supplied unique identifier
|
|
2181
|
+
along with the flow definition describing its implementation. Async version.
|
|
2182
|
+
|
|
2183
|
+
Parameters
|
|
2184
|
+
----------
|
|
2185
|
+
guid: str
|
|
2186
|
+
GUID of the governance definition to get.
|
|
2187
|
+
|
|
2188
|
+
body: dict, optional
|
|
2189
|
+
A dictionary containing the definition of the governance definition to create.
|
|
2190
|
+
output_format: str
|
|
2191
|
+
The output format to use.
|
|
2192
|
+
|
|
2193
|
+
Returns
|
|
2194
|
+
-------
|
|
2195
|
+
|
|
2196
|
+
dict | str
|
|
2197
|
+
A list of information governance definition structures or a string if there are no elements found.
|
|
2198
|
+
|
|
2199
|
+
|
|
2200
|
+
Raises
|
|
2201
|
+
------
|
|
2202
|
+
PyegeriaInvalidParameterException
|
|
2203
|
+
one of the parameters is null or invalid or
|
|
2204
|
+
PyegeriaAPIException
|
|
2205
|
+
There is a problem adding the element properties to the metadata repository or
|
|
2206
|
+
PyegeriaUnauthorizedException
|
|
2207
|
+
the requesting user is not authorized to issue this request.
|
|
2208
|
+
|
|
2209
|
+
Notes
|
|
2210
|
+
----
|
|
2211
|
+
https://egeria-project.org/concepts/governance-definition
|
|
2212
|
+
|
|
2213
|
+
Body structure:
|
|
2214
|
+
{
|
|
2215
|
+
"class" : "GetRequestBody",
|
|
2216
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
|
2217
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
2218
|
+
"forLineage" : false,
|
|
2219
|
+
"forDuplicateProcessing" : false
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
"""
|
|
2223
|
+
|
|
2224
|
+
url = (
|
|
2225
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
2226
|
+
f"{self.url_marker}/governance-action-processes/{guid}/graph")
|
|
2227
|
+
type = element_type if element_type else "GovernanceDefinition"
|
|
2228
|
+
|
|
2229
|
+
response = await self._async_get_guid_request(url, _type=type,
|
|
2230
|
+
_gen_output=self._generate_governance_definition_output,
|
|
2231
|
+
output_format=output_format, report_spec=report_spec,
|
|
2232
|
+
body=body)
|
|
2233
|
+
|
|
2234
|
+
return response
|
|
2235
|
+
|
|
2236
|
+
@dynamic_catch
|
|
2237
|
+
def get_governance_process_graph(self, guid: str, element_type: Optional[str] = None, body: dict = None,
|
|
2238
|
+
output_format: str = "JSON",
|
|
2239
|
+
report_spec: dict = None) -> dict | str:
|
|
2240
|
+
|
|
2241
|
+
""" Retrieve the governance action process metadata element with the supplied unique identifier
|
|
2242
|
+
along with the flow definition describing its implementation.
|
|
2243
|
+
|
|
2244
|
+
Parameters
|
|
2245
|
+
----------
|
|
2246
|
+
guid: str
|
|
2247
|
+
GUID of the governance definition to get.
|
|
2248
|
+
|
|
2249
|
+
body: dict, optional
|
|
2250
|
+
A dictionary containing the definition of the governance definition to create.
|
|
2251
|
+
output_format: str, default = "JSON"
|
|
2252
|
+
The output format to use.
|
|
2253
|
+
|
|
2254
|
+
Returns
|
|
2255
|
+
-------
|
|
2256
|
+
|
|
2257
|
+
dict | str
|
|
2258
|
+
A list of information governance definition structures or a string if there are no elements found.
|
|
2259
|
+
|
|
2260
|
+
|
|
2261
|
+
Raises
|
|
2262
|
+
------
|
|
2263
|
+
PyegeriaInvalidParameterException
|
|
2264
|
+
one of the parameters is null or invalid or
|
|
2265
|
+
PyegeriaAPIException
|
|
2266
|
+
There is a problem adding the element properties to the metadata repository or
|
|
2267
|
+
PyegeriaUnauthorizedException
|
|
2268
|
+
the requesting user is not authorized to issue this request.
|
|
2269
|
+
|
|
2270
|
+
Notes
|
|
2271
|
+
----
|
|
2272
|
+
https://egeria-project.org/concepts/governance-definition
|
|
2273
|
+
Body structure:
|
|
2274
|
+
{
|
|
2275
|
+
"class" : "GetRequestBody",
|
|
2276
|
+
"asOfTime" : "{{$isoTimestamp}}",
|
|
2277
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
2278
|
+
"forLineage" : false,
|
|
2279
|
+
"forDuplicateProcessing" : false
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
"""
|
|
2283
|
+
|
|
2284
|
+
loop = asyncio.get_event_loop()
|
|
2285
|
+
response = loop.run_until_complete(self._async_get_governance_process_graph(guid, element_type, body,
|
|
2286
|
+
output_format,
|
|
2287
|
+
report_spec))
|
|
2288
|
+
return response
|
|
2289
|
+
|
|
2290
|
+
@dynamic_catch
|
|
2291
|
+
async def _async_link_design_to_implementation(self, design_desc_guid: str, implementation_guid: str,
|
|
2292
|
+
body: Optional[dict | NewRelationshipRequestBody] = None) -> None:
|
|
2293
|
+
""" Attach a design object such as a solution component or governance definition to its implementation via the
|
|
2294
|
+
ImplementedBy relationship. Request body is optional. Async Version.
|
|
2295
|
+
https://egeria-project.org/types/7/0737-Solution-Implementation/
|
|
2296
|
+
|
|
2297
|
+
Parameters
|
|
2298
|
+
----------
|
|
2299
|
+
design_desc_guid: str
|
|
2300
|
+
guid of the design element to link.
|
|
2301
|
+
implementation_guid: str
|
|
2302
|
+
guid of the implementation definition to link.
|
|
2303
|
+
body: dict, optional
|
|
2304
|
+
The body describing the link between the two segments.
|
|
2305
|
+
|
|
2306
|
+
Returns
|
|
2307
|
+
-------
|
|
2308
|
+
None
|
|
2309
|
+
|
|
2310
|
+
Raises
|
|
2311
|
+
------
|
|
2312
|
+
PyegeriaInvalidParameterException
|
|
2313
|
+
one of the parameters is null or invalid or
|
|
2314
|
+
PyegeriaAPIException
|
|
2315
|
+
There is a problem adding the element properties to the metadata repository or
|
|
2316
|
+
PyegeriaUnauthorizedException
|
|
2317
|
+
the requesting user is not authorized to issue this request.
|
|
2318
|
+
|
|
2319
|
+
Notes
|
|
2320
|
+
----
|
|
2321
|
+
|
|
2322
|
+
Body structure:
|
|
2323
|
+
{
|
|
2324
|
+
"class" : "RelationshipRequestBody",
|
|
2325
|
+
"externalSourceGUID": "add guid here",
|
|
2326
|
+
"externalSourceName": "add qualified name here",
|
|
2327
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
2328
|
+
"forLineage" : false,
|
|
2329
|
+
"forDuplicateProcessing" : false,
|
|
2330
|
+
"properties": {
|
|
2331
|
+
"class": "ImplementedByProperties",
|
|
2332
|
+
"designStep": "",
|
|
2333
|
+
"role": "",
|
|
2334
|
+
"transformation": "",
|
|
2335
|
+
"description": "",
|
|
2336
|
+
"iscQualifiedName": "",
|
|
2337
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
2338
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
2339
|
+
}
|
|
2340
|
+
}
|
|
2341
|
+
"""
|
|
2342
|
+
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/designs/"
|
|
2343
|
+
f"{design_desc_guid}/implementations/{implementation_guid}/attach")
|
|
2344
|
+
await self._async_new_relationship_request(url, "ImplementedByProperties", body)
|
|
2345
|
+
logger.info(f"Linked design to implementation: {design_desc_guid} -> {implementation_guid}")
|
|
2346
|
+
|
|
2347
|
+
@dynamic_catch
|
|
2348
|
+
def link_design_to_implementation(self, design_desc_guid: str, implementation_guid: str,
|
|
2349
|
+
body: Optional[dict | NewRelationshipRequestBody] = None) -> None:
|
|
2350
|
+
""" Attach a design object such as a solution component or governance definition to its implementation via the
|
|
2351
|
+
ImplementedBy relationship. Request body is optional.
|
|
2352
|
+
https://egeria-project.org/types/7/0737-Solution-Implementation/
|
|
2353
|
+
|
|
2354
|
+
Parameters
|
|
2355
|
+
----------
|
|
2356
|
+
design_desc_guid: str
|
|
2357
|
+
guid of the design element to link.
|
|
2358
|
+
implementation_guid: str
|
|
2359
|
+
guid of the implementation definition to link.
|
|
2360
|
+
body: dict, optional
|
|
2361
|
+
The body describing the link between the two segments.
|
|
2362
|
+
|
|
2363
|
+
Returns
|
|
2364
|
+
-------
|
|
2365
|
+
None
|
|
2366
|
+
|
|
2367
|
+
Raises
|
|
2368
|
+
------
|
|
2369
|
+
PyegeriaInvalidParameterException
|
|
2370
|
+
one of the parameters is null or invalid or
|
|
2371
|
+
PyegeriaAPIException
|
|
2372
|
+
There is a problem adding the element properties to the metadata repository or
|
|
2373
|
+
PyegeriaUnauthorizedException
|
|
2374
|
+
the requesting user is not authorized to issue this request.
|
|
2375
|
+
|
|
2376
|
+
Notes
|
|
2377
|
+
----
|
|
2378
|
+
|
|
2379
|
+
Body structure:
|
|
2380
|
+
{
|
|
2381
|
+
"class" : "RelationshipRequestBody",
|
|
2382
|
+
"externalSourceGUID": "add guid here",
|
|
2383
|
+
"externalSourceName": "add qualified name here",
|
|
2384
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
2385
|
+
"forLineage" : false,
|
|
2386
|
+
"forDuplicateProcessing" : false,
|
|
2387
|
+
"properties": {
|
|
2388
|
+
"class": "ImplementedByProperties",
|
|
2389
|
+
"designStep": "",
|
|
2390
|
+
"role": "",
|
|
2391
|
+
"transformation": "",
|
|
2392
|
+
"description": "",
|
|
2393
|
+
"iscQualifiedName": "",
|
|
2394
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
2395
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
"""
|
|
2399
|
+
loop = asyncio.get_event_loop()
|
|
2400
|
+
loop.run_until_complete(self._async_link_design_to_implementation(design_desc_guid, implementation_guid, body))
|
|
2401
|
+
|
|
2402
|
+
@dynamic_catch
|
|
2403
|
+
async def _async_detach_design_from_implementation(self, design_desc_guid: str, implementation_guid: str,
|
|
2404
|
+
body: Optional[dict | DeleteElementRequestBody] = None) -> None:
|
|
2405
|
+
""" Detach a governance definition from its implementation. Async Version.
|
|
2406
|
+
|
|
2407
|
+
Parameters
|
|
2408
|
+
----------
|
|
2409
|
+
design_desc_guid: str
|
|
2410
|
+
guid of the technical control to link.
|
|
2411
|
+
implementation_guid: str
|
|
2412
|
+
guid of the implementation definition to unlink.
|
|
2413
|
+
body: dict
|
|
2414
|
+
The body describing the link between the two segments.
|
|
2415
|
+
|
|
2416
|
+
Returns
|
|
2417
|
+
-------
|
|
2418
|
+
None
|
|
2419
|
+
|
|
2420
|
+
Raises
|
|
2421
|
+
------
|
|
2422
|
+
PyegeriaInvalidParameterException
|
|
2423
|
+
one of the parameters is null or invalid or
|
|
2424
|
+
PyegeriaAPIException
|
|
2425
|
+
There is a problem adding the element properties to the metadata repository or
|
|
2426
|
+
PyegeriaUnauthorizedException
|
|
2427
|
+
the requesting user is not authorized to issue this request.
|
|
2428
|
+
|
|
2429
|
+
Notes
|
|
2430
|
+
----
|
|
2431
|
+
|
|
2432
|
+
Body structure:
|
|
2433
|
+
{
|
|
2434
|
+
"class": "MetadataSourceRequestBody",
|
|
2435
|
+
"externalSourceGUID": "string",
|
|
2436
|
+
"externalSourceName": "string",
|
|
2437
|
+
"forLineage": true,
|
|
2438
|
+
"forDuplicateProcessing": true,
|
|
2439
|
+
"effectiveTime": "2025-06-13T15:13:31.339Z"
|
|
2440
|
+
}
|
|
2441
|
+
"""
|
|
2442
|
+
|
|
2443
|
+
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/designs/"
|
|
2444
|
+
f"{design_desc_guid}/implementations/{implementation_guid}/detach")
|
|
2445
|
+
await self._async_delete_relationship_request(url, body)
|
|
2446
|
+
logger.info(
|
|
2447
|
+
f"Detached design from implementation: {design_desc_guid} -> {implementation_guid}")
|
|
2448
|
+
|
|
2449
|
+
@dynamic_catch
|
|
2450
|
+
def detach_design_from_implementation(self, design_desc_guid: str, implementation_guid: str,
|
|
2451
|
+
body: Optional[dict | DeleteElementRequestBody] = None) -> None:
|
|
2452
|
+
""" Detach a governance definition from its implementation. Request body is optional.
|
|
2453
|
+
|
|
2454
|
+
Parameters
|
|
2455
|
+
----------
|
|
2456
|
+
design_descl_guid: str
|
|
2457
|
+
guid of the technical control to unlink.
|
|
2458
|
+
implementation_guid: str
|
|
2459
|
+
guid of the implementation definition to unlink.
|
|
2460
|
+
body: dict, optional
|
|
2461
|
+
The body describing the link between the two segments.
|
|
2462
|
+
|
|
2463
|
+
Returns
|
|
2464
|
+
-------
|
|
2465
|
+
None
|
|
2466
|
+
|
|
2467
|
+
Raises
|
|
2468
|
+
------
|
|
2469
|
+
PyegeriaInvalidParameterException
|
|
2470
|
+
one of the parameters is null or invalid or
|
|
2471
|
+
PyegeriaAPIException
|
|
2472
|
+
There is a problem adding the element properties to the metadata repository or
|
|
2473
|
+
PyegeriaUnauthorizedException
|
|
2474
|
+
the requesting user is not authorized to issue this request.
|
|
2475
|
+
|
|
2476
|
+
Notes
|
|
2477
|
+
----
|
|
2478
|
+
|
|
2479
|
+
Body structure:
|
|
2480
|
+
{
|
|
2481
|
+
"externalSourceGUID": "string",
|
|
2482
|
+
"externalSourceName": "string",
|
|
2483
|
+
"forLineage": true,
|
|
2484
|
+
"forDuplicateProcessing": true,
|
|
2485
|
+
"effectiveTime": "2025-06-13T15:13:31.339Z"
|
|
2486
|
+
}
|
|
2487
|
+
"""
|
|
2488
|
+
loop = asyncio.get_event_loop()
|
|
2489
|
+
loop.run_until_complete(
|
|
2490
|
+
self._async_detach_design_from_implementation(design_desc_guid, implementation_guid, body))
|
|
2491
|
+
|
|
2492
|
+
@dynamic_catch
|
|
2493
|
+
async def _async_link_implementation_resource(self, design_desc_guid: str, implementation_guid: str,
|
|
2494
|
+
body: Optional[dict | NewRelationshipRequestBody] = None) -> None:
|
|
2495
|
+
""" Attach a design object such as a solution component or governance definition to one of its implementation
|
|
2496
|
+
resource via the ImplementationResource relationship. Request body is optional.
|
|
2497
|
+
https://egeria-project.org/types/7/0737-Solution-Implementation/
|
|
2498
|
+
|
|
2499
|
+
Parameters
|
|
2500
|
+
----------
|
|
2501
|
+
design_desc_guid: str
|
|
2502
|
+
guid of the design element to link.
|
|
2503
|
+
implementation_guid: str
|
|
2504
|
+
guid of the implementation definition to link.
|
|
2505
|
+
body: dict, optional
|
|
2506
|
+
The body describing the link between the two segments.
|
|
2507
|
+
|
|
2508
|
+
Returns
|
|
2509
|
+
-------
|
|
2510
|
+
None
|
|
2511
|
+
|
|
2512
|
+
Raises
|
|
2513
|
+
------
|
|
2514
|
+
PyegeriaInvalidParameterException
|
|
2515
|
+
one of the parameters is null or invalid or
|
|
2516
|
+
PyegeriaAPIException
|
|
2517
|
+
There is a problem adding the element properties to the metadata repository or
|
|
2518
|
+
PyegeriaUnauthorizedException
|
|
2519
|
+
the requesting user is not authorized to issue this request.
|
|
2520
|
+
|
|
2521
|
+
Notes
|
|
2522
|
+
----
|
|
2523
|
+
|
|
2524
|
+
Body structure:
|
|
2525
|
+
{
|
|
2526
|
+
"class" : "RelationshipRequestBody",
|
|
2527
|
+
"externalSourceGUID": "add guid here",
|
|
2528
|
+
"externalSourceName": "add qualified name here",
|
|
2529
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
2530
|
+
"forLineage" : false,
|
|
2531
|
+
"forDuplicateProcessing" : false,
|
|
2532
|
+
"properties": {
|
|
2533
|
+
"class": "ImplementedByProperties",
|
|
2534
|
+
"designStep": "",
|
|
2535
|
+
"role": "",
|
|
2536
|
+
"transformation": "",
|
|
2537
|
+
"description": "",
|
|
2538
|
+
"iscQualifiedName": "",
|
|
2539
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
2540
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
"""
|
|
2544
|
+
|
|
2545
|
+
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/designs/"
|
|
2546
|
+
f"{design_desc_guid}/implementation-resources/{implementation_guid}/attach")
|
|
2547
|
+
await self._async_new_relationship_request(url, "ImplementationResourceProperties", body)
|
|
2548
|
+
logger.info(f"Linked design to implementation resource: {design_desc_guid} -> {implementation_guid}")
|
|
2549
|
+
|
|
2550
|
+
@dynamic_catch
|
|
2551
|
+
def link_implementation_resource(self, design_desc_guid: str, implementation_guid: str,
|
|
2552
|
+
body: Optional[dict | NewRelationshipRequestBody] = None) -> None:
|
|
2553
|
+
""" Attach a design object such as a solution component or governance definition to its implementation via the
|
|
2554
|
+
ImplementedBy relationship. Request body is optional.
|
|
2555
|
+
https://egeria-project.org/types/7/0737-Solution-Implementation/
|
|
2556
|
+
|
|
2557
|
+
Parameters
|
|
2558
|
+
----------
|
|
2559
|
+
design_desc_guid: str
|
|
2560
|
+
guid of the design element to link.
|
|
2561
|
+
implementation_guid: str
|
|
2562
|
+
guid of the implementation definition to link.
|
|
2563
|
+
body: dict, optional
|
|
2564
|
+
The body describing the link between the two segments.
|
|
2565
|
+
|
|
2566
|
+
Returns
|
|
2567
|
+
-------
|
|
2568
|
+
None
|
|
2569
|
+
|
|
2570
|
+
Raises
|
|
2571
|
+
------
|
|
2572
|
+
PyegeriaInvalidParameterException
|
|
2573
|
+
one of the parameters is null or invalid or
|
|
2574
|
+
PyegeriaAPIException
|
|
2575
|
+
There is a problem adding the element properties to the metadata repository or
|
|
2576
|
+
PyegeriaUnauthorizedException
|
|
2577
|
+
the requesting user is not authorized to issue this request.
|
|
2578
|
+
|
|
2579
|
+
Notes
|
|
2580
|
+
----
|
|
2581
|
+
|
|
2582
|
+
Body structure:
|
|
2583
|
+
{
|
|
2584
|
+
"class" : "RelationshipRequestBody",
|
|
2585
|
+
"externalSourceGUID": "add guid here",
|
|
2586
|
+
"externalSourceName": "add qualified name here",
|
|
2587
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
2588
|
+
"forLineage" : false,
|
|
2589
|
+
"forDuplicateProcessing" : false,
|
|
2590
|
+
"properties": {
|
|
2591
|
+
"class": "ImplementedByProperties",
|
|
2592
|
+
"designStep": "",
|
|
2593
|
+
"role": "",
|
|
2594
|
+
"transformation": "",
|
|
2595
|
+
"description": "",
|
|
2596
|
+
"iscQualifiedName": "",
|
|
2597
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
2598
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
"""
|
|
2602
|
+
loop = asyncio.get_event_loop()
|
|
2603
|
+
loop.run_until_complete(self._async_link_implementation_resource(design_desc_guid, implementation_guid, body))
|
|
2604
|
+
|
|
2605
|
+
@dynamic_catch
|
|
2606
|
+
async def _async_detach_implementation_resource(self, design_desc_guid: str, implementation_guid: str,
|
|
2607
|
+
body: Optional[dict | DeleteRelationshipRequestBody] = None) -> None:
|
|
2608
|
+
""" Detach a design object such as a solution component or governance definition from one of its implementation
|
|
2609
|
+
resources. Request body is optional. Async version.
|
|
2610
|
+
|
|
2611
|
+
Parameters
|
|
2612
|
+
----------
|
|
2613
|
+
design_desc_guid: str
|
|
2614
|
+
guid of the technical control to link.
|
|
2615
|
+
implementation_guid: str
|
|
2616
|
+
guid of the implementation definition to unlink.
|
|
2617
|
+
body: dict
|
|
2618
|
+
The body describing the link between the two segments.
|
|
2619
|
+
|
|
2620
|
+
Returns
|
|
2621
|
+
-------
|
|
2622
|
+
None
|
|
2623
|
+
|
|
2624
|
+
Raises
|
|
2625
|
+
------
|
|
2626
|
+
PyegeriaInvalidParameterException
|
|
2627
|
+
one of the parameters is null or invalid or
|
|
2628
|
+
PyegeriaAPIException
|
|
2629
|
+
There is a problem adding the element properties to the metadata repository or
|
|
2630
|
+
PyegeriaUnauthorizedException
|
|
2631
|
+
the requesting user is not authorized to issue this request.
|
|
2632
|
+
|
|
2633
|
+
Notes
|
|
2634
|
+
----
|
|
2635
|
+
|
|
2636
|
+
Body structure:
|
|
2637
|
+
{
|
|
2638
|
+
"class": "MetadataSourceRequestBody",
|
|
2639
|
+
"externalSourceGUID": "string",
|
|
2640
|
+
"externalSourceName": "string",
|
|
2641
|
+
"forLineage": true,
|
|
2642
|
+
"forDuplicateProcessing": true,
|
|
2643
|
+
"effectiveTime": "2025-06-13T15:13:31.339Z"
|
|
2644
|
+
}
|
|
2645
|
+
"""
|
|
2646
|
+
|
|
2647
|
+
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/designs/"
|
|
2648
|
+
f"{design_desc_guid}/implementation-resources/{implementation_guid}/detach")
|
|
2649
|
+
await self._async_delete_relationship_request(url, body)
|
|
2650
|
+
logger.info(
|
|
2651
|
+
f"Detached design from implementation resource: {design_desc_guid} -> {implementation_guid}")
|
|
2652
|
+
|
|
2653
|
+
def detach_implementation_resource(self, design_desc_guid: str, implementation_guid: str,
|
|
2654
|
+
body: Optional[dict | DeleteRelationshipRequestBody] = None) -> None:
|
|
2655
|
+
""" Detach a design object such as a solution component or governance definition from one of its implementation
|
|
2656
|
+
resources. Request body is optional.
|
|
2657
|
+
|
|
2658
|
+
Parameters
|
|
2659
|
+
----------
|
|
2660
|
+
design_desc_guid: str
|
|
2661
|
+
guid of the technical control to link.
|
|
2662
|
+
implementation_guid: str
|
|
2663
|
+
guid of the implementation definition to unlink.
|
|
2664
|
+
body: dict, optional
|
|
2665
|
+
The body describing the link between the two segments.
|
|
2666
|
+
|
|
2667
|
+
Returns
|
|
2668
|
+
-------
|
|
2669
|
+
None
|
|
2670
|
+
|
|
2671
|
+
Raises
|
|
2672
|
+
------
|
|
2673
|
+
PyegeriaInvalidParameterException
|
|
2674
|
+
one of the parameters is null or invalid or
|
|
2675
|
+
PyegeriaAPIException
|
|
2676
|
+
There is a problem adding the element properties to the metadata repository or
|
|
2677
|
+
PyegeriaUnauthorizedException
|
|
2678
|
+
the requesting user is not authorized to issue this request.
|
|
2679
|
+
|
|
2680
|
+
Notes
|
|
2681
|
+
----
|
|
2682
|
+
|
|
2683
|
+
Body structure:
|
|
2684
|
+
{
|
|
2685
|
+
"class": "MetadataSourceRequestBody",
|
|
2686
|
+
"externalSourceGUID": "string",
|
|
2687
|
+
"externalSourceName": "string",
|
|
2688
|
+
"forLineage": true,
|
|
2689
|
+
"forDuplicateProcessing": true,
|
|
2690
|
+
"effectiveTime": "2025-06-13T15:13:31.339Z"
|
|
2691
|
+
}
|
|
2692
|
+
"""
|
|
2693
|
+
loop = asyncio.get_event_loop()
|
|
2694
|
+
loop.run_until_complete(self._async_detach_implementation_resource(design_desc_guid, implementation_guid, body))
|
|
2695
|
+
|
|
2696
|
+
|
|
2697
|
+
@dynamic_catch
|
|
2698
|
+
async def _async_link_governance_results(self, gov_metric_guid: str, data_asset_guid: str,
|
|
2699
|
+
body: Optional[dict | NewRelationshipRequestBody] = None) -> None:
|
|
2700
|
+
""" Attach a governance metric to a data asset that describes where its measurements are kept.
|
|
2701
|
+
Request body is optional. https://egeria-project.org/concepts/governance-definition/
|
|
2702
|
+
|
|
2703
|
+
Async Version.
|
|
2704
|
+
|
|
2705
|
+
Parameters
|
|
2706
|
+
----------
|
|
2707
|
+
gov_metric_guid: str
|
|
2708
|
+
guid of the governance metric to link.
|
|
2709
|
+
data_asset_guid: str
|
|
2710
|
+
guid of the data asset to link.
|
|
2711
|
+
body: dict, optional
|
|
2712
|
+
The body describing the link between the two elements.
|
|
2713
|
+
|
|
2714
|
+
Returns
|
|
2715
|
+
-------
|
|
2716
|
+
None
|
|
2717
|
+
|
|
2718
|
+
Raises
|
|
2719
|
+
------
|
|
2720
|
+
PyegeriaException
|
|
2721
|
+
ValidationError
|
|
2722
|
+
|
|
2723
|
+
Notes
|
|
2724
|
+
----
|
|
2725
|
+
|
|
2726
|
+
Body structure:
|
|
2727
|
+
{
|
|
2728
|
+
"class" : "NewRelationshipRequestBody",
|
|
2729
|
+
"properties": {
|
|
2730
|
+
"class": "GovernanceResultsProperties",
|
|
2731
|
+
"description": "",
|
|
2732
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
2733
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
2734
|
+
},
|
|
2735
|
+
"externalSourceGUID": "add guid here",
|
|
2736
|
+
"externalSourceName": "add qualified name here",
|
|
2737
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
2738
|
+
"forLineage" : false,
|
|
2739
|
+
"forDuplicateProcessing" : false
|
|
2740
|
+
}
|
|
2741
|
+
"""
|
|
2742
|
+
|
|
2743
|
+
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/governance-metrics/"
|
|
2744
|
+
f"{gov_metric_guid}/measurements/{data_asset_guid}/attach"
|
|
2745
|
+
)
|
|
2746
|
+
await self._async_new_relationship_request(url, "GovernanceResultsProperties", body)
|
|
2747
|
+
logger.info(f"Linked governance metric to a data asset containing its measurements.: {gov_metric_guid} -> {data_asset_guid}")
|
|
2748
|
+
|
|
2749
|
+
@dynamic_catch
|
|
2750
|
+
def link_governance_results(self, gov_metric_guid: str, data_asset_guid: str,
|
|
2751
|
+
body: Optional[dict | NewRelationshipRequestBody] = None) -> None:
|
|
2752
|
+
""" Attach a governance metric to a data asset that describes where its measurements are kept.
|
|
2753
|
+
Request body is optional. https://egeria-project.org/concepts/governance-definition/
|
|
2754
|
+
|
|
2755
|
+
|
|
2756
|
+
Parameters
|
|
2757
|
+
----------
|
|
2758
|
+
gov_metric_guid: str
|
|
2759
|
+
guid of the governance metric to link.
|
|
2760
|
+
data_asset_guid: str
|
|
2761
|
+
guid of the data asset to link.
|
|
2762
|
+
body: dict, optional
|
|
2763
|
+
The body describing the link between the two elements.
|
|
2764
|
+
|
|
2765
|
+
Returns
|
|
2766
|
+
-------
|
|
2767
|
+
None
|
|
2768
|
+
|
|
2769
|
+
Raises
|
|
2770
|
+
------
|
|
2771
|
+
PyegeriaException
|
|
2772
|
+
ValidationError
|
|
2773
|
+
|
|
2774
|
+
Notes
|
|
2775
|
+
----
|
|
2776
|
+
|
|
2777
|
+
Body structure:
|
|
2778
|
+
{
|
|
2779
|
+
"class" : "NewRelationshipRequestBody",
|
|
2780
|
+
"properties": {
|
|
2781
|
+
"class": "GovernanceResultsProperties",
|
|
2782
|
+
"description": "",
|
|
2783
|
+
"effectiveFrom": "{{$isoTimestamp}}",
|
|
2784
|
+
"effectiveTo": "{{$isoTimestamp}}"
|
|
2785
|
+
},
|
|
2786
|
+
"externalSourceGUID": "add guid here",
|
|
2787
|
+
"externalSourceName": "add qualified name here",
|
|
2788
|
+
"effectiveTime" : "{{$isoTimestamp}}",
|
|
2789
|
+
"forLineage" : false,
|
|
2790
|
+
"forDuplicateProcessing" : false
|
|
2791
|
+
}
|
|
2792
|
+
"""
|
|
2793
|
+
loop = asyncio.get_event_loop()
|
|
2794
|
+
loop.run_until_complete(self._async_link_governance_results(gov_metric_guid, data_asset_guid, body))
|
|
2795
|
+
|
|
2796
|
+
@dynamic_catch
|
|
2797
|
+
async def _async_detach_governance_results(self, gov_metric_guid: str, data_asset_guid: str, body: Optional[dict | DeleteRelationshipRequestBody] = None) -> None:
|
|
2798
|
+
""" Detach an governance metric from its measurements data set. Request body is optional.
|
|
2799
|
+
https://egeria-project.org/concepts/governance-definition/ Async version.
|
|
2800
|
+
|
|
2801
|
+
Parameters
|
|
2802
|
+
----------
|
|
2803
|
+
gov_metric_guid: str
|
|
2804
|
+
guid of the governance metric to link.
|
|
2805
|
+
data_asset_guid: str
|
|
2806
|
+
guid of the data asset to link.
|
|
2807
|
+
body: dict, optional
|
|
2808
|
+
The body describing the link between the two elements.
|
|
2809
|
+
|
|
2810
|
+
Returns
|
|
2811
|
+
-------
|
|
2812
|
+
None
|
|
2813
|
+
|
|
2814
|
+
Raises
|
|
2815
|
+
------
|
|
2816
|
+
PyegeriaException
|
|
2817
|
+
ValidationError
|
|
2818
|
+
|
|
2819
|
+
Notes
|
|
2820
|
+
----
|
|
2821
|
+
|
|
2822
|
+
Body structure:
|
|
2823
|
+
{
|
|
2824
|
+
"class": "MetadataSourceRequestBody",
|
|
2825
|
+
"externalSourceGUID": "string",
|
|
2826
|
+
"externalSourceName": "string",
|
|
2827
|
+
"forLineage": true,
|
|
2828
|
+
"forDuplicateProcessing": true,
|
|
2829
|
+
"effectiveTime": "2025-06-13T15:13:31.339Z"
|
|
2830
|
+
}
|
|
2831
|
+
"""
|
|
2832
|
+
|
|
2833
|
+
url = (f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/{self.url_marker}/governance-metrics/"
|
|
2834
|
+
f"{gov_metric_guid}/measurements/{data_asset_guid}/detach")
|
|
2835
|
+
await self._async_delete_relationship_request(url, body)
|
|
2836
|
+
logger.info(
|
|
2837
|
+
f"Detached governance metric from the asset where measurements were stored: {gov_metric_guid} -> {data_asset_guid}")
|
|
2838
|
+
|
|
2839
|
+
def detach_governance_results(self, gov_metric_guid: str, data_asset_guid: str,
|
|
2840
|
+
body: Optional[dict | DeleteRelationshipRequestBody] = None) -> None:
|
|
2841
|
+
""" Detach an governance metric from its measurements data set. Request body is optional.
|
|
2842
|
+
https://egeria-project.org/concepts/governance-definition/
|
|
2843
|
+
|
|
2844
|
+
Parameters
|
|
2845
|
+
----------
|
|
2846
|
+
gov_metric_guid: str
|
|
2847
|
+
guid of the governance metric to link.
|
|
2848
|
+
data_asset_guid: str
|
|
2849
|
+
guid of the data asset to link.
|
|
2850
|
+
body: dict, optional
|
|
2851
|
+
The body describing the link between the two elements.
|
|
2852
|
+
|
|
2853
|
+
Returns
|
|
2854
|
+
-------
|
|
2855
|
+
None
|
|
2856
|
+
|
|
2857
|
+
Raises
|
|
2858
|
+
------
|
|
2859
|
+
PyegeriaException
|
|
2860
|
+
ValidationError
|
|
2861
|
+
|
|
2862
|
+
Notes
|
|
2863
|
+
----
|
|
2864
|
+
|
|
2865
|
+
Body structure:
|
|
2866
|
+
{
|
|
2867
|
+
"class": "MetadataSourceRequestBody",
|
|
2868
|
+
"externalSourceGUID": "string",
|
|
2869
|
+
"externalSourceName": "string",
|
|
2870
|
+
"forLineage": true,
|
|
2871
|
+
"forDuplicateProcessing": true,
|
|
2872
|
+
"effectiveTime": "2025-06-13T15:13:31.339Z"
|
|
2873
|
+
}
|
|
2874
|
+
"""
|
|
2875
|
+
loop = asyncio.get_event_loop()
|
|
2876
|
+
loop.run_until_complete(self._async_detach_governance_results(gov_metric_guid, data_asset_guid, data_asset_guid, body))
|
|
2877
|
+
|
|
2878
|
+
# async def _async_get_gov_def_in_context(self, guid: str, body: dict = None, output_format: str = "JSON",
|
|
2879
|
+
# start_from: int = 0,
|
|
2880
|
+
# page_size: int = 0) -> list[dict] | str:
|
|
2881
|
+
# """ Get governance definition in context. Brings back the graph.
|
|
2882
|
+
# Async version.
|
|
2883
|
+
#
|
|
2884
|
+
# Parameters
|
|
2885
|
+
# ----------
|
|
2886
|
+
# guid: str
|
|
2887
|
+
# GUID of the governance definition to get.
|
|
2888
|
+
#
|
|
2889
|
+
# body: dict
|
|
2890
|
+
# A dictionary containing the definition of the governance definition to get.
|
|
2891
|
+
# output_format: str
|
|
2892
|
+
# The output format to use.
|
|
2893
|
+
# start_from: int, default= 0
|
|
2894
|
+
# Indicates the start of the page range.
|
|
2895
|
+
# page_size: int, default = 0
|
|
2896
|
+
# The page size to use.
|
|
2897
|
+
#
|
|
2898
|
+
# Returns
|
|
2899
|
+
# -------
|
|
2900
|
+
#
|
|
2901
|
+
# list[dict] | str
|
|
2902
|
+
# A list of information governance definition structures or a string if there are no elements found.
|
|
2903
|
+
#
|
|
2904
|
+
#
|
|
2905
|
+
# Raises
|
|
2906
|
+
# ------
|
|
2907
|
+
# PyegeriaInvalidParameterException
|
|
2908
|
+
# one of the parameters is null or invalid or
|
|
2909
|
+
# PyegeriaAPIException
|
|
2910
|
+
# There is a problem adding the element properties to the metadata repository or
|
|
2911
|
+
# PyegeriaUnauthorizedException
|
|
2912
|
+
# the requesting user is not authorized to issue this request.
|
|
2913
|
+
#
|
|
2914
|
+
# Notes
|
|
2915
|
+
# ----
|
|
2916
|
+
# https://egeria-project.org/concepts/governance-definition
|
|
2917
|
+
#
|
|
2918
|
+
# Body structure:
|
|
2919
|
+
# {
|
|
2920
|
+
# "forLineage": true,
|
|
2921
|
+
# "forDuplicateProcessing": true,
|
|
2922
|
+
# "effectiveTime": "2025-06-13T14:12:44.896Z",
|
|
2923
|
+
# "limitResultsByStatus": [
|
|
2924
|
+
# "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}"
|
|
2925
|
+
# ],
|
|
2926
|
+
# "asOfTime": "2025-06-13T14:12:44.896Z",
|
|
2927
|
+
# "sequencingOrder": "SequencingOrder{Any Order}",
|
|
2928
|
+
# "sequencingProperty": "string"
|
|
2929
|
+
# }
|
|
2930
|
+
#
|
|
2931
|
+
# """
|
|
2932
|
+
# possible_query_params = query_string([("startFrom", start_from), ("pageSize", page_size)])
|
|
2933
|
+
#
|
|
2934
|
+
# url = (
|
|
2935
|
+
# f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/"
|
|
2936
|
+
# f"{self.url_marker}/governance-definitions/"
|
|
2937
|
+
# f"{guid}/in-context{possible_query_params}")
|
|
2938
|
+
#
|
|
2939
|
+
# if body:
|
|
2940
|
+
# response = await self._async_make_request("POST", url, body_slimmer(body))
|
|
2941
|
+
# else:
|
|
2942
|
+
# response = await self._async_make_request("POST", url)
|
|
2943
|
+
#
|
|
2944
|
+
# element = response.json().get("element", NO_ELEMENTS_FOUND)
|
|
2945
|
+
# if output_format != 'JSON': # return a simplified markdown representation
|
|
2946
|
+
# return self.generate_governance_definition_output(element, "", output_format)
|
|
2947
|
+
# return response.json().get("element", NO_ELEMENTS_FOUND)
|
|
2948
|
+
#
|
|
2949
|
+
# def get_gov_def_in_context(self, guid: str, body: dict = None, output_format: str = "JSON", start_from: int = 0,
|
|
2950
|
+
# page_size: int = 0) -> list[dict] | str:
|
|
2951
|
+
# """ Get governance definition in context. Brings back the graph.
|
|
2952
|
+
#
|
|
2953
|
+
# Parameters
|
|
2954
|
+
# ----------
|
|
2955
|
+
# guid: str
|
|
2956
|
+
# GUID of the governance definition to get.
|
|
2957
|
+
#
|
|
2958
|
+
# body: dict
|
|
2959
|
+
# A dictionary containing the definition of the governance definition to get.
|
|
2960
|
+
# output_format: str
|
|
2961
|
+
# The output format to use.
|
|
2962
|
+
# start_from: int, default= 0
|
|
2963
|
+
# Indicates the start of the page range.
|
|
2964
|
+
# page_size: int, default = 0
|
|
2965
|
+
# The page size to use.
|
|
2966
|
+
#
|
|
2967
|
+
# Returns
|
|
2968
|
+
# -------
|
|
2969
|
+
#
|
|
2970
|
+
# list[dict] | str
|
|
2971
|
+
# A list of information governance definition structures or a string if there are no elements found.
|
|
2972
|
+
#
|
|
2973
|
+
#
|
|
2974
|
+
# Raises
|
|
2975
|
+
# ------
|
|
2976
|
+
# PyegeriaInvalidParameterException
|
|
2977
|
+
# one of the parameters is null or invalid or
|
|
2978
|
+
# PyegeriaAPIException
|
|
2979
|
+
# There is a problem adding the element properties to the metadata repository or
|
|
2980
|
+
# PyegeriaUnauthorizedException
|
|
2981
|
+
# the requesting user is not authorized to issue this request.
|
|
2982
|
+
#
|
|
2983
|
+
# Notes
|
|
2984
|
+
# ----
|
|
2985
|
+
# https://egeria-project.org/concepts/governance-definition
|
|
2986
|
+
#
|
|
2987
|
+
# Body structure:
|
|
2988
|
+
# {
|
|
2989
|
+
# "forLineage": true,
|
|
2990
|
+
# "forDuplicateProcessing": true,
|
|
2991
|
+
# "effectiveTime": "2025-06-13T14:12:44.896Z",
|
|
2992
|
+
# "limitResultsByStatus": [
|
|
2993
|
+
# "InstanceStatus{ordinal=0, name='<Unknown>', description='Unknown instance status.'}"
|
|
2994
|
+
# ],
|
|
2995
|
+
# "asOfTime": "2025-06-13T14:12:44.896Z",
|
|
2996
|
+
# "sequencingOrder": "SequencingOrder{Any Order}",
|
|
2997
|
+
# "sequencingProperty": "string"
|
|
2998
|
+
# }
|
|
2999
|
+
#
|
|
3000
|
+
# """
|
|
3001
|
+
#
|
|
3002
|
+
# loop = asyncio.get_event_loop()
|
|
3003
|
+
# response = loop.run_until_complete(
|
|
3004
|
+
# self._async_get_gov_def_in_context(guid, body, output_format, start_from, page_size))
|
|
3005
|
+
# return response
|
|
3006
|
+
|
|
3007
|
+
|
|
3008
|
+
if __name__ == "__main__":
|
|
3009
|
+
print("Main-Metadata Explorer")
|