Temporary database users (dbusers)

Overview

Manages temporary domain database user accounts.

Information for database connection is obtained from the parameters of the corresponding role, excluding 'dc', whose database access is prohibited.

Requests

HTTP verb Endpoint Description

GET

/rest/v1/iam/dbusers

Getting the list of databases

POST

/rest/v1/iam/dbusers/<DB>

Creating a new temporary database user

GET

/rest/v1/iam/dbusers/<DB>

Getting the list of temporary database users

DELETE

/rest/v1/iam/dbusers/<DB>

Deleting all temporary database users

DELETE

/rest/v1/iam/dbusers/<DB>/<login>

Deleting a temporary database user


Getting the list of databases

Returns a list of the domain’s databases. Each of the elements is a database key string used in endpoint queries to manage temporary database users.

Request

Request example
GET /rest/v1/iam/dbusers HTTP/1.1

Response

Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
    "name": "dummy",
    "_links": {
      "self": {
        "href": "/rest/v1/iam/dbusers/dummy"
      }
    }
  }
]

Creating a new temporary database user

Creates a role and a temporary user account with a validity restriction until the end of the current day in the time zone of the database server. Returns the account password in plaintext.

An object is passed as the content of the request, which may contain an access property that defines the access level for the user (value options: read, write).

The access level to be set cannot be higher than the allowed access level for the domain (a property of the current domain set from the parent domain).

Request

Request example
POST /rest/v1/iam/dbusers/dummy HTTP/1.1
Content-Type: application/json; charset=utf-8

{
  "access": "read"
}

Response

Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "host": "192.168.0.32",
  "port": 5432,
  "login": "tmp_rRpyH0hgS",
  "pwd": "2WJ0wCyHHeci",
  "database": "era_dummy_central_common",
  "access": "read",
  "validuntil": "2019-09-23 00:00:00+03"
}

Getting the list of temporary database users

Returns a list of actual temporary user accounts of the specified database. It does not return passwords.

Request

Request example
GET /rest/v1/iam/dbusers/dummy HTTP/1.1

Response

Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
    "host": "192.168.0.32",
    "port": 5432,
    "login": "tmp_rRpyH0hgS",
    "database": "era_dummy_central_common",
    "validuntil": "2019-09-23 00:00:00+03"
  },
  {
    "host": "192.168.0.32",
    "port": 5432,
    "login": "tmp_wyPHG0NN1",
    "database": "era_dummy_central_common",
    "validuntil": "2019-09-21 00:00:00+03"
  }
]

Deleting a temporary database user

Request

Request example
DELETE /rest/v1/iam/dbusers/dummy/tmp_rRpyH0hgS HTTP/1.1

Response

Response example
HTTP/1.1 204 No Content

Deleting all temporary database users

Request

Request example
DELETE /rest/v1/iam/dbusers/dummy HTTP/1.1

Response

Response example
HTTP/1.1 204 No Content

See also