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
@@ -0,0 +1,2727 @@
|
|
1
|
+
"""
|
2
|
+
PDX-License-Identifier: Apache-2.0
|
3
|
+
Copyright Contributors to the ODPi Egeria project.
|
4
|
+
|
5
|
+
Maintain and explore the contents of nested collections.
|
6
|
+
|
7
|
+
"""
|
8
|
+
import asyncio
|
9
|
+
import time
|
10
|
+
|
11
|
+
# import json
|
12
|
+
from pyegeria._client import Client
|
13
|
+
from pyegeria._validators import (
|
14
|
+
validate_guid,
|
15
|
+
validate_search_string,
|
16
|
+
)
|
17
|
+
from pyegeria.utils import body_slimmer
|
18
|
+
|
19
|
+
|
20
|
+
class CollectionManager(Client):
|
21
|
+
"""
|
22
|
+
Maintain and explore the contents of nested collections. These collections can be used to represent digital
|
23
|
+
products, or collections of resources for a particular project or team. They can be used to organize assets and
|
24
|
+
other resources into logical groups.
|
25
|
+
|
26
|
+
Attributes:
|
27
|
+
|
28
|
+
server_name: str
|
29
|
+
The name of the View Server to connect to.
|
30
|
+
platform_url : str
|
31
|
+
URL of the server platform to connect to
|
32
|
+
user_id : str
|
33
|
+
The identity of the user calling the method - this sets a default optionally used by the methods
|
34
|
+
when the user doesn't pass the user_id on a method call.
|
35
|
+
user_pwd: str
|
36
|
+
The password associated with the user_id. Defaults to None
|
37
|
+
token: str
|
38
|
+
An optional bearer token
|
39
|
+
|
40
|
+
"""
|
41
|
+
|
42
|
+
def __init__(
|
43
|
+
self,
|
44
|
+
view_server: str,
|
45
|
+
platform_url: str,
|
46
|
+
user_id: str,
|
47
|
+
user_pwd: str = None,
|
48
|
+
token: str = None,
|
49
|
+
):
|
50
|
+
self.view_server = view_server
|
51
|
+
self.platform_url = platform_url
|
52
|
+
self.user_id = user_id
|
53
|
+
self.user_pwd = user_pwd
|
54
|
+
|
55
|
+
self.collection_command_root: str = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/collection-manager/collections"
|
56
|
+
Client.__init__(self, view_server, platform_url, user_id, user_pwd, token)
|
57
|
+
|
58
|
+
#
|
59
|
+
# Retrieving Collections - https://egeria-project.org/concepts/collection
|
60
|
+
#
|
61
|
+
async def _async_get_linked_collections(
|
62
|
+
self,
|
63
|
+
parent_guid: str,
|
64
|
+
start_from: int = 0,
|
65
|
+
page_size: int = None,
|
66
|
+
) -> list:
|
67
|
+
"""Returns the list of collections that are linked off of the supplied element. Async version.
|
68
|
+
|
69
|
+
Parameters
|
70
|
+
----------
|
71
|
+
parent_guid: str
|
72
|
+
The identity of the parent to find linked collections from.
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
start_from: int, [default=0], optional
|
77
|
+
When multiple pages of results are available, the page number to start from.
|
78
|
+
page_size: int, [default=None]
|
79
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
80
|
+
the class instance.
|
81
|
+
Returns
|
82
|
+
-------
|
83
|
+
List
|
84
|
+
|
85
|
+
A list of collections linked off of the supplied element.
|
86
|
+
|
87
|
+
Raises
|
88
|
+
------
|
89
|
+
|
90
|
+
InvalidParameterException
|
91
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
92
|
+
PropertyServerException
|
93
|
+
Raised by the server when an issue arises in processing a valid request
|
94
|
+
NotAuthorizedException
|
95
|
+
The principle specified by the user_id does not have authorization for the requested action
|
96
|
+
|
97
|
+
"""
|
98
|
+
|
99
|
+
if page_size is None:
|
100
|
+
page_size = self.page_size
|
101
|
+
|
102
|
+
body = {}
|
103
|
+
|
104
|
+
url = (
|
105
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/collection-manager/"
|
106
|
+
f"metadata-elements/{parent_guid}/collections?startFrom={start_from}&pageSize={page_size}"
|
107
|
+
)
|
108
|
+
|
109
|
+
resp = await self._async_make_request("POST", url, body)
|
110
|
+
return resp.json()
|
111
|
+
|
112
|
+
def get_linked_collections(
|
113
|
+
self,
|
114
|
+
parent_guid: str,
|
115
|
+
start_from: int = 0,
|
116
|
+
page_size: int = None,
|
117
|
+
) -> list:
|
118
|
+
"""Returns the list of collections that are linked off of the supplied element.
|
119
|
+
|
120
|
+
Parameters
|
121
|
+
----------
|
122
|
+
parent_guid: str
|
123
|
+
The identity of the parent to find linked collections from.
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
start_from: int, [default=0], optional
|
128
|
+
When multiple pages of results are available, the page number to start from.
|
129
|
+
page_size: int, [default=None]
|
130
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
131
|
+
the class instance.
|
132
|
+
Returns
|
133
|
+
-------
|
134
|
+
List
|
135
|
+
|
136
|
+
A list of collections linked off of the supplied element.
|
137
|
+
|
138
|
+
Raises
|
139
|
+
------
|
140
|
+
|
141
|
+
InvalidParameterException
|
142
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
143
|
+
PropertyServerException
|
144
|
+
Raised by the server when an issue arises in processing a valid request
|
145
|
+
NotAuthorizedException
|
146
|
+
The principle specified by the user_id does not have authorization for the requested action
|
147
|
+
|
148
|
+
"""
|
149
|
+
loop = asyncio.get_event_loop()
|
150
|
+
resp = loop.run_until_complete(
|
151
|
+
self._async_get_linked_collections(parent_guid, start_from, page_size)
|
152
|
+
)
|
153
|
+
return resp
|
154
|
+
|
155
|
+
async def _async_get_classified_collections(
|
156
|
+
self,
|
157
|
+
classification: str,
|
158
|
+
start_from: int = 0,
|
159
|
+
page_size: int = None,
|
160
|
+
) -> list | str:
|
161
|
+
"""Returns the list of collections with a particular classification. These classifications
|
162
|
+
are typically "RootCollection", "Folder" or "DigitalProduct". Async version.
|
163
|
+
|
164
|
+
Parameters
|
165
|
+
----------
|
166
|
+
classification: str
|
167
|
+
The classification of the collection to inspect.
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
start_from: int, [default=0], optional
|
172
|
+
When multiple pages of results are available, the page number to start from.
|
173
|
+
page_size: int, [default=None]
|
174
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
175
|
+
the class instance.
|
176
|
+
|
177
|
+
Returns
|
178
|
+
-------
|
179
|
+
list | str
|
180
|
+
The list of collections (if found) with the specified classification. Returns a string if none found.
|
181
|
+
|
182
|
+
Raises
|
183
|
+
------
|
184
|
+
InvalidParameterException
|
185
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values.
|
186
|
+
PropertyServerException
|
187
|
+
Raised by the server when an issue arises in processing a valid request.
|
188
|
+
NotAuthorizedException
|
189
|
+
The principle specified by the user_id does not have authorization for the requested action.
|
190
|
+
Notes
|
191
|
+
-----
|
192
|
+
"""
|
193
|
+
|
194
|
+
if page_size is None:
|
195
|
+
page_size = self.page_size
|
196
|
+
|
197
|
+
body = {"filter": classification}
|
198
|
+
|
199
|
+
url = (
|
200
|
+
f"{self.collection_command_root}/by-classifications?"
|
201
|
+
f"startFrom={start_from}&pageSize={page_size}"
|
202
|
+
)
|
203
|
+
|
204
|
+
resp = await self._async_make_request("POST", url, body)
|
205
|
+
# result = resp.json().get("elements","No elements found")
|
206
|
+
result = resp.json().get("elements", "No Elements to return")
|
207
|
+
return result
|
208
|
+
|
209
|
+
def get_classified_collections(
|
210
|
+
self,
|
211
|
+
classification: str,
|
212
|
+
start_from: int = 0,
|
213
|
+
page_size: int = None,
|
214
|
+
) -> list | str:
|
215
|
+
"""Returns the list of collections with a particular classification. These classifications
|
216
|
+
are typically "RootCollection", "Folder" or "DigitalProduct".
|
217
|
+
|
218
|
+
Parameters
|
219
|
+
----------
|
220
|
+
classification: str
|
221
|
+
The classification of the collection to inspect.
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
start_from: int, [default=0], optional
|
226
|
+
When multiple pages of results are available, the page number to start from.
|
227
|
+
page_size: int, [default=None]
|
228
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
229
|
+
the class instance.
|
230
|
+
Returns
|
231
|
+
-------
|
232
|
+
List | str
|
233
|
+
|
234
|
+
A list of collections linked off of the supplied element.
|
235
|
+
|
236
|
+
Raises
|
237
|
+
------
|
238
|
+
|
239
|
+
InvalidParameterException
|
240
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
241
|
+
PropertyServerException
|
242
|
+
Raised by the server when an issue arises in processing a valid request
|
243
|
+
NotAuthorizedException
|
244
|
+
The principle specified by the user_id does not have authorization for the requested action
|
245
|
+
|
246
|
+
"""
|
247
|
+
loop = asyncio.get_event_loop()
|
248
|
+
resp = loop.run_until_complete(
|
249
|
+
self._async_get_classified_collections(
|
250
|
+
classification, start_from, page_size
|
251
|
+
)
|
252
|
+
)
|
253
|
+
return resp
|
254
|
+
|
255
|
+
async def _async_find_collections(
|
256
|
+
self,
|
257
|
+
search_string: str,
|
258
|
+
effective_time: str = None,
|
259
|
+
starts_with: bool = False,
|
260
|
+
ends_with: bool = False,
|
261
|
+
ignore_case: bool = False,
|
262
|
+
start_from: int = 0,
|
263
|
+
page_size: int = None,
|
264
|
+
) -> list | str:
|
265
|
+
"""Returns the list of collections matching the search string.
|
266
|
+
The search string is located in the request body and is interpreted as a plain string.
|
267
|
+
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
268
|
+
|
269
|
+
Parameters
|
270
|
+
----------
|
271
|
+
search_string: str,
|
272
|
+
Search string to use to find matching collections. If the search string is '*' then all glossaries returned.
|
273
|
+
effective_time: str, [default=None], optional
|
274
|
+
Effective time of the query. If not specified will default to any time. ISO8601 format is assumed.
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
starts_with : bool, [default=False], optional
|
279
|
+
Starts with the supplied string.
|
280
|
+
ends_with : bool, [default=False], optional
|
281
|
+
Ends with the supplied string
|
282
|
+
ignore_case : bool, [default=False], optional
|
283
|
+
Ignore case when searching
|
284
|
+
start_from: int, [default=0], optional
|
285
|
+
When multiple pages of results are available, the page number to start from.
|
286
|
+
page_size: int, [default=None]
|
287
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
288
|
+
the class instance.
|
289
|
+
Returns
|
290
|
+
-------
|
291
|
+
List | str
|
292
|
+
|
293
|
+
A list of collections match matching the search string. Returns a string if none found.
|
294
|
+
|
295
|
+
Raises
|
296
|
+
------
|
297
|
+
|
298
|
+
InvalidParameterException
|
299
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
300
|
+
PropertyServerException
|
301
|
+
Raised by the server when an issue arises in processing a valid request
|
302
|
+
NotAuthorizedException
|
303
|
+
The principle specified by the user_id does not have authorization for the requested action
|
304
|
+
|
305
|
+
"""
|
306
|
+
|
307
|
+
if page_size is None:
|
308
|
+
page_size = self.page_size
|
309
|
+
starts_with_s = str(starts_with).lower()
|
310
|
+
ends_with_s = str(ends_with).lower()
|
311
|
+
ignore_case_s = str(ignore_case).lower()
|
312
|
+
|
313
|
+
validate_search_string(search_string)
|
314
|
+
|
315
|
+
if search_string == "*":
|
316
|
+
search_string = None
|
317
|
+
|
318
|
+
body = {"filter": search_string, "effective_time": effective_time}
|
319
|
+
|
320
|
+
body_s = body_slimmer(body)
|
321
|
+
url = (
|
322
|
+
f"{self.collection_command_root}/"
|
323
|
+
f"by-search-string?startFrom={start_from}&pageSize={page_size}&startsWith={starts_with_s}&"
|
324
|
+
f"endsWith={ends_with_s}&ignoreCase={ignore_case_s}"
|
325
|
+
)
|
326
|
+
|
327
|
+
resp = await self._async_make_request("POST", url, body_s)
|
328
|
+
return resp.json().get("elements", "No elements found")
|
329
|
+
|
330
|
+
def find_collections(
|
331
|
+
self,
|
332
|
+
search_string: str,
|
333
|
+
effective_time: str = None,
|
334
|
+
starts_with: bool = False,
|
335
|
+
ends_with: bool = False,
|
336
|
+
ignore_case: bool = False,
|
337
|
+
start_from: int = 0,
|
338
|
+
page_size: int = None,
|
339
|
+
) -> list | str:
|
340
|
+
"""Returns the list of collections matching the search string. Async version.
|
341
|
+
The search string is located in the request body and is interpreted as a plain string.
|
342
|
+
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
343
|
+
|
344
|
+
Parameters
|
345
|
+
----------
|
346
|
+
search_string: str,
|
347
|
+
Search string to use to find matching collections. If the search string is '*' then all glossaries returned.
|
348
|
+
effective_time: str, [default=None], optional
|
349
|
+
Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
starts_with : bool, [default=False], optional
|
354
|
+
Starts with the supplied string.
|
355
|
+
ends_with : bool, [default=False], optional
|
356
|
+
Ends with the supplied string
|
357
|
+
ignore_case : bool, [default=False], optional
|
358
|
+
Ignore case when searching
|
359
|
+
start_from: int, [default=0], optional
|
360
|
+
When multiple pages of results are available, the page number to start from.
|
361
|
+
page_size: int, [default=None]
|
362
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
363
|
+
the class instance.
|
364
|
+
Returns
|
365
|
+
-------
|
366
|
+
List | str
|
367
|
+
|
368
|
+
A list of collections match matching the search string. Returns a string if none found.
|
369
|
+
|
370
|
+
Raises
|
371
|
+
------
|
372
|
+
|
373
|
+
InvalidParameterException
|
374
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
375
|
+
PropertyServerException
|
376
|
+
Raised by the server when an issue arises in processing a valid request
|
377
|
+
NotAuthorizedException
|
378
|
+
The principle specified by the user_id does not have authorization for the requested action
|
379
|
+
|
380
|
+
"""
|
381
|
+
loop = asyncio.get_event_loop()
|
382
|
+
resp = loop.run_until_complete(
|
383
|
+
self._async_find_collections(
|
384
|
+
search_string,
|
385
|
+
effective_time,
|
386
|
+
starts_with,
|
387
|
+
ends_with,
|
388
|
+
ignore_case,
|
389
|
+
start_from,
|
390
|
+
page_size,
|
391
|
+
)
|
392
|
+
)
|
393
|
+
|
394
|
+
return resp
|
395
|
+
|
396
|
+
async def _async_get_collections_by_name(
|
397
|
+
self,
|
398
|
+
name: str,
|
399
|
+
effective_time: str = None,
|
400
|
+
start_from: int = 0,
|
401
|
+
page_size: int = None,
|
402
|
+
) -> list | str:
|
403
|
+
"""Returns the list of collections with a particular name.
|
404
|
+
|
405
|
+
Parameters
|
406
|
+
----------
|
407
|
+
name: str,
|
408
|
+
name to use to find matching collections.
|
409
|
+
effective_time: str, [default=None], optional
|
410
|
+
Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
start_from: int, [default=0], optional
|
415
|
+
When multiple pages of results are available, the page number to start from.
|
416
|
+
page_size: int, [default=None]
|
417
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
418
|
+
the class instance.
|
419
|
+
Returns
|
420
|
+
-------
|
421
|
+
List | str
|
422
|
+
|
423
|
+
A list of collections match matching the name. Returns a string if none found.
|
424
|
+
|
425
|
+
Raises
|
426
|
+
------
|
427
|
+
|
428
|
+
InvalidParameterException
|
429
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
430
|
+
PropertyServerException
|
431
|
+
Raised by the server when an issue arises in processing a valid request
|
432
|
+
NotAuthorizedException
|
433
|
+
The principle specified by the user_id does not have authorization for the requested action
|
434
|
+
|
435
|
+
"""
|
436
|
+
|
437
|
+
if page_size is None:
|
438
|
+
page_size = self.page_size
|
439
|
+
|
440
|
+
validate_search_string(name)
|
441
|
+
|
442
|
+
body = {
|
443
|
+
"filter": name,
|
444
|
+
effective_time: effective_time,
|
445
|
+
}
|
446
|
+
body_s = body_slimmer(body)
|
447
|
+
url = (
|
448
|
+
f"{self.collection_command_root}/"
|
449
|
+
f"by-name?startFrom={start_from}&pageSize={page_size}"
|
450
|
+
)
|
451
|
+
|
452
|
+
resp = await self._async_make_request("POST", url, body_s)
|
453
|
+
return resp.json().get("elements", "No elements found")
|
454
|
+
|
455
|
+
def get_collections_by_name(
|
456
|
+
self,
|
457
|
+
name: str,
|
458
|
+
effective_time: str = None,
|
459
|
+
start_from: int = 0,
|
460
|
+
page_size: int = None,
|
461
|
+
) -> list | str:
|
462
|
+
"""Returns the list of collections matching the search string. Async version.
|
463
|
+
The search string is located in the request body and is interpreted as a plain string.
|
464
|
+
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
465
|
+
|
466
|
+
Parameters
|
467
|
+
----------
|
468
|
+
name: str,
|
469
|
+
name to use to find matching collections.
|
470
|
+
effective_time: str, [default=None], optional
|
471
|
+
Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
start_from: int, [default=0], optional
|
476
|
+
When multiple pages of results are available, the page number to start from.
|
477
|
+
page_size: int, [default=None]
|
478
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
479
|
+
the class instance.
|
480
|
+
|
481
|
+
Returns
|
482
|
+
-------
|
483
|
+
List | str
|
484
|
+
|
485
|
+
A list of collections match matching the search string. Returns a string if none found.
|
486
|
+
|
487
|
+
Raises
|
488
|
+
------
|
489
|
+
|
490
|
+
InvalidParameterException
|
491
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
492
|
+
PropertyServerException
|
493
|
+
Raised by the server when an issue arises in processing a valid request
|
494
|
+
NotAuthorizedException
|
495
|
+
The principle specified by the user_id does not have authorization for the requested action
|
496
|
+
|
497
|
+
"""
|
498
|
+
loop = asyncio.get_event_loop()
|
499
|
+
resp = loop.run_until_complete(
|
500
|
+
self._async_get_collections_by_name(
|
501
|
+
name, effective_time, start_from, page_size
|
502
|
+
)
|
503
|
+
)
|
504
|
+
|
505
|
+
return resp
|
506
|
+
|
507
|
+
async def _async_get_collections_by_type(
|
508
|
+
self,
|
509
|
+
collection_type: str,
|
510
|
+
effective_time: str = None,
|
511
|
+
start_from: int = 0,
|
512
|
+
page_size: int = None,
|
513
|
+
) -> list | str:
|
514
|
+
"""Returns the list of collections with a particular collectionType. This is an optional text field in the
|
515
|
+
collection element.
|
516
|
+
|
517
|
+
Parameters
|
518
|
+
----------
|
519
|
+
collection_type: str,
|
520
|
+
collection_type to use to find matching collections.
|
521
|
+
effective_time: str, [default=None], optional
|
522
|
+
Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
start_from: int, [default=0], optional
|
527
|
+
When multiple pages of results are available, the page number to start from.
|
528
|
+
page_size: int, [default=None]
|
529
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
530
|
+
the class instance.
|
531
|
+
|
532
|
+
Returns
|
533
|
+
-------
|
534
|
+
List | str
|
535
|
+
|
536
|
+
A list of collections match matching the name. Returns a string if none found.
|
537
|
+
|
538
|
+
Raises
|
539
|
+
------
|
540
|
+
|
541
|
+
InvalidParameterException
|
542
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
543
|
+
PropertyServerException
|
544
|
+
Raised by the server when an issue arises in processing a valid request
|
545
|
+
NotAuthorizedException
|
546
|
+
The principle specified by the user_id does not have authorization for the requested action
|
547
|
+
|
548
|
+
"""
|
549
|
+
|
550
|
+
if page_size is None:
|
551
|
+
page_size = self.page_size
|
552
|
+
|
553
|
+
validate_search_string(collection_type)
|
554
|
+
|
555
|
+
body = {
|
556
|
+
"filter": collection_type,
|
557
|
+
effective_time: effective_time,
|
558
|
+
}
|
559
|
+
body_s = body_slimmer(body)
|
560
|
+
|
561
|
+
url = (
|
562
|
+
f"{self.collection_command_root}/"
|
563
|
+
f"by-collection-type?startFrom={start_from}&pageSize={page_size}"
|
564
|
+
)
|
565
|
+
|
566
|
+
resp = await self._async_make_request("POST", url, body_s)
|
567
|
+
return resp.json().get("elements", "No elements found")
|
568
|
+
|
569
|
+
def get_collections_by_type(
|
570
|
+
self,
|
571
|
+
collection_type: str,
|
572
|
+
effective_time: str = None,
|
573
|
+
start_from: int = 0,
|
574
|
+
page_size: int = None,
|
575
|
+
) -> list | str:
|
576
|
+
"""Returns the list of collections matching the search string. Async version.
|
577
|
+
The search string is located in the request body and is interpreted as a plain string.
|
578
|
+
The request parameters, startsWith, endsWith and ignoreCase can be used to allow a fuzzy search.
|
579
|
+
|
580
|
+
Parameters
|
581
|
+
----------
|
582
|
+
collection_type: str,
|
583
|
+
collection type to find.
|
584
|
+
effective_time: str, [default=None], optional
|
585
|
+
Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
start_from: int, [default=0], optional
|
590
|
+
When multiple pages of results are available, the page number to start from.
|
591
|
+
page_size: int, [default=None]
|
592
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
593
|
+
the class instance.
|
594
|
+
|
595
|
+
Returns
|
596
|
+
-------
|
597
|
+
List | str
|
598
|
+
|
599
|
+
A list of collections match matching the search string. Returns a string if none found.
|
600
|
+
|
601
|
+
Raises
|
602
|
+
------
|
603
|
+
|
604
|
+
InvalidParameterException
|
605
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
606
|
+
PropertyServerException
|
607
|
+
Raised by the server when an issue arises in processing a valid request
|
608
|
+
NotAuthorizedException
|
609
|
+
The principle specified by the user_id does not have authorization for the requested action
|
610
|
+
|
611
|
+
"""
|
612
|
+
loop = asyncio.get_event_loop()
|
613
|
+
resp = loop.run_until_complete(
|
614
|
+
self._async_get_collections_by_type(
|
615
|
+
collection_type, effective_time, start_from, page_size
|
616
|
+
)
|
617
|
+
)
|
618
|
+
|
619
|
+
return resp
|
620
|
+
|
621
|
+
async def _async_get_collection(
|
622
|
+
self, collection_guid: str, effective_time: str = None
|
623
|
+
) -> dict | str:
|
624
|
+
"""Return the properties of a specific collection. Async version.
|
625
|
+
|
626
|
+
Parameters
|
627
|
+
----------
|
628
|
+
collection_guid: str,
|
629
|
+
unique identifier of the collection.
|
630
|
+
effective_time: str, [default=None], optional
|
631
|
+
Effective time of the query. If not specified will default to any time. Time in ISO8601 format is assumed.
|
632
|
+
|
633
|
+
|
634
|
+
|
635
|
+
|
636
|
+
Returns
|
637
|
+
-------
|
638
|
+
dict | str
|
639
|
+
|
640
|
+
A JSON dict representing the specified collection. Returns a string if none found.
|
641
|
+
|
642
|
+
Raises
|
643
|
+
------
|
644
|
+
|
645
|
+
InvalidParameterException
|
646
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
647
|
+
PropertyServerException
|
648
|
+
Raised by the server when an issue arises in processing a valid request
|
649
|
+
NotAuthorizedException
|
650
|
+
The principle specified by the user_id does not have authorization for the requested action
|
651
|
+
|
652
|
+
"""
|
653
|
+
|
654
|
+
validate_guid(collection_guid)
|
655
|
+
|
656
|
+
url = f"{self.collection_command_root}/{collection_guid}"
|
657
|
+
body = {
|
658
|
+
"effective_time": effective_time,
|
659
|
+
}
|
660
|
+
resp = await self._async_make_request("GET", url, body)
|
661
|
+
return resp.json()
|
662
|
+
|
663
|
+
def get_collection(
|
664
|
+
self, collection_guid: str, effective_time: str = None
|
665
|
+
) -> dict | str:
|
666
|
+
"""Return the properties of a specific collection.
|
667
|
+
|
668
|
+
Parameters
|
669
|
+
----------
|
670
|
+
collection_guid: str,
|
671
|
+
unique identifier of the collection.
|
672
|
+
effective_time: str, [default=None], optional
|
673
|
+
Effective time of the query. If not specified will default to any time.
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
Returns
|
679
|
+
-------
|
680
|
+
dict | str
|
681
|
+
|
682
|
+
A JSON dict representing the specified collection. Returns a string if none found.
|
683
|
+
|
684
|
+
Raises
|
685
|
+
------
|
686
|
+
|
687
|
+
InvalidParameterException
|
688
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
689
|
+
PropertyServerException
|
690
|
+
Raised by the server when an issue arises in processing a valid request
|
691
|
+
NotAuthorizedException
|
692
|
+
The principle specified by the user_id does not have authorization for the requested action
|
693
|
+
|
694
|
+
"""
|
695
|
+
loop = asyncio.get_event_loop()
|
696
|
+
resp = loop.run_until_complete(
|
697
|
+
self._async_get_collection(collection_guid, effective_time)
|
698
|
+
)
|
699
|
+
|
700
|
+
return resp
|
701
|
+
|
702
|
+
#
|
703
|
+
# Create collection methods
|
704
|
+
#
|
705
|
+
async def _async_create_collection_w_body(
|
706
|
+
self, classification_name: str, body: dict
|
707
|
+
) -> str:
|
708
|
+
"""Create Collections: https://egeria-project.org/concepts/collection Async version.
|
709
|
+
|
710
|
+
Parameters
|
711
|
+
----------
|
712
|
+
classification_name: str
|
713
|
+
Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
|
714
|
+
body: dict
|
715
|
+
A dict representing the details of the collection to create.
|
716
|
+
|
717
|
+
|
718
|
+
Returns
|
719
|
+
-------
|
720
|
+
str - the guid of the created collection
|
721
|
+
|
722
|
+
A JSON dict representing the specified collection. Returns a string if none found.
|
723
|
+
|
724
|
+
Raises
|
725
|
+
------
|
726
|
+
InvalidParameterException
|
727
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
728
|
+
PropertyServerException
|
729
|
+
Raised by the server when an issue arises in processing a valid request
|
730
|
+
NotAuthorizedException
|
731
|
+
The principle specified by the user_id does not have authorization for the requested action
|
732
|
+
|
733
|
+
"""
|
734
|
+
|
735
|
+
url = (
|
736
|
+
f"{self.collection_command_root}?"
|
737
|
+
f"classificationName={classification_name}"
|
738
|
+
)
|
739
|
+
|
740
|
+
resp = await self._async_make_request("POST", url, body)
|
741
|
+
return resp.json().get("guid", "No GUID returned")
|
742
|
+
|
743
|
+
def create_collection_w_body(self, classification_name: str, body: dict) -> str:
|
744
|
+
"""Create Collections: https://egeria-project.org/concepts/collection
|
745
|
+
|
746
|
+
Parameters
|
747
|
+
----------
|
748
|
+
classification_name: str
|
749
|
+
Type of collection to create; e.g RootCollection, Folder, Set, DigitalProduct, etc.
|
750
|
+
body: dict
|
751
|
+
A dict representing the details of the collection to create.
|
752
|
+
|
753
|
+
If not provided, the server name associated with the instance is
|
754
|
+
used.
|
755
|
+
|
756
|
+
Returns
|
757
|
+
-------
|
758
|
+
str - the guid of the created collection
|
759
|
+
|
760
|
+
A JSON dict representing the specified collection. Returns a string if none found.
|
761
|
+
|
762
|
+
Raises
|
763
|
+
------
|
764
|
+
InvalidParameterException
|
765
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
766
|
+
PropertyServerException
|
767
|
+
Raised by the server when an issue arises in processing a valid request
|
768
|
+
NotAuthorizedException
|
769
|
+
The principle specified by the user_id does not have authorization for the requested action
|
770
|
+
|
771
|
+
"""
|
772
|
+
loop = asyncio.get_event_loop()
|
773
|
+
resp = loop.run_until_complete(
|
774
|
+
self._async_create_collection_w_body(classification_name, body)
|
775
|
+
)
|
776
|
+
return resp
|
777
|
+
|
778
|
+
async def _async_create_collection(
|
779
|
+
self,
|
780
|
+
classification_name: str,
|
781
|
+
anchor_guid: str,
|
782
|
+
parent_guid: str,
|
783
|
+
parent_relationship_type_name: str,
|
784
|
+
parent_at_end1: bool,
|
785
|
+
display_name: str,
|
786
|
+
description: str,
|
787
|
+
collection_type: str,
|
788
|
+
is_own_anchor: bool = False,
|
789
|
+
collection_ordering: str = None,
|
790
|
+
order_property_name: str = None,
|
791
|
+
) -> str:
|
792
|
+
"""Create Collections: https://egeria-project.org/concepts/collection Async version.
|
793
|
+
|
794
|
+
Parameters
|
795
|
+
----------
|
796
|
+
classification_name: str
|
797
|
+
Type of collection to create; e.g RootCollection, Folder, ResultsSet, DigitalProduct, HomeCollection,
|
798
|
+
RecentAccess, WorkItemList, etc.
|
799
|
+
anchor_guid: str
|
800
|
+
The unique identifier of the element that should be the anchor for the new element. Set to null if no
|
801
|
+
anchor, or if this collection is to be its own anchor.
|
802
|
+
parent_guid: str
|
803
|
+
The optional unique identifier for an element that should be connected to the newly created element.
|
804
|
+
If this property is specified, parentRelationshipTypeName must also be specified
|
805
|
+
parent_relationship_type_name: str
|
806
|
+
The name of the relationship, if any, that should be established between the new element and the parent
|
807
|
+
element. Examples could be "ResourceList" or "DigitalServiceProduct".
|
808
|
+
parent_at_end1: bool
|
809
|
+
Identifies which end any parent entity sits on the relationship.
|
810
|
+
display_name: str
|
811
|
+
The display name of the element. Will also be used as the basis of the qualified_name.
|
812
|
+
description: str
|
813
|
+
A description of the collection.
|
814
|
+
collection_type: str
|
815
|
+
Add appropriate valid value for the collection type.
|
816
|
+
is_own_anchor: bool, optional, defaults to False
|
817
|
+
Indicates if the collection should classified as its own anchor or not.
|
818
|
+
collection_ordering: str, optional, defaults to "OTHER"
|
819
|
+
Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED",
|
820
|
+
"OTHER"
|
821
|
+
order_property_name: str, optional, defaults to "Something"
|
822
|
+
Property to use for sequencing if collection_ordering is "OTHER"
|
823
|
+
|
824
|
+
|
825
|
+
Returns
|
826
|
+
-------
|
827
|
+
str - the guid of the created collection
|
828
|
+
|
829
|
+
A JSON dict representing the specified collection. Returns a string if none found.
|
830
|
+
|
831
|
+
Raises
|
832
|
+
------
|
833
|
+
InvalidParameterException
|
834
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
835
|
+
PropertyServerException
|
836
|
+
Raised by the server when an issue arises in processing a valid request
|
837
|
+
NotAuthorizedException
|
838
|
+
The principle specified by the user_id does not have authorization for the requested action
|
839
|
+
|
840
|
+
"""
|
841
|
+
|
842
|
+
if parent_guid is None:
|
843
|
+
is_own_anchor = False
|
844
|
+
is_own_anchor_s = str(is_own_anchor).lower()
|
845
|
+
|
846
|
+
url = (
|
847
|
+
f"{self.collection_command_root}?"
|
848
|
+
f"classificationName={classification_name}"
|
849
|
+
)
|
850
|
+
|
851
|
+
body = {
|
852
|
+
"anchorGUID": anchor_guid,
|
853
|
+
"isOwnAnchor": is_own_anchor_s,
|
854
|
+
"parentGUID": parent_guid,
|
855
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
856
|
+
"parentAtEnd1": parent_at_end1,
|
857
|
+
"collectionProperties": {
|
858
|
+
"class": "CollectionProperties",
|
859
|
+
"qualifiedName": f"{classification_name}-{display_name}-{time.asctime()}",
|
860
|
+
"name": display_name,
|
861
|
+
"description": description,
|
862
|
+
"collectionType": collection_type,
|
863
|
+
"collectionOrdering": collection_ordering,
|
864
|
+
"orderPropertyName": order_property_name,
|
865
|
+
},
|
866
|
+
}
|
867
|
+
|
868
|
+
resp = await self._async_make_request("POST", url, body)
|
869
|
+
return resp.json().get("guid", "No GUID returned")
|
870
|
+
|
871
|
+
def create_collection(
|
872
|
+
self,
|
873
|
+
classification_name: str,
|
874
|
+
anchor_guid: str,
|
875
|
+
parent_guid: str,
|
876
|
+
parent_relationship_type_name: str,
|
877
|
+
parent_at_end1: bool,
|
878
|
+
display_name: str,
|
879
|
+
description: str,
|
880
|
+
collection_type: str,
|
881
|
+
is_own_anchor: bool = False,
|
882
|
+
collection_ordering: str = "OTHER",
|
883
|
+
order_property_name: str = "Something",
|
884
|
+
) -> str:
|
885
|
+
"""Create Collections: https://egeria-project.org/concepts/collection
|
886
|
+
|
887
|
+
Parameters
|
888
|
+
----------
|
889
|
+
|
890
|
+
classification_name: str
|
891
|
+
Type of collection to create; e.g RootCollection, Folder, ResultsSet, DigitalProduct, HomeCollection,
|
892
|
+
RecentAccess, WorkItemList, etc.
|
893
|
+
anchor_guid: str
|
894
|
+
The unique identifier of the element that should be the anchor for the new element.
|
895
|
+
Set to null if no anchor, or if this collection is to be its own anchor.
|
896
|
+
parent_guid: str
|
897
|
+
The optional unique identifier for an element that should be connected to the newly created element.
|
898
|
+
If this property is specified, parentRelationshipTypeName must also be specified
|
899
|
+
parent_relationship_type_name: str
|
900
|
+
The name of the relationship, if any, that should be established between the new element and the parent
|
901
|
+
element. Examples could be "ResourceList" or "DigitalServiceProduct".
|
902
|
+
parent_at_end1: bool
|
903
|
+
Identifies which end any parent entity sits on the relationship.
|
904
|
+
display_name: str
|
905
|
+
The display name of the element. Will also be used as the basis of the qualified_name.
|
906
|
+
description: str
|
907
|
+
A description of the collection.
|
908
|
+
collection_type: str
|
909
|
+
Add appropriate valid value for the collection type.
|
910
|
+
is_own_anchor: bool, optional, defaults to False
|
911
|
+
Indicates if the collection should classified as its own anchor or not.
|
912
|
+
collection_ordering: str, optional, defaults to "OTHER"
|
913
|
+
Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
|
914
|
+
"DATE_CREATED", "OTHER"
|
915
|
+
order_property_name: str, optional, defaults to "Something"
|
916
|
+
Property to use for sequencing if collection_ordering is "OTHER"
|
917
|
+
|
918
|
+
|
919
|
+
Returns
|
920
|
+
-------
|
921
|
+
str - the guid of the created collection
|
922
|
+
|
923
|
+
A JSON dict representing the specified collection. Returns a string if none found.
|
924
|
+
|
925
|
+
Raises
|
926
|
+
------
|
927
|
+
InvalidParameterException
|
928
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
929
|
+
PropertyServerException
|
930
|
+
Raised by the server when an issue arises in processing a valid request
|
931
|
+
NotAuthorizedException
|
932
|
+
The principle specified by the user_id does not have authorization for the requested action
|
933
|
+
|
934
|
+
"""
|
935
|
+
loop = asyncio.get_event_loop()
|
936
|
+
resp = loop.run_until_complete(
|
937
|
+
self._async_create_collection(
|
938
|
+
classification_name,
|
939
|
+
anchor_guid,
|
940
|
+
parent_guid,
|
941
|
+
parent_relationship_type_name,
|
942
|
+
parent_at_end1,
|
943
|
+
display_name,
|
944
|
+
description,
|
945
|
+
collection_type,
|
946
|
+
is_own_anchor,
|
947
|
+
collection_ordering,
|
948
|
+
order_property_name,
|
949
|
+
)
|
950
|
+
)
|
951
|
+
return resp
|
952
|
+
|
953
|
+
async def _async_create_root_collection(
|
954
|
+
self,
|
955
|
+
anchor_guid: str,
|
956
|
+
parent_guid: str,
|
957
|
+
parent_relationship_type_name: str,
|
958
|
+
parent_at_end1: bool,
|
959
|
+
display_name: str,
|
960
|
+
description: str,
|
961
|
+
collection_type: str,
|
962
|
+
is_own_anchor: bool = False,
|
963
|
+
) -> str:
|
964
|
+
"""Create a new collection with the RootCollection classification. Used to identify the top of a
|
965
|
+
collection hierarchy. Async version.
|
966
|
+
|
967
|
+
Parameters
|
968
|
+
----------
|
969
|
+
anchor_guid: str
|
970
|
+
The unique identifier of the element that should be the anchor for the new element.
|
971
|
+
Set to null if no anchor, or if this collection is to be its own anchor.
|
972
|
+
parent_guid: str
|
973
|
+
The optional unique identifier for an element that should be connected to the newly created element.
|
974
|
+
If this property is specified, parentRelationshipTypeName must also be specified
|
975
|
+
parent_relationship_type_name: str
|
976
|
+
The name of the relationship, if any, that should be established between the new element and the parent
|
977
|
+
element. Examples could be "ResourceList" or "DigitalServiceProduct".
|
978
|
+
parent_at_end1: bool
|
979
|
+
Identifies which end any parent entity sits on the relationship.
|
980
|
+
display_name: str
|
981
|
+
The display name of the element. Will also be used as the basis of the qualified_name.
|
982
|
+
description: str
|
983
|
+
A description of the collection.
|
984
|
+
collection_type: str
|
985
|
+
Add appropriate valid value for the collection type.
|
986
|
+
is_own_anchor: bool, optional, defaults to False
|
987
|
+
Indicates if the collection should classified as its own anchor or not.
|
988
|
+
|
989
|
+
Returns
|
990
|
+
-------
|
991
|
+
str - the guid of the created collection
|
992
|
+
|
993
|
+
A JSON dict representing the specified collection. Returns a string if none found.
|
994
|
+
|
995
|
+
Raises
|
996
|
+
------
|
997
|
+
InvalidParameterException
|
998
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
999
|
+
PropertyServerException
|
1000
|
+
Raised by the server when an issue arises in processing a valid request
|
1001
|
+
NotAuthorizedException
|
1002
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1003
|
+
|
1004
|
+
"""
|
1005
|
+
|
1006
|
+
is_own_anchor_s = str(is_own_anchor).lower()
|
1007
|
+
url = f"{self.collection_command_root}/root-collection"
|
1008
|
+
|
1009
|
+
body = {
|
1010
|
+
"anchorGUID": anchor_guid,
|
1011
|
+
"isOwnAnchor": is_own_anchor_s,
|
1012
|
+
"parentGUID": parent_guid,
|
1013
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
1014
|
+
"parentAtEnd1": parent_at_end1,
|
1015
|
+
"collectionProperties": {
|
1016
|
+
"class": "CollectionProperties",
|
1017
|
+
"qualifiedName": f"root-collection-{display_name}-{time.asctime()}",
|
1018
|
+
"name": display_name,
|
1019
|
+
"description": description,
|
1020
|
+
"collectionType": collection_type,
|
1021
|
+
},
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
resp = await self._async_make_request("POST", url, body)
|
1025
|
+
return resp.json().get("guid", "No GUID Returned")
|
1026
|
+
|
1027
|
+
def create_root_collection(
|
1028
|
+
self,
|
1029
|
+
anchor_guid: str,
|
1030
|
+
parent_guid: str,
|
1031
|
+
parent_relationship_type_name: str,
|
1032
|
+
parent_at_end1: bool,
|
1033
|
+
display_name: str,
|
1034
|
+
description: str,
|
1035
|
+
collection_type: str,
|
1036
|
+
is_own_anchor: bool = False,
|
1037
|
+
) -> str:
|
1038
|
+
"""Create a new collection with the RootCollection classification. Used to identify the top of a
|
1039
|
+
collection hierarchy.
|
1040
|
+
|
1041
|
+
Parameters
|
1042
|
+
----------
|
1043
|
+
anchor_guid: str
|
1044
|
+
The unique identifier of the element that should be the anchor for the new element.
|
1045
|
+
Set to null if no anchor,
|
1046
|
+
or if this collection is to be its own anchor.
|
1047
|
+
parent_guid: str
|
1048
|
+
The optional unique identifier for an element that should be connected to the newly created element.
|
1049
|
+
If this property is specified, parentRelationshipTypeName must also be specified
|
1050
|
+
parent_relationship_type_name: str
|
1051
|
+
The name of the relationship, if any, that should be established between the new element and the parent
|
1052
|
+
element. Examples could be "ResourceList" or "DigitalServiceProduct".
|
1053
|
+
parent_at_end1: bool
|
1054
|
+
Identifies which end any parent entity sits on the relationship.
|
1055
|
+
display_name: str
|
1056
|
+
The display name of the element. Will also be used as the basis of the qualified_name.
|
1057
|
+
description: str
|
1058
|
+
A description of the collection.
|
1059
|
+
collection_type: str
|
1060
|
+
Add appropriate valid value for the collection type.
|
1061
|
+
is_own_anchor: bool, optional, defaults to False
|
1062
|
+
Indicates if the collection should classified as its own anchor or not.
|
1063
|
+
|
1064
|
+
Returns
|
1065
|
+
-------
|
1066
|
+
str - the guid of the created collection
|
1067
|
+
|
1068
|
+
A JSON dict representing the specified collection. Returns a string if none found.
|
1069
|
+
|
1070
|
+
Raises
|
1071
|
+
------
|
1072
|
+
InvalidParameterException
|
1073
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1074
|
+
PropertyServerException
|
1075
|
+
Raised by the server when an issue arises in processing a valid request
|
1076
|
+
NotAuthorizedException
|
1077
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1078
|
+
|
1079
|
+
"""
|
1080
|
+
loop = asyncio.get_event_loop()
|
1081
|
+
resp = loop.run_until_complete(
|
1082
|
+
self._async_create_root_collection(
|
1083
|
+
anchor_guid,
|
1084
|
+
parent_guid,
|
1085
|
+
parent_relationship_type_name,
|
1086
|
+
parent_at_end1,
|
1087
|
+
display_name,
|
1088
|
+
description,
|
1089
|
+
collection_type,
|
1090
|
+
is_own_anchor,
|
1091
|
+
)
|
1092
|
+
)
|
1093
|
+
return resp
|
1094
|
+
|
1095
|
+
async def _async_create_data_spec_collection(
|
1096
|
+
self,
|
1097
|
+
anchor_guid: str,
|
1098
|
+
parent_guid: str,
|
1099
|
+
parent_relationship_type_name: str,
|
1100
|
+
parent_at_end1: bool,
|
1101
|
+
display_name: str,
|
1102
|
+
description: str,
|
1103
|
+
collection_type: str,
|
1104
|
+
is_own_anchor: bool = True,
|
1105
|
+
collection_ordering: str = "OTHER",
|
1106
|
+
order_property_name: str = "Something",
|
1107
|
+
) -> str:
|
1108
|
+
"""Create a new collection with the DataSpec classification. Used to identify a collection of data fields
|
1109
|
+
and schema types. Async version.
|
1110
|
+
|
1111
|
+
Parameters
|
1112
|
+
----------
|
1113
|
+
anchor_guid: str
|
1114
|
+
The unique identifier of the element that should be the anchor for the new element.
|
1115
|
+
Set to null if no anchor, or if this collection is to be its own anchor.
|
1116
|
+
parent_guid: str
|
1117
|
+
The optional unique identifier for an element that should be connected to the newly created element.
|
1118
|
+
If this property is specified, parentRelationshipTypeName must also be specified
|
1119
|
+
parent_relationship_type_name: str
|
1120
|
+
The name of the relationship, if any, that should be established between the new element and the parent
|
1121
|
+
element. Examples could be "ResourceList" or "DigitalServiceProduct".
|
1122
|
+
parent_at_end1: bool
|
1123
|
+
Identifies which end any parent entity sits on the relationship.
|
1124
|
+
display_name: str
|
1125
|
+
The display name of the element. Will also be used as the basis of the qualified_name.
|
1126
|
+
description: str
|
1127
|
+
A description of the collection.
|
1128
|
+
collection_type: str
|
1129
|
+
Add appropriate valid value for the collection type.
|
1130
|
+
is_own_anchor: bool, optional, defaults to False
|
1131
|
+
Indicates if the collection should classified as its own anchor or not.
|
1132
|
+
collection_ordering: str, optional, defaults to "OTHER"
|
1133
|
+
Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
|
1134
|
+
"DATE_CREATED", "OTHER"
|
1135
|
+
order_property_name: str, optional, defaults to "Something"
|
1136
|
+
Property to use for sequencing if collection_ordering is "OTHER"
|
1137
|
+
|
1138
|
+
Returns
|
1139
|
+
-------
|
1140
|
+
str - the guid of the created collection
|
1141
|
+
|
1142
|
+
A JSON dict representing the specified collection. Returns a string if none found.
|
1143
|
+
|
1144
|
+
Raises
|
1145
|
+
------
|
1146
|
+
InvalidParameterException
|
1147
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1148
|
+
PropertyServerException
|
1149
|
+
Raised by the server when an issue arises in processing a valid request
|
1150
|
+
NotAuthorizedException
|
1151
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1152
|
+
"""
|
1153
|
+
|
1154
|
+
is_own_anchor_s = str(is_own_anchor).lower()
|
1155
|
+
url = f"{self.collection_command_root}/data-spec-collection"
|
1156
|
+
|
1157
|
+
body = {
|
1158
|
+
"anchorGUID": anchor_guid,
|
1159
|
+
"isOwnAnchor": is_own_anchor_s,
|
1160
|
+
"parentGUID": parent_guid,
|
1161
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
1162
|
+
"parentAtEnd1": parent_at_end1,
|
1163
|
+
"collectionProperties": {
|
1164
|
+
"class": "CollectionProperties",
|
1165
|
+
"qualifiedName": f"data-spec-collection-{display_name}-{time.asctime()}",
|
1166
|
+
"name": display_name,
|
1167
|
+
"description": description,
|
1168
|
+
"collectionType": collection_type,
|
1169
|
+
"collectionOrdering": collection_ordering,
|
1170
|
+
"orderPropertyName": order_property_name,
|
1171
|
+
},
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
resp = await self._async_make_request("POST", url, body)
|
1175
|
+
return resp.json().get("guid", "No GUID Returned")
|
1176
|
+
|
1177
|
+
def create_data_spec_collection(
|
1178
|
+
self,
|
1179
|
+
anchor_guid: str,
|
1180
|
+
parent_guid: str,
|
1181
|
+
parent_relationship_type_name: str,
|
1182
|
+
parent_at_end1: bool,
|
1183
|
+
display_name: str,
|
1184
|
+
description: str,
|
1185
|
+
collection_type: str,
|
1186
|
+
is_own_anchor: bool,
|
1187
|
+
collection_ordering: str = "OTHER",
|
1188
|
+
order_property_name: str = "Something",
|
1189
|
+
) -> str:
|
1190
|
+
"""Create a new collection with the DataSpec classification. Used to identify a collection of data fields
|
1191
|
+
and schema types.
|
1192
|
+
|
1193
|
+
Parameters
|
1194
|
+
----------
|
1195
|
+
anchor_guid: str
|
1196
|
+
The unique identifier of the element that should be the anchor for the new element.
|
1197
|
+
Set to null if no anchor, or if this collection is to be its own anchor.
|
1198
|
+
parent_guid: str
|
1199
|
+
The optional unique identifier for an element that should be connected to the newly created element.
|
1200
|
+
If this property is specified, parentRelationshipTypeName must also be specified
|
1201
|
+
parent_relationship_type_name: str
|
1202
|
+
The name of the relationship, if any, that should be established between the new element and the parent
|
1203
|
+
element. Examples could be "ResourceList" or "DigitalServiceProduct".
|
1204
|
+
parent_at_end1: bool
|
1205
|
+
Identifies which end any parent entity sits on the relationship.
|
1206
|
+
display_name: str
|
1207
|
+
The display name of the element. Will also be used as the basis of the qualified_name.
|
1208
|
+
description: str
|
1209
|
+
A description of the collection.
|
1210
|
+
collection_type: str
|
1211
|
+
Add appropriate valid value for the collection type.
|
1212
|
+
is_own_anchor: bool, optional, defaults to False
|
1213
|
+
Indicates if the collection should classified as its own anchor or not.
|
1214
|
+
collection_ordering: str, optional, defaults to "OTHER"
|
1215
|
+
Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED", "OTHER"
|
1216
|
+
order_property_name: str, optional, defaults to "Something"
|
1217
|
+
Property to use for sequencing if collection_ordering is "OTHER"
|
1218
|
+
|
1219
|
+
|
1220
|
+
|
1221
|
+
Returns
|
1222
|
+
-------
|
1223
|
+
str - the guid of the created collection
|
1224
|
+
|
1225
|
+
A JSON dict representing the specified collection. Returns a string if none found.
|
1226
|
+
|
1227
|
+
Raises
|
1228
|
+
------
|
1229
|
+
InvalidParameterException
|
1230
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1231
|
+
PropertyServerException
|
1232
|
+
Raised by the server when an issue arises in processing a valid request
|
1233
|
+
NotAuthorizedException
|
1234
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1235
|
+
|
1236
|
+
"""
|
1237
|
+
loop = asyncio.get_event_loop()
|
1238
|
+
resp = loop.run_until_complete(
|
1239
|
+
self._async_create_data_spec_collection(
|
1240
|
+
anchor_guid,
|
1241
|
+
parent_guid,
|
1242
|
+
parent_relationship_type_name,
|
1243
|
+
parent_at_end1,
|
1244
|
+
display_name,
|
1245
|
+
description,
|
1246
|
+
collection_type,
|
1247
|
+
is_own_anchor,
|
1248
|
+
collection_ordering,
|
1249
|
+
order_property_name,
|
1250
|
+
)
|
1251
|
+
)
|
1252
|
+
return resp
|
1253
|
+
|
1254
|
+
async def _async_create_folder_collection(
|
1255
|
+
self,
|
1256
|
+
anchor_guid: str,
|
1257
|
+
parent_guid: str,
|
1258
|
+
parent_relationship_type_name: str,
|
1259
|
+
parent_at_end1: bool,
|
1260
|
+
display_name: str,
|
1261
|
+
description: str,
|
1262
|
+
collection_type: str,
|
1263
|
+
is_own_anchor: bool = True,
|
1264
|
+
collection_ordering: str = "OTHER",
|
1265
|
+
order_property_name: str = "Something",
|
1266
|
+
) -> str:
|
1267
|
+
"""Create a new collection with the Folder classification. This is used to identify the organizing
|
1268
|
+
collections in a collection hierarchy. Async version.
|
1269
|
+
|
1270
|
+
Parameters
|
1271
|
+
----------
|
1272
|
+
anchor_guid: str
|
1273
|
+
The unique identifier of the element that should be the anchor for the new element.
|
1274
|
+
Set to null if no anchor, or if this collection is to be its own anchor.
|
1275
|
+
parent_guid: str
|
1276
|
+
The optional unique identifier for an element that should be connected to the newly created element.
|
1277
|
+
If this property is specified, parentRelationshipTypeName must also be specified
|
1278
|
+
parent_relationship_type_name: str
|
1279
|
+
The name of the relationship, if any, that should be established between the new element and the parent
|
1280
|
+
element. Examples could be "ResourceList" or "DigitalServiceProduct".
|
1281
|
+
parent_at_end1: bool
|
1282
|
+
Identifies which end any parent entity sits on the relationship.
|
1283
|
+
display_name: str
|
1284
|
+
The display name of the element. Will also be used as the basis of the qualified_name.
|
1285
|
+
description: str
|
1286
|
+
A description of the collection.
|
1287
|
+
collection_type: str
|
1288
|
+
Add appropriate valid value for the collection type.
|
1289
|
+
is_own_anchor: bool, optional, defaults to False
|
1290
|
+
Indicates if the collection should classified as its own anchor or not.
|
1291
|
+
collection_ordering: str, optional, defaults to "OTHER"
|
1292
|
+
Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
|
1293
|
+
"DATE_CREATED", "OTHER"
|
1294
|
+
order_property_name: str, optional, defaults to "Something"
|
1295
|
+
Property to use for sequencing if collection_ordering is "OTHER"
|
1296
|
+
|
1297
|
+
Returns
|
1298
|
+
-------
|
1299
|
+
str - the guid of the created collection
|
1300
|
+
|
1301
|
+
A JSON dict representing the specified collection. Returns a string if none found.
|
1302
|
+
|
1303
|
+
Raises
|
1304
|
+
------
|
1305
|
+
InvalidParameterException
|
1306
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1307
|
+
PropertyServerException
|
1308
|
+
Raised by the server when an issue arises in processing a valid request
|
1309
|
+
NotAuthorizedException
|
1310
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1311
|
+
|
1312
|
+
"""
|
1313
|
+
|
1314
|
+
is_own_anchor_s = str(is_own_anchor).lower()
|
1315
|
+
|
1316
|
+
url = f"{self.collection_command_root}/folder"
|
1317
|
+
|
1318
|
+
body = {
|
1319
|
+
"anchorGUID": anchor_guid,
|
1320
|
+
"isOwnAnchor": is_own_anchor_s,
|
1321
|
+
"parentGUID": parent_guid,
|
1322
|
+
"parentRelationshipTypeName": parent_relationship_type_name,
|
1323
|
+
"parentAtEnd1": parent_at_end1,
|
1324
|
+
"collectionProperties": {
|
1325
|
+
"class": "CollectionProperties",
|
1326
|
+
"qualifiedName": f"folder-collection-{display_name}-{time.asctime()}",
|
1327
|
+
"name": display_name,
|
1328
|
+
"description": description,
|
1329
|
+
"collectionType": collection_type,
|
1330
|
+
"collectionOrdering": collection_ordering,
|
1331
|
+
"orderPropertyName": order_property_name,
|
1332
|
+
},
|
1333
|
+
}
|
1334
|
+
|
1335
|
+
resp = await self._async_make_request("POST", url, body)
|
1336
|
+
return resp.json().get("guid", "No GUID returned")
|
1337
|
+
|
1338
|
+
def create_folder_collection(
|
1339
|
+
self,
|
1340
|
+
anchor_guid: str,
|
1341
|
+
parent_guid: str,
|
1342
|
+
parent_relationship_type_name: str,
|
1343
|
+
parent_at_end1: bool,
|
1344
|
+
display_name: str,
|
1345
|
+
description: str,
|
1346
|
+
collection_type: str,
|
1347
|
+
is_own_anchor: bool,
|
1348
|
+
collection_ordering: str = "OTHER",
|
1349
|
+
order_property_name: str = "Something",
|
1350
|
+
) -> str:
|
1351
|
+
"""Create a new collection with the Folder classification. This is used to identify the organizing
|
1352
|
+
collections in a collection hierarchy.
|
1353
|
+
|
1354
|
+
Parameters
|
1355
|
+
----------
|
1356
|
+
anchor_guid: str
|
1357
|
+
The unique identifier of the element that should be the anchor for the new element.
|
1358
|
+
Set to null if no anchor, or if this collection is to be its own anchor.
|
1359
|
+
parent_guid: str
|
1360
|
+
The optional unique identifier for an element that should be connected to the newly created element.
|
1361
|
+
If this property is specified, parentRelationshipTypeName must also be specified
|
1362
|
+
parent_relationship_type_name: str
|
1363
|
+
The name of the relationship, if any, that should be established between the new element and the parent
|
1364
|
+
element. Examples could be "ResourceList" or "DigitalServiceProduct".
|
1365
|
+
parent_at_end1: bool
|
1366
|
+
Identifies which end any parent entity sits on the relationship.
|
1367
|
+
display_name: str
|
1368
|
+
The display name of the element. Will also be used as the basis of the qualified_name.
|
1369
|
+
description: str
|
1370
|
+
A description of the collection.
|
1371
|
+
collection_type: str
|
1372
|
+
Add appropriate valid value for the collection type.
|
1373
|
+
is_own_anchor: bool, optional, defaults to False
|
1374
|
+
Indicates if the collection should classified as its own anchor or not.
|
1375
|
+
collection_ordering: str, optional, defaults to "OTHER"
|
1376
|
+
Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER", "DATE_CREATED",
|
1377
|
+
"OTHER"
|
1378
|
+
order_property_name: str, optional, defaults to "Something"
|
1379
|
+
Property to use for sequencing if collection_ordering is "OTHER"
|
1380
|
+
|
1381
|
+
Returns
|
1382
|
+
-------
|
1383
|
+
str - the guid of the created collection
|
1384
|
+
|
1385
|
+
A JSON dict representing the specified collection. Returns a string if none found.
|
1386
|
+
|
1387
|
+
Raises
|
1388
|
+
------
|
1389
|
+
InvalidParameterException
|
1390
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1391
|
+
PropertyServerException
|
1392
|
+
Raised by the server when an issue arises in processing a valid request
|
1393
|
+
NotAuthorizedException
|
1394
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1395
|
+
|
1396
|
+
"""
|
1397
|
+
loop = asyncio.get_event_loop()
|
1398
|
+
resp = loop.run_until_complete(
|
1399
|
+
self._async_create_folder_collection(
|
1400
|
+
anchor_guid,
|
1401
|
+
parent_guid,
|
1402
|
+
parent_relationship_type_name,
|
1403
|
+
parent_at_end1,
|
1404
|
+
display_name,
|
1405
|
+
description,
|
1406
|
+
collection_type,
|
1407
|
+
is_own_anchor,
|
1408
|
+
collection_ordering,
|
1409
|
+
order_property_name,
|
1410
|
+
)
|
1411
|
+
)
|
1412
|
+
return resp
|
1413
|
+
|
1414
|
+
async def _async_create_collection_from_template(self, body: dict) -> str:
|
1415
|
+
"""Create a new metadata element to represent a collection using an existing metadata element as a template.
|
1416
|
+
The template defines additional classifications and relationships that are added to the new collection.
|
1417
|
+
Async version.
|
1418
|
+
|
1419
|
+
Parameters
|
1420
|
+
----------
|
1421
|
+
|
1422
|
+
body: dict
|
1423
|
+
A dict representing the details of the collection to create.
|
1424
|
+
|
1425
|
+
Returns
|
1426
|
+
-------
|
1427
|
+
str - the guid of the created collection
|
1428
|
+
|
1429
|
+
Raises
|
1430
|
+
------
|
1431
|
+
InvalidParameterException
|
1432
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1433
|
+
PropertyServerException
|
1434
|
+
Raised by the server when an issue arises in processing a valid request
|
1435
|
+
NotAuthorizedException
|
1436
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1437
|
+
|
1438
|
+
Notes
|
1439
|
+
-----
|
1440
|
+
JSON Structure looks like:
|
1441
|
+
|
1442
|
+
{
|
1443
|
+
"class": "TemplateRequestBody",
|
1444
|
+
"anchorGUID": "anchor GUID, if set then isOwnAnchor=false",
|
1445
|
+
"isOwnAnchor": false,
|
1446
|
+
"parentGUID": "parent GUID, if set, set all parameters beginning 'parent'",
|
1447
|
+
"parentRelationshipTypeName": "open metadata type name",
|
1448
|
+
"parentAtEnd1": true,
|
1449
|
+
"templateGUID": "template GUID",
|
1450
|
+
"replacementProperties": {
|
1451
|
+
"class": "ElementProperties",
|
1452
|
+
"propertyValueMap" : {
|
1453
|
+
"propertyName" : {
|
1454
|
+
"class": "PrimitiveTypePropertyValue",
|
1455
|
+
"typeName": "string",
|
1456
|
+
"primitiveTypeCategory" : "OM_PRIMITIVE_TYPE_STRING",
|
1457
|
+
"primitiveValue" : "value of property"
|
1458
|
+
}
|
1459
|
+
}
|
1460
|
+
},
|
1461
|
+
"placeholderPropertyValues" : {
|
1462
|
+
"placeholderProperty1Name" : "property1Value",
|
1463
|
+
"placeholderProperty2Name" : "property2Value"
|
1464
|
+
}
|
1465
|
+
}
|
1466
|
+
|
1467
|
+
"""
|
1468
|
+
|
1469
|
+
url = f"{self.collection_command_root}/from-template"
|
1470
|
+
|
1471
|
+
resp = await self._async_make_request("POST", url, body)
|
1472
|
+
return resp.json().get("guid", "No GUID Returned")
|
1473
|
+
|
1474
|
+
def create_collection_from_template(self, body: dict) -> str:
|
1475
|
+
"""Create a new metadata element to represent a collection using an existing metadata element as a template.
|
1476
|
+
The template defines additional classifications and relationships that are added to the new collection.
|
1477
|
+
|
1478
|
+
Parameters
|
1479
|
+
----------
|
1480
|
+
body: dict
|
1481
|
+
A dict representing the details of the collection to create.
|
1482
|
+
|
1483
|
+
Returns
|
1484
|
+
-------
|
1485
|
+
str - the guid of the created collection
|
1486
|
+
|
1487
|
+
Raises
|
1488
|
+
------
|
1489
|
+
InvalidParameterException
|
1490
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1491
|
+
PropertyServerException
|
1492
|
+
Raised by the server when an issue arises in processing a valid request
|
1493
|
+
NotAuthorizedException
|
1494
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1495
|
+
|
1496
|
+
Notes
|
1497
|
+
-----
|
1498
|
+
JSON Structure looks like:
|
1499
|
+
|
1500
|
+
{
|
1501
|
+
"class": "TemplateRequestBody",
|
1502
|
+
"anchorGUID": "anchor GUID, if set then isOwnAnchor=false",
|
1503
|
+
"isOwnAnchor": false,
|
1504
|
+
"parentGUID": "parent GUID, if set, set all parameters beginning 'parent'",
|
1505
|
+
"parentRelationshipTypeName": "open metadata type name",
|
1506
|
+
"parentAtEnd1": true,
|
1507
|
+
"templateGUID": "template GUID",
|
1508
|
+
"replacementProperties": {
|
1509
|
+
"class": "ElementProperties",
|
1510
|
+
"propertyValueMap" : {
|
1511
|
+
"propertyName" : {
|
1512
|
+
"class": "PrimitiveTypePropertyValue",
|
1513
|
+
"typeName": "string",
|
1514
|
+
"primitiveTypeCategory" : "OM_PRIMITIVE_TYPE_STRING",
|
1515
|
+
"primitiveValue" : "value of property"
|
1516
|
+
}
|
1517
|
+
}
|
1518
|
+
},
|
1519
|
+
"placeholderPropertyValues" : {
|
1520
|
+
"placeholderProperty1Name" : "property1Value",
|
1521
|
+
"placeholderProperty2Name" : "property2Value"
|
1522
|
+
}
|
1523
|
+
}
|
1524
|
+
"""
|
1525
|
+
loop = asyncio.get_event_loop()
|
1526
|
+
resp = loop.run_until_complete(
|
1527
|
+
self._async_create_collection_from_template(body)
|
1528
|
+
)
|
1529
|
+
return resp
|
1530
|
+
|
1531
|
+
async def _async_create_digital_product(self, body: dict) -> str:
|
1532
|
+
"""Create a new collection that represents a digital product. Async version.
|
1533
|
+
|
1534
|
+
Parameters
|
1535
|
+
----------
|
1536
|
+
body: dict
|
1537
|
+
A dict representing the details of the collection to create.
|
1538
|
+
|
1539
|
+
If not provided, the server name associated
|
1540
|
+
with the instance is used.
|
1541
|
+
|
1542
|
+
Returns
|
1543
|
+
-------
|
1544
|
+
str - the guid of the created collection
|
1545
|
+
|
1546
|
+
Raises
|
1547
|
+
------
|
1548
|
+
InvalidParameterException
|
1549
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1550
|
+
PropertyServerException
|
1551
|
+
Raised by the server when an issue arises in processing a valid request
|
1552
|
+
NotAuthorizedException
|
1553
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1554
|
+
|
1555
|
+
Notes
|
1556
|
+
-----
|
1557
|
+
JSON Structure looks like:
|
1558
|
+
{
|
1559
|
+
"class" : "NewDigitalProductRequestBody",
|
1560
|
+
"anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
|
1561
|
+
"isOwnAnchor" : false,
|
1562
|
+
"parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
|
1563
|
+
"parentRelationshipTypeName" : "open metadata type name",
|
1564
|
+
"parentAtEnd1": true,
|
1565
|
+
"collectionProperties": {
|
1566
|
+
"class" : "CollectionProperties",
|
1567
|
+
"qualifiedName": "Must provide a unique name here",
|
1568
|
+
"name" : "Add display name here",
|
1569
|
+
"description" : "Add description of the collection here",
|
1570
|
+
"collectionType": "Add appropriate valid value for type",
|
1571
|
+
"collectionOrdering" : "OTHER",
|
1572
|
+
"orderPropertyName" : "Add property name if 'collectionOrdering' is OTHER"
|
1573
|
+
},
|
1574
|
+
"digitalProductProperties" : {
|
1575
|
+
"class" : "DigitalProductProperties",
|
1576
|
+
"productStatus" : "ACTIVE",
|
1577
|
+
"productName" : "Add name here",
|
1578
|
+
"productType" : "Add valid value here",
|
1579
|
+
"description" : "Add description here",
|
1580
|
+
"introductionDate" : "date",
|
1581
|
+
"maturity" : "Add valid value here",
|
1582
|
+
"serviceLife" : "Add the estimated lifetime of the product",
|
1583
|
+
"currentVersion": "V1.0",
|
1584
|
+
"nextVersion": "V1.1",
|
1585
|
+
"withdrawDate": "date",
|
1586
|
+
"additionalProperties": {
|
1587
|
+
"property1Name" : "property1Value",
|
1588
|
+
"property2Name" : "property2Value"
|
1589
|
+
}
|
1590
|
+
}
|
1591
|
+
}
|
1592
|
+
"""
|
1593
|
+
|
1594
|
+
url = f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/collection-manager/digital-products"
|
1595
|
+
|
1596
|
+
resp = await self._async_make_request("POST", url, body)
|
1597
|
+
return resp.json().get("guid", "No GUID returned")
|
1598
|
+
|
1599
|
+
def create_digital_product(self, body: dict) -> str:
|
1600
|
+
"""Create a new collection that represents a digital product. Async version.
|
1601
|
+
|
1602
|
+
Parameters
|
1603
|
+
----------
|
1604
|
+
body: dict
|
1605
|
+
A dict representing the details of the collection to create.
|
1606
|
+
|
1607
|
+
If not provided, the server name associated
|
1608
|
+
with the instance is used.
|
1609
|
+
|
1610
|
+
Returns
|
1611
|
+
-------
|
1612
|
+
str - the guid of the created collection
|
1613
|
+
|
1614
|
+
Raises
|
1615
|
+
------
|
1616
|
+
InvalidParameterException
|
1617
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1618
|
+
PropertyServerException
|
1619
|
+
Raised by the server when an issue arises in processing a valid request
|
1620
|
+
NotAuthorizedException
|
1621
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1622
|
+
|
1623
|
+
Notes
|
1624
|
+
-----
|
1625
|
+
JSON Structure looks like:
|
1626
|
+
{
|
1627
|
+
"class" : "NewDigitalProductRequestBody",
|
1628
|
+
"anchorGUID" : "anchor GUID, if set then isOwnAnchor=false",
|
1629
|
+
"isOwnAnchor" : false,
|
1630
|
+
"parentGUID" : "parent GUID, if set, set all parameters beginning 'parent'",
|
1631
|
+
"parentRelationshipTypeName" : "open metadata type name",
|
1632
|
+
"parentAtEnd1": true,
|
1633
|
+
"collectionProperties": {
|
1634
|
+
"class" : "CollectionProperties",
|
1635
|
+
"qualifiedName": "Must provide a unique name here",
|
1636
|
+
"name" : "Add display name here",
|
1637
|
+
"description" : "Add description of the collection here",
|
1638
|
+
"collectionType": "Add appropriate valid value for type",
|
1639
|
+
"collectionOrdering" : "OTHER",
|
1640
|
+
"orderPropertyName" : "Add property name if 'collectionOrdering' is OTHER"
|
1641
|
+
},
|
1642
|
+
"digitalProductProperties" : {
|
1643
|
+
"class" : "DigitalProductProperties",
|
1644
|
+
"productStatus" : "ACTIVE",
|
1645
|
+
"productName" : "Add name here",
|
1646
|
+
"productType" : "Add valid value here",
|
1647
|
+
"description" : "Add description here",
|
1648
|
+
"introductionDate" : "date",
|
1649
|
+
"maturity" : "Add valid value here",
|
1650
|
+
"serviceLife" : "Add the estimated lifetime of the product",
|
1651
|
+
"currentVersion": "V1.0",
|
1652
|
+
"nextVersion": "V1.1",
|
1653
|
+
"withdrawDate": "date",
|
1654
|
+
"additionalProperties": {
|
1655
|
+
"property1Name" : "property1Value",
|
1656
|
+
"property2Name" : "property2Value"
|
1657
|
+
}
|
1658
|
+
}
|
1659
|
+
}
|
1660
|
+
"""
|
1661
|
+
loop = asyncio.get_event_loop()
|
1662
|
+
resp = loop.run_until_complete(self._async_create_digital_product(body))
|
1663
|
+
return resp
|
1664
|
+
|
1665
|
+
#
|
1666
|
+
# Manage collections
|
1667
|
+
#
|
1668
|
+
async def _async_update_collection(
|
1669
|
+
self,
|
1670
|
+
collection_guid: str,
|
1671
|
+
qualified_name: str = None,
|
1672
|
+
display_name: str = None,
|
1673
|
+
description: str = None,
|
1674
|
+
collection_type: str = None,
|
1675
|
+
collection_ordering: str = None,
|
1676
|
+
order_property_name: str = None,
|
1677
|
+
replace_all_props: bool = False,
|
1678
|
+
) -> None:
|
1679
|
+
"""Update the properties of a collection. Async version.
|
1680
|
+
|
1681
|
+
Parameters
|
1682
|
+
----------
|
1683
|
+
collection_guid: str
|
1684
|
+
The guid of the collection to update.
|
1685
|
+
qualified_name: str, optional, defaults to None
|
1686
|
+
The qualified name of the collection to update.
|
1687
|
+
display_name: str, optional, defaults to None
|
1688
|
+
The display name of the element. Will also be used as the basis of the qualified_name.
|
1689
|
+
description: str, optional, defaults to None
|
1690
|
+
A description of the collection.
|
1691
|
+
collection_type: str, optional, defaults to None
|
1692
|
+
Add appropriate valid value for the collection type.
|
1693
|
+
collection_ordering: str, optional, defaults to None
|
1694
|
+
Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
|
1695
|
+
"DATE_CREATED", "OTHER"
|
1696
|
+
order_property_name: str, optional, defaults to None
|
1697
|
+
Property to use for sequencing if collection_ordering is "OTHER"
|
1698
|
+
replace_all_props: bool, optional, defaults to False
|
1699
|
+
Whether to replace all properties in the collection.
|
1700
|
+
|
1701
|
+
If not provided, the server name associated
|
1702
|
+
with the instance is used.
|
1703
|
+
|
1704
|
+
Returns
|
1705
|
+
-------
|
1706
|
+
Nothing
|
1707
|
+
|
1708
|
+
Raises
|
1709
|
+
------
|
1710
|
+
InvalidParameterException
|
1711
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1712
|
+
PropertyServerException
|
1713
|
+
Raised by the server when an issue arises in processing a valid request
|
1714
|
+
NotAuthorizedException
|
1715
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1716
|
+
"""
|
1717
|
+
|
1718
|
+
replace_all_props_s = str(replace_all_props).lower()
|
1719
|
+
url = (
|
1720
|
+
f"{self.collection_command_root}/{collection_guid}/update?"
|
1721
|
+
f"replaceAllProperties={replace_all_props_s}"
|
1722
|
+
)
|
1723
|
+
|
1724
|
+
body = {
|
1725
|
+
"class": "CollectionProperties",
|
1726
|
+
"qualifiedName": qualified_name,
|
1727
|
+
"name": display_name,
|
1728
|
+
"description": description,
|
1729
|
+
"collectionType": collection_type,
|
1730
|
+
"collectionOrdering": collection_ordering,
|
1731
|
+
"orderPropertyName": order_property_name,
|
1732
|
+
}
|
1733
|
+
body_s = body_slimmer(body)
|
1734
|
+
await self._async_make_request("POST", url, body_s)
|
1735
|
+
return
|
1736
|
+
|
1737
|
+
def update_collection(
|
1738
|
+
self,
|
1739
|
+
collection_guid,
|
1740
|
+
qualified_name: str = None,
|
1741
|
+
display_name: str = None,
|
1742
|
+
description: str = None,
|
1743
|
+
collection_type: str = None,
|
1744
|
+
collection_ordering: str = None,
|
1745
|
+
order_property_name: str = None,
|
1746
|
+
replace_all_props: bool = False,
|
1747
|
+
) -> None:
|
1748
|
+
"""Update the properties of a collection.
|
1749
|
+
|
1750
|
+
Parameters
|
1751
|
+
----------
|
1752
|
+
collection_guid: str
|
1753
|
+
The guid of the collection to update.
|
1754
|
+
qualified_name: str
|
1755
|
+
The qualified name of the collection to update.
|
1756
|
+
display_name: str
|
1757
|
+
The display name of the element. Will also be used as the basis of the qualified_name.
|
1758
|
+
description: str
|
1759
|
+
A description of the collection.
|
1760
|
+
collection_type: str
|
1761
|
+
Add appropriate valid value for the collection type.
|
1762
|
+
collection_ordering: str, optional, defaults to "OTHER"
|
1763
|
+
Specifies the sequencing to use in a collection. Examples include "NAME", "OWNER",
|
1764
|
+
"DATE_CREATED", "OTHER"
|
1765
|
+
order_property_name: str, optional, defaults to "Something"
|
1766
|
+
Property to use for sequencing if collection_ordering is "OTHER"
|
1767
|
+
replace_all_props: bool, optional, defaults to False
|
1768
|
+
Whether to replace all properties in the collection.
|
1769
|
+
|
1770
|
+
If not provided, the server name associated
|
1771
|
+
with the instance is used.
|
1772
|
+
|
1773
|
+
Returns
|
1774
|
+
-------
|
1775
|
+
Nothing
|
1776
|
+
|
1777
|
+
Raises
|
1778
|
+
------
|
1779
|
+
InvalidParameterException
|
1780
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1781
|
+
PropertyServerException
|
1782
|
+
Raised by the server when an issue arises in processing a valid request
|
1783
|
+
NotAuthorizedException
|
1784
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1785
|
+
"""
|
1786
|
+
loop = asyncio.get_event_loop()
|
1787
|
+
loop.run_until_complete(
|
1788
|
+
self._async_update_collection(
|
1789
|
+
collection_guid,
|
1790
|
+
qualified_name,
|
1791
|
+
display_name,
|
1792
|
+
description,
|
1793
|
+
collection_type,
|
1794
|
+
collection_ordering,
|
1795
|
+
order_property_name,
|
1796
|
+
replace_all_props,
|
1797
|
+
)
|
1798
|
+
)
|
1799
|
+
return
|
1800
|
+
|
1801
|
+
async def _async_update_digital_product(
|
1802
|
+
self,
|
1803
|
+
collection_guid: str,
|
1804
|
+
body: dict,
|
1805
|
+
replace_all_props: bool = False,
|
1806
|
+
):
|
1807
|
+
"""Update the properties of the DigitalProduct classification attached to a collection. Async version.
|
1808
|
+
|
1809
|
+
Parameters
|
1810
|
+
----------
|
1811
|
+
collection_guid: str
|
1812
|
+
The guid of the collection to update.
|
1813
|
+
body: dict
|
1814
|
+
A dict representing the details of the collection to create.
|
1815
|
+
replace_all_props: bool, optional, defaults to False
|
1816
|
+
Whether to replace all properties in the collection.
|
1817
|
+
|
1818
|
+
|
1819
|
+
Returns
|
1820
|
+
-------
|
1821
|
+
Nothing
|
1822
|
+
|
1823
|
+
Raises
|
1824
|
+
------
|
1825
|
+
InvalidParameterException
|
1826
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1827
|
+
PropertyServerException
|
1828
|
+
Raised by the server when an issue arises in processing a valid request
|
1829
|
+
NotAuthorizedException
|
1830
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1831
|
+
|
1832
|
+
Notes
|
1833
|
+
-----
|
1834
|
+
JSON Structure looks like:
|
1835
|
+
{
|
1836
|
+
"class" : "DigitalProductProperties",
|
1837
|
+
"productStatus" : "ACTIVE",
|
1838
|
+
"productName" : "Add name here",
|
1839
|
+
"productType" : "Add valid value here",
|
1840
|
+
"description" : "Add description here",
|
1841
|
+
"introductionDate" : "date",
|
1842
|
+
"maturity" : "Add valid value here",
|
1843
|
+
"serviceLife" : "Add the estimated lifetime of the product",
|
1844
|
+
"currentVersion": "V1.0",
|
1845
|
+
"nextVersion": "V1.1",
|
1846
|
+
"withdrawDate": "date",
|
1847
|
+
"additionalProperties": {
|
1848
|
+
"property1Name" : "property1Value",
|
1849
|
+
"property2Name" : "property2Value"
|
1850
|
+
}
|
1851
|
+
}
|
1852
|
+
"""
|
1853
|
+
|
1854
|
+
replace_all_props_s = str(replace_all_props).lower()
|
1855
|
+
url = (
|
1856
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/collection-manager/digital-products/"
|
1857
|
+
f"{collection_guid}/update?replaceAllProperties={replace_all_props_s}"
|
1858
|
+
)
|
1859
|
+
|
1860
|
+
await self._async_make_request("POST", url, body)
|
1861
|
+
return
|
1862
|
+
|
1863
|
+
def update_digital_product(
|
1864
|
+
self,
|
1865
|
+
collection_guid: str,
|
1866
|
+
body: dict,
|
1867
|
+
replace_all_props: bool = False,
|
1868
|
+
):
|
1869
|
+
"""Update the properties of the DigitalProduct classification attached to a collection.
|
1870
|
+
|
1871
|
+
Parameters
|
1872
|
+
----------
|
1873
|
+
collection_guid: str
|
1874
|
+
The guid of the collection to update.
|
1875
|
+
body: dict
|
1876
|
+
A dict representing the details of the collection to create.
|
1877
|
+
replace_all_props: bool, optional, defaults to False
|
1878
|
+
Whether to replace all properties in the collection.
|
1879
|
+
|
1880
|
+
|
1881
|
+
Returns
|
1882
|
+
-------
|
1883
|
+
Nothing
|
1884
|
+
|
1885
|
+
Raises
|
1886
|
+
------
|
1887
|
+
InvalidParameterException
|
1888
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1889
|
+
PropertyServerException
|
1890
|
+
Raised by the server when an issue arises in processing a valid request
|
1891
|
+
NotAuthorizedException
|
1892
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1893
|
+
|
1894
|
+
Notes
|
1895
|
+
-----
|
1896
|
+
JSON Structure looks like:
|
1897
|
+
{
|
1898
|
+
"class" : "DigitalProductProperties",
|
1899
|
+
"productStatus" : "ACTIVE",
|
1900
|
+
"productName" : "Add name here",
|
1901
|
+
"productType" : "Add valid value here",
|
1902
|
+
"description" : "Add description here",
|
1903
|
+
"introductionDate" : "date",
|
1904
|
+
"maturity" : "Add valid value here",
|
1905
|
+
"serviceLife" : "Add the estimated lifetime of the product",
|
1906
|
+
"currentVersion": "V1.0",
|
1907
|
+
"nextVersion": "V1.1",
|
1908
|
+
"withdrawDate": "date",
|
1909
|
+
"additionalProperties": {
|
1910
|
+
"property1Name" : "property1Value",
|
1911
|
+
"property2Name" : "property2Value"
|
1912
|
+
}
|
1913
|
+
}
|
1914
|
+
"""
|
1915
|
+
loop = asyncio.get_event_loop()
|
1916
|
+
loop.run_until_complete(
|
1917
|
+
self._async_update_digital_product(collection_guid, body, replace_all_props)
|
1918
|
+
)
|
1919
|
+
return
|
1920
|
+
|
1921
|
+
async def _async_attach_collection(
|
1922
|
+
self,
|
1923
|
+
collection_guid: str,
|
1924
|
+
element_guid: str,
|
1925
|
+
resource_use: str,
|
1926
|
+
resource_use_description: str = None,
|
1927
|
+
resource_use_props: dict = None,
|
1928
|
+
watch_resources: bool = False,
|
1929
|
+
make_anchor: bool = False,
|
1930
|
+
) -> None:
|
1931
|
+
"""Connect an existing collection to an element using the ResourceList relationship (0019). Async version.
|
1932
|
+
Parameters
|
1933
|
+
----------
|
1934
|
+
collection_guid: str
|
1935
|
+
The guid of the collection to update.
|
1936
|
+
element_guid: str
|
1937
|
+
The guid of the element to attach.
|
1938
|
+
resource_use: str,
|
1939
|
+
How the resource is being used.
|
1940
|
+
resource_use_description: str
|
1941
|
+
Describe how the resource is being used.
|
1942
|
+
resource_use_props: dict, optional, defaults to None
|
1943
|
+
The properties of the resource to be used.
|
1944
|
+
watch_resources, bool, optional, defaults to False
|
1945
|
+
Whether to watch for the resources to be updated.
|
1946
|
+
make_anchor, bool, optional, defaults to False
|
1947
|
+
Whether to make the this an anchor.
|
1948
|
+
|
1949
|
+
|
1950
|
+
Returns
|
1951
|
+
-------
|
1952
|
+
Nothing
|
1953
|
+
|
1954
|
+
Raises
|
1955
|
+
------
|
1956
|
+
InvalidParameterException
|
1957
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
1958
|
+
PropertyServerException
|
1959
|
+
Raised by the server when an issue arises in processing a valid request
|
1960
|
+
NotAuthorizedException
|
1961
|
+
The principle specified by the user_id does not have authorization for the requested action
|
1962
|
+
|
1963
|
+
"""
|
1964
|
+
|
1965
|
+
watch_resources_s = str(watch_resources).lower()
|
1966
|
+
make_anchor_s = str(make_anchor).lower()
|
1967
|
+
|
1968
|
+
url = (
|
1969
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/collection-manager/metadata-elements/"
|
1970
|
+
f"{element_guid}/collections/{collection_guid}/attach?makeAnchor={make_anchor_s}"
|
1971
|
+
)
|
1972
|
+
|
1973
|
+
body = {
|
1974
|
+
"class": "ResourceListProperties",
|
1975
|
+
"resourceUse": resource_use,
|
1976
|
+
"resourceUseDescription": resource_use_description,
|
1977
|
+
"watchResource": watch_resources_s,
|
1978
|
+
"resourceUseProperties": resource_use_props,
|
1979
|
+
}
|
1980
|
+
await self._async_make_request("POST", url, body)
|
1981
|
+
return
|
1982
|
+
|
1983
|
+
def attach_collection(
|
1984
|
+
self,
|
1985
|
+
collection_guid: str,
|
1986
|
+
element_guid: str,
|
1987
|
+
resource_use: str,
|
1988
|
+
resource_use_description: str,
|
1989
|
+
resource_use_props: dict = None,
|
1990
|
+
watch_resources: bool = False,
|
1991
|
+
make_anchor: bool = False,
|
1992
|
+
) -> None:
|
1993
|
+
"""Connect an existing collection to an element using the ResourceList relationship (0019).
|
1994
|
+
Parameters
|
1995
|
+
----------
|
1996
|
+
collection_guid: str
|
1997
|
+
The guid of the collection to update.
|
1998
|
+
element_guid: str
|
1999
|
+
The guid of the element to attach.
|
2000
|
+
resource_use: str,
|
2001
|
+
How the resource is being used.
|
2002
|
+
resource_use_description: str
|
2003
|
+
Describe how the resource is being used.
|
2004
|
+
resource_use_props: dict, optional, defaults to None
|
2005
|
+
The properties of the resource to be used.
|
2006
|
+
watch_resources: bool, optional, defaults to False
|
2007
|
+
Whether to watch for the resources to be updated.
|
2008
|
+
make_anchor: bool, optional, defaults to False
|
2009
|
+
Whether to make the this an anchor.
|
2010
|
+
|
2011
|
+
If not provided, the server name associated
|
2012
|
+
with the instance is used.
|
2013
|
+
|
2014
|
+
Returns
|
2015
|
+
-------
|
2016
|
+
Nothing
|
2017
|
+
|
2018
|
+
Raises
|
2019
|
+
------
|
2020
|
+
InvalidParameterException
|
2021
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2022
|
+
PropertyServerException
|
2023
|
+
Raised by the server when an issue arises in processing a valid request
|
2024
|
+
NotAuthorizedException
|
2025
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2026
|
+
|
2027
|
+
"""
|
2028
|
+
loop = asyncio.get_event_loop()
|
2029
|
+
loop.run_until_complete(
|
2030
|
+
self._async_attach_collection(
|
2031
|
+
collection_guid,
|
2032
|
+
element_guid,
|
2033
|
+
resource_use,
|
2034
|
+
resource_use_description,
|
2035
|
+
resource_use_props,
|
2036
|
+
watch_resources,
|
2037
|
+
make_anchor,
|
2038
|
+
)
|
2039
|
+
)
|
2040
|
+
return
|
2041
|
+
|
2042
|
+
async def _async_detach_collection(
|
2043
|
+
self, collection_guid: str, element_guid: str
|
2044
|
+
) -> None:
|
2045
|
+
"""Detach an existing collection from an element. If the collection is anchored to the element, it is deleted.
|
2046
|
+
Async version.
|
2047
|
+
|
2048
|
+
Parameters
|
2049
|
+
----------
|
2050
|
+
collection_guid: str
|
2051
|
+
The guid of the collection to update.
|
2052
|
+
element_guid: str
|
2053
|
+
The guid of the element to attach.
|
2054
|
+
|
2055
|
+
If not provided, the server name associated
|
2056
|
+
with the instance is used.
|
2057
|
+
|
2058
|
+
Returns
|
2059
|
+
-------
|
2060
|
+
Nothing
|
2061
|
+
|
2062
|
+
Raises
|
2063
|
+
------
|
2064
|
+
InvalidParameterException
|
2065
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2066
|
+
PropertyServerException
|
2067
|
+
Raised by the server when an issue arises in processing a valid request
|
2068
|
+
NotAuthorizedException
|
2069
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2070
|
+
|
2071
|
+
"""
|
2072
|
+
|
2073
|
+
url = (
|
2074
|
+
f"{self.platform_url}/servers/{self.view_server}/api/open-metadata/collection-manager/metadata-elements/"
|
2075
|
+
f"{element_guid}/collections/{collection_guid}/detach"
|
2076
|
+
)
|
2077
|
+
|
2078
|
+
body = {"class": "NullRequestBody"}
|
2079
|
+
|
2080
|
+
await self._async_make_request("POST", url, body)
|
2081
|
+
return
|
2082
|
+
|
2083
|
+
def detach_collection(self, collection_guid: str, element_guid: str) -> None:
|
2084
|
+
"""Connect an existing collection to an element using the ResourceList relationship (0019).
|
2085
|
+
Parameters
|
2086
|
+
----------
|
2087
|
+
collection_guid: str
|
2088
|
+
The guid of the collection to update.
|
2089
|
+
element_guid: str
|
2090
|
+
The guid of the element to attach.
|
2091
|
+
|
2092
|
+
If not provided, the server name associated
|
2093
|
+
with the instance is used.
|
2094
|
+
|
2095
|
+
Returns
|
2096
|
+
-------
|
2097
|
+
Nothing
|
2098
|
+
|
2099
|
+
Raises
|
2100
|
+
------
|
2101
|
+
InvalidParameterException
|
2102
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2103
|
+
PropertyServerException
|
2104
|
+
Raised by the server when an issue arises in processing a valid request
|
2105
|
+
NotAuthorizedException
|
2106
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2107
|
+
|
2108
|
+
"""
|
2109
|
+
loop = asyncio.get_event_loop()
|
2110
|
+
loop.run_until_complete(
|
2111
|
+
self._async_detach_collection(collection_guid, element_guid)
|
2112
|
+
)
|
2113
|
+
return
|
2114
|
+
|
2115
|
+
async def _async_delete_collection(self, collection_guid: str) -> None:
|
2116
|
+
"""Delete a collection. It is detected from all parent elements. If members are anchored to the collection
|
2117
|
+
then they are also deleted. Async version
|
2118
|
+
|
2119
|
+
|
2120
|
+
Parameters
|
2121
|
+
----------
|
2122
|
+
collection_guid: str
|
2123
|
+
The guid of the collection to update.
|
2124
|
+
|
2125
|
+
If not provided, the server name associated
|
2126
|
+
with the instance is used.
|
2127
|
+
|
2128
|
+
Returns
|
2129
|
+
-------
|
2130
|
+
Nothing
|
2131
|
+
|
2132
|
+
Raises
|
2133
|
+
------
|
2134
|
+
InvalidParameterException
|
2135
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2136
|
+
PropertyServerException
|
2137
|
+
Raised by the server when an issue arises in processing a valid request
|
2138
|
+
NotAuthorizedException
|
2139
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2140
|
+
|
2141
|
+
"""
|
2142
|
+
|
2143
|
+
url = f"{self.collection_command_root}/{collection_guid}/delete"
|
2144
|
+
body = {"class": "NullRequestBody"}
|
2145
|
+
|
2146
|
+
await self._async_make_request("POST", url, body)
|
2147
|
+
return
|
2148
|
+
|
2149
|
+
def delete_collection(self, collection_guid: str) -> None:
|
2150
|
+
"""Delete a collection. It is detected from all parent elements. If members are anchored to the collection
|
2151
|
+
then they are also deleted.
|
2152
|
+
|
2153
|
+
Parameters
|
2154
|
+
----------
|
2155
|
+
collection_guid: str
|
2156
|
+
The guid of the collection to update.
|
2157
|
+
|
2158
|
+
If not provided, the server name associated
|
2159
|
+
with the instance is used.
|
2160
|
+
|
2161
|
+
Returns
|
2162
|
+
-------
|
2163
|
+
Nothing
|
2164
|
+
|
2165
|
+
Raises
|
2166
|
+
------
|
2167
|
+
|
2168
|
+
InvalidParameterException
|
2169
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2170
|
+
PropertyServerException
|
2171
|
+
Raised by the server when an issue arises in processing a valid request
|
2172
|
+
NotAuthorizedException
|
2173
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2174
|
+
|
2175
|
+
"""
|
2176
|
+
loop = asyncio.get_event_loop()
|
2177
|
+
loop.run_until_complete(self._async_delete_collection(collection_guid))
|
2178
|
+
return
|
2179
|
+
|
2180
|
+
async def _async_get_collection_members(
|
2181
|
+
self,
|
2182
|
+
collection_guid: str = None,
|
2183
|
+
collection_name: str = None,
|
2184
|
+
collection_qname: str = None,
|
2185
|
+
effective_time: str = None,
|
2186
|
+
start_from: int = 0,
|
2187
|
+
page_size: int = None,
|
2188
|
+
) -> list | str:
|
2189
|
+
"""Return a list of elements that are a member of a collection. Async version.
|
2190
|
+
|
2191
|
+
Parameters
|
2192
|
+
----------
|
2193
|
+
collection_guid: str,
|
2194
|
+
identity of the collection to return members for. If none, collection_name or
|
2195
|
+
collection_qname are used.
|
2196
|
+
collection_name: str,
|
2197
|
+
display name of the collection to return members for. If none, collection_guid
|
2198
|
+
or collection_qname are used.
|
2199
|
+
collection_qname: str,
|
2200
|
+
qualified name of the collection to return members for. If none, collection_guid
|
2201
|
+
or collection_name are used.
|
2202
|
+
effective_time: str, [default=None], optional
|
2203
|
+
Effective time of the query. If not specified will default to any time.
|
2204
|
+
start_from: int, [default=0], optional
|
2205
|
+
When multiple pages of results are available, the page number to start from.
|
2206
|
+
page_size: int, [default=None]
|
2207
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
2208
|
+
the class instance.
|
2209
|
+
Returns
|
2210
|
+
-------
|
2211
|
+
List | str
|
2212
|
+
|
2213
|
+
A list of collection members in the collection.
|
2214
|
+
|
2215
|
+
Raises
|
2216
|
+
------
|
2217
|
+
|
2218
|
+
InvalidParameterException
|
2219
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2220
|
+
PropertyServerException
|
2221
|
+
Raised by the server when an issue arises in processing a valid request
|
2222
|
+
NotAuthorizedException
|
2223
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2224
|
+
|
2225
|
+
"""
|
2226
|
+
|
2227
|
+
if page_size is None:
|
2228
|
+
page_size = self.page_size
|
2229
|
+
collection_guid = self.__get_guid__(
|
2230
|
+
collection_guid,
|
2231
|
+
collection_name,
|
2232
|
+
"name",
|
2233
|
+
collection_qname,
|
2234
|
+
None,
|
2235
|
+
)
|
2236
|
+
url = (
|
2237
|
+
f"{self.collection_command_root}/{collection_guid}/"
|
2238
|
+
f"members?startFrom={start_from}&pageSize={page_size}"
|
2239
|
+
)
|
2240
|
+
|
2241
|
+
resp = await self._async_make_request("GET", url)
|
2242
|
+
return resp.json().get("elements", "No elements found")
|
2243
|
+
|
2244
|
+
def get_collection_members(
|
2245
|
+
self,
|
2246
|
+
collection_guid: str = None,
|
2247
|
+
collection_name: str = None,
|
2248
|
+
collection_qname: str = None,
|
2249
|
+
effective_time: str = None,
|
2250
|
+
start_from: int = 0,
|
2251
|
+
page_size: int = None,
|
2252
|
+
) -> list | str:
|
2253
|
+
"""Return a list of elements that are a member of a collection. Async version.
|
2254
|
+
|
2255
|
+
Parameters
|
2256
|
+
----------
|
2257
|
+
collection_guid: str,
|
2258
|
+
identity of the collection to return members for. If none, collection_name or
|
2259
|
+
collection_qname are used.
|
2260
|
+
collection_name: str,
|
2261
|
+
display name of the collection to return members for. If none, collection_guid
|
2262
|
+
or collection_qname are used.
|
2263
|
+
collection_qname: str,
|
2264
|
+
qualified name of the collection to return members for. If none, collection_guid
|
2265
|
+
or collection_name are used.
|
2266
|
+
effective_time: str, [default=None], optional
|
2267
|
+
Effective time of the query. If not specified will default to any time.
|
2268
|
+
start_from: int, [default=0], optional
|
2269
|
+
When multiple pages of results are available, the page number to start from.
|
2270
|
+
page_size: int, [default=None]
|
2271
|
+
The number of items to return in a single page. If not specified, the default will be taken from
|
2272
|
+
the class instance.
|
2273
|
+
Returns
|
2274
|
+
-------
|
2275
|
+
List | str
|
2276
|
+
|
2277
|
+
A list of collection members in the collection.
|
2278
|
+
|
2279
|
+
Raises
|
2280
|
+
------
|
2281
|
+
|
2282
|
+
InvalidParameterException
|
2283
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2284
|
+
PropertyServerException
|
2285
|
+
Raised by the server when an issue arises in processing a valid request
|
2286
|
+
NotAuthorizedException
|
2287
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2288
|
+
|
2289
|
+
"""
|
2290
|
+
loop = asyncio.get_event_loop()
|
2291
|
+
resp = loop.run_until_complete(
|
2292
|
+
self._async_get_collection_members(
|
2293
|
+
collection_guid,
|
2294
|
+
collection_name,
|
2295
|
+
collection_qname,
|
2296
|
+
effective_time,
|
2297
|
+
start_from,
|
2298
|
+
page_size,
|
2299
|
+
)
|
2300
|
+
)
|
2301
|
+
|
2302
|
+
return resp
|
2303
|
+
|
2304
|
+
async def _async_add_to_collection(
|
2305
|
+
self,
|
2306
|
+
collection_guid: str,
|
2307
|
+
element_guid: str,
|
2308
|
+
body: dict = None,
|
2309
|
+
) -> None:
|
2310
|
+
"""Add an element to a collection. The request body is optional. Async version.
|
2311
|
+
|
2312
|
+
Parameters
|
2313
|
+
----------
|
2314
|
+
collection_guid: str
|
2315
|
+
identity of the collection to return members for.
|
2316
|
+
element_guid: str
|
2317
|
+
Effective time of the query. If not specified will default to any time.
|
2318
|
+
body: dict, optional, defaults to None
|
2319
|
+
The body of the request to add to the collection. See notes.
|
2320
|
+
|
2321
|
+
The name of the server to use.
|
2322
|
+
|
2323
|
+
|
2324
|
+
Returns
|
2325
|
+
-------
|
2326
|
+
None
|
2327
|
+
|
2328
|
+
Raises
|
2329
|
+
------
|
2330
|
+
|
2331
|
+
InvalidParameterException
|
2332
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2333
|
+
PropertyServerException
|
2334
|
+
Raised by the server when an issue arises in processing a valid request
|
2335
|
+
NotAuthorizedException
|
2336
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2337
|
+
|
2338
|
+
Notes
|
2339
|
+
-----
|
2340
|
+
Example body:
|
2341
|
+
{
|
2342
|
+
"class" : "CollectionMembershipProperties",
|
2343
|
+
"membershipRationale": "xxx",
|
2344
|
+
"createdBy": "user id here",
|
2345
|
+
"expression": "expression that described why the element is a part of this collection",
|
2346
|
+
"confidence": 100,
|
2347
|
+
"status": "PROPOSED",
|
2348
|
+
"userDefinedStatus": "Add valid value here",
|
2349
|
+
"steward": "identifier of steward that validated this member",
|
2350
|
+
"stewardTypeName": "type name of element identifying the steward",
|
2351
|
+
"stewardPropertyName": "property name if the steward's identifier",
|
2352
|
+
"source": "source of the member",
|
2353
|
+
"notes": "Add notes here"
|
2354
|
+
}
|
2355
|
+
|
2356
|
+
"""
|
2357
|
+
|
2358
|
+
url = (
|
2359
|
+
f"{self.collection_command_root}/{collection_guid}/members/"
|
2360
|
+
f"{element_guid}/attach"
|
2361
|
+
)
|
2362
|
+
body_s = body_slimmer(body)
|
2363
|
+
await self._async_make_request("POST", url, body_s)
|
2364
|
+
return
|
2365
|
+
|
2366
|
+
def add_to_collection(
|
2367
|
+
self,
|
2368
|
+
collection_guid: str,
|
2369
|
+
element_guid: str,
|
2370
|
+
body: dict = None,
|
2371
|
+
) -> None:
|
2372
|
+
"""Add an element to a collection. The request body is optional.
|
2373
|
+
|
2374
|
+
Parameters
|
2375
|
+
----------
|
2376
|
+
collection_guid: str
|
2377
|
+
identity of the collection to return members for.
|
2378
|
+
element_guid: str
|
2379
|
+
Effective time of the query. If not specified will default to any time.
|
2380
|
+
body: dict, optional, defaults to None
|
2381
|
+
The body of the request to add to the collection. See notes.
|
2382
|
+
|
2383
|
+
The name of the server to use.
|
2384
|
+
|
2385
|
+
|
2386
|
+
Returns
|
2387
|
+
-------
|
2388
|
+
None
|
2389
|
+
|
2390
|
+
Raises
|
2391
|
+
------
|
2392
|
+
|
2393
|
+
InvalidParameterException
|
2394
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2395
|
+
PropertyServerException
|
2396
|
+
Raised by the server when an issue arises in processing a valid request
|
2397
|
+
NotAuthorizedException
|
2398
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2399
|
+
|
2400
|
+
Notes
|
2401
|
+
-----
|
2402
|
+
Example body:
|
2403
|
+
{
|
2404
|
+
"class" : "CollectionMembershipProperties",
|
2405
|
+
"membershipRationale": "xxx",
|
2406
|
+
"createdBy": "user id here",
|
2407
|
+
"expression": "expression that described why the element is a part of this collection",
|
2408
|
+
"confidence": 100,
|
2409
|
+
"status": "PROPOSED",
|
2410
|
+
"userDefinedStatus": "Add valid value here",
|
2411
|
+
"steward": "identifier of steward that validated this member",
|
2412
|
+
"stewardTypeName": "type name of element identifying the steward",
|
2413
|
+
"stewardPropertyName": "property name if the steward's identifier",
|
2414
|
+
"source": "source of the member",
|
2415
|
+
"notes": "Add notes here"
|
2416
|
+
}
|
2417
|
+
|
2418
|
+
"""
|
2419
|
+
loop = asyncio.get_event_loop()
|
2420
|
+
loop.run_until_complete(
|
2421
|
+
self._async_add_to_collection(collection_guid, element_guid, body)
|
2422
|
+
)
|
2423
|
+
return
|
2424
|
+
|
2425
|
+
async def _async_update_collection_membership(
|
2426
|
+
self,
|
2427
|
+
collection_guid: str,
|
2428
|
+
element_guid: str,
|
2429
|
+
body: dict = None,
|
2430
|
+
replace_all_props: bool = False,
|
2431
|
+
) -> None:
|
2432
|
+
"""Update an element's membership to a collection. Async version.
|
2433
|
+
|
2434
|
+
Parameters
|
2435
|
+
----------
|
2436
|
+
collection_guid: str
|
2437
|
+
identity of the collection to return members for.
|
2438
|
+
element_guid: str
|
2439
|
+
Effective time of the query. If not specified will default to any time.
|
2440
|
+
body: dict, optional, defaults to None
|
2441
|
+
The body of the request to add to the collection. See notes.
|
2442
|
+
replace_all_props: bool, optional, defaults to False
|
2443
|
+
Replace all properties or just update ones specified in body.
|
2444
|
+
|
2445
|
+
The name of the server to use.
|
2446
|
+
|
2447
|
+
|
2448
|
+
Returns
|
2449
|
+
-------
|
2450
|
+
None
|
2451
|
+
|
2452
|
+
Raises
|
2453
|
+
------
|
2454
|
+
|
2455
|
+
InvalidParameterException
|
2456
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2457
|
+
PropertyServerException
|
2458
|
+
Raised by the server when an issue arises in processing a valid request
|
2459
|
+
NotAuthorizedException
|
2460
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2461
|
+
|
2462
|
+
Notes
|
2463
|
+
-----
|
2464
|
+
Example body:
|
2465
|
+
{
|
2466
|
+
"class" : "CollectionMembershipProperties",
|
2467
|
+
"membershipRationale": "xxx",
|
2468
|
+
"createdBy": "user id here",
|
2469
|
+
"expression": "expression that described why the element is a part of this collection",
|
2470
|
+
"confidence": 100,
|
2471
|
+
"status": "PROPOSED",
|
2472
|
+
"userDefinedStatus": "Add valid value here",
|
2473
|
+
"steward": "identifier of steward that validated this member",
|
2474
|
+
"stewardTypeName": "type name of element identifying the steward",
|
2475
|
+
"stewardPropertyName": "property name if the steward's identifier",
|
2476
|
+
"source": "source of the member",
|
2477
|
+
"notes": "Add notes here"
|
2478
|
+
}
|
2479
|
+
|
2480
|
+
"""
|
2481
|
+
|
2482
|
+
replace_all_props_s = str(replace_all_props).lower()
|
2483
|
+
url = (
|
2484
|
+
f"{self.collection_command_root}/{collection_guid}/members/"
|
2485
|
+
f"{element_guid}/update?replaceAllProperties={replace_all_props_s}"
|
2486
|
+
)
|
2487
|
+
body_s = body_slimmer(body)
|
2488
|
+
await self._async_make_request("POST", url, body_s)
|
2489
|
+
return
|
2490
|
+
|
2491
|
+
def update_collection_membership(
|
2492
|
+
self,
|
2493
|
+
collection_guid: str,
|
2494
|
+
element_guid: str,
|
2495
|
+
body: dict = None,
|
2496
|
+
replace_all_props: bool = False,
|
2497
|
+
) -> None:
|
2498
|
+
"""Update an element's membership to a collection.
|
2499
|
+
|
2500
|
+
Parameters
|
2501
|
+
----------
|
2502
|
+
collection_guid: str
|
2503
|
+
identity of the collection to update members for.
|
2504
|
+
element_guid: str
|
2505
|
+
Effective time of the query. If not specified will default to any time.
|
2506
|
+
body: dict, optional, defaults to None
|
2507
|
+
The body of the request to add to the collection. See notes.
|
2508
|
+
replace_all_props: bool, optional, defaults to False
|
2509
|
+
Replace all properties or just update ones specified in body.
|
2510
|
+
|
2511
|
+
The name of the server to use.
|
2512
|
+
|
2513
|
+
|
2514
|
+
Returns
|
2515
|
+
-------
|
2516
|
+
None
|
2517
|
+
|
2518
|
+
Raises
|
2519
|
+
------
|
2520
|
+
|
2521
|
+
InvalidParameterException
|
2522
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2523
|
+
PropertyServerException
|
2524
|
+
Raised by the server when an issue arises in processing a valid request
|
2525
|
+
NotAuthorizedException
|
2526
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2527
|
+
|
2528
|
+
Notes
|
2529
|
+
-----
|
2530
|
+
Example body:
|
2531
|
+
{
|
2532
|
+
"class" : "CollectionMembershipProperties",
|
2533
|
+
"membershipRationale": "xxx",
|
2534
|
+
"createdBy": "user id here",
|
2535
|
+
"expression": "expression that described why the element is a part of this collection",
|
2536
|
+
"confidence": 100,
|
2537
|
+
"status": "PROPOSED",
|
2538
|
+
"userDefinedStatus": "Add valid value here",
|
2539
|
+
"steward": "identifier of steward that validated this member",
|
2540
|
+
"stewardTypeName": "type name of element identifying the steward",
|
2541
|
+
"stewardPropertyName": "property name if the steward's identifier",
|
2542
|
+
"source": "source of the member",
|
2543
|
+
"notes": "Add notes here"
|
2544
|
+
}
|
2545
|
+
|
2546
|
+
"""
|
2547
|
+
loop = asyncio.get_event_loop()
|
2548
|
+
loop.run_until_complete(
|
2549
|
+
self._async_update_collection_membership(
|
2550
|
+
collection_guid, element_guid, body, replace_all_props
|
2551
|
+
)
|
2552
|
+
)
|
2553
|
+
return
|
2554
|
+
|
2555
|
+
async def _async_remove_from_collection(
|
2556
|
+
self, collection_guid: str, element_guid: str
|
2557
|
+
) -> None:
|
2558
|
+
"""Remove an element from a collection. Async version.
|
2559
|
+
|
2560
|
+
Parameters
|
2561
|
+
----------
|
2562
|
+
collection_guid: str
|
2563
|
+
identity of the collection to return members for.
|
2564
|
+
element_guid: str
|
2565
|
+
Effective time of the query. If not specified will default to any time.
|
2566
|
+
|
2567
|
+
The name of the server to use.
|
2568
|
+
|
2569
|
+
|
2570
|
+
Returns
|
2571
|
+
-------
|
2572
|
+
None
|
2573
|
+
|
2574
|
+
Raises
|
2575
|
+
------
|
2576
|
+
|
2577
|
+
InvalidParameterException
|
2578
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2579
|
+
PropertyServerException
|
2580
|
+
Raised by the server when an issue arises in processing a valid request
|
2581
|
+
NotAuthorizedException
|
2582
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2583
|
+
|
2584
|
+
"""
|
2585
|
+
|
2586
|
+
url = (
|
2587
|
+
f"{self.collection_command_root}/{collection_guid}/members/"
|
2588
|
+
f"{element_guid}/detach"
|
2589
|
+
)
|
2590
|
+
body = {"class": "NullRequestBody"}
|
2591
|
+
await self._async_make_request("POST", url, body)
|
2592
|
+
return
|
2593
|
+
|
2594
|
+
def remove_from_collection(self, collection_guid: str, element_guid: str) -> None:
|
2595
|
+
"""Remove an element from a collection.
|
2596
|
+
|
2597
|
+
Parameters
|
2598
|
+
----------
|
2599
|
+
collection_guid: str
|
2600
|
+
identity of the collection to return members for.
|
2601
|
+
element_guid: str
|
2602
|
+
Effective time of the query. If not specified will default to any time.
|
2603
|
+
|
2604
|
+
The name of the server to use.
|
2605
|
+
|
2606
|
+
|
2607
|
+
Returns
|
2608
|
+
-------
|
2609
|
+
None
|
2610
|
+
|
2611
|
+
Raises
|
2612
|
+
------
|
2613
|
+
|
2614
|
+
InvalidParameterException
|
2615
|
+
If the client passes incorrect parameters on the request - such as bad URLs or invalid values
|
2616
|
+
PropertyServerException
|
2617
|
+
Raised by the server when an issue arises in processing a valid request
|
2618
|
+
NotAuthorizedException
|
2619
|
+
The principle specified by the user_id does not have authorization for the requested action
|
2620
|
+
|
2621
|
+
"""
|
2622
|
+
loop = asyncio.get_event_loop()
|
2623
|
+
loop.run_until_complete(
|
2624
|
+
self._async_remove_from_collection(collection_guid, element_guid)
|
2625
|
+
)
|
2626
|
+
return
|
2627
|
+
|
2628
|
+
async def _async_get_member_list(
|
2629
|
+
self,
|
2630
|
+
collection_guid: str = None,
|
2631
|
+
collection_name: str = None,
|
2632
|
+
collection_qname: str = None,
|
2633
|
+
) -> list | bool:
|
2634
|
+
"""Get the member list for the collection - async version.
|
2635
|
+
Parameters
|
2636
|
+
----------
|
2637
|
+
collection_guid: str,
|
2638
|
+
identity of the collection to return members for. If none, collection_name or
|
2639
|
+
collection_qname are used.
|
2640
|
+
collection_name: str,
|
2641
|
+
display name of the collection to return members for. If none, collection_guid
|
2642
|
+
or collection_qname are used.
|
2643
|
+
collection_qname: str,
|
2644
|
+
qualified name of the collection to return members for. If none, collection_guid
|
2645
|
+
or collection_name are used.
|
2646
|
+
|
2647
|
+
Returns
|
2648
|
+
-------
|
2649
|
+
list | str
|
2650
|
+
The list of member information if successful, otherwise the string "No members found"
|
2651
|
+
|
2652
|
+
Raises
|
2653
|
+
------
|
2654
|
+
InvalidParameterException
|
2655
|
+
If the root_collection_name does not have exactly one root collection.
|
2656
|
+
|
2657
|
+
"""
|
2658
|
+
|
2659
|
+
# first find the guid for the collection we are using as root
|
2660
|
+
|
2661
|
+
# now find the members of the collection
|
2662
|
+
member_list = []
|
2663
|
+
members = await self._async_get_collection_members(
|
2664
|
+
collection_guid, collection_name, collection_qname
|
2665
|
+
)
|
2666
|
+
if (type(members) is str) or (len(members) == 0):
|
2667
|
+
return "No members found"
|
2668
|
+
# finally, construct a list of member information
|
2669
|
+
for member_rel in members:
|
2670
|
+
member_guid = member_rel["elementHeader"]["guid"]
|
2671
|
+
member_resp = await self._async_get_collection(member_guid)
|
2672
|
+
member = member_resp.get("element", None)
|
2673
|
+
if member is None:
|
2674
|
+
continue
|
2675
|
+
# print(json.dumps(member, indent = 4))
|
2676
|
+
|
2677
|
+
member_instance = {
|
2678
|
+
"name": member["properties"]["name"],
|
2679
|
+
"qualifiedName": member["properties"]["qualifiedName"],
|
2680
|
+
"guid": member["elementHeader"]["guid"],
|
2681
|
+
"description": member["properties"]["description"],
|
2682
|
+
"collectionType": member["properties"]["collectionType"],
|
2683
|
+
}
|
2684
|
+
member_list.append(member_instance)
|
2685
|
+
|
2686
|
+
return member_list if len(member_list) > 0 else "No members found"
|
2687
|
+
|
2688
|
+
def get_member_list(
|
2689
|
+
self,
|
2690
|
+
collection_guid: str = None,
|
2691
|
+
collection_name: str = None,
|
2692
|
+
collection_qname: str = None,
|
2693
|
+
) -> list | bool:
|
2694
|
+
"""Get the member list for the collection - async version.
|
2695
|
+
Parameters
|
2696
|
+
----------
|
2697
|
+
collection_guid: str,
|
2698
|
+
identity of the collection to return members for. If none, collection_name or
|
2699
|
+
collection_qname are used.
|
2700
|
+
collection_name: str,
|
2701
|
+
display name of the collection to return members for. If none, collection_guid
|
2702
|
+
or collection_qname are used.
|
2703
|
+
collection_qname: str,
|
2704
|
+
qualified name of the collection to return members for. If none, collection_guid
|
2705
|
+
or collection_name are used.
|
2706
|
+
Returns
|
2707
|
+
-------
|
2708
|
+
list | bool
|
2709
|
+
The list of member information if successful, otherwise False.
|
2710
|
+
|
2711
|
+
Raises
|
2712
|
+
------
|
2713
|
+
InvalidParameterException
|
2714
|
+
If the root_collection_name does not have exactly one root collection.
|
2715
|
+
|
2716
|
+
"""
|
2717
|
+
loop = asyncio.get_event_loop()
|
2718
|
+
resp = loop.run_until_complete(
|
2719
|
+
self._async_get_member_list(
|
2720
|
+
collection_guid, collection_name, collection_qname
|
2721
|
+
)
|
2722
|
+
)
|
2723
|
+
return resp
|
2724
|
+
|
2725
|
+
|
2726
|
+
if __name__ == "__main__":
|
2727
|
+
print("Main-Collection Manager")
|