Set a Folder Policy
- PUT /api/v1.2/folders/policy
Use this API to set access permissions for a Notebook/Dashboard folder. For more information, see Using Folders in Notebooks and manage-folders.
Required Role
The following users can make this API call:
Users who belong to the system-user/system-admin group/a user with allowed
manage
permissions on folders.Users who belong to a group associated with a role that allows submitting a command. See Managing Groups and Managing Roles for more information.
Parameters
Note
Parameters marked in bold are mandatory. Others are optional and have default values.
Parameter |
Description |
---|---|
location |
It is the current location of the folder. |
source_type |
For a folder, the source type is |
type |
It denotes if the type is Notebooks or Dashboards. Its value must be |
policy |
Array of policies to be assigned to a cluster. Each policy include following parameters: Note Escape the values of policy elements and corresponding values except the user ID value and group ID value.
|
Request API Syntax
curl -X PUT -H "X-AUTH-TOKEN: <API-TOKEN>" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"location":"<FolderLocation>", "type": "<notes/notebook_dashboards>", "source_type":"Folder",
"policy": "[{\"access\":\"<Access>\",\"condition\":{\"qbol_users\":[<User ID>]},\"action\":[\"<Actions>\"]},
\"action\":[\"<Actions>\"]}, {\"access\":\"<Access>\",
\"condition\":{\"qbol_groups\":[<Group ID>] \"action\":[\"<Actions>\"]}, {\"access\":\"<Access>\"}]"}' \
"https://api.qubole.com/api/api/v1.2/folders/policy"
Note
The above syntax uses https://api.qubole.com as the endpoint. Qubole provides other endpoints to access QDS that are described in Supported Qubole Endpoints on Different Cloud Providers.
Sample API Requests
Here is a sample API call to assign permissions to the SparkNotes Notebook folder.
curl -i -X PUT -H "X-AUTH-TOKEN: $AUTH_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"name":"SparkNotes", "type":"notes", "location":"Users/[email protected]/SparkNotes",
"source_type":"Folder","policy":"[{\"access\":\"allow\", \"condition\":{\"qbol_users\":[12902]},\"action\":[\"read\",\"write\"]},
{\"condition\":{\"qbol_groups\":[129]},\"access\":\"deny\",\"action\":[\"all\"]}]"}' \
"https://api.qubole.com/api/v1.2/folders/policy"
Here is a sample API call to assign permissions to SparkStatus Dashboard folder.
curl -i -X PUT -H "X-AUTH-TOKEN: $AUTH_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"name":"SparkStatus", "type":"notebook_dashboards", "location":"Users/[email protected]/SparkStatus","source_type":"Folder","
policy":"[{\"access\":\"allow\",\"condition\": {\"qbol_users\":[12902]},\"action\":[\"read\",\"write\"]},
{\"condition\":{\"qbol_groups\":[129]},\"access\":\"deny\",\"action\":[\"all\"]}]"}' \
"https://api.qubole.com/api/v1.2/folders/policy"
Here is a sample API call to assign permissions to a Jupyter notebook Jupynotebook2 folder.
curl -i -X PUT -H "X-AUTH-TOKEN: $AUTH_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"name":"Jupynotebook2", "type":"jupyter_notebooks", "location":"Users/[email protected]/Jupynotebook2","source_type":"Folder","
policy":"[{\"access\":\"allow\",\"condition\": {\"qbol_users\":[12902]},\"action\":[\"read\",\"write\"]},
{\"condition\":{\"qbol_groups\":[129]},\"access\":\"deny\",\"action\":[\"all\"]}]"}' \
"https://api.qubole.com/api/v1.2/folders/policy"