users
Creates, updates, deletes, gets or lists a users resource.
Overview​
| Name | users |
| Type | Resource |
| Id | ovh.hosting_private_database.users |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
user_name | string | User name used to connect to your databases (wire: userName) |
creation_date | string (date-time) | Creation date of the user (wire: creationDate) |
databases | array | Databases granted for this user |
Users
| Name | Datatype | Description |
|---|---|---|
user_name | string | User name used to connect to your databases (wire: userName) |
creation_date | string (date-time) | Creation date of the user (wire: creationDate) |
databases | array | Databases granted for this user |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | service_name, user_name | Returns the creation date of the user and the databases it is granted on, with its rights. | |
list | select | service_name | x_pagination_mode | Returns the names of the users of the service. |
create | insert | service_name, password, user_name | Creates a user on the service, with no rights on any database until a grant is added. The password must be alphanumeric and at least 8 characters long. | |
delete | delete | service_name, user_name | Deletes the user and its grants. The databases are kept. | |
change_password | exec | serviceName, userName, password | Changes the password of the user. The password must be alphanumeric and at least 8 characters long. |
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"}}) |
serviceName | string | Service name |
service_name | string | Service name (wire: serviceName) |
userName | string | User name |
user_name | string | User name (wire: userName) |
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
Returns the creation date of the user and the databases it is granted on, with its rights.
SELECT
user_name,
creation_date,
databases
FROM ovh.hosting_private_database.users
WHERE service_name = '{{ service_name }}' -- required
AND user_name = '{{ user_name }}' -- required
;
Returns the names of the users of the service.
SELECT
user_name,
creation_date,
databases
FROM ovh.hosting_private_database.users
WHERE service_name = '{{ service_name }}' -- required
AND x_pagination_mode = '{{ x_pagination_mode }}'
;
INSERT examples​
- create
- Manifest
Creates a user on the service, with no rights on any database until a grant is added. The password must be alphanumeric and at least 8 characters long.
INSERT INTO ovh.hosting_private_database.users (
password,
user_name,
service_name
)
SELECT
'{{ password }}' /* required */,
'{{ user_name }}' /* required */,
'{{ service_name }}'
RETURNING
id,
dump_id,
database_name,
user_name,
done_date,
function,
last_update,
start_date,
status
;
# Description fields are for documentation purposes
- name: users
props:
- name: service_name
value: "{{ service_name }}"
description: Required parameter for the users resource.
- name: password
value: "{{ password }}"
description: |
Password for the new user ( alphanumeric and 8 characters minimum )
- name: user_name
value: "{{ user_name }}"
description: |
User name used to connect on your databases
DELETE examples​
- delete
Deletes the user and its grants. The databases are kept.
DELETE FROM ovh.hosting_private_database.users
WHERE service_name = '{{ service_name }}' --required
AND user_name = '{{ user_name }}' --required
;
Lifecycle Methods​
EXEC variables use wire (API) names.
- change_password
Changes the password of the user. The password must be alphanumeric and at least 8 characters long.
EXEC ovh.hosting_private_database.users.change_password
@serviceName='{{ serviceName }}' --required,
@userName='{{ userName }}' --required
@@json=
'{
"password": "{{ password }}"
}'
;