qwak-sdk 0.5.102__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.
- qwak_sdk/__init__.py +9 -0
- qwak_sdk/cli.py +79 -0
- qwak_sdk/commands/__init__.py +0 -0
- qwak_sdk/commands/_logic/__init__.py +0 -0
- qwak_sdk/commands/_logic/tools.py +6 -0
- qwak_sdk/commands/admin/__init__.py +0 -0
- qwak_sdk/commands/admin/admin_commands_group.py +17 -0
- qwak_sdk/commands/admin/apikeys/__init__.py +0 -0
- qwak_sdk/commands/admin/apikeys/api_keys_commands_group.py +17 -0
- qwak_sdk/commands/admin/apikeys/generate/__init__.py +0 -0
- qwak_sdk/commands/admin/apikeys/generate/_logic.py +21 -0
- qwak_sdk/commands/admin/apikeys/generate/ui.py +45 -0
- qwak_sdk/commands/admin/apikeys/revoke/__init__.py +0 -0
- qwak_sdk/commands/admin/apikeys/revoke/_logic.py +22 -0
- qwak_sdk/commands/admin/apikeys/revoke/ui.py +31 -0
- qwak_sdk/commands/alerts/__init__.py +0 -0
- qwak_sdk/commands/alerts/alerts_commnad_group.py +18 -0
- qwak_sdk/commands/alerts/delete/__init__.py +0 -0
- qwak_sdk/commands/alerts/delete/_logic.py +5 -0
- qwak_sdk/commands/alerts/delete/ui.py +10 -0
- qwak_sdk/commands/alerts/list/__init__.py +0 -0
- qwak_sdk/commands/alerts/list/_logic.py +23 -0
- qwak_sdk/commands/alerts/list/ui.py +17 -0
- qwak_sdk/commands/alerts/register/__init__.py +0 -0
- qwak_sdk/commands/alerts/register/_logic.py +72 -0
- qwak_sdk/commands/alerts/register/ui.py +30 -0
- qwak_sdk/commands/audience/__init__.py +0 -0
- qwak_sdk/commands/audience/_logic/__init__.py +0 -0
- qwak_sdk/commands/audience/_logic/config/__init__.py +0 -0
- qwak_sdk/commands/audience/_logic/config/config_base.py +15 -0
- qwak_sdk/commands/audience/_logic/config/parser.py +30 -0
- qwak_sdk/commands/audience/_logic/config/v1/__init__.py +0 -0
- qwak_sdk/commands/audience/_logic/config/v1/audience_config.py +26 -0
- qwak_sdk/commands/audience/_logic/config/v1/conditions_config.py +59 -0
- qwak_sdk/commands/audience/_logic/config/v1/config_v1.py +23 -0
- qwak_sdk/commands/audience/_logic/config/v1/route_config.py +15 -0
- qwak_sdk/commands/audience/_logic/config/v1/spec.py +9 -0
- qwak_sdk/commands/audience/audience_api_dump.py +86 -0
- qwak_sdk/commands/audience/audience_commands_group.py +30 -0
- qwak_sdk/commands/audience/create/__init__.py +0 -0
- qwak_sdk/commands/audience/create/logic.py +41 -0
- qwak_sdk/commands/audience/create/ui.py +21 -0
- qwak_sdk/commands/audience/delete/__init__.py +0 -0
- qwak_sdk/commands/audience/delete/logic.py +13 -0
- qwak_sdk/commands/audience/delete/ui.py +17 -0
- qwak_sdk/commands/audience/get/__init__.py +0 -0
- qwak_sdk/commands/audience/get/logic.py +14 -0
- qwak_sdk/commands/audience/get/ui.py +25 -0
- qwak_sdk/commands/audience/list/__init__.py +0 -0
- qwak_sdk/commands/audience/list/logic.py +16 -0
- qwak_sdk/commands/audience/list/ui.py +26 -0
- qwak_sdk/commands/audience/update/__init__.py +0 -0
- qwak_sdk/commands/audience/update/logic.py +37 -0
- qwak_sdk/commands/audience/update/ui.py +26 -0
- qwak_sdk/commands/auto_scalling/__init__.py +0 -0
- qwak_sdk/commands/auto_scalling/_logic/__init__.py +0 -0
- qwak_sdk/commands/auto_scalling/_logic/config/__init__.py +3 -0
- qwak_sdk/commands/auto_scalling/_logic/config/config.py +152 -0
- qwak_sdk/commands/auto_scalling/_logic/config/parser.py +21 -0
- qwak_sdk/commands/auto_scalling/attach/__init__.py +0 -0
- qwak_sdk/commands/auto_scalling/attach/_logic.py +43 -0
- qwak_sdk/commands/auto_scalling/attach/ui.py +21 -0
- qwak_sdk/commands/auto_scalling/autoscaling_commands_group.py +15 -0
- qwak_sdk/commands/automations/__init__.py +0 -0
- qwak_sdk/commands/automations/automations_commands_group.py +30 -0
- qwak_sdk/commands/automations/delete/__init__.py +0 -0
- qwak_sdk/commands/automations/delete/_logic.py +6 -0
- qwak_sdk/commands/automations/delete/ui.py +23 -0
- qwak_sdk/commands/automations/executions/__init__.py +0 -0
- qwak_sdk/commands/automations/executions/executions_commands_group.py +14 -0
- qwak_sdk/commands/automations/executions/list/__init__.py +0 -0
- qwak_sdk/commands/automations/executions/list/_logic.py +8 -0
- qwak_sdk/commands/automations/executions/list/ui.py +25 -0
- qwak_sdk/commands/automations/list/__init__.py +0 -0
- qwak_sdk/commands/automations/list/_logic.py +36 -0
- qwak_sdk/commands/automations/list/ui.py +21 -0
- qwak_sdk/commands/automations/register/__init__.py +0 -0
- qwak_sdk/commands/automations/register/_logic.py +43 -0
- qwak_sdk/commands/automations/register/ui.py +44 -0
- qwak_sdk/commands/feature_store/__init__.py +0 -0
- qwak_sdk/commands/feature_store/backfill/__init__.py +0 -0
- qwak_sdk/commands/feature_store/backfill/_logic.py +140 -0
- qwak_sdk/commands/feature_store/backfill/streaming/__init__.py +0 -0
- qwak_sdk/commands/feature_store/backfill/streaming/_logic.py +50 -0
- qwak_sdk/commands/feature_store/backfill/streaming/ui.py +67 -0
- qwak_sdk/commands/feature_store/backfill/ui.py +146 -0
- qwak_sdk/commands/feature_store/delete/__init__.py +0 -0
- qwak_sdk/commands/feature_store/delete/_logic.py +104 -0
- qwak_sdk/commands/feature_store/delete/ui.py +40 -0
- qwak_sdk/commands/feature_store/execution/__init__.py +0 -0
- qwak_sdk/commands/feature_store/execution/ui.py +19 -0
- qwak_sdk/commands/feature_store/feature_store_command_group.py +29 -0
- qwak_sdk/commands/feature_store/list/__init__.py +0 -0
- qwak_sdk/commands/feature_store/list/ui.py +140 -0
- qwak_sdk/commands/feature_store/pause/__init__.py +0 -0
- qwak_sdk/commands/feature_store/pause/ui.py +18 -0
- qwak_sdk/commands/feature_store/register/__init__.py +0 -0
- qwak_sdk/commands/feature_store/register/_logic.py +367 -0
- qwak_sdk/commands/feature_store/register/ui.py +111 -0
- qwak_sdk/commands/feature_store/resume/__init__.py +0 -0
- qwak_sdk/commands/feature_store/resume/ui.py +18 -0
- qwak_sdk/commands/feature_store/trigger/__init__.py +0 -0
- qwak_sdk/commands/feature_store/trigger/ui.py +39 -0
- qwak_sdk/commands/models/__init__.py +0 -0
- qwak_sdk/commands/models/build/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/build_steps.py +42 -0
- qwak_sdk/commands/models/build/_logic/client_logs/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/client_logs/cli_phase_run_handler.py +123 -0
- qwak_sdk/commands/models/build/_logic/client_logs/cli_trigger_build_logger.py +19 -0
- qwak_sdk/commands/models/build/_logic/client_logs/logger.py +88 -0
- qwak_sdk/commands/models/build/_logic/client_logs/messages.py +36 -0
- qwak_sdk/commands/models/build/_logic/client_logs/spinner.py +14 -0
- qwak_sdk/commands/models/build/_logic/client_logs/trigger_build_logger.py +54 -0
- qwak_sdk/commands/models/build/_logic/client_logs/utils.py +12 -0
- qwak_sdk/commands/models/build/_logic/phase/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/phase/a_fetch_model_code/__init__.py +20 -0
- qwak_sdk/commands/models/build/_logic/phase/a_fetch_model_code/get_sdk_version_step.py +14 -0
- qwak_sdk/commands/models/build/_logic/phase/b_remote_register_qwak_build/__init__.py +16 -0
- qwak_sdk/commands/models/build/_logic/phase/c_deploy/__init__.py +6 -0
- qwak_sdk/commands/models/build/_logic/phase/c_deploy/build_polling_status.py +55 -0
- qwak_sdk/commands/models/build/_logic/phase/c_deploy/deploy_build.py +61 -0
- qwak_sdk/commands/models/build/_logic/util/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/util/protobuf_factory.py +45 -0
- qwak_sdk/commands/models/build/_logic/util/step_decorator.py +60 -0
- qwak_sdk/commands/models/build/_logic/util/text.py +9 -0
- qwak_sdk/commands/models/build/_logic/wait_until_finished.py +27 -0
- qwak_sdk/commands/models/build/ui.py +337 -0
- qwak_sdk/commands/models/builds/__init__.py +0 -0
- qwak_sdk/commands/models/builds/builds_commands_group.py +16 -0
- qwak_sdk/commands/models/builds/cancel/__init__.py +0 -0
- qwak_sdk/commands/models/builds/cancel/_logic.py +5 -0
- qwak_sdk/commands/models/builds/cancel/ui.py +15 -0
- qwak_sdk/commands/models/builds/logs/__init__.py +0 -0
- qwak_sdk/commands/models/builds/logs/ui.py +35 -0
- qwak_sdk/commands/models/builds/status/__init__.py +0 -0
- qwak_sdk/commands/models/builds/status/_logic.py +6 -0
- qwak_sdk/commands/models/builds/status/ui.py +39 -0
- qwak_sdk/commands/models/create/__init__.py +0 -0
- qwak_sdk/commands/models/create/_logic.py +36 -0
- qwak_sdk/commands/models/create/ui.py +43 -0
- qwak_sdk/commands/models/delete/__init__.py +0 -0
- qwak_sdk/commands/models/delete/_logic.py +5 -0
- qwak_sdk/commands/models/delete/ui.py +25 -0
- qwak_sdk/commands/models/deployments/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/advance_deployment_options_handler.py +31 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/base_deploy_executor.py +68 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deploy_config.py +261 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deployment.py +405 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deployment_message_helpers.py +114 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deployment_response_handler.py +156 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deployment_size_mapper.py +96 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/get_latest_successful_build.py +28 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/local_deployment.py +193 -0
- qwak_sdk/commands/models/deployments/deploy/batch/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/batch/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/batch/_logic/advanced_deployment_mapper.py +15 -0
- qwak_sdk/commands/models/deployments/deploy/batch/_logic/deploy_executor.py +24 -0
- qwak_sdk/commands/models/deployments/deploy/batch/ui.py +126 -0
- qwak_sdk/commands/models/deployments/deploy/deploy_commands_group.py +19 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/_logic/advanced_deployment_mapper.py +21 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/_logic/deploy_executor.py +24 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/_logic/serving_strategy_mapper.py +75 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/ui.py +209 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/_logic/deploy_executor.py +24 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/_logic/serving_strategy_mapper.py +38 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/ui.py +213 -0
- qwak_sdk/commands/models/deployments/undeploy/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/undeploy/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/undeploy/_logic/request_undeploy.py +249 -0
- qwak_sdk/commands/models/deployments/undeploy/ui.py +72 -0
- qwak_sdk/commands/models/describe/__init__.py +0 -0
- qwak_sdk/commands/models/describe/_logic.py +169 -0
- qwak_sdk/commands/models/describe/ui.py +35 -0
- qwak_sdk/commands/models/executions/__init__.py +0 -0
- qwak_sdk/commands/models/executions/cancel/__init__.py +0 -0
- qwak_sdk/commands/models/executions/cancel/_logic.py +9 -0
- qwak_sdk/commands/models/executions/cancel/ui.py +27 -0
- qwak_sdk/commands/models/executions/execution_commands_group.py +24 -0
- qwak_sdk/commands/models/executions/report/__init__.py +0 -0
- qwak_sdk/commands/models/executions/report/_logic.py +14 -0
- qwak_sdk/commands/models/executions/report/ui.py +43 -0
- qwak_sdk/commands/models/executions/start/__init__.py +0 -0
- qwak_sdk/commands/models/executions/start/_logic.py +81 -0
- qwak_sdk/commands/models/executions/start/ui.py +208 -0
- qwak_sdk/commands/models/executions/status/__init__.py +0 -0
- qwak_sdk/commands/models/executions/status/_logic.py +13 -0
- qwak_sdk/commands/models/executions/status/ui.py +27 -0
- qwak_sdk/commands/models/init/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/initialize_model_structure.py +40 -0
- qwak_sdk/commands/models/init/_logic/template/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/cookiecutter.json +3 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/main/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/main/conda.yml +10 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/main/data.csv +1001 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/main/model.py +95 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/tests/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/tests/it/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/tests/it/test_churn.py +32 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/cookiecutter.json +3 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/main/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/main/conda.yml +11 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/main/data.csv +1001 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/main/model.py +108 -0
- qwak_sdk/commands/models/init/_logic/template/general/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/general/cookiecutter.json +6 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.main_directory}}/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.main_directory}}/conda.yml +8 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.main_directory}}/model.py +66 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.test_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.test_directory}}/test_qwak_model.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/cookiecutter.json +3 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/main/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/main/conda.yml +11 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/main/model.py +98 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/tests/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/tests/it/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/tests/it/test_titanic.py +24 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/cookiecutter.json +3 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/main/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/main/model.py +98 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/main/pyproject.toml +20 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/tests/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/tests/it/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/tests/it/test_titanic.py +25 -0
- qwak_sdk/commands/models/init/ui.py +61 -0
- qwak_sdk/commands/models/list/__init__.py +0 -0
- qwak_sdk/commands/models/list/_logic.py +5 -0
- qwak_sdk/commands/models/list/ui.py +40 -0
- qwak_sdk/commands/models/list_models/__init__.py +0 -0
- qwak_sdk/commands/models/list_models/_logic.py +5 -0
- qwak_sdk/commands/models/list_models/ui.py +60 -0
- qwak_sdk/commands/models/metadata/__init__.py +0 -0
- qwak_sdk/commands/models/metadata/_logic.py +5 -0
- qwak_sdk/commands/models/metadata/ui.py +60 -0
- qwak_sdk/commands/models/models_command_group.py +44 -0
- qwak_sdk/commands/models/runtime/__init__.py +0 -0
- qwak_sdk/commands/models/runtime/logs/__init__.py +0 -0
- qwak_sdk/commands/models/runtime/logs/ui.py +63 -0
- qwak_sdk/commands/models/runtime/runtime_commands_group.py +17 -0
- qwak_sdk/commands/models/runtime/update/__init__.py +0 -0
- qwak_sdk/commands/models/runtime/update/_logic.py +9 -0
- qwak_sdk/commands/models/runtime/update/ui.py +15 -0
- qwak_sdk/commands/projects/__init__.py +0 -0
- qwak_sdk/commands/projects/create/__init__.py +0 -0
- qwak_sdk/commands/projects/create/_logic.py +9 -0
- qwak_sdk/commands/projects/create/ui.py +68 -0
- qwak_sdk/commands/projects/delete/__init__.py +0 -0
- qwak_sdk/commands/projects/delete/_logic.py +6 -0
- qwak_sdk/commands/projects/delete/ui.py +24 -0
- qwak_sdk/commands/projects/list/__init__.py +0 -0
- qwak_sdk/commands/projects/list/_logic.py +6 -0
- qwak_sdk/commands/projects/list/ui.py +45 -0
- qwak_sdk/commands/projects/projects_command_group.py +19 -0
- qwak_sdk/commands/secrets/__init__.py +0 -0
- qwak_sdk/commands/secrets/delete/__init__.py +0 -0
- qwak_sdk/commands/secrets/delete/_logic.py +5 -0
- qwak_sdk/commands/secrets/delete/ui.py +21 -0
- qwak_sdk/commands/secrets/get/__init__.py +0 -0
- qwak_sdk/commands/secrets/get/_logic.py +5 -0
- qwak_sdk/commands/secrets/get/ui.py +17 -0
- qwak_sdk/commands/secrets/secrets_commands_group.py +19 -0
- qwak_sdk/commands/secrets/set/__init__.py +0 -0
- qwak_sdk/commands/secrets/set/_logic.py +5 -0
- qwak_sdk/commands/secrets/set/ui.py +16 -0
- qwak_sdk/commands/ui_tools.py +18 -0
- qwak_sdk/commands/workspaces/__init__.py +0 -0
- qwak_sdk/commands/workspaces/_logic/__init__.py +0 -0
- qwak_sdk/commands/workspaces/_logic/tools.py +44 -0
- qwak_sdk/commands/workspaces/_logic/workspace_validations.py +41 -0
- qwak_sdk/commands/workspaces/config/__init__.py +0 -0
- qwak_sdk/commands/workspaces/config/workspace_config.py +35 -0
- qwak_sdk/commands/workspaces/create/__init__.py +0 -0
- qwak_sdk/commands/workspaces/create/_logic.py +54 -0
- qwak_sdk/commands/workspaces/create/ui.py +48 -0
- qwak_sdk/commands/workspaces/delete/__init__.py +0 -0
- qwak_sdk/commands/workspaces/delete/_logic.py +30 -0
- qwak_sdk/commands/workspaces/delete/ui.py +23 -0
- qwak_sdk/commands/workspaces/start/__init__.py +0 -0
- qwak_sdk/commands/workspaces/start/_logic.py +30 -0
- qwak_sdk/commands/workspaces/start/ui.py +23 -0
- qwak_sdk/commands/workspaces/stop/__init__.py +0 -0
- qwak_sdk/commands/workspaces/stop/_logic.py +30 -0
- qwak_sdk/commands/workspaces/stop/ui.py +23 -0
- qwak_sdk/commands/workspaces/update/__init__.py +0 -0
- qwak_sdk/commands/workspaces/update/_logic.py +82 -0
- qwak_sdk/commands/workspaces/update/ui.py +57 -0
- qwak_sdk/commands/workspaces/workspaces_commands_group.py +23 -0
- qwak_sdk/exceptions/__init__.py +11 -0
- qwak_sdk/exceptions/qwak_command_exception.py +2 -0
- qwak_sdk/exceptions/qwak_deploy_new_build_failed.py +5 -0
- qwak_sdk/exceptions/qwak_resource_not_found.py +2 -0
- qwak_sdk/inner/__init__.py +0 -0
- qwak_sdk/inner/file_registry.py +98 -0
- qwak_sdk/inner/tools/__init__.py +0 -0
- qwak_sdk/inner/tools/cli_tools.py +220 -0
- qwak_sdk/inner/tools/config_handler.py +27 -0
- qwak_sdk/inner/tools/dataclasses_utils.py +21 -0
- qwak_sdk/inner/tools/logger/__init__.py +3 -0
- qwak_sdk/inner/tools/logger/logger.py +269 -0
- qwak_sdk/inner/tools/logger/logging.yml +79 -0
- qwak_sdk/inner/tools/tracking.py +47 -0
- qwak_sdk/main.py +9 -0
- qwak_sdk/tools/__init__.py +0 -0
- qwak_sdk/tools/colors.py +13 -0
- qwak_sdk/tools/files.py +63 -0
- qwak_sdk/tools/log_handling.py +159 -0
- qwak_sdk/tools/utils.py +42 -0
- qwak_sdk-0.5.102.dist-info/METADATA +51 -0
- qwak_sdk-0.5.102.dist-info/RECORD +328 -0
- qwak_sdk-0.5.102.dist-info/WHEEL +4 -0
- qwak_sdk-0.5.102.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from _qwak_proto.qwak.models.models_pb2 import DeploymentModelStatus
|
|
3
|
+
|
|
4
|
+
from qwak_sdk.commands.models.list_models._logic import list_models as _list_models
|
|
5
|
+
from qwak_sdk.commands.ui_tools import output_as_json, output_as_table
|
|
6
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def parse_model(model):
|
|
10
|
+
return [
|
|
11
|
+
model.model_id,
|
|
12
|
+
model.uuid,
|
|
13
|
+
model.display_name,
|
|
14
|
+
model.model_description,
|
|
15
|
+
model.project_id,
|
|
16
|
+
model.created_by,
|
|
17
|
+
model.created_at,
|
|
18
|
+
model.last_modified_by,
|
|
19
|
+
model.last_modified_at,
|
|
20
|
+
model.model_status,
|
|
21
|
+
"\n".join(
|
|
22
|
+
[f"{branch.branch_name} {branch.branch_id}" for branch in model.branches]
|
|
23
|
+
),
|
|
24
|
+
DeploymentModelStatus.DESCRIPTOR.values_by_number[
|
|
25
|
+
model.deployment_model_status
|
|
26
|
+
].name,
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@click.command("list-models", cls=QwakCommand)
|
|
31
|
+
@click.option("--project-id", metavar="NAME", required=True, help="Project id")
|
|
32
|
+
@click.option(
|
|
33
|
+
"--format",
|
|
34
|
+
default="text",
|
|
35
|
+
show_default=True,
|
|
36
|
+
type=click.Choice(["text", "json"], case_sensitive=True),
|
|
37
|
+
metavar="FORMAT",
|
|
38
|
+
required=False,
|
|
39
|
+
help="The formatting style for command output (choose from text, json)",
|
|
40
|
+
)
|
|
41
|
+
def list_models(project_id, format, **kwargs):
|
|
42
|
+
model_list_result = _list_models(project_id)
|
|
43
|
+
columns = [
|
|
44
|
+
"Model id",
|
|
45
|
+
"Model UUID",
|
|
46
|
+
"Model Name",
|
|
47
|
+
"Model Description",
|
|
48
|
+
"Project ID",
|
|
49
|
+
"Created By",
|
|
50
|
+
"Created At",
|
|
51
|
+
"Last Modified At",
|
|
52
|
+
"Last Modified By",
|
|
53
|
+
"Model Status",
|
|
54
|
+
"Branches",
|
|
55
|
+
"Deployment Status",
|
|
56
|
+
]
|
|
57
|
+
if format == "json":
|
|
58
|
+
output_as_json(model_list_result)
|
|
59
|
+
elif format == "text":
|
|
60
|
+
output_as_table(model_list_result.models, parse_model, headers=columns)
|
|
File without changes
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
from google.protobuf.json_format import MessageToDict
|
|
5
|
+
from tabulate import tabulate
|
|
6
|
+
|
|
7
|
+
from qwak_sdk.commands.models.metadata._logic import (
|
|
8
|
+
list_models_metadata as _list_models_metadata,
|
|
9
|
+
)
|
|
10
|
+
from qwak_sdk.commands.ui_tools import output_as_json
|
|
11
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def print_text_data(metadata):
|
|
15
|
+
def dict_to_table(data, prefix=""):
|
|
16
|
+
headers = []
|
|
17
|
+
values = []
|
|
18
|
+
for key, value in data.items():
|
|
19
|
+
key = re.sub(r"(\w)([A-Z])", r"\1 \2", key).lower()
|
|
20
|
+
if isinstance(value, dict):
|
|
21
|
+
headers.append(key.title())
|
|
22
|
+
values.append(dict_to_table(value, prefix=key + ": "))
|
|
23
|
+
elif isinstance(value, list):
|
|
24
|
+
headers.append(key.title())
|
|
25
|
+
values.append(
|
|
26
|
+
"\n".join(
|
|
27
|
+
[
|
|
28
|
+
dict_to_table(item, prefix=key + ": ")
|
|
29
|
+
for item in value
|
|
30
|
+
if isinstance(item, dict)
|
|
31
|
+
]
|
|
32
|
+
)
|
|
33
|
+
)
|
|
34
|
+
else:
|
|
35
|
+
headers.append((prefix + key).title())
|
|
36
|
+
values.append(value)
|
|
37
|
+
return tabulate([values], headers=headers)
|
|
38
|
+
|
|
39
|
+
for model_metadata in metadata.model_metadata:
|
|
40
|
+
print(dict_to_table(MessageToDict(model_metadata)))
|
|
41
|
+
print("")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@click.command("metadata", cls=QwakCommand)
|
|
45
|
+
@click.option("--project-id", metavar="NAME", required=True, help="Project id")
|
|
46
|
+
@click.option(
|
|
47
|
+
"--format",
|
|
48
|
+
default="text",
|
|
49
|
+
show_default=True,
|
|
50
|
+
type=click.Choice(["text", "json"], case_sensitive=True),
|
|
51
|
+
metavar="FORMAT",
|
|
52
|
+
required=False,
|
|
53
|
+
help="The formatting style for command output (choose from text, json)",
|
|
54
|
+
)
|
|
55
|
+
def list_models_metadata(project_id, format, **kwargs):
|
|
56
|
+
model_list_result = _list_models_metadata(project_id)
|
|
57
|
+
if format == "json":
|
|
58
|
+
output_as_json(model_list_result)
|
|
59
|
+
elif format == "text":
|
|
60
|
+
print_text_data(model_list_result)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from qwak_sdk.commands.auto_scalling.autoscaling_commands_group import (
|
|
4
|
+
autoscaling_commands_group,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
from .build.ui import models_build
|
|
8
|
+
from .builds.builds_commands_group import builds_commands_group
|
|
9
|
+
from .create.ui import model_create
|
|
10
|
+
from .delete.ui import model_delete
|
|
11
|
+
from .deployments.deploy.deploy_commands_group import deploy_group
|
|
12
|
+
from .deployments.undeploy.ui import models_undeploy
|
|
13
|
+
from .describe.ui import model_describe
|
|
14
|
+
from .executions.execution_commands_group import execution_commands_group
|
|
15
|
+
from .init.ui import model_init
|
|
16
|
+
from .list.ui import model_list
|
|
17
|
+
from .list_models.ui import list_models
|
|
18
|
+
from .metadata.ui import list_models_metadata
|
|
19
|
+
from .runtime.runtime_commands_group import runtime_commands_group
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@click.group(
|
|
23
|
+
name="models",
|
|
24
|
+
help="Commands for interacting with Qwak based models",
|
|
25
|
+
)
|
|
26
|
+
def models_command_group():
|
|
27
|
+
# Click group injection
|
|
28
|
+
pass
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
models_command_group.add_command(autoscaling_commands_group)
|
|
32
|
+
models_command_group.add_command(builds_commands_group)
|
|
33
|
+
models_command_group.add_command(execution_commands_group)
|
|
34
|
+
models_command_group.add_command(model_init)
|
|
35
|
+
models_command_group.add_command(model_create)
|
|
36
|
+
models_command_group.add_command(model_delete)
|
|
37
|
+
models_command_group.add_command(model_list)
|
|
38
|
+
models_command_group.add_command(models_build)
|
|
39
|
+
models_command_group.add_command(deploy_group, "deploy")
|
|
40
|
+
models_command_group.add_command(models_undeploy, "undeploy")
|
|
41
|
+
models_command_group.add_command(model_describe)
|
|
42
|
+
models_command_group.add_command(runtime_commands_group)
|
|
43
|
+
models_command_group.add_command(list_models)
|
|
44
|
+
models_command_group.add_command(list_models_metadata)
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
4
|
+
from qwak_sdk.tools.colors import Color
|
|
5
|
+
from qwak_sdk.tools.log_handling import QwakLogHandling
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@click.command("logs", cls=QwakCommand)
|
|
9
|
+
@click.option("-f", "--follow", is_flag=True, default=False, help="Follow log tail")
|
|
10
|
+
@click.option(
|
|
11
|
+
"-d",
|
|
12
|
+
"--deployment-id",
|
|
13
|
+
required=False,
|
|
14
|
+
help="Runtime model Deployment ID to show logs of",
|
|
15
|
+
)
|
|
16
|
+
@click.option(
|
|
17
|
+
"-b",
|
|
18
|
+
"--build-id",
|
|
19
|
+
required=False,
|
|
20
|
+
help="Runtime model Build ID to show logs of",
|
|
21
|
+
)
|
|
22
|
+
@click.option(
|
|
23
|
+
"-s",
|
|
24
|
+
"--since",
|
|
25
|
+
required=False,
|
|
26
|
+
metavar="X [TYPE] ago",
|
|
27
|
+
help=f"Get logs from X1 [type] X2 [type]... Xn [type] ago. "
|
|
28
|
+
f"(x = INT; type = {QwakLogHandling.TIME_UNITS}) i.e. [1 day 2 hours ago]",
|
|
29
|
+
)
|
|
30
|
+
@click.option(
|
|
31
|
+
"-n",
|
|
32
|
+
"--number-of-results",
|
|
33
|
+
required=False,
|
|
34
|
+
type=int,
|
|
35
|
+
help="Maximum number of results per query",
|
|
36
|
+
)
|
|
37
|
+
@click.option(
|
|
38
|
+
"-g", "--grep", required=False, help="Filter by log content contains [expression]"
|
|
39
|
+
)
|
|
40
|
+
def runtime_logs(
|
|
41
|
+
follow=True,
|
|
42
|
+
deployment_id=None,
|
|
43
|
+
build_id=None,
|
|
44
|
+
since=None,
|
|
45
|
+
number_of_results=None,
|
|
46
|
+
grep=None,
|
|
47
|
+
**kwargs,
|
|
48
|
+
):
|
|
49
|
+
if not deployment_id and not build_id:
|
|
50
|
+
print(
|
|
51
|
+
f"{Color.YELLOW}Please provide either a Deployment or a Build ID{Color.END}"
|
|
52
|
+
)
|
|
53
|
+
return
|
|
54
|
+
|
|
55
|
+
qwak_log_handling = QwakLogHandling()
|
|
56
|
+
qwak_log_handling.get_logs(
|
|
57
|
+
follow,
|
|
58
|
+
since,
|
|
59
|
+
number_of_results,
|
|
60
|
+
grep,
|
|
61
|
+
{"build_id": build_id, "deployment_id": deployment_id},
|
|
62
|
+
"runtime_model",
|
|
63
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from qwak_sdk.commands.models.runtime.logs.ui import runtime_logs
|
|
4
|
+
from qwak_sdk.commands.models.runtime.update.ui import runtime_update
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@click.group(
|
|
8
|
+
name="runtime",
|
|
9
|
+
help="Runtime configurations for deployed models",
|
|
10
|
+
)
|
|
11
|
+
def runtime_commands_group():
|
|
12
|
+
# Click commands group injection
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
runtime_commands_group.add_command(runtime_logs)
|
|
17
|
+
runtime_commands_group.add_command(runtime_update)
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from qwak.clients.deployment.client import DeploymentManagementClient
|
|
2
|
+
from qwak.clients.model_management import ModelsManagementClient
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def execute_runtime_update(model_id, log_level):
|
|
6
|
+
model_uuid = ModelsManagementClient().get_model_uuid(model_id)
|
|
7
|
+
DeploymentManagementClient().update_runtime_configurations(
|
|
8
|
+
model_id=model_id, model_uuid=model_uuid, log_level=log_level
|
|
9
|
+
)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from qwak.exceptions import QwakException
|
|
3
|
+
|
|
4
|
+
from qwak_sdk.commands.models.runtime.update._logic import execute_runtime_update
|
|
5
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@click.command("update", cls=QwakCommand)
|
|
9
|
+
@click.option("-l", "--log-level", required=True, help="Log level to set.")
|
|
10
|
+
@click.option("-m", "--model-id", required=True, help="Model named ID")
|
|
11
|
+
def runtime_update(model_id, log_level, **kwargs):
|
|
12
|
+
try:
|
|
13
|
+
execute_runtime_update(model_id, log_level=log_level)
|
|
14
|
+
except Exception as e:
|
|
15
|
+
raise QwakException(f'Failed to update runtime configurations. Error is "{e}"')
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from qwak.clients.project.client import ProjectsManagementClient
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def execute(
|
|
5
|
+
project_name: str,
|
|
6
|
+
project_description: str,
|
|
7
|
+
):
|
|
8
|
+
projects_management = ProjectsManagementClient()
|
|
9
|
+
return projects_management.create_project(project_name, project_description)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
from click import Argument, Context
|
|
5
|
+
|
|
6
|
+
from qwak_sdk.commands.projects.create._logic import execute as execute_create
|
|
7
|
+
from qwak_sdk.commands.ui_tools import output_as_json
|
|
8
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def validate_name(_: Context, argument: Argument, value: str) -> str:
|
|
12
|
+
"""
|
|
13
|
+
Validate that `value` is a valid project name.
|
|
14
|
+
A valid project name must:
|
|
15
|
+
- Start with a lowercase letter,
|
|
16
|
+
- Contain only lowercase letters or hyphens,
|
|
17
|
+
- End with a lowercase letter,
|
|
18
|
+
- Not be empty.
|
|
19
|
+
:param _: Unused parameter for click's callback signature.
|
|
20
|
+
:param argument: Argument provided.
|
|
21
|
+
:param value: The project name to validate.
|
|
22
|
+
:raise click.BadParameter: If the validation fails.
|
|
23
|
+
:return: The validated project name.
|
|
24
|
+
"""
|
|
25
|
+
# Validate that `value`:
|
|
26
|
+
# - starts with a lowercase letter,
|
|
27
|
+
# - contains only lowercase letters or hyphens,
|
|
28
|
+
# - ends with a lowercase letter,
|
|
29
|
+
# - and is not empty.
|
|
30
|
+
if not re.fullmatch(r"[a-z](?:[a-z-]*[a-z])?", value):
|
|
31
|
+
raise click.BadParameter(
|
|
32
|
+
f"{argument.name} must be lower-cased, "
|
|
33
|
+
"start and end with a letter, and only contain letters or hyphens (-)."
|
|
34
|
+
)
|
|
35
|
+
return value
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@click.command("create", cls=QwakCommand)
|
|
39
|
+
@click.argument(
|
|
40
|
+
"name", metavar="name", type=click.STRING, required=True, callback=validate_name
|
|
41
|
+
)
|
|
42
|
+
@click.option(
|
|
43
|
+
"--description",
|
|
44
|
+
metavar="DESCRIPTION",
|
|
45
|
+
required=False,
|
|
46
|
+
help="Project description",
|
|
47
|
+
)
|
|
48
|
+
@click.option(
|
|
49
|
+
"--format",
|
|
50
|
+
default="text",
|
|
51
|
+
show_default=True,
|
|
52
|
+
type=click.Choice(["text", "json"], case_sensitive=True),
|
|
53
|
+
metavar="FORMAT",
|
|
54
|
+
required=False,
|
|
55
|
+
help="The formatting style for commands output (choose from text, json)",
|
|
56
|
+
)
|
|
57
|
+
def create_project(
|
|
58
|
+
name,
|
|
59
|
+
description,
|
|
60
|
+
format,
|
|
61
|
+
*args,
|
|
62
|
+
**kwargs,
|
|
63
|
+
):
|
|
64
|
+
response = execute_create(name, description)
|
|
65
|
+
if format == "json":
|
|
66
|
+
output_as_json(response)
|
|
67
|
+
else:
|
|
68
|
+
print(f"Project created\nproject id : {response.project.project_id}")
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from google.protobuf.json_format import MessageToJson
|
|
3
|
+
|
|
4
|
+
from qwak_sdk.commands.projects.delete._logic import execute as execute_delete
|
|
5
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@click.command("delete", cls=QwakCommand)
|
|
9
|
+
@click.option("--project-id", metavar="NAME", required=True, help="Project name")
|
|
10
|
+
@click.option(
|
|
11
|
+
"--format",
|
|
12
|
+
default="text",
|
|
13
|
+
show_default=True,
|
|
14
|
+
type=click.Choice(["text", "json"], case_sensitive=True),
|
|
15
|
+
metavar="FORMAT",
|
|
16
|
+
required=False,
|
|
17
|
+
help="The formatting style for commands output (choose from text, json)",
|
|
18
|
+
)
|
|
19
|
+
def delete_project(project_id, format, **kwargs):
|
|
20
|
+
response = execute_delete(project_id)
|
|
21
|
+
if format == "json":
|
|
22
|
+
print(MessageToJson(response))
|
|
23
|
+
else:
|
|
24
|
+
print(f"Project deleted\nproject id : {project_id}")
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
|
|
5
|
+
from qwak_sdk.commands.projects.list._logic import execute as execute_list
|
|
6
|
+
from qwak_sdk.commands.ui_tools import output_as_json, output_as_table
|
|
7
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def parse_project(project):
|
|
11
|
+
return [
|
|
12
|
+
project.project_id,
|
|
13
|
+
project.project_name,
|
|
14
|
+
datetime.fromtimestamp(
|
|
15
|
+
project.created_at.seconds + project.created_at.nanos / 1e9
|
|
16
|
+
).strftime("%A, %B %d, %Y %I:%M:%S"),
|
|
17
|
+
datetime.fromtimestamp(
|
|
18
|
+
project.last_modified_at.seconds + project.last_modified_at.nanos / 1e9
|
|
19
|
+
).strftime("%A, %B %d, %Y %I:%M:%S"),
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@click.command("list", cls=QwakCommand)
|
|
24
|
+
@click.option(
|
|
25
|
+
"--format",
|
|
26
|
+
default="text",
|
|
27
|
+
show_default=True,
|
|
28
|
+
type=click.Choice(["text", "json"], case_sensitive=True),
|
|
29
|
+
metavar="FORMAT",
|
|
30
|
+
required=False,
|
|
31
|
+
help="The formatting style for commands output (choose from text, json)",
|
|
32
|
+
)
|
|
33
|
+
def projects_list(format, **kwargs):
|
|
34
|
+
projects_data = execute_list()
|
|
35
|
+
if format == "json":
|
|
36
|
+
output_as_json(projects_data)
|
|
37
|
+
elif format == "text":
|
|
38
|
+
columns = [
|
|
39
|
+
"Project id",
|
|
40
|
+
"Project name",
|
|
41
|
+
"Creation date",
|
|
42
|
+
"Last updated",
|
|
43
|
+
"Models count",
|
|
44
|
+
]
|
|
45
|
+
output_as_table(projects_data.projects, parse_project, columns)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from qwak_sdk.commands.projects.create.ui import create_project
|
|
4
|
+
from qwak_sdk.commands.projects.delete.ui import delete_project
|
|
5
|
+
from qwak_sdk.commands.projects.list.ui import projects_list
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@click.group(
|
|
9
|
+
name="projects",
|
|
10
|
+
help="Commands for interacting with Qwak based project",
|
|
11
|
+
)
|
|
12
|
+
def projects_command_group():
|
|
13
|
+
# Intentionally left empty since this is how we inject this CLI to the general CLI group
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
projects_command_group.add_command(create_project)
|
|
18
|
+
projects_command_group.add_command(projects_list)
|
|
19
|
+
projects_command_group.add_command(delete_project)
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import click
|
|
2
|
+
import grpc
|
|
3
|
+
|
|
4
|
+
from qwak_sdk.commands.secrets.delete._logic import execute_delete_secret
|
|
5
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@click.command("delete", cls=QwakCommand)
|
|
9
|
+
@click.option("--name", metavar="TEXT", required=True, help="The secret name")
|
|
10
|
+
def delete_secret(name, **kwargs):
|
|
11
|
+
print(f"Deleting secret named '{name}'")
|
|
12
|
+
try:
|
|
13
|
+
execute_delete_secret(name)
|
|
14
|
+
print(f"Secret '{name}' has been deleted")
|
|
15
|
+
except grpc.RpcError as e:
|
|
16
|
+
if e.code() == grpc.StatusCode.NOT_FOUND:
|
|
17
|
+
print(f"Secret '{name}' does not exist")
|
|
18
|
+
else:
|
|
19
|
+
print(f"Error deleting secret. Error is {e}")
|
|
20
|
+
except Exception as e:
|
|
21
|
+
print(f"Error deleting secret. Error is {e}")
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from qwak.exceptions import QwakNotFoundException
|
|
3
|
+
|
|
4
|
+
from qwak_sdk.commands.secrets.get._logic import execute_get_secret
|
|
5
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@click.command("get", cls=QwakCommand)
|
|
9
|
+
@click.option("--name", metavar="TEXT", required=True, help="the secret name")
|
|
10
|
+
def get_secret(name, **kwargs):
|
|
11
|
+
try:
|
|
12
|
+
value = execute_get_secret(name)
|
|
13
|
+
print(value)
|
|
14
|
+
except QwakNotFoundException:
|
|
15
|
+
print(f"Secret '{name}' does not exists")
|
|
16
|
+
except Exception as e:
|
|
17
|
+
print(f"Error getting secret. Error is {e}")
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from qwak_sdk.commands.secrets.delete.ui import delete_secret
|
|
4
|
+
from qwak_sdk.commands.secrets.get.ui import get_secret
|
|
5
|
+
from qwak_sdk.commands.secrets.set.ui import set_secret
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@click.group(
|
|
9
|
+
"secrets",
|
|
10
|
+
help="Commands for interacting with the secret store",
|
|
11
|
+
)
|
|
12
|
+
def secrets_commands_group():
|
|
13
|
+
# Click commands group injection
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
secrets_commands_group.add_command(set_secret)
|
|
18
|
+
secrets_commands_group.add_command(get_secret)
|
|
19
|
+
secrets_commands_group.add_command(delete_secret)
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from qwak_sdk.commands.secrets.set._logic import execute_set_secret
|
|
4
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@click.command("set", cls=QwakCommand)
|
|
8
|
+
@click.option("--name", metavar="TEXT", required=True, help="the secret name")
|
|
9
|
+
@click.option("--value", hide_input=True, confirmation_prompt=False, prompt=True)
|
|
10
|
+
def set_secret(name, value, **kwargs):
|
|
11
|
+
print(f"Creating secret named '{name}' with value length of {len(value)}...")
|
|
12
|
+
try:
|
|
13
|
+
execute_set_secret(name, value)
|
|
14
|
+
print("Created!")
|
|
15
|
+
except Exception as e:
|
|
16
|
+
print(f"Error setting secret. Error is {e}")
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from typing import Any, Callable, Iterable, List
|
|
2
|
+
|
|
3
|
+
from google.protobuf.json_format import MessageToJson
|
|
4
|
+
from tabulate import tabulate
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def output_as_json(data: Any):
|
|
8
|
+
print(MessageToJson(data))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def output_as_table(
|
|
12
|
+
data_source: Iterable[Any], data_extractor: Callable, headers: List[str]
|
|
13
|
+
):
|
|
14
|
+
data = []
|
|
15
|
+
for item in data_source:
|
|
16
|
+
data.append(data_extractor(item))
|
|
17
|
+
|
|
18
|
+
print(tabulate(data, headers=headers))
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from qwak.clients.workspace_manager import WorkspaceManagerClient
|
|
4
|
+
from qwak.exceptions import QwakException
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def get_workspace_id_by_name(
|
|
8
|
+
workspace_name: str, workspace_manager_client: Optional[WorkspaceManagerClient]
|
|
9
|
+
) -> str:
|
|
10
|
+
"""
|
|
11
|
+
Args:
|
|
12
|
+
workspace_name: The name of the workspace
|
|
13
|
+
workspace_manager_client: The workspace manager client
|
|
14
|
+
Returns:
|
|
15
|
+
The id of the workspace
|
|
16
|
+
"""
|
|
17
|
+
return get_workspace_by_name(
|
|
18
|
+
workspace_name=workspace_name, workspace_manager_client=workspace_manager_client
|
|
19
|
+
).workspace_id
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def get_workspace_by_name(
|
|
23
|
+
workspace_name: str, workspace_manager_client: Optional[WorkspaceManagerClient]
|
|
24
|
+
) -> str:
|
|
25
|
+
"""
|
|
26
|
+
Args:
|
|
27
|
+
workspace_name: The name of the workspace
|
|
28
|
+
workspace_manager_client: The workspace manager client
|
|
29
|
+
Returns:
|
|
30
|
+
The id of the workspace
|
|
31
|
+
"""
|
|
32
|
+
client = (
|
|
33
|
+
workspace_manager_client
|
|
34
|
+
if workspace_manager_client
|
|
35
|
+
else WorkspaceManagerClient()
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
response = client.get_workspaces()
|
|
39
|
+
|
|
40
|
+
for workspace in response.workspaces:
|
|
41
|
+
if workspace.workspace_name == workspace_name:
|
|
42
|
+
return workspace
|
|
43
|
+
|
|
44
|
+
raise QwakException(f"Failed to find workspace with name {workspace_name}")
|