valkey_users
Creates, updates, deletes, gets or lists a valkey_users resource.
Overview​
| Name | valkey_users |
| Type | Resource |
| Id | ovh.public_cloud_database.valkey_users |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Unique identifier of the user |
admin | boolean | Whether this is the service administrator, the user created automatically at provisioning time, which cannot be deleted |
categories | array | Command category rules granted to the user, each written as a category name prefixed with +@ when it is allowed or -@ when it is denied, for example +@read, -@dangerous |
channels | array | Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example news:*, chat:room1. * means every channel, and an empty list means the user cannot use any channel. |
checksum | string | Hash of the resource used for concurrency control |
commands | array | Individual command rules refining the permissions granted through the categories, each written as a Valkey command name prefixed with + when it is allowed or - when it is denied, for example +get, -flushall |
created_at | string (date-time) | Date at which the user was created (wire: createdAt) |
credentials_last_updated_at | string (date-time) | Date at which the user credentials were last updated (wire: credentialsLastUpdatedAt) |
keys | array | Glob patterns of the keys the user can access, for example cache:*, session:user:42. * means every key, and an empty list means the user cannot access any key. |
password | string (password) | Password of the user. Returned only on creation or password reset. |
status | string | Current readiness status of the user (CREATING, DELETING, ERROR, READY, UPDATING) |
username | string | Login name of the user |
A user account on a managed Valkey service
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Unique identifier of the user |
admin | boolean | Whether this is the service administrator, the user created automatically at provisioning time, which cannot be deleted |
categories | array | Command category rules granted to the user, each written as a category name prefixed with +@ when it is allowed or -@ when it is denied, for example +@read, -@dangerous |
channels | array | Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example news:*, chat:room1. * means every channel, and an empty list means the user cannot use any channel. |
checksum | string | Hash of the resource used for concurrency control |
commands | array | Individual command rules refining the permissions granted through the categories, each written as a Valkey command name prefixed with + when it is allowed or - when it is denied, for example +get, -flushall |
created_at | string (date-time) | Date at which the user was created (wire: createdAt) |
credentials_last_updated_at | string (date-time) | Date at which the user credentials were last updated (wire: credentialsLastUpdatedAt) |
keys | array | Glob patterns of the keys the user can access, for example cache:*, session:user:42. * means every key, and an empty list means the user cannot access any key. |
password | string (password) | Password of the user. Returned only on creation or password reset. |
status | string | Current readiness status of the user (CREATING, DELETING, ERROR, READY, UPDATING) |
username | string | Login name of the user |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | service_id, user_id, project_id | Returns the user, its access rules and its status. The password is not returned. (Beta version) | |
list | select | service_id, project_id | x_pagination_cursor, x_pagination_size | Returns the users of the service with their access rules and status. Passwords are not returned. (Beta version) |
create | insert | service_id, project_id, name | Creates a user with access rules on command categories, commands, keys and Pub/Sub channels. An empty keys or channels list grants no access. The generated password is returned only on creation and on password reset. (Beta version) | |
update | update | service_id, user_id, project_id | Partially updates the access rules of the user. Each list replaces the current one, and an empty keys or channels list revokes all access. Setting credentialsLastUpdatedAt resets the password and returns the new one. (Beta version) | |
delete | delete | service_id, user_id, project_id | Permanently deletes the user. (Beta version) | |
replace | exec | serviceId, userId, project_id, categories, channels, commands, keys | Updates the access rules of the user. Each list replaces the current one, and an empty keys or channels list revokes all access. To reset the password, use the resetPassword route of the user or a partial update with credentialsLastUpdatedAt. (Beta version) | |
reset_password | exec | serviceId, userId, project_id | Generates a new password for the user and returns it in the response. Reading the user never returns it. The previous password stops working once the new one is applied, and credentialsLastUpdatedAt becomes the date of this reset. This is the same reset as a partial update of the user that sets credentialsLastUpdatedAt. (Beta version) |
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"}}) |
project_id | string | The Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set. |
serviceId | string (uuid) | Service ID |
service_id | string (uuid) | Service ID (wire: serviceId) |
userId | string (uuid) | User ID |
user_id | string (uuid) | User ID (wire: userId) |
x_pagination_cursor | string | Pagination cursor (wire: X-Pagination-Cursor) |
x_pagination_size | integer | Pagination size (wire: X-Pagination-Size) |
SELECT examples​
- get
- list
Returns the user, its access rules and its status. The password is not returned. (Beta version)
SELECT
id,
admin,
categories,
channels,
checksum,
commands,
created_at,
credentials_last_updated_at,
keys,
password,
status,
username
FROM ovh.public_cloud_database.valkey_users
WHERE service_id = '{{ service_id }}' -- required
AND user_id = '{{ user_id }}' -- required
AND project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Returns the users of the service with their access rules and status. Passwords are not returned. (Beta version)
SELECT
id,
admin,
categories,
channels,
checksum,
commands,
created_at,
credentials_last_updated_at,
keys,
password,
status,
username
FROM ovh.public_cloud_database.valkey_users
WHERE service_id = '{{ service_id }}' -- required
AND project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
AND x_pagination_cursor = '{{ x_pagination_cursor }}'
AND x_pagination_size = '{{ x_pagination_size }}'
;
INSERT examples​
- create
- Manifest
Creates a user with access rules on command categories, commands, keys and Pub/Sub channels. An empty keys or channels list grants no access. The generated password is returned only on creation and on password reset. (Beta version)
INSERT INTO ovh.public_cloud_database.valkey_users (
categories,
channels,
commands,
keys,
name,
service_id,
project_id
)
SELECT
'{{ categories }}',
'{{ channels }}',
'{{ commands }}',
'{{ keys }}',
'{{ name }}' /* required */,
'{{ service_id }}',
'{{ project_id }}'
RETURNING
id,
admin,
categories,
channels,
checksum,
commands,
created_at,
credentials_last_updated_at,
keys,
password,
status,
username
;
# Description fields are for documentation purposes
- name: valkey_users
props:
- name: service_id
value: "{{ service_id }}"
description: Required parameter for the valkey_users resource.
- name: project_id
value: "{{ project_id }}"
description: Required parameter for the valkey_users resource.
- name: categories
value:
- "{{ categories }}"
description: |
Command category rules granted to the user, each written as a category name prefixed with `+@` to allow it or `-@` to deny it, for example `+@read`, `-@dangerous`. Available categories are all, admin, bitmap, blocking, connection, dangerous, fast, geo, hash, hyperloglog, keyspace, list, pubsub, read, scripting, set, slow, sortedset, stream, string, transaction and write.
- name: channels
value:
- "{{ channels }}"
description: |
Glob patterns of the Pub/Sub channels the user can subscribe to and publish on, for example `news:*`, `chat:room1`. Use `*` to allow every channel. When the list is empty, the user cannot use any channel.
- name: commands
value:
- "{{ commands }}"
description: |
Individual command rules that refine the permissions granted through the categories, each written as a Valkey command name in lowercase prefixed with `+` to allow it or `-` to deny it, for example `+get`, `-flushall`
- name: keys
value:
- "{{ keys }}"
description: |
Glob patterns of the keys the user can access, for example `cache:*`, `session:user:42`. Use `*` to allow every key. When the list is empty, the user cannot access any key.
- name: name
value: "{{ name }}"
description: |
Login name of the new user, unique on the service. It must be 1 to 32 characters long, start with a letter, a digit or an underscore, and contain only letters, digits, underscores, dots and hyphens.
UPDATE examples​
- update
Partially updates the access rules of the user. Each list replaces the current one, and an empty keys or channels list revokes all access. Setting credentialsLastUpdatedAt resets the password and returns the new one. (Beta version)
UPDATE ovh.public_cloud_database.valkey_users
SET
categories = '{{ categories }}',
channels = '{{ channels }}',
commands = '{{ commands }}',
credentials_last_updated_at = '{{ credentials_last_updated_at }}',
keys = '{{ keys }}'
WHERE
service_id = '{{ service_id }}' --required
AND user_id = '{{ user_id }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
RETURNING
id,
admin,
categories,
channels,
checksum,
commands,
created_at,
credentials_last_updated_at,
keys,
password,
status,
username;
DELETE examples​
- delete
Permanently deletes the user. (Beta version)
DELETE FROM ovh.public_cloud_database.valkey_users
WHERE service_id = '{{ service_id }}' --required
AND user_id = '{{ user_id }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;
Lifecycle Methods​
EXEC variables use wire (API) names.
- replace
- reset_password
Updates the access rules of the user. Each list replaces the current one, and an empty keys or channels list revokes all access. To reset the password, use the resetPassword route of the user or a partial update with credentialsLastUpdatedAt. (Beta version)
EXEC ovh.public_cloud_database.valkey_users.replace
@serviceId='{{ serviceId }}' --required,
@userId='{{ userId }}' --required,
@project_id='{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"categories": "{{ categories }}",
"channels": "{{ channels }}",
"commands": "{{ commands }}",
"keys": "{{ keys }}"
}'
;
Generates a new password for the user and returns it in the response. Reading the user never returns it. The previous password stops working once the new one is applied, and credentialsLastUpdatedAt becomes the date of this reset. This is the same reset as a partial update of the user that sets credentialsLastUpdatedAt. (Beta version)
EXEC ovh.public_cloud_database.valkey_users.reset_password
@serviceId='{{ serviceId }}' --required,
@userId='{{ userId }}' --required,
@project_id='{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;