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,163 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
Unit tests for the Utils helper functions using the Pytest framework.
|
7
|
+
|
8
|
+
|
9
|
+
A simple display for my profile
|
10
|
+
"""
|
11
|
+
import os
|
12
|
+
import argparse
|
13
|
+
import time
|
14
|
+
import sys
|
15
|
+
|
16
|
+
from rich import box, print
|
17
|
+
from rich.console import Console
|
18
|
+
from rich.table import Table
|
19
|
+
from rich.tree import Tree
|
20
|
+
from rich.panel import Panel
|
21
|
+
from rich.markdown import Markdown
|
22
|
+
|
23
|
+
from pyegeria import (
|
24
|
+
InvalidParameterException,
|
25
|
+
PropertyServerException,
|
26
|
+
UserNotAuthorizedException,
|
27
|
+
print_exception_response,
|
28
|
+
)
|
29
|
+
from pyegeria.my_profile_omvs import MyProfile
|
30
|
+
|
31
|
+
disable_ssl_warnings = True
|
32
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
33
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
34
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
35
|
+
EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
|
36
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
37
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
38
|
+
)
|
39
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
40
|
+
EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
|
41
|
+
"EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
|
42
|
+
)
|
43
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
44
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
45
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
46
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
47
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
48
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "150"))
|
49
|
+
|
50
|
+
|
51
|
+
def display_my_profile(
|
52
|
+
server: str,
|
53
|
+
url: str,
|
54
|
+
username: str,
|
55
|
+
user_pass: str,
|
56
|
+
jupyter: bool = EGERIA_JUPYTER,
|
57
|
+
width: int = EGERIA_WIDTH,
|
58
|
+
):
|
59
|
+
try:
|
60
|
+
m_client = MyProfile(server, url, user_id=username, user_pwd=user_pass)
|
61
|
+
token = m_client.create_egeria_bearer_token(username, user_pass)
|
62
|
+
my_profiles = m_client.get_my_profile()
|
63
|
+
if type(my_profiles) is str:
|
64
|
+
print(f"No profiles found for {username}")
|
65
|
+
sys.exit(1)
|
66
|
+
|
67
|
+
console = Console(width=width, force_terminal=not jupyter, soft_wrap=True)
|
68
|
+
|
69
|
+
profile_props = my_profiles.get("profileProperties", "---")
|
70
|
+
name = profile_props["fullName"]
|
71
|
+
|
72
|
+
tree = Tree(
|
73
|
+
Panel(f"Profile of {name}", title="Personal Profile"),
|
74
|
+
expanded=True,
|
75
|
+
style="bright_white on black",
|
76
|
+
guide_style="bold bright_blue",
|
77
|
+
)
|
78
|
+
|
79
|
+
profile_props_md = f"\n* GUID: {my_profiles['elementHeader']['guid']}\n"
|
80
|
+
if type(profile_props) is dict:
|
81
|
+
for key in profile_props.keys():
|
82
|
+
if type(profile_props[key]) is str:
|
83
|
+
profile_props_md += f"* {key}: {profile_props[key]}\n"
|
84
|
+
elif type(profile_props[key]) is dict:
|
85
|
+
p_md = "\n* Additional Details:\n"
|
86
|
+
for k in profile_props[key].keys():
|
87
|
+
p_md += f"\t* {k}: {profile_props[key][k]}\n"
|
88
|
+
profile_props_md += p_md
|
89
|
+
t1 = tree.add(
|
90
|
+
Panel(
|
91
|
+
Markdown(profile_props_md), title="Profile Properties", expand=False
|
92
|
+
)
|
93
|
+
)
|
94
|
+
|
95
|
+
id_list_md = ""
|
96
|
+
for identities in my_profiles["userIdentities"]:
|
97
|
+
id_list_md += (
|
98
|
+
f"* {identities['userIdentity']['properties']['userId']}\n"
|
99
|
+
f"* {identities['userIdentity']['elementHeader']['guid']}\n"
|
100
|
+
)
|
101
|
+
t2 = tree.add(Panel(Markdown(id_list_md), title="Identities", expand=False))
|
102
|
+
|
103
|
+
contact_methods = my_profiles["contactMethods"]
|
104
|
+
for method in contact_methods:
|
105
|
+
contact = method["properties"]
|
106
|
+
contact_methods_md = ""
|
107
|
+
for key in contact.keys():
|
108
|
+
contact_methods_md += f"* {key}: {contact[key]}\n"
|
109
|
+
t3 = tree.add(
|
110
|
+
Panel(
|
111
|
+
Markdown(contact_methods_md), title="Contact Methods", expand=False
|
112
|
+
)
|
113
|
+
)
|
114
|
+
|
115
|
+
my_roles = my_profiles["roles"]
|
116
|
+
table = Table(
|
117
|
+
title=f" Roles of {name}",
|
118
|
+
show_lines=True,
|
119
|
+
box=box.ROUNDED,
|
120
|
+
expand=True,
|
121
|
+
)
|
122
|
+
table.add_column("Role Type")
|
123
|
+
table.add_column("Role")
|
124
|
+
table.add_column("Role GUID")
|
125
|
+
for a_role in my_roles:
|
126
|
+
my_role_props = a_role["properties"]
|
127
|
+
role_type = my_role_props["typeName"]
|
128
|
+
role = my_role_props.get("title", " ")
|
129
|
+
role_guid = a_role["elementHeader"]["guid"]
|
130
|
+
table.add_row(role_type, role, role_guid)
|
131
|
+
t4 = tree.add(Panel(table, title="Roles", expand=False), expanded=True)
|
132
|
+
|
133
|
+
print(tree)
|
134
|
+
|
135
|
+
except (
|
136
|
+
InvalidParameterException,
|
137
|
+
PropertyServerException,
|
138
|
+
UserNotAuthorizedException,
|
139
|
+
) as e:
|
140
|
+
print_exception_response(e)
|
141
|
+
finally:
|
142
|
+
m_client.close_session()
|
143
|
+
|
144
|
+
|
145
|
+
def main():
|
146
|
+
parser = argparse.ArgumentParser()
|
147
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
148
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
149
|
+
parser.add_argument("--userid", help="User Id")
|
150
|
+
parser.add_argument("--password", help="User Password")
|
151
|
+
|
152
|
+
args = parser.parse_args()
|
153
|
+
|
154
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
155
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
156
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
157
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
158
|
+
|
159
|
+
display_my_profile(server, url, userid, user_pass)
|
160
|
+
|
161
|
+
|
162
|
+
if __name__ == "__main__":
|
163
|
+
main()
|
@@ -0,0 +1,151 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
Unit tests for the Utils helper functions using the Pytest framework.
|
7
|
+
|
8
|
+
|
9
|
+
List the roles for a given user.
|
10
|
+
"""
|
11
|
+
import os
|
12
|
+
import argparse
|
13
|
+
import time
|
14
|
+
import sys
|
15
|
+
|
16
|
+
from rich import box
|
17
|
+
from rich.console import Console
|
18
|
+
from rich.table import Table
|
19
|
+
|
20
|
+
from pyegeria import (
|
21
|
+
InvalidParameterException,
|
22
|
+
PropertyServerException,
|
23
|
+
UserNotAuthorizedException,
|
24
|
+
print_exception_response,
|
25
|
+
)
|
26
|
+
from pyegeria.my_profile_omvs import MyProfile
|
27
|
+
|
28
|
+
disable_ssl_warnings = True
|
29
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
30
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
31
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
32
|
+
EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
|
33
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
34
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
35
|
+
)
|
36
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
37
|
+
EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
|
38
|
+
"EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
|
39
|
+
)
|
40
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
41
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
42
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
43
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
44
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
45
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
46
|
+
|
47
|
+
|
48
|
+
def display_my_roles(
|
49
|
+
server: str,
|
50
|
+
url: str,
|
51
|
+
username: str,
|
52
|
+
user_pass: str,
|
53
|
+
jupyter: bool = EGERIA_JUPYTER,
|
54
|
+
width: int = EGERIA_WIDTH,
|
55
|
+
):
|
56
|
+
m_client = MyProfile(server, url, user_id=username, user_pwd=user_pass)
|
57
|
+
token = m_client.create_egeria_bearer_token(username, user_pass)
|
58
|
+
my_profiles = m_client.get_my_profile()
|
59
|
+
if type(my_profiles) is str:
|
60
|
+
print(f"No profiles found for {username}")
|
61
|
+
sys.exit(1)
|
62
|
+
|
63
|
+
def generate_table() -> Table:
|
64
|
+
"""Make a new table."""
|
65
|
+
table = Table(
|
66
|
+
title=f"My Profile Information {url} @ {time.asctime()}",
|
67
|
+
# style = "black on grey66",
|
68
|
+
header_style="white on dark_blue",
|
69
|
+
show_lines=True,
|
70
|
+
box=box.ROUNDED,
|
71
|
+
caption=f"My Profile from Server '{server}' @ Platform - {url}\n Press 'q' to Quit",
|
72
|
+
expand=True,
|
73
|
+
)
|
74
|
+
|
75
|
+
table.add_column("Name")
|
76
|
+
table.add_column("Job Title")
|
77
|
+
table.add_column("userId")
|
78
|
+
table.add_column("myGUID")
|
79
|
+
table.add_column("Role Type")
|
80
|
+
table.add_column("Role")
|
81
|
+
table.add_column("Role GUID")
|
82
|
+
|
83
|
+
if len(my_profiles) == 0:
|
84
|
+
name = " "
|
85
|
+
job_title = " "
|
86
|
+
user_id = " "
|
87
|
+
my_guid = " "
|
88
|
+
role_type = " "
|
89
|
+
role = " "
|
90
|
+
role_guid = " "
|
91
|
+
else:
|
92
|
+
name = my_profiles["profileProperties"]["fullName"]
|
93
|
+
job_title = my_profiles["profileProperties"]["jobTitle"]
|
94
|
+
id_list = " "
|
95
|
+
for identities in my_profiles["userIdentities"]:
|
96
|
+
id_list = (
|
97
|
+
f"{identities['userIdentity']['properties']['userId']} {id_list}"
|
98
|
+
)
|
99
|
+
|
100
|
+
my_guid = my_profiles["elementHeader"]["guid"]
|
101
|
+
|
102
|
+
my_roles = my_profiles["roles"]
|
103
|
+
for a_role in my_roles:
|
104
|
+
my_role_props = a_role["properties"]
|
105
|
+
role_type = my_role_props["typeName"]
|
106
|
+
role = my_role_props.get("title", " ")
|
107
|
+
role_guid = a_role["elementHeader"]["guid"]
|
108
|
+
table.add_row(
|
109
|
+
name, job_title, str(id_list), my_guid, role_type, role, role_guid
|
110
|
+
)
|
111
|
+
|
112
|
+
m_client.close_session()
|
113
|
+
return table
|
114
|
+
|
115
|
+
try:
|
116
|
+
# with Live(generate_table(), refresh_per_second=4, screen=True) as live:
|
117
|
+
# while True:
|
118
|
+
# time.sleep(2)
|
119
|
+
# live.update(generate_table())
|
120
|
+
console = Console(width=width, force_terminal=not jupyter)
|
121
|
+
with console.pager():
|
122
|
+
console.print(generate_table())
|
123
|
+
|
124
|
+
except (
|
125
|
+
InvalidParameterException,
|
126
|
+
PropertyServerException,
|
127
|
+
UserNotAuthorizedException,
|
128
|
+
) as e:
|
129
|
+
print_exception_response(e)
|
130
|
+
assert e.related_http_code != "200", "Invalid parameters"
|
131
|
+
|
132
|
+
|
133
|
+
def main():
|
134
|
+
parser = argparse.ArgumentParser()
|
135
|
+
parser.add_argument("--server", help="Name of the server to display status for")
|
136
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
137
|
+
parser.add_argument("--userid", help="User Id")
|
138
|
+
parser.add_argument("--password", help="User Password")
|
139
|
+
|
140
|
+
args = parser.parse_args()
|
141
|
+
|
142
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
143
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
144
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
145
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
146
|
+
|
147
|
+
display_my_roles(server, url, userid, user_pass)
|
148
|
+
|
149
|
+
|
150
|
+
if __name__ == "__main__":
|
151
|
+
main()
|
@@ -0,0 +1,205 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
Unit tests for the Utils helper functions using the Pytest framework.
|
7
|
+
|
8
|
+
|
9
|
+
A simple status display of a user's todos
|
10
|
+
"""
|
11
|
+
import os
|
12
|
+
import argparse
|
13
|
+
import time
|
14
|
+
|
15
|
+
from rich import box
|
16
|
+
from rich.live import Live
|
17
|
+
from rich.markdown import Markdown
|
18
|
+
from rich.table import Table
|
19
|
+
from rich.console import Console
|
20
|
+
|
21
|
+
from pyegeria import (
|
22
|
+
InvalidParameterException,
|
23
|
+
PropertyServerException,
|
24
|
+
UserNotAuthorizedException,
|
25
|
+
print_exception_response,
|
26
|
+
)
|
27
|
+
from pyegeria.my_profile_omvs import MyProfile
|
28
|
+
|
29
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
30
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
31
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
32
|
+
EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
|
33
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
34
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
35
|
+
)
|
36
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
37
|
+
EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
|
38
|
+
"EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
|
39
|
+
)
|
40
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
41
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
42
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
43
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
44
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
45
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
46
|
+
|
47
|
+
disable_ssl_warnings = True
|
48
|
+
|
49
|
+
|
50
|
+
def display_my_todos(
|
51
|
+
server: str,
|
52
|
+
url: str,
|
53
|
+
user: str,
|
54
|
+
user_pass: str,
|
55
|
+
jupyter: bool = EGERIA_JUPYTER,
|
56
|
+
width: int = EGERIA_WIDTH,
|
57
|
+
):
|
58
|
+
console = Console(width=width, force_terminal=not jupyter)
|
59
|
+
|
60
|
+
m_client = MyProfile(server, url, user_id=user)
|
61
|
+
token = m_client.create_egeria_bearer_token(user, user_pass)
|
62
|
+
|
63
|
+
def add_rows(table: Table, guid: str, identity: str) -> None:
|
64
|
+
todo_items = m_client.get_assigned_actions(guid)
|
65
|
+
if type(todo_items) is str:
|
66
|
+
return
|
67
|
+
|
68
|
+
for item in todo_items:
|
69
|
+
assigned_actors = ''
|
70
|
+
if todo_items is None:
|
71
|
+
name = " "
|
72
|
+
type_name = " "
|
73
|
+
todo_guid = " "
|
74
|
+
created = " "
|
75
|
+
priority = " "
|
76
|
+
due = " "
|
77
|
+
completed = " "
|
78
|
+
status = " "
|
79
|
+
sponsor = " "
|
80
|
+
else:
|
81
|
+
props = item["properties"]
|
82
|
+
name = props["name"]
|
83
|
+
todo_type_name = props.get("toDoType", " ")
|
84
|
+
todo_guid = item["elementHeader"].get("guid", "---")
|
85
|
+
created = props.get("creationTime", "---")
|
86
|
+
priority = str(props.get("priority", "---"))
|
87
|
+
due = props.get("dueTime", " ")
|
88
|
+
completed = props.get("completionTime", "---")
|
89
|
+
status = props.get("toDoStatus")
|
90
|
+
|
91
|
+
for actor in item["assignedActors"]:
|
92
|
+
assigned_actors+=f"{actor.get("uniqueName", "NoOne")}\n"
|
93
|
+
assigned_actors_out = Markdown(assigned_actors)
|
94
|
+
if status in ("WAITING", "OPEN"):
|
95
|
+
status = f"[yellow]{status}"
|
96
|
+
elif status in ("INPROGRESS", "COMPLETE"):
|
97
|
+
status = f"[green]{status}"
|
98
|
+
else:
|
99
|
+
status = f"[red]{status}"
|
100
|
+
|
101
|
+
table.add_row(
|
102
|
+
str(identity),
|
103
|
+
name,
|
104
|
+
todo_type_name,
|
105
|
+
todo_guid,
|
106
|
+
created,
|
107
|
+
priority,
|
108
|
+
due,
|
109
|
+
completed,
|
110
|
+
status,
|
111
|
+
assigned_actors_out,
|
112
|
+
)
|
113
|
+
|
114
|
+
def generate_table() -> Table:
|
115
|
+
"""Make a new table."""
|
116
|
+
table = Table(
|
117
|
+
title=f"Open ToDos for Platform {url} @ {time.asctime()}",
|
118
|
+
# style = "black on grey66",
|
119
|
+
header_style="white on dark_blue",
|
120
|
+
show_lines=True,
|
121
|
+
box=box.ROUNDED,
|
122
|
+
caption=f"ToDos for Server '{server}' @ Platform - {url}",
|
123
|
+
expand=True,
|
124
|
+
)
|
125
|
+
table.add_column("Actor")
|
126
|
+
table.add_column("ToDo Name")
|
127
|
+
table.add_column("Type Name")
|
128
|
+
table.add_column("GUID")
|
129
|
+
table.add_column("Created")
|
130
|
+
table.add_column("Priority")
|
131
|
+
table.add_column("Due")
|
132
|
+
table.add_column("Completion")
|
133
|
+
table.add_column("Status")
|
134
|
+
table.add_column("Sponsor")
|
135
|
+
|
136
|
+
my_profile = m_client.get_my_profile()
|
137
|
+
my_guid = my_profile["elementHeader"].get("guid", "---")
|
138
|
+
my_ids = my_profile["userIdentities"]
|
139
|
+
my_title = my_profile["profileProperties"].get("jobTitle", "No Title")
|
140
|
+
user_ids = []
|
141
|
+
for id in my_ids:
|
142
|
+
user_ids.append(id["userIdentity"]["properties"].get("userid", "NoOne"))
|
143
|
+
add_rows(
|
144
|
+
table,
|
145
|
+
id["userIdentity"]["elementHeader"]["guid"],
|
146
|
+
id["userIdentity"]["properties"]["userId"],
|
147
|
+
)
|
148
|
+
|
149
|
+
add_rows(table, my_guid, user_ids)
|
150
|
+
|
151
|
+
# user_id_guid = my_profile["userIdentity"]["guid"]
|
152
|
+
# user_id_name = my_profile["userIdentity"]["properties"]["userid"]
|
153
|
+
# add_rows(table, user_id_guid, user_id_name)
|
154
|
+
|
155
|
+
my_roles = my_profile["roles"]
|
156
|
+
if type(my_roles) is list:
|
157
|
+
for role in my_roles:
|
158
|
+
role_guid = role["elementHeader"]["guid"]
|
159
|
+
role_id = role["properties"].get("roleId", "No Role Id")
|
160
|
+
add_rows(table, role_guid, role_id)
|
161
|
+
|
162
|
+
# m_client.close_session()
|
163
|
+
return table
|
164
|
+
|
165
|
+
try:
|
166
|
+
with Live(generate_table(), refresh_per_second=4, screen=True) as live:
|
167
|
+
while True:
|
168
|
+
time.sleep(2)
|
169
|
+
live.update(generate_table())
|
170
|
+
|
171
|
+
except (
|
172
|
+
InvalidParameterException,
|
173
|
+
PropertyServerException,
|
174
|
+
UserNotAuthorizedException,
|
175
|
+
) as e:
|
176
|
+
print_exception_response(e)
|
177
|
+
|
178
|
+
except KeyboardInterrupt:
|
179
|
+
pass
|
180
|
+
finally:
|
181
|
+
m_client.close_session()
|
182
|
+
|
183
|
+
|
184
|
+
def main():
|
185
|
+
parser = argparse.ArgumentParser()
|
186
|
+
parser.add_argument("--server", help="Name of the view server to connect to")
|
187
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
188
|
+
parser.add_argument("--userid", help="User Id")
|
189
|
+
parser.add_argument("--password", help="User Password")
|
190
|
+
args = parser.parse_args()
|
191
|
+
|
192
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
193
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
194
|
+
userid = args.userid if args.userid is not None else "peterprofile"
|
195
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
196
|
+
|
197
|
+
try:
|
198
|
+
print(f"Starting display_todos with {server}, {url}, {userid}")
|
199
|
+
display_my_todos(server=server, url=url, user=userid, user_pass=user_pass)
|
200
|
+
except KeyboardInterrupt:
|
201
|
+
pass
|
202
|
+
|
203
|
+
|
204
|
+
if __name__ == "__main__":
|
205
|
+
main()
|
@@ -0,0 +1,175 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
SPDX-License-Identifier: Apache-2.0
|
4
|
+
Copyright Contributors to the ODPi Egeria project.
|
5
|
+
|
6
|
+
Unit tests for the Utils helper functions using the Pytest framework.
|
7
|
+
|
8
|
+
|
9
|
+
A simple status display for Open To Dos
|
10
|
+
"""
|
11
|
+
import os
|
12
|
+
import argparse
|
13
|
+
import time
|
14
|
+
import sys
|
15
|
+
from rich import box
|
16
|
+
from rich.live import Live
|
17
|
+
from rich.markdown import Markdown
|
18
|
+
from rich.table import Table
|
19
|
+
from rich.console import Console
|
20
|
+
|
21
|
+
from pyegeria import EgeriaTech
|
22
|
+
from pyegeria._exceptions import (
|
23
|
+
InvalidParameterException,
|
24
|
+
PropertyServerException,
|
25
|
+
UserNotAuthorizedException,
|
26
|
+
print_exception_response,
|
27
|
+
)
|
28
|
+
|
29
|
+
from pyegeria.my_profile_omvs import MyProfile
|
30
|
+
|
31
|
+
disable_ssl_warnings = True
|
32
|
+
|
33
|
+
EGERIA_METADATA_STORE = os.environ.get("EGERIA_METADATA_STORE", "active-metadata-store")
|
34
|
+
EGERIA_KAFKA_ENDPOINT = os.environ.get("KAFKA_ENDPOINT", "localhost:9092")
|
35
|
+
EGERIA_PLATFORM_URL = os.environ.get("EGERIA_PLATFORM_URL", "https://localhost:9443")
|
36
|
+
EGERIA_VIEW_SERVER = os.environ.get("VIEW_SERVER", "view-server")
|
37
|
+
EGERIA_VIEW_SERVER_URL = os.environ.get(
|
38
|
+
"EGERIA_VIEW_SERVER_URL", "https://localhost:9443"
|
39
|
+
)
|
40
|
+
EGERIA_INTEGRATION_DAEMON = os.environ.get("INTEGRATION_DAEMON", "integration-daemon")
|
41
|
+
EGERIA_INTEGRATION_DAEMON_URL = os.environ.get(
|
42
|
+
"EGERIA_INTEGRATION_DAEMON_URL", "https://localhost:9443"
|
43
|
+
)
|
44
|
+
EGERIA_ADMIN_USER = os.environ.get("ADMIN_USER", "garygeeke")
|
45
|
+
EGERIA_ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "secret")
|
46
|
+
EGERIA_USER = os.environ.get("EGERIA_USER", "erinoverview")
|
47
|
+
EGERIA_USER_PASSWORD = os.environ.get("EGERIA_USER_PASSWORD", "secret")
|
48
|
+
EGERIA_JUPYTER = bool(os.environ.get("EGERIA_JUPYTER", "False"))
|
49
|
+
EGERIA_WIDTH = int(os.environ.get("EGERIA_WIDTH", "200"))
|
50
|
+
|
51
|
+
|
52
|
+
def display_todos(
|
53
|
+
server: str,
|
54
|
+
url: str,
|
55
|
+
user: str,
|
56
|
+
user_pass: str,
|
57
|
+
jupyter: bool = EGERIA_JUPYTER,
|
58
|
+
width: int = EGERIA_WIDTH,
|
59
|
+
):
|
60
|
+
console = Console(width=width, force_terminal=not jupyter)
|
61
|
+
|
62
|
+
m_client = EgeriaTech(server, url, user_id=user)
|
63
|
+
token = m_client.create_egeria_bearer_token(user, user_pass)
|
64
|
+
|
65
|
+
def generate_table(search_string: str = "*") -> Table:
|
66
|
+
"""Make a new table."""
|
67
|
+
table = Table(
|
68
|
+
header_style="bright_white on dark_blue",
|
69
|
+
title_style="bold white on black",
|
70
|
+
caption_style="white on black",
|
71
|
+
title=f"Open ToDos for Platform {url} @ {time.asctime()}",
|
72
|
+
show_lines=True,
|
73
|
+
box=box.ROUNDED,
|
74
|
+
caption=f"ToDos for Server '{server}' @ Platform - {url}",
|
75
|
+
expand=True,
|
76
|
+
)
|
77
|
+
|
78
|
+
table.add_column("Name")
|
79
|
+
table.add_column("Type Name")
|
80
|
+
|
81
|
+
table.add_column("Created")
|
82
|
+
table.add_column("Priority")
|
83
|
+
table.add_column("Due")
|
84
|
+
table.add_column("Completion")
|
85
|
+
table.add_column("Status")
|
86
|
+
table.add_column("Assigned Actors")
|
87
|
+
|
88
|
+
todo_items = m_client.find_to_do("*", starts_with=True)
|
89
|
+
if type(todo_items) is str:
|
90
|
+
print("===> No To Do items found")
|
91
|
+
sys.exit()
|
92
|
+
if todo_items is None:
|
93
|
+
name = " "
|
94
|
+
type_name = " "
|
95
|
+
created = " "
|
96
|
+
priority = " "
|
97
|
+
due = " "
|
98
|
+
completed = " "
|
99
|
+
status = " "
|
100
|
+
assigned = " "
|
101
|
+
else:
|
102
|
+
for item in todo_items:
|
103
|
+
props = item["properties"]
|
104
|
+
name = props["name"]
|
105
|
+
type_name = props.get("toDoType", " ")
|
106
|
+
created = props.get("creationTime", " ")
|
107
|
+
priority = str(props.get("priority", " "))
|
108
|
+
due = props.get("dueTime", " ")
|
109
|
+
completed = props.get("completionTime", " ")
|
110
|
+
status = props.get("toDoStatus", "---")
|
111
|
+
assigned_actors = item["assignedActors"]
|
112
|
+
|
113
|
+
assigned = ""
|
114
|
+
if type(assigned_actors) is list:
|
115
|
+
for actor in assigned_actors:
|
116
|
+
actor_guid = actor["guid"]
|
117
|
+
assigned += f"{m_client.get_actor_for_guid(actor_guid)} \n ({actor_guid}"
|
118
|
+
assigned_out = Markdown(assigned)
|
119
|
+
|
120
|
+
if status in ("WAITING", "OPEN"):
|
121
|
+
status = f"[yellow]{status}"
|
122
|
+
elif status in ("INPROGRESS", "COMPLETE"):
|
123
|
+
status = f"[green]{status}"
|
124
|
+
else:
|
125
|
+
status = f"[red]{status}"
|
126
|
+
|
127
|
+
table.add_row(
|
128
|
+
name,
|
129
|
+
type_name,
|
130
|
+
created,
|
131
|
+
priority,
|
132
|
+
due,
|
133
|
+
completed,
|
134
|
+
status,
|
135
|
+
assigned_out,
|
136
|
+
)
|
137
|
+
|
138
|
+
return table
|
139
|
+
|
140
|
+
try:
|
141
|
+
with Live(generate_table(), refresh_per_second=4, screen=True) as live:
|
142
|
+
while True:
|
143
|
+
time.sleep(2)
|
144
|
+
live.update(generate_table())
|
145
|
+
live.console.pager()
|
146
|
+
|
147
|
+
except (
|
148
|
+
InvalidParameterException,
|
149
|
+
PropertyServerException,
|
150
|
+
UserNotAuthorizedException,
|
151
|
+
) as e:
|
152
|
+
print_exception_response(e)
|
153
|
+
except KeyboardInterrupt:
|
154
|
+
pass
|
155
|
+
finally:
|
156
|
+
m_client.close_session()
|
157
|
+
|
158
|
+
|
159
|
+
def main():
|
160
|
+
parser = argparse.ArgumentParser()
|
161
|
+
parser.add_argument("--server", help="Name of the view server to connect to")
|
162
|
+
parser.add_argument("--url", help="URL Platform to connect to")
|
163
|
+
parser.add_argument("--userid", help="User Id")
|
164
|
+
parser.add_argument("--password", help="User Password")
|
165
|
+
args = parser.parse_args()
|
166
|
+
|
167
|
+
server = args.server if args.server is not None else EGERIA_VIEW_SERVER
|
168
|
+
url = args.url if args.url is not None else EGERIA_PLATFORM_URL
|
169
|
+
userid = args.userid if args.userid is not None else EGERIA_USER
|
170
|
+
user_pass = args.password if args.password is not None else EGERIA_USER_PASSWORD
|
171
|
+
display_todos(server=server, url=url, user=userid, user_pass=user_pass)
|
172
|
+
|
173
|
+
|
174
|
+
if __name__ == "__main__":
|
175
|
+
main()
|