pyegeria 0.2.4__py3-none-any.whl → 5.3.0.dev3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyegeria/README.md +35 -0
- pyegeria/__init__.py +345 -14
- pyegeria/_client.py +376 -126
- pyegeria/_deprecated_gov_engine.py +451 -0
- pyegeria/_exceptions.py +6 -6
- pyegeria/_globals.py +7 -1
- pyegeria/_validators.py +9 -6
- pyegeria/asset_catalog_omvs.py +807 -0
- pyegeria/automated_curation_omvs.py +3760 -0
- pyegeria/classification_manager_omvs.py +5238 -0
- pyegeria/collection_manager_omvs.py +2727 -0
- pyegeria/commands/README.md +47 -0
- pyegeria/commands/__init__.py +22 -0
- pyegeria/commands/cat/README.md +16 -0
- pyegeria/commands/cat/__init__.py +1 -0
- pyegeria/commands/cat/exp_list_glossaries.py +156 -0
- pyegeria/commands/cat/get_asset_graph.py +319 -0
- pyegeria/commands/cat/get_collection.py +148 -0
- pyegeria/commands/cat/get_project_dependencies.py +168 -0
- pyegeria/commands/cat/get_project_structure.py +168 -0
- pyegeria/commands/cat/get_tech_type_elements.py +174 -0
- pyegeria/commands/cat/glossary_actions.py +362 -0
- pyegeria/commands/cat/list_assets.py +176 -0
- pyegeria/commands/cat/list_cert_types.py +194 -0
- pyegeria/commands/cat/list_collections.py +162 -0
- pyegeria/commands/cat/list_deployed_catalogs.py +217 -0
- pyegeria/commands/cat/list_deployed_database_schemas.py +251 -0
- pyegeria/commands/cat/list_deployed_databases.py +202 -0
- pyegeria/commands/cat/list_glossaries.py +150 -0
- pyegeria/commands/cat/list_projects.py +221 -0
- pyegeria/commands/cat/list_servers_deployed_imp.py +158 -0
- pyegeria/commands/cat/list_tech_type_elements.py +190 -0
- pyegeria/commands/cat/list_tech_types.py +140 -0
- pyegeria/commands/cat/list_terms.py +242 -0
- pyegeria/commands/cat/list_todos.py +189 -0
- pyegeria/commands/cat/list_user_ids.py +145 -0
- pyegeria/commands/cli/__init__.py +13 -0
- pyegeria/commands/cli/egeria.py +1844 -0
- pyegeria/commands/cli/egeria_cat.py +638 -0
- pyegeria/commands/cli/egeria_login_tui.py +313 -0
- pyegeria/commands/cli/egeria_my.py +248 -0
- pyegeria/commands/cli/egeria_ops.py +502 -0
- pyegeria/commands/cli/egeria_tech.py +618 -0
- pyegeria/commands/cli/ops_config.py +45 -0
- pyegeria/commands/cli/txt_custom_v2.tcss +19 -0
- pyegeria/commands/doc/README.md +145 -0
- pyegeria/commands/doc/Visual Command Reference/README.md +511 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/assets/asset-graph 2024-11-20 at 15.56.42.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/assets/assets-in-domain 2024-11-20 at 15.49.55@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/assets/elements-of-type 2024-11-20 at 16.01.35.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/assets/tech-type-elements 2024-11-20 at 16.05.05.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-data-catalogs 2024-12-17 at 15.43.27@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-data-catalogs-2024-11-20 at 16.17.43@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-schemas 2024-11-25 at 20.14.50@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-schemas 2024-12-17 at 15.48.38@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-servers 2024-11-25 at 20.21.25@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed-servers 2024-12-17 at 15.52.16@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/deployed-data/deployed_databases 2024-12-16 at 16.40.31@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/glossary/list-glossaries 2024-11-25 at 20.30.02.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/glossary/list-terms 2024-11-25 at 20.32.11.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/info/asset-types 2024-11-25 at 20.34.19@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/info/certification-types 2024-11-25 at 20.37.07.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/info/collection-graph 2024-12-12 at 11.33.18@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/info/list-collections 2024-12-10 at 14.25.51@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/info/list-todos 2024-12-12 at 11.46.30@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/info/list-user-ids 2024-12-12 at 11.51.09@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/info/tech-types 2024-12-12 at 11.37.20@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/projects/project_dependencies 2024-12-14 at 16.24.39@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/projects/project_structure 2024-12-14 at 16.21.35@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/cat/show/projects/projects 2024-12-14 at 16.18.10@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/hey_egeria tui 2024-12-16 at 16.58.22@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/my/show/my_profile 2024-12-14 at 16.29.27@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/my/show/my_roles 2024-12-14 at 16.32.10@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/my/show/my_todos 2024-12-15 at 16.24.13@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/my/show/open_todos 2024-12-14 at 16.36.12@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/ops/show/engines/list_engine_activity compressed 2024-12-15 at 16.48.48@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/ops/show/engines/monitor_engine_activity 2024-12-15 at 16.32.55@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/ops/show/engines/monitor_engine_activity compressed 2024-12-15 at 16.38.29@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/ops/show/engines/monitor_engine_status 2024-12-15 at 16.51.26.jpeg +0 -0
- pyegeria/commands/doc/Visual Command Reference/ops/show/integrations/monitor_integration_daemon_status 2024-12-15 at 16.57.12@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/ops/show/integrations/monitor_integration_targets 2024-12-15 at 17.02.19@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/ops/show/platforms/monitor_platform_status 2024-12-15 at 19.53.18@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/ops/show/servers/monitor_server_status 2024-12-15 at 19.59.39@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/ops/show/servers/monitor_server_status full 2024-12-15 at 20.01.57@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/ops/show/servers/monitor_startup_servers 2024-12-15 at 19.56.07@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/elements/get_anchored_elements 2024-12-15 at 21.25.41@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/elements/get_elements_of_om_type 2024-12-16 at 14.39.59@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/elements/info_for_guid 2024-12-16 at 11.35.29@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/elements/list_elements_by_om-type 2024-12-16 at 14.24.18@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/elements/list_elements_by_om-type extended 2024-12-16 at 14.28.46@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/elements/list_elements_of_om_type_by_classification 2024-12-16 at 14.35.26@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/elements/related_elements 2024-12-16 at 14.55.01@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/elements/show_related_specifications 2024-12-16 at 15.04.55@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/asset_types 2024-12-16 at 15.10.16@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/detailed_governance_action_processes 2024-12-16 at 15.16.26@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/governance_action_processes 2024-12-16 at 15.13.01@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/registered_services 2024-12-16 at 16.44.54@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/relationship_types 2024-12-16 at 16.20.34@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/relationship_types 2024-12-19 at 10.51.54@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/tech-info/valid_metadata_values 2024-12-16 at 15.31.56@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/tech-types/list_tech_type_template_specs 2024-12-16 at 16.03.22@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/tech-types/list_technology_types 2024-12-16 at 15.39.20@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/tech-types/tech_type_details 2024-12-16 at 15.37.21@2x.png +0 -0
- pyegeria/commands/doc/Visual Command Reference/tech/show/tech-types/tech_type_templates 2024-12-16 at 16.11.48@2x.png +0 -0
- pyegeria/commands/doc/glossary/basic-glossary-tui.md +109 -0
- pyegeria/commands/doc/glossary/images/delete-glossary-step1 2024-11-06 at 15.47.23@2x.png +0 -0
- pyegeria/commands/doc/glossary/images/delete-glossary-step2 2024-11-06 at 15.51.29@2x.png +0 -0
- pyegeria/commands/doc/glossary/images/delete-glossary-step3 2024-11-06 at 15.53.19@2x.png +0 -0
- pyegeria/commands/doc/glossary/images/delete-glossary-step4 2024-11-06 at 15.55.11@2x.png +0 -0
- pyegeria/commands/doc/glossary/images/out-create-glossary example 2024-11-05 at 20.38.04@2x.png +0 -0
- pyegeria/commands/doc/glossary/images/out-create-term 2024-11-06 at 20.48.29.png +0 -0
- pyegeria/commands/doc/glossary/images/out-delete-term 2024-11-07 at 03.57.25.png +0 -0
- pyegeria/commands/doc/glossary/images/out-display-terms-for-glossary-test 2024-11-06 at 20.51.28.png +0 -0
- pyegeria/commands/doc/glossary/images/out-export-example 2024-11-07 at 09.54.57.png +0 -0
- pyegeria/commands/doc/glossary/images/out-exported-terms 2024-11-06 at 21.06.32.png +0 -0
- pyegeria/commands/doc/glossary/images/out-glossary-list example 2024-11-05 at 20.41.02@2x.png +0 -0
- pyegeria/commands/doc/glossary/images/out-import-terms 2024-11-07 at 08.15.18.png +0 -0
- pyegeria/commands/doc/glossary/images/out-list-all-terms 2024-11-06 at 16.22.20@2x.png +0 -0
- pyegeria/commands/doc/glossary/images/out-list-terms-for-example 2024-11-06 at 16.40.12.png +0 -0
- pyegeria/commands/doc/glossary/images/out-list-terms-second 2024-11-06 at 16.45.13.png +0 -0
- pyegeria/commands/doc/glossary/images/out-pipx install pyegeria 2024-11-10 at 18.12.21.png +0 -0
- pyegeria/commands/doc/glossary/images/out-server-status-full 2024-11-10 at 18.25.14.png +0 -0
- pyegeria/commands/doc/glossary/images/out-servers-status 2024-11-10 at 18.15.42.png +0 -0
- pyegeria/commands/doc/glossary/images/out-upsert-import 2024-11-07 at 19.37.00.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-2024-11-10 at 18.26.29.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-create-glossary example 2024-11-05 at 20.34.24@2x.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-create-term 2024-11-06 at 20.46.35.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-delete-term 2024-11-07 at 03.51.57.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-display-terms-for-example 2024-11-06 at 20.56.49.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-export-example 2024-11-07 at 09.52.59.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-hey-egeria 2024-11-10 at 18.31.01.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-import-upsert-example 2024-11-07 at 10.08.37.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-list-terms-second 2024-11-06 at 16.46.34.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-load-archive.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-server-status-full 2024-11-10 at 19.14.36.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-show-glossaries 2024-11-07 at 20.00.05.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-show-glossary-terms 2024-11-05 at 19.37.53@2x.png +0 -0
- pyegeria/commands/doc/glossary/images/tui-upsert 2024-11-07 at 11.49.04.png +0 -0
- pyegeria/commands/doc/glossary/images/upsert-example.om-terms 2024-11-07 at 11.44.05.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/README.md +346 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/CleanShot 2024-11-18 at 21.32.03@2x.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/Xmind 1731421782704.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/Xmind 1731422134920.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/hey_egeria 2024-11-12 at 20.38.43.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/hey_egeria cat 2024-11-12 at 21.41.43.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/out-integ-status-list 2024-11-12 at 16.45.26.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/out-integ-status-live 2024-11-12 at 16.44.12@2x.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/out-server-status 2024-11-10 at 18.15.42@2x.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/out-server-status-full 2024-11-10 at 18.25.14@2x.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/short-cut commands 2024-11-12 at 22.22.13.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/tui-hey-egeria.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/tui-integration-status-paging.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/tui-load-archive 2024-11-10 at 19.19.09@2x.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/tui-show-server-status 2024-11-10 at 18.52.01@2x.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/tui-show-server-status-full 2024-11-10.png +0 -0
- pyegeria/commands/doc/hey_egeria: a pyegeria command line interface/images/tui-status-paging 2024-11-12 at 16.26.14@2x.png +0 -0
- pyegeria/commands/my/README.md +17 -0
- pyegeria/commands/my/__init__.py +0 -0
- pyegeria/commands/my/list_my_profile.py +163 -0
- pyegeria/commands/my/list_my_roles.py +151 -0
- pyegeria/commands/my/monitor_my_todos.py +205 -0
- pyegeria/commands/my/monitor_open_todos.py +175 -0
- pyegeria/commands/my/todo_actions.py +242 -0
- pyegeria/commands/ops/README.md +24 -0
- pyegeria/commands/ops/__init__.py +22 -0
- pyegeria/commands/ops/gov_server_actions.py +177 -0
- pyegeria/commands/ops/list_archives.py +161 -0
- pyegeria/commands/ops/list_catalog_targets.py +203 -0
- pyegeria/commands/ops/load_archive.py +75 -0
- pyegeria/commands/ops/monitor_asset_events.py +107 -0
- pyegeria/commands/ops/monitor_engine_activity.py +270 -0
- pyegeria/commands/ops/monitor_engine_activity_c.py +286 -0
- pyegeria/commands/ops/monitor_gov_eng_status.py +288 -0
- pyegeria/commands/ops/monitor_integ_daemon_status.py +321 -0
- pyegeria/commands/ops/monitor_platform_status.py +188 -0
- pyegeria/commands/ops/monitor_server_startup.py +117 -0
- pyegeria/commands/ops/monitor_server_status.py +182 -0
- pyegeria/commands/ops/orig_monitor_server_list.py +140 -0
- pyegeria/commands/ops/orig_monitor_server_status.py +124 -0
- pyegeria/commands/ops/refresh_integration_daemon.py +83 -0
- pyegeria/commands/ops/restart_integration_daemon.py +82 -0
- pyegeria/commands/ops/table_integ_daemon_status.py +237 -0
- pyegeria/commands/ops/x_engine_actions.py +76 -0
- pyegeria/commands/tech/README.md +24 -0
- pyegeria/commands/tech/__init__.py +0 -0
- pyegeria/commands/tech/get_element_info.py +144 -0
- pyegeria/commands/tech/get_guid_info.py +134 -0
- pyegeria/commands/tech/get_tech_details.py +173 -0
- pyegeria/commands/tech/get_tech_type_template.py +166 -0
- pyegeria/commands/tech/list_anchored_elements.py +205 -0
- pyegeria/commands/tech/list_asset_types.py +123 -0
- pyegeria/commands/tech/list_elements.py +168 -0
- pyegeria/commands/tech/list_elements_for_classification.py +171 -0
- pyegeria/commands/tech/list_elements_x.py +191 -0
- pyegeria/commands/tech/list_gov_action_processes.py +139 -0
- pyegeria/commands/tech/list_registered_services.py +180 -0
- pyegeria/commands/tech/list_related_elements.py +207 -0
- pyegeria/commands/tech/list_related_specification.py +169 -0
- pyegeria/commands/tech/list_relationship_types.py +164 -0
- pyegeria/commands/tech/list_relationships.py +179 -0
- pyegeria/commands/tech/list_tech_templates.py +360 -0
- pyegeria/commands/tech/list_valid_metadata_values.py +178 -0
- pyegeria/commands/tech/table_tech_templates.py +238 -0
- pyegeria/commands/tech/x_list_related_elements.py +165 -0
- pyegeria/core_omag_server_config.py +550 -313
- pyegeria/create_tech_guid_lists.py +105 -0
- pyegeria/egeria_cat_client.py +78 -0
- pyegeria/egeria_client.py +117 -0
- pyegeria/egeria_config_client.py +45 -0
- pyegeria/egeria_my_client.py +56 -0
- pyegeria/egeria_tech_client.py +93 -0
- pyegeria/feedback_manager_omvs.py +4573 -0
- pyegeria/full_omag_server_config.py +1337 -0
- pyegeria/glossary_browser_omvs.py +2507 -0
- pyegeria/glossary_manager_omvs.py +3597 -0
- pyegeria/mermaid_utilities.py +218 -0
- pyegeria/metadata_explorer_omvs.py +2371 -0
- pyegeria/my_profile_omvs.py +1021 -0
- pyegeria/platform_services.py +259 -218
- pyegeria/project_manager_omvs.py +1854 -0
- pyegeria/registered_info.py +111 -108
- pyegeria/runtime_manager_omvs.py +2299 -0
- pyegeria/server_operations.py +178 -71
- pyegeria/template_manager_omvs.py +1414 -0
- pyegeria/utils.py +75 -85
- pyegeria/valid_metadata_omvs.py +1911 -0
- pyegeria/x_action_author_omvs.py +200 -0
- pyegeria-5.3.0.dev3.dist-info/METADATA +70 -0
- pyegeria-5.3.0.dev3.dist-info/RECORD +232 -0
- {pyegeria-0.2.4.dist-info → pyegeria-5.3.0.dev3.dist-info}/WHEEL +1 -1
- pyegeria-5.3.0.dev3.dist-info/entry_points.txt +81 -0
- pyegeria/config.toml +0 -11
- pyegeria/curation_omvs.py +0 -458
- pyegeria/exceptions.py +0 -382
- pyegeria/glossary_omvs.py +0 -639
- pyegeria/gov_engine.py +0 -573
- pyegeria-0.2.4.dist-info/METADATA +0 -57
- pyegeria-0.2.4.dist-info/RECORD +0 -19
- {pyegeria-0.2.4.dist-info/licenses → pyegeria-5.3.0.dev3.dist-info}/LICENSE +0 -0
pyegeria/_client.py
CHANGED
@@ -6,30 +6,31 @@ This is a simple class to create and manage a connection to an Egeria backend. I
|
|
6
6
|
different client capabilities. It also provides the common methods used to make restful self.session to Egeria.
|
7
7
|
|
8
8
|
"""
|
9
|
+
import asyncio
|
9
10
|
import inspect
|
10
11
|
import json
|
11
12
|
import os
|
13
|
+
from pyegeria import body_slimmer
|
12
14
|
import httpx
|
13
|
-
import
|
14
|
-
|
15
|
+
from httpx import AsyncClient, Response
|
15
16
|
|
16
|
-
from pyegeria.
|
17
|
+
from pyegeria._exceptions import (
|
18
|
+
OMAGCommonErrorCode,
|
19
|
+
InvalidParameterException,
|
20
|
+
PropertyServerException,
|
21
|
+
UserNotAuthorizedException,
|
22
|
+
)
|
23
|
+
from pyegeria._globals import (
|
24
|
+
max_paging_size,
|
25
|
+
enable_ssl_check,
|
26
|
+
)
|
17
27
|
from pyegeria._validators import (
|
18
28
|
validate_name,
|
19
29
|
validate_server_name,
|
20
30
|
validate_url,
|
21
31
|
validate_user_id,
|
22
|
-
is_json
|
32
|
+
is_json,
|
23
33
|
)
|
24
|
-
from pyegeria.exceptions import (
|
25
|
-
OMAGCommonErrorCode,
|
26
|
-
InvalidParameterException,
|
27
|
-
PropertyServerException,
|
28
|
-
UserNotAuthorizedException, print_exception_response,
|
29
|
-
)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
34
|
|
34
35
|
...
|
35
36
|
|
@@ -82,22 +83,18 @@ class Client:
|
|
82
83
|
platform_url: str,
|
83
84
|
user_id: str = None,
|
84
85
|
user_pwd: str = None,
|
85
|
-
verify_flag: bool = False,
|
86
|
-
api_key: str = None,
|
87
|
-
page_size: int = max_paging_size,
|
88
86
|
token: str = None,
|
89
87
|
token_src: str = None,
|
90
|
-
|
88
|
+
api_key: str = None,
|
89
|
+
page_size: int = max_paging_size,
|
91
90
|
):
|
92
91
|
self.server_name = None
|
93
92
|
self.platform_url = None
|
94
93
|
self.user_id = user_id
|
95
94
|
self.user_pwd = user_pwd
|
96
|
-
self.ssl_verify = verify_flag
|
97
95
|
self.page_size = page_size
|
98
96
|
self.token_src = token_src
|
99
97
|
self.token = token
|
100
|
-
self.sync_mode = async_mode
|
101
98
|
self.exc_type = None
|
102
99
|
self.exc_value = None
|
103
100
|
self.exc_tb = None
|
@@ -113,15 +110,15 @@ class Client:
|
|
113
110
|
# self.token = token
|
114
111
|
|
115
112
|
if api_key is None:
|
116
|
-
api_key = os.environ.get("API_KEY",None)
|
113
|
+
api_key = os.environ.get("API_KEY", None)
|
117
114
|
self.api_key = api_key
|
118
115
|
|
119
116
|
self.headers = {
|
120
117
|
"Content-Type": "application/json",
|
121
|
-
|
118
|
+
}
|
122
119
|
self.text_headers = {
|
123
120
|
"Content-Type": "text/plain",
|
124
|
-
|
121
|
+
}
|
125
122
|
if self.api_key is not None:
|
126
123
|
self.headers["X-Api-Key"] = self.api_key
|
127
124
|
self.text_headers["X-Api-Key"] = self.api_key
|
@@ -130,23 +127,15 @@ class Client:
|
|
130
127
|
self.headers["Authorization"] = f"Bearer {token}"
|
131
128
|
self.text_headers["Authorization"] = f"Bearer {token}"
|
132
129
|
|
133
|
-
calling_frame = inspect.currentframe().f_back
|
134
|
-
caller_method = inspect.getframeinfo(calling_frame).function
|
135
|
-
|
136
130
|
v_url = validate_url(platform_url)
|
137
131
|
|
138
132
|
if v_url:
|
139
133
|
self.platform_url = platform_url
|
140
134
|
if validate_server_name(server_name):
|
141
135
|
self.server_name = server_name
|
142
|
-
|
143
|
-
# self.session = httpx.Client(verify=self.ssl_verify)
|
144
|
-
# else:
|
145
|
-
# self.session = httpx.AsyncClient(verify=self.ssl_verify)
|
146
|
-
self.session = httpx.AsyncClient(verify=self.ssl_verify)
|
136
|
+
self.session = AsyncClient(verify=enable_ssl_check)
|
147
137
|
|
148
138
|
def __enter__(self):
|
149
|
-
print("entered client")
|
150
139
|
return self
|
151
140
|
|
152
141
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
@@ -156,20 +145,28 @@ class Client:
|
|
156
145
|
self.exc_val = exc_val
|
157
146
|
self.exc_tb = exc_tb
|
158
147
|
|
159
|
-
return False
|
148
|
+
return False # allows exceptions to propagate
|
149
|
+
|
150
|
+
async def _async_close_session(self) -> None:
|
151
|
+
"""Close the session"""
|
152
|
+
await self.session.aclose()
|
160
153
|
|
161
154
|
def close_session(self) -> None:
|
162
155
|
"""Close the session"""
|
163
|
-
|
156
|
+
loop = asyncio.get_event_loop()
|
157
|
+
loop.run_until_complete(self._async_close_session())
|
158
|
+
return
|
164
159
|
|
165
|
-
def
|
166
|
-
|
160
|
+
async def _async_create_egeria_bearer_token(
|
161
|
+
self, user_id: str = None, password: str = None
|
162
|
+
) -> str:
|
163
|
+
"""Create and set an Egeria Bearer Token for the user. Async version
|
167
164
|
Parameters
|
168
165
|
----------
|
169
|
-
|
170
|
-
The user id to authenticate with.
|
171
|
-
password : str
|
172
|
-
The password for the user.
|
166
|
+
user_id : str, opt
|
167
|
+
The user id to authenticate with. If None, then user_id from class instance used.
|
168
|
+
password : str, opt
|
169
|
+
The password for the user. If None, then user_pwd from class instance is used.
|
173
170
|
|
174
171
|
Returns
|
175
172
|
-------
|
@@ -191,35 +188,124 @@ class Client:
|
|
191
188
|
A bearer token from another source can be set with the set_bearer_token() method.
|
192
189
|
|
193
190
|
"""
|
194
|
-
|
195
|
-
|
191
|
+
if user_id is None:
|
192
|
+
validate_user_id(self.user_id)
|
193
|
+
user_id = self.user_id
|
194
|
+
if password is None:
|
195
|
+
validate_name(self.user_pwd)
|
196
|
+
password = self.user_pwd
|
196
197
|
|
197
198
|
url = f"{self.platform_url}/api/token"
|
198
|
-
data = {
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
199
|
+
data = {"userId": user_id, "password": password}
|
200
|
+
async with AsyncClient(verify=enable_ssl_check) as client:
|
201
|
+
try:
|
202
|
+
response = await client.post(url, json=data, headers=self.headers)
|
203
|
+
token = response.text
|
204
|
+
except httpx.HTTPError as e:
|
205
|
+
print(e)
|
206
|
+
return "FAILED"
|
204
207
|
|
205
|
-
token = response.text
|
206
208
|
if token:
|
207
|
-
self.token_src =
|
209
|
+
self.token_src = "Egeria"
|
208
210
|
self.headers["Authorization"] = f"Bearer {token}"
|
209
211
|
self.text_headers["Authorization"] = f"Bearer {token}"
|
210
212
|
return token
|
211
213
|
else:
|
212
214
|
raise InvalidParameterException("No token returned - request issue")
|
213
215
|
|
214
|
-
def
|
215
|
-
|
216
|
-
|
216
|
+
def create_egeria_bearer_token(
|
217
|
+
self, user_id: str = None, password: str = None
|
218
|
+
) -> str:
|
219
|
+
"""Create and set an Egeria Bearer Token for the user
|
220
|
+
Parameters
|
221
|
+
----------
|
222
|
+
user_id : str
|
223
|
+
The user id to authenticate with.
|
224
|
+
password : str
|
225
|
+
The password for the user.
|
226
|
+
|
227
|
+
Returns
|
228
|
+
-------
|
229
|
+
token
|
230
|
+
The bearer token for the specified user.
|
231
|
+
|
232
|
+
Raises
|
233
|
+
------
|
234
|
+
InvalidParameterException
|
235
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
236
|
+
PropertyServerException
|
237
|
+
Raised by the server when an issue arises in processing a valid request
|
238
|
+
NotAuthorizedException
|
239
|
+
The principle specified by the user_id does not have authorization for the requested action
|
240
|
+
Notes
|
241
|
+
-----
|
242
|
+
This routine creates a new bearer token for the user and updates the object with it.
|
243
|
+
It uses Egeria's mechanisms to create a token. This is useful if an Egeria token expires.
|
244
|
+
A bearer token from another source can be set with the set_bearer_token() method.
|
245
|
+
|
246
|
+
"""
|
247
|
+
loop = asyncio.get_event_loop()
|
248
|
+
response = loop.run_until_complete(
|
249
|
+
self._async_create_egeria_bearer_token(user_id, password)
|
250
|
+
)
|
251
|
+
return response
|
252
|
+
|
253
|
+
async def _async_refresh_egeria_bearer_token(self) -> str:
|
254
|
+
"""
|
255
|
+
Refreshes the Egeria bearer token. Async version.
|
256
|
+
|
257
|
+
This method is used to refresh the bearer token used for authentication with Egeria. It checks if the token
|
258
|
+
source is 'Egeria', and if the user ID and password are valid. If all conditions are met, it calls the
|
259
|
+
`create_egeria_bearer_token` method to create a new bearer token. Otherwise,
|
260
|
+
it raises an `InvalidParameterException`.
|
261
|
+
|
262
|
+
Parameters:
|
263
|
+
|
264
|
+
Returns:
|
265
|
+
None
|
266
|
+
|
267
|
+
Raises:
|
268
|
+
InvalidParameterException: If the token source is invalid.
|
269
|
+
"""
|
270
|
+
if (
|
271
|
+
(self.token_src == "Egeria")
|
272
|
+
and validate_user_id(self.user_id)
|
273
|
+
and validate_name(self.user_pwd)
|
274
|
+
):
|
275
|
+
token = await self._async_create_egeria_bearer_token(
|
276
|
+
self.user_id, self.user_pwd
|
277
|
+
)
|
278
|
+
return token
|
217
279
|
else:
|
218
280
|
raise InvalidParameterException("Invalid token source")
|
219
|
-
|
281
|
+
|
282
|
+
def refresh_egeria_bearer_token(self) -> None:
|
283
|
+
"""
|
284
|
+
Refreshes the Egeria bearer token.
|
285
|
+
|
286
|
+
This method is used to refresh the bearer token used for authentication with Egeria. It checks if the token
|
287
|
+
source is 'Egeria', and if the user ID and password are valid. If all conditions are met, it calls the
|
288
|
+
`create_egeria_bearer_token` method to create a new bearer token. Otherwise,
|
289
|
+
it raises an `InvalidParameterException`.
|
290
|
+
|
291
|
+
Parameters:
|
292
|
+
|
293
|
+
Returns:
|
294
|
+
None
|
295
|
+
|
296
|
+
Raises:
|
297
|
+
InvalidParameterException: If the token source is invalid.
|
298
|
+
PropertyServerException
|
299
|
+
Raised by the server when an issue arises in processing a valid request
|
300
|
+
NotAuthorizedException
|
301
|
+
The principle specified by the user_id does not have authorization for the requested action
|
302
|
+
"""
|
303
|
+
loop = asyncio.get_event_loop()
|
304
|
+
token = loop.run_until_complete(self._async_refresh_egeria_bearer_token())
|
305
|
+
return token
|
220
306
|
|
221
307
|
def set_bearer_token(self, token: str) -> None:
|
222
|
-
"""
|
308
|
+
"""Retrieve and set a Bearer Token
|
223
309
|
Parameters
|
224
310
|
----------
|
225
311
|
token: str
|
@@ -247,31 +333,32 @@ class Client:
|
|
247
333
|
self.headers["Authorization"] = f"Bearer {token}"
|
248
334
|
self.text_headers["Authorization"] = f"Bearer {token}"
|
249
335
|
|
250
|
-
|
251
336
|
def get_token(self) -> str:
|
337
|
+
"""Retrieve and return the bearer token"""
|
252
338
|
return self.text_headers["Authorization"]
|
253
339
|
|
254
|
-
def make_request(
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
340
|
+
def make_request(
|
341
|
+
self,
|
342
|
+
request_type: str,
|
343
|
+
endpoint: str,
|
344
|
+
payload: str | dict = None,
|
345
|
+
time_out: int = 30,
|
346
|
+
) -> Response | str:
|
347
|
+
"""Make a request to the Egeria API"""
|
260
348
|
loop = asyncio.get_event_loop()
|
261
|
-
response = loop.run_until_complete(
|
262
|
-
|
263
|
-
|
264
|
-
# response = asyncio.run( self._async_make_request(request_type, endpoint,
|
265
|
-
# payload, time_out))
|
266
|
-
# else:
|
267
|
-
# response = await self.smart_make_request( request_type, endpoint,
|
268
|
-
# payload, time_out)
|
269
|
-
# # response = self.async_make_request(request_type, endpoint,payload, time_out)
|
349
|
+
response = loop.run_until_complete(
|
350
|
+
self._async_make_request(request_type, endpoint, payload, time_out)
|
351
|
+
)
|
270
352
|
return response
|
271
353
|
|
272
354
|
async def _async_make_request(
|
273
|
-
self,
|
274
|
-
|
355
|
+
self,
|
356
|
+
request_type: str,
|
357
|
+
endpoint: str,
|
358
|
+
payload: str | dict = None,
|
359
|
+
time_out: int = 30,
|
360
|
+
) -> Response | str:
|
361
|
+
"""Make a request to the Egeria API - Async Version
|
275
362
|
Function to make an API call via the self.session Library. Raise an exception if the HTTP response code
|
276
363
|
is not 200/201. IF there is a REST communication exception, raise InvalidParameterException.
|
277
364
|
|
@@ -288,39 +375,40 @@ class Client:
|
|
288
375
|
calling_frame = inspect.currentframe().f_back
|
289
376
|
caller_method = inspect.getframeinfo(calling_frame).function
|
290
377
|
|
291
|
-
|
292
378
|
try:
|
293
379
|
response = ""
|
294
380
|
if request_type == "GET":
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
response = await self.session.get(endpoint, params=payload, headers=self.headers)
|
381
|
+
response = await self.session.get(
|
382
|
+
endpoint, params=payload, headers=self.headers, timeout=time_out
|
383
|
+
)
|
299
384
|
|
300
385
|
elif request_type == "POST":
|
301
|
-
if
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
386
|
+
if payload is None:
|
387
|
+
response = await self.session.post(
|
388
|
+
endpoint, headers=self.headers, timeout=time_out
|
389
|
+
)
|
390
|
+
elif type(payload) is str:
|
391
|
+
response = await self.session.post(
|
392
|
+
endpoint,
|
393
|
+
headers=self.text_headers,
|
394
|
+
data=payload,
|
395
|
+
timeout=time_out,
|
396
|
+
)
|
307
397
|
else:
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
# timeout=time_out, json=payload, )
|
398
|
+
response = await self.session.post(
|
399
|
+
endpoint, headers=self.headers, json=payload, timeout=time_out
|
400
|
+
)
|
312
401
|
|
313
402
|
elif request_type == "POST-DATA":
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
# else: response = self.session.post(endpoint, headers=self.headers,
|
319
|
-
# timeout=time_out, data=payload )
|
403
|
+
if True:
|
404
|
+
response = await self.session.post(
|
405
|
+
endpoint, headers=self.headers, data=payload, timeout=time_out
|
406
|
+
)
|
320
407
|
elif request_type == "DELETE":
|
321
|
-
|
322
|
-
|
323
|
-
|
408
|
+
if True:
|
409
|
+
response = await self.session.delete(
|
410
|
+
endpoint, headers=self.headers, timeout=time_out
|
411
|
+
)
|
324
412
|
|
325
413
|
status_code = response.status_code
|
326
414
|
|
@@ -376,7 +464,7 @@ class Client:
|
|
376
464
|
)
|
377
465
|
raise InvalidParameterException(exc_msg)
|
378
466
|
|
379
|
-
if response.status_code in (400, 401, 403, 404, 405):
|
467
|
+
if response.status_code in (400, 401, 403, 404, 405, 415):
|
380
468
|
# 4xx are client side errors - 400 bad request, 401 unauthorized
|
381
469
|
msg = OMAGCommonErrorCode.CLIENT_SIDE_REST_API_ERROR.value[
|
382
470
|
"message_template"
|
@@ -415,21 +503,28 @@ class Client:
|
|
415
503
|
},
|
416
504
|
}
|
417
505
|
)
|
418
|
-
if response.status_code in (401,403,405):
|
506
|
+
if response.status_code in (401, 403, 405):
|
419
507
|
raise UserNotAuthorizedException(exc_msg)
|
420
508
|
else:
|
421
509
|
raise InvalidParameterException(exc_msg)
|
422
510
|
|
423
511
|
elif response.status_code in (500, 501, 502, 503, 504):
|
424
512
|
# server errors
|
425
|
-
msg =
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
513
|
+
msg = (
|
514
|
+
OMAGCommonErrorCode.EXCEPTION_RESPONSE_FROM_API.value[
|
515
|
+
"message_template"
|
516
|
+
].format(
|
517
|
+
str(response.status_code),
|
518
|
+
caller_method,
|
519
|
+
endpoint,
|
520
|
+
OMAGCommonErrorCode.EXCEPTION_RESPONSE_FROM_API.value[
|
521
|
+
"message_id"
|
522
|
+
],
|
523
|
+
)
|
524
|
+
+ "==>System reports:'"
|
525
|
+
+ response.reason_phrase
|
526
|
+
+ "'"
|
527
|
+
)
|
433
528
|
exc_msg = json.dumps(
|
434
529
|
{
|
435
530
|
"class": "VoidResponse",
|
@@ -472,17 +567,23 @@ class Client:
|
|
472
567
|
) as e:
|
473
568
|
if type(response) is str:
|
474
569
|
reason = response
|
475
|
-
else:
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
570
|
+
else:
|
571
|
+
reason = response.reason_phrase
|
572
|
+
|
573
|
+
msg = (
|
574
|
+
OMAGCommonErrorCode.CLIENT_SIDE_REST_API_ERROR.value[
|
575
|
+
"message_template"
|
576
|
+
].format(
|
577
|
+
e.args[0],
|
578
|
+
caller_method,
|
579
|
+
class_name,
|
580
|
+
endpoint,
|
581
|
+
OMAGCommonErrorCode.CLIENT_SIDE_REST_API_ERROR.value["message_id"],
|
582
|
+
)
|
583
|
+
+ "==>System reports:'"
|
584
|
+
+ reason
|
585
|
+
+ "'"
|
586
|
+
)
|
486
587
|
exc_msg = json.dumps(
|
487
588
|
{
|
488
589
|
"class": "VoidResponse",
|
@@ -504,15 +605,164 @@ class Client:
|
|
504
605
|
}
|
505
606
|
)
|
506
607
|
raise InvalidParameterException(exc_msg)
|
507
|
-
# finally:
|
508
|
-
# self.session.close()
|
509
|
-
|
510
608
|
|
609
|
+
def build_global_guid_lists(self) -> None:
|
610
|
+
global template_guids, integration_guids
|
511
611
|
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
"
|
612
|
+
self.create_egeria_bearer_token(self.user_id, self.user_pwd)
|
613
|
+
# get all technology types
|
614
|
+
url = (
|
615
|
+
f"{self.platform_url}/servers/{self.server_name}/api/open-metadata/automated-curation/technology-types/"
|
616
|
+
f"by-search-string?startFrom=0&pageSize=0&startsWith=false&"
|
617
|
+
f"endsWith=false&ignoreCase=true"
|
618
|
+
)
|
619
|
+
body = {"filter": ""}
|
620
|
+
|
621
|
+
response = self.make_request("POST", url, body)
|
622
|
+
tech_types = response.json().get("elements", "no tech found")
|
623
|
+
if type(tech_types) is list:
|
624
|
+
for tech_type in tech_types:
|
625
|
+
# get tech type details
|
626
|
+
display_name = tech_type["name"]
|
627
|
+
|
628
|
+
url = f"{self.platform_url}/servers/{self.server_name}/api/open-metadata/automated-curation/technology-types/by-name"
|
629
|
+
body = {"filter": display_name}
|
630
|
+
response = self.make_request("POST", url, body)
|
631
|
+
details = response.json().get("element", "no type found")
|
632
|
+
if type(details) is str:
|
633
|
+
continue
|
634
|
+
# get templates and update the template_guids global
|
635
|
+
templates = details.get("catalogTemplates", "Not Found")
|
636
|
+
if type(templates) is str:
|
637
|
+
template_guids[display_name] = None
|
638
|
+
else:
|
639
|
+
for template in templates:
|
640
|
+
template_name = template.get("name", None)
|
641
|
+
template_guid = template["relatedElement"]["guid"]
|
642
|
+
template_guids[template_name] = template_guid
|
643
|
+
# print(f"Added {template_name} template with GUID {template_guids[template_name]}")
|
644
|
+
|
645
|
+
# Now find the integration connector guids
|
646
|
+
resource_list = details.get("resourceList", " ")
|
647
|
+
if type(resource_list) is str:
|
648
|
+
integration_guids[display_name] = None
|
649
|
+
else:
|
650
|
+
for resource in resource_list:
|
651
|
+
resource_guid = resource["relatedElement"]["guid"]
|
652
|
+
resource_type = resource["relatedElement"]["type"]["typeName"]
|
653
|
+
if resource_type == "IntegrationConnector":
|
654
|
+
integration_guids[display_name] = resource_guid
|
655
|
+
# print(f"Added {display_name} integration connector with GUID {integration_guids[display_name]}")
|
656
|
+
|
657
|
+
async def __async_get_guid__(
|
658
|
+
self,
|
659
|
+
guid: str = None,
|
660
|
+
display_name: str = None,
|
661
|
+
property_name: str = "qualifiedName",
|
662
|
+
qualified_name: str = None,
|
663
|
+
tech_type: str = None,
|
664
|
+
) -> str:
|
665
|
+
"""Helper function to return a server_guid - one of server_guid, qualified_name or display_name should
|
666
|
+
contain information. If all are None, an exception will be thrown. If all contain
|
667
|
+
values, server_guid will be used first, followed by qualified_name. If the tech_type is supplied and the
|
668
|
+
property_name is qualifiedName then the display_name will be pre-pended with the tech_type name to form a
|
669
|
+
qualifiedName.
|
670
|
+
|
671
|
+
An InvalidParameter Exception is thrown if multiple matches
|
672
|
+
are found for the given property name. If this occurs, use a qualified name for the property name.
|
673
|
+
Async version.
|
674
|
+
"""
|
675
|
+
|
676
|
+
if guid:
|
677
|
+
return guid
|
678
|
+
|
679
|
+
if qualified_name:
|
680
|
+
body = {
|
681
|
+
"class": "NameRequestBody",
|
682
|
+
"name": qualified_name,
|
683
|
+
"namePropertyName": "qualifiedName",
|
684
|
+
"forLineage": False,
|
685
|
+
"forDuplicateProcessing": False,
|
686
|
+
"effectiveTime": None,
|
687
|
+
}
|
688
|
+
url = (
|
689
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/classification-manager/"
|
690
|
+
f"elements/guid-by-unique-name?forLineage=false&forDuplicateProcessing=false"
|
691
|
+
)
|
692
|
+
|
693
|
+
result = await self._async_make_request("POST", url, body_slimmer(body))
|
694
|
+
return result.json().get("guid", "No elements found")
|
695
|
+
|
696
|
+
try:
|
697
|
+
view_server = self.view_server
|
698
|
+
except AttributeError:
|
699
|
+
view_server = os.environ.get("VIEW_SERVER", "view-server")
|
700
|
+
|
701
|
+
if (not qualified_name) and display_name:
|
702
|
+
if (tech_type) and (property_name == "qualifiedName"):
|
703
|
+
name = f"{tech_type}:{display_name}"
|
704
|
+
body = {
|
705
|
+
"class": "NameRequestBody",
|
706
|
+
"name": name,
|
707
|
+
"namePropertyName": property_name,
|
708
|
+
"forLineage": False,
|
709
|
+
"forDuplicateProcessing": False,
|
710
|
+
"effectiveTime": None,
|
711
|
+
}
|
712
|
+
url = (
|
713
|
+
f"{self.platform_url}/servers/{view_server}/api/open-metadata/classification-manager/"
|
714
|
+
f"elements/guid-by-unique-name?forLineage=false&forDuplicateProcessing=false"
|
715
|
+
)
|
716
|
+
|
717
|
+
result = await self._async_make_request("POST", url, body_slimmer(body))
|
718
|
+
return result.json().get("guid", "No elements found")
|
719
|
+
else:
|
720
|
+
body = {
|
721
|
+
"class": "NameRequestBody",
|
722
|
+
"name": display_name,
|
723
|
+
"namePropertyName": property_name,
|
724
|
+
"forLineage": False,
|
725
|
+
"forDuplicateProcessing": False,
|
726
|
+
"effectiveTime": None,
|
727
|
+
}
|
728
|
+
url = (
|
729
|
+
f"{self.platform_url}/servers/{view_server}/api/open-metadata/classification-manager/"
|
730
|
+
f"elements/guid-by-unique-name?forLineage=false&forDuplicateProcessing=false"
|
731
|
+
)
|
732
|
+
|
733
|
+
result = await self._async_make_request("POST", url, body_slimmer(body))
|
734
|
+
return result.json().get("guid", "No elements found")
|
735
|
+
else:
|
736
|
+
raise InvalidParameterException(
|
737
|
+
"Neither server_guid nor server_name were provided - please provide."
|
738
|
+
)
|
739
|
+
|
740
|
+
def __get_guid__(
|
741
|
+
self,
|
742
|
+
guid: str = None,
|
743
|
+
display_name: str = None,
|
744
|
+
property_name: str = "qualifiedName",
|
745
|
+
qualified_name: str = None,
|
746
|
+
tech_type: str = None,
|
747
|
+
) -> str:
|
748
|
+
"""Helper function to return a server_guid - one of server_guid, qualified_name or display_name should
|
749
|
+
contain information. If all are None, an exception will be thrown. If all contain
|
750
|
+
values, server_guid will be used first, followed by qualified_name. If the tech_type is supplied and the
|
751
|
+
property_name is qualifiedName then the display_name will be pre-pended with the tech_type name to form a
|
752
|
+
qualifiedName.
|
753
|
+
|
754
|
+
An InvalidParameter Exception is thrown if multiple matches
|
755
|
+
are found for the given property name. If this occurs, use a qualified name for the property name.
|
756
|
+
Async version.
|
757
|
+
"""
|
758
|
+
loop = asyncio.get_event_loop()
|
759
|
+
result = loop.run_until_complete(
|
760
|
+
self.__async_get_guid__(
|
761
|
+
guid, display_name, property_name, qualified_name, tech_type
|
762
|
+
)
|
516
763
|
)
|
517
|
-
|
518
|
-
|
764
|
+
return result
|
765
|
+
|
766
|
+
|
767
|
+
if __name__ == "__main__":
|
768
|
+
print("Main-__client")
|