List Database Users
List a database's users, oldest first. Apps connect to a database as one of its users. A database can have up to 10 users. Passwords are never listed: one is returned only by the call that creates the user or rotates its password. Requires Databases read.
User object
u_<6 characters>_<name>. An app connected as the user gets it as DB_USER.read_write: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX, CREATE VIEW, SHOW VIEW on this database. read_only: SELECT, SHOW VIEW.customer.provisioning (being created) → ready; rotating (a new password is being set); failed (last_error says why; rotating its password retries); deleting.{application_uuid, application_name}. Several apps can share a user (and then share its connection and query-rate caps).Response (200 OK)
{"users": […], "max_users": 10}. max_users is the most users a database can have.
Errors
database not found.databases_unavailable.Create Database User
Add a user to a database. ngris generates its login and a 48-character hex password, and returns the password once, in this response; it is stored encrypted and never returned again. Apps connected as the user get it automatically. The user starts as provisioning and becomes ready within seconds (once the database is ready). Requires Databases write.
Request body
_, unique on this database.read_write (default) or read_only.Response (201 Created)
{user, password, password_notice}: the new user, its password (shown only in this response) and a reminder that it is shown once.
Errors
invalid request body, User name must be 1-32 characters, with no control characters, not starting with _, or Access must be read_write or read_only.database not found.name_taken: A user with this name already exists on this database.user_limit: A database can have at most 10 users. (with limit: 10).quota_paused: the database is paused over your plan's database limit; a paused database gets no new users.database_status: the database is failed or deleting (e.g. Not possible while the database is deleting., with resource and status).
databases_unavailable.Delete Database User
Delete a user: it is marked deleting and ngris drops its login. The delete is refused while any application connects as the user; disconnect those apps (or connect them as another user) first. Works on a paused database too, and answers 202 again for a user already being deleted. Requires Databases delete.
Response (202 Accepted)
{"user": {…}} with status: "deleting".
Errors
database not found or database user not found.database_user_in_use: apps connect as this user; connected_apps lists them.databases_unavailable.