tokens
Creates, updates, deletes, gets or lists a tokens resource.
Overview​
| Name | tokens |
| Type | Resource |
| Id | ovh.metrics.tokens |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | string | Id of the token |
access | string (password) | The actual access token |
created_at | string (date-time) | Token creation date (wire: createdAt) |
description | string | Description of the token |
expiry_at | string (date-time) | Token expiration date (wire: expiryAt) |
is_revoked | boolean | Is your token revoked? (wire: isRevoked) |
labels | array | Labels for the token if set |
permission | string | Token permission: read or write (read, write) |
Structure holding the elements about a token
| Name | Datatype | Description |
|---|---|---|
id | string | Id of the token |
access | string (password) | The actual access token |
created_at | string (date-time) | Token creation date (wire: createdAt) |
description | string | Description of the token |
expiry_at | string (date-time) | Token expiration date (wire: expiryAt) |
is_revoked | boolean | Is your token revoked? (wire: isRevoked) |
labels | array | Labels for the token if set |
permission | string | Token permission: read or write (read, write) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | service_name, token_id | Get a specific token (Deprecated, will be removed) | |
list | select | service_name | x_pagination_mode | Get list of tokens (Deprecated, will be removed) |
create | insert | service_name, permission | Create a token (Deprecated, will be removed) | |
update | update | service_name, token_id | Modify a token (Deprecated, will be removed) | |
delete | delete | service_name, token_id | Revoke a token (Deprecated, will be removed) |
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 |
|---|---|---|
api_host | string | The OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}}) |
service_name | string | Service name (wire: serviceName) |
token_id | string | Token ID (wire: tokenId) |
x_pagination_mode | string | Sent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode) |
SELECT examples​
- get
- list
Get a specific token (Deprecated, will be removed)
SELECT
id,
access,
created_at,
description,
expiry_at,
is_revoked,
labels,
permission
FROM ovh.metrics.tokens
WHERE service_name = '{{ service_name }}' -- required
AND token_id = '{{ token_id }}' -- required
;
Get list of tokens (Deprecated, will be removed)
SELECT
id,
access,
created_at,
description,
expiry_at,
is_revoked,
labels,
permission
FROM ovh.metrics.tokens
WHERE service_name = '{{ service_name }}' -- required
AND x_pagination_mode = '{{ x_pagination_mode }}'
;
INSERT examples​
- create
- Manifest
Create a token (Deprecated, will be removed)
INSERT INTO ovh.metrics.tokens (
description,
labels,
permission,
service_name
)
SELECT
'{{ description }}',
'{{ labels }}',
'{{ permission }}' /* required */,
'{{ service_name }}'
RETURNING
id,
access,
created_at,
description,
expiry_at,
is_revoked,
labels,
permission
;
# Description fields are for documentation purposes
- name: tokens
props:
- name: service_name
value: "{{ service_name }}"
description: Required parameter for the tokens resource.
- name: description
value: "{{ description }}"
description: |
Description for the new token
- name: labels
description: |
Labels for the new token
value:
- key: "{{ key }}"
value: "{{ value }}"
- name: permission
value: "{{ permission }}"
description: |
Type of the new token. Read or Write
valid_values: ['read', 'write']
UPDATE examples​
- update
Modify a token (Deprecated, will be removed)
UPDATE ovh.metrics.tokens
SET
description = '{{ description }}'
WHERE
service_name = '{{ service_name }}' --required
AND token_id = '{{ token_id }}' --required
RETURNING
id,
access,
created_at,
description,
expiry_at,
is_revoked,
labels,
permission;
DELETE examples​
- delete
Revoke a token (Deprecated, will be removed)
DELETE FROM ovh.metrics.tokens
WHERE service_name = '{{ service_name }}' --required
AND token_id = '{{ token_id }}' --required
;