Skip to main content

tokens

Creates, updates, deletes, gets or lists a tokens resource.

Overview​

Nametokens
TypeResource
Idovh.metrics.tokens

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstringId of the token
accessstring (password)The actual access token
created_atstring (date-time)Token creation date (wire: createdAt)
descriptionstringDescription of the token
expiry_atstring (date-time)Token expiration date (wire: expiryAt)
is_revokedbooleanIs your token revoked? (wire: isRevoked)
labelsarrayLabels for the token if set
permissionstringToken permission: read or write (read, write)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectservice_name, token_idGet a specific token (Deprecated, will be removed)
listselectservice_namex_pagination_modeGet list of tokens (Deprecated, will be removed)
createinsertservice_name, permissionCreate a token (Deprecated, will be removed)
updateupdateservice_name, token_idModify a token (Deprecated, will be removed)
deletedeleteservice_name, token_idRevoke 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.

NameDatatypeDescription
api_hoststringThe 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_namestringService name (wire: serviceName)
token_idstringToken ID (wire: tokenId)
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

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
;

INSERT examples​

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
;

UPDATE examples​

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​

Revoke a token (Deprecated, will be removed)

DELETE FROM ovh.metrics.tokens
WHERE service_name = '{{ service_name }}' --required
AND token_id = '{{ token_id }}' --required
;