tokens
Creates, updates, deletes, gets or lists a tokens resource.
Overview
| Name | tokens |
| Type | Resource |
| Id | databricks_workspace.settings.tokens |
Fields
The following fields are returned by SELECT queries:
- list
| Name | Datatype | Description |
|---|---|---|
token_id | string | The ID of this token. |
comment | string | |
creation_time | integer | Server time (in epoch milliseconds) when the token was created. |
expiry_time | integer | Server time (in epoch milliseconds) when the token will expire, or -1 if not applicable. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | deployment_name | Lists all the valid tokens for a user-workspace pair. | |
create | insert | deployment_name | Creates and returns a token for a user. If this call is made through token authentication, it creates | |
delete | exec | deployment_name, token_id | Revokes an access token. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
SELECT examples
- list
Lists all the valid tokens for a user-workspace pair.
SELECT
token_id,
comment,
creation_time,
expiry_time
FROM databricks_workspace.settings.tokens
WHERE deployment_name = '{{ deployment_name }}' -- required
;
INSERT examples
- create
- Manifest
Creates and returns a token for a user. If this call is made through token authentication, it creates
INSERT INTO databricks_workspace.settings.tokens (
comment,
lifetime_seconds,
deployment_name
)
SELECT
'{{ comment }}',
{{ lifetime_seconds }},
'{{ deployment_name }}'
RETURNING
token_info,
token_value
;
# Description fields are for documentation purposes
- name: tokens
props:
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the tokens resource.
- name: comment
value: "{{ comment }}"
description: |
Optional description to attach to the token.
- name: lifetime_seconds
value: {{ lifetime_seconds }}
description: |
The lifetime of the token, in seconds. If the lifetime is not specified, this token remains valid for 2 years.
Lifecycle Methods
- delete
Revokes an access token.
EXEC databricks_workspace.settings.tokens.delete
@deployment_name='{{ deployment_name }}' --required
@@json=
'{
"token_id": "{{ token_id }}"
}'
;