Skip to main content

users

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

Overview​

Nameusers
TypeResource
Idovh.hosting_private_database.users

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
user_namestringUser name used to connect to your databases (wire: userName)
creation_datestring (date-time)Creation date of the user (wire: creationDate)
databasesarrayDatabases granted for this user

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectservice_name, user_nameReturns the creation date of the user and the databases it is granted on, with its rights.
listselectservice_namex_pagination_modeReturns the names of the users of the service.
createinsertservice_name, password, user_nameCreates 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.
deletedeleteservice_name, user_nameDeletes the user and its grants. The databases are kept.
change_passwordexecserviceName, userName, passwordChanges 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.

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"}})
serviceNamestringService name
service_namestringService name (wire: serviceName)
userNamestringUser name
user_namestringUser name (wire: userName)
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​

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
;

INSERT examples​

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
;

DELETE examples​

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.

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 }}"
}'
;