routes.py
1 from mlflow.server.handlers import _add_static_prefix, _get_ajax_path, _get_rest_path 2 3 HOME = "/" 4 SIGNUP = "/signup" 5 CREATE_USER = _get_rest_path("/mlflow/users/create") 6 CREATE_USER_UI = _get_rest_path("/mlflow/users/create-ui") 7 GET_USER = _get_rest_path("/mlflow/users/get") 8 UPDATE_USER_PASSWORD = _get_rest_path("/mlflow/users/update-password") 9 UPDATE_USER_ADMIN = _get_rest_path("/mlflow/users/update-admin") 10 DELETE_USER = _get_rest_path("/mlflow/users/delete") 11 LIST_USERS = _get_rest_path("/mlflow/users/list") 12 AJAX_LIST_USERS = _get_ajax_path("/mlflow/users/list") 13 CREATE_EXPERIMENT_PERMISSION = _get_rest_path("/mlflow/experiments/permissions/create") 14 GET_EXPERIMENT_PERMISSION = _get_rest_path("/mlflow/experiments/permissions/get") 15 UPDATE_EXPERIMENT_PERMISSION = _get_rest_path("/mlflow/experiments/permissions/update") 16 DELETE_EXPERIMENT_PERMISSION = _get_rest_path("/mlflow/experiments/permissions/delete") 17 CREATE_REGISTERED_MODEL_PERMISSION = _get_rest_path("/mlflow/registered-models/permissions/create") 18 GET_REGISTERED_MODEL_PERMISSION = _get_rest_path("/mlflow/registered-models/permissions/get") 19 UPDATE_REGISTERED_MODEL_PERMISSION = _get_rest_path("/mlflow/registered-models/permissions/update") 20 DELETE_REGISTERED_MODEL_PERMISSION = _get_rest_path("/mlflow/registered-models/permissions/delete") 21 CREATE_SCORER_PERMISSION = _get_rest_path("/mlflow/scorers/permissions/create", version=3) 22 GET_SCORER_PERMISSION = _get_rest_path("/mlflow/scorers/permissions/get", version=3) 23 UPDATE_SCORER_PERMISSION = _get_rest_path("/mlflow/scorers/permissions/update", version=3) 24 DELETE_SCORER_PERMISSION = _get_rest_path("/mlflow/scorers/permissions/delete", version=3) 25 LIST_WORKSPACE_PERMISSIONS = _get_rest_path( 26 "/mlflow/workspaces/<workspace_name>/permissions", version=3 27 ) 28 LIST_USER_WORKSPACE_PERMISSIONS = _get_rest_path("/mlflow/workspace-permissions", version=3) 29 30 # Flask routes (not part of Protobuf API) 31 GET_ARTIFACT = _add_static_prefix("/get-artifact") 32 UPLOAD_ARTIFACT = _get_ajax_path("/mlflow/upload-artifact") 33 GET_MODEL_VERSION_ARTIFACT = _add_static_prefix("/model-versions/get-artifact") 34 GET_TRACE_ARTIFACT = _get_ajax_path("/mlflow/get-trace-artifact") 35 GET_METRIC_HISTORY_BULK = _get_ajax_path("/mlflow/metrics/get-history-bulk") 36 GET_METRIC_HISTORY_BULK_INTERVAL = _get_ajax_path("/mlflow/metrics/get-history-bulk-interval") 37 SEARCH_DATASETS = _get_ajax_path("/mlflow/experiments/search-datasets") 38 CREATE_PROMPTLAB_RUN = _get_ajax_path("/mlflow/runs/create-promptlab-run") 39 GATEWAY_PROXY = _get_ajax_path("/mlflow/gateway-proxy") 40 41 # Gateway permission routes 42 CREATE_GATEWAY_SECRET_PERMISSION = _get_rest_path( 43 "/mlflow/gateway/secrets/permissions/create", version=3 44 ) 45 GET_GATEWAY_SECRET_PERMISSION = _get_rest_path("/mlflow/gateway/secrets/permissions/get", version=3) 46 UPDATE_GATEWAY_SECRET_PERMISSION = _get_rest_path( 47 "/mlflow/gateway/secrets/permissions/update", version=3 48 ) 49 DELETE_GATEWAY_SECRET_PERMISSION = _get_rest_path( 50 "/mlflow/gateway/secrets/permissions/delete", version=3 51 ) 52 53 CREATE_GATEWAY_ENDPOINT_PERMISSION = _get_rest_path( 54 "/mlflow/gateway/endpoints/permissions/create", version=3 55 ) 56 GET_GATEWAY_ENDPOINT_PERMISSION = _get_rest_path( 57 "/mlflow/gateway/endpoints/permissions/get", version=3 58 ) 59 UPDATE_GATEWAY_ENDPOINT_PERMISSION = _get_rest_path( 60 "/mlflow/gateway/endpoints/permissions/update", version=3 61 ) 62 DELETE_GATEWAY_ENDPOINT_PERMISSION = _get_rest_path( 63 "/mlflow/gateway/endpoints/permissions/delete", version=3 64 ) 65 66 CREATE_GATEWAY_MODEL_DEFINITION_PERMISSION = _get_rest_path( 67 "/mlflow/gateway/model-definitions/permissions/create", version=3 68 ) 69 GET_GATEWAY_MODEL_DEFINITION_PERMISSION = _get_rest_path( 70 "/mlflow/gateway/model-definitions/permissions/get", version=3 71 ) 72 UPDATE_GATEWAY_MODEL_DEFINITION_PERMISSION = _get_rest_path( 73 "/mlflow/gateway/model-definitions/permissions/update", version=3 74 ) 75 DELETE_GATEWAY_MODEL_DEFINITION_PERMISSION = _get_rest_path( 76 "/mlflow/gateway/model-definitions/permissions/delete", version=3 77 ) 78 79 # Role management routes (RBAC). Each route is exposed at both the `/api/` path (for 80 # the Python client) and the `/ajax-api/` path (for the MLflow frontend), following the 81 # same convention as LIST_USERS / AJAX_LIST_USERS and handlers._get_paths. 82 CREATE_ROLE = _get_rest_path("/mlflow/roles/create", version=3) 83 AJAX_CREATE_ROLE = _get_ajax_path("/mlflow/roles/create", version=3) 84 GET_ROLE = _get_rest_path("/mlflow/roles/get", version=3) 85 AJAX_GET_ROLE = _get_ajax_path("/mlflow/roles/get", version=3) 86 LIST_ROLES = _get_rest_path("/mlflow/roles/list", version=3) 87 AJAX_LIST_ROLES = _get_ajax_path("/mlflow/roles/list", version=3) 88 UPDATE_ROLE = _get_rest_path("/mlflow/roles/update", version=3) 89 AJAX_UPDATE_ROLE = _get_ajax_path("/mlflow/roles/update", version=3) 90 DELETE_ROLE = _get_rest_path("/mlflow/roles/delete", version=3) 91 AJAX_DELETE_ROLE = _get_ajax_path("/mlflow/roles/delete", version=3) 92 ADD_ROLE_PERMISSION = _get_rest_path("/mlflow/roles/permissions/add", version=3) 93 AJAX_ADD_ROLE_PERMISSION = _get_ajax_path("/mlflow/roles/permissions/add", version=3) 94 REMOVE_ROLE_PERMISSION = _get_rest_path("/mlflow/roles/permissions/remove", version=3) 95 AJAX_REMOVE_ROLE_PERMISSION = _get_ajax_path("/mlflow/roles/permissions/remove", version=3) 96 LIST_ROLE_PERMISSIONS = _get_rest_path("/mlflow/roles/permissions/list", version=3) 97 AJAX_LIST_ROLE_PERMISSIONS = _get_ajax_path("/mlflow/roles/permissions/list", version=3) 98 UPDATE_ROLE_PERMISSION = _get_rest_path("/mlflow/roles/permissions/update", version=3) 99 AJAX_UPDATE_ROLE_PERMISSION = _get_ajax_path("/mlflow/roles/permissions/update", version=3) 100 ASSIGN_ROLE = _get_rest_path("/mlflow/roles/assign", version=3) 101 AJAX_ASSIGN_ROLE = _get_ajax_path("/mlflow/roles/assign", version=3) 102 UNASSIGN_ROLE = _get_rest_path("/mlflow/roles/unassign", version=3) 103 AJAX_UNASSIGN_ROLE = _get_ajax_path("/mlflow/roles/unassign", version=3) 104 LIST_USER_ROLES = _get_rest_path("/mlflow/users/roles/list", version=3) 105 AJAX_LIST_USER_ROLES = _get_ajax_path("/mlflow/users/roles/list", version=3) 106 LIST_ROLE_USERS = _get_rest_path("/mlflow/roles/users/list", version=3) 107 AJAX_LIST_ROLE_USERS = _get_ajax_path("/mlflow/roles/users/list", version=3) 108 109 # Gateway AJAX-only routes 110 GATEWAY_SUPPORTED_PROVIDERS = _get_ajax_path("/mlflow/gateway/supported-providers", version=3) 111 GATEWAY_SUPPORTED_MODELS = _get_ajax_path("/mlflow/gateway/supported-models", version=3) 112 GATEWAY_PROVIDER_CONFIG = _get_ajax_path("/mlflow/gateway/provider-config", version=3) 113 GATEWAY_SECRETS_CONFIG = _get_ajax_path("/mlflow/gateway/secrets/config", version=3) 114 INVOKE_SCORER = _get_ajax_path("/mlflow/scorer/invoke", version=3)