MXS-3245: Document REST API responses

This commit is contained in:
Markus Mäkelä
2020-11-17 14:14:03 +02:00
parent 41caccbf4b
commit 080232e7ef
4 changed files with 44 additions and 37 deletions

View File

@ -120,22 +120,22 @@ value of `threads`.
"type": "threads", "type": "threads",
"attributes": { "attributes": {
"stats": { "stats": {
"reads": 2, "reads": 2, // Number of read events received
"writes": 0, "writes": 0, // Number of write events received
"errors": 0, "errors": 0, // Number of error events received
"hangups": 0, "hangups": 0, // Number of hangup events received
"accepts": 0, "accepts": 0, // Number of accepted connections
"blocking_polls": 180, "blocking_polls": 180,
"event_queue_length": 1, "event_queue_length": 1,
"max_event_queue_length": 1, "max_event_queue_length": 1,
"max_exec_time": 0, "max_exec_time": 0,
"max_queue_time": 0, "max_queue_time": 0,
"current_descriptors": 1, "current_descriptors": 1, // Current number of managed file descriptors
"total_descriptors": 1, "total_descriptors": 1, // Total number of managed file descriptors
"load": { "load": { // Average load as a percentage from 0 to 100
"last_second": 0, "last_second": 0, // Average load over the last second
"last_minute": 0, "last_minute": 0, // Average load over the last minute
"last_hour": 0 "last_hour": 0 // Average load over the last hour
} }
} }
}, },
@ -144,7 +144,7 @@ value of `threads`.
} }
} }
} }
``` 1```
## Get information for all threads ## Get information for all threads
@ -159,6 +159,7 @@ Get the information for all threads. Returns a collection of threads resources.
`Status: 200 OK` `Status: 200 OK`
```javascript ```javascript
// See `/v1/maxscale/threads/:id` for a descriptions of the fields
{ {
"links": { "links": {
"self": "http://localhost:8989/v1/maxscale/threads/" "self": "http://localhost:8989/v1/maxscale/threads/"
@ -316,7 +317,7 @@ location where the log files are stored.
"log_to_shm": false "log_to_shm": false
}, },
"log_file": "/home/markusjm/build/log/maxscale/maxscale.log", // The file MaxScale is logging into if `maxlog` is enabled "log_file": "/home/markusjm/build/log/maxscale/maxscale.log", // The file MaxScale is logging into if `maxlog` is enabled
"log_priorities": [ // Active log priorities "log_priorities": [ // Enabled log priorities
"error", "error",
"warning", "warning",
"notice", "notice",

View File

@ -24,10 +24,10 @@ all whitespace replaced with hyphens. The monitor names are case-sensitive.
"self": "http://localhost:8989/v1/monitors/MariaDB-Monitor" "self": "http://localhost:8989/v1/monitors/MariaDB-Monitor"
}, },
"data": { "data": {
"id": "MariaDB-Monitor", "id": "MariaDB-Monitor", // Name of the monitor
"type": "monitors", "type": "monitors",
"relationships": { "relationships": {
"servers": { "servers": { // Servers that are monitored by this monitor
"links": { "links": {
"self": "http://localhost:8989/v1/servers/" "self": "http://localhost:8989/v1/servers/"
}, },
@ -44,9 +44,9 @@ all whitespace replaced with hyphens. The monitor names are case-sensitive.
} }
}, },
"attributes": { "attributes": {
"module": "mariadbmon", "module": "mariadbmon", // The module that the monitor uses
"state": "Running", "state": "Running", // Monitor state
"parameters": { "parameters": { // Monitor parameters
"user": "maxuser", "user": "maxuser",
"password": "maxpwd", "password": "maxpwd",
"monitor_interval": 10000, "monitor_interval": 10000,
@ -64,7 +64,7 @@ all whitespace replaced with hyphens. The monitor names are case-sensitive.
"allow_cluster_recovery": true, "allow_cluster_recovery": true,
"journal_max_age": 28800 "journal_max_age": 28800
}, },
"monitor_diagnostics": { "monitor_diagnostics": { // Diagnostic output from the monitor, depends on the monitor module
"monitor_id": 0, "monitor_id": 0,
"detect_stale_master": true, "detect_stale_master": true,
"detect_stale_slave": true, "detect_stale_slave": true,
@ -117,10 +117,11 @@ GET /v1/monitors
Get all monitors. Get all monitors.
#### Response #### Response
// See `/v1/monitors/:name` for a descriptions of the fields
`Status: 200 OK` `Status: 200 OK`
```javascript ```javascript
{ {
"links": { "links": {
"self": "http://localhost:8989/v1/monitors/" "self": "http://localhost:8989/v1/monitors/"

View File

@ -25,10 +25,10 @@ same that is exposed to the client as the connection ID.
"self": "http://localhost:8989/v1/sessions/9" "self": "http://localhost:8989/v1/sessions/9"
}, },
"data": { "data": {
"id": "9", "id": "9", // The session ID, same as the one sent to the client
"type": "sessions", "type": "sessions",
"relationships": { "relationships": {
"services": { "services": { // The service that the session uses
"links": { "links": {
"self": "http://localhost:8989/v1/services/" "self": "http://localhost:8989/v1/services/"
}, },
@ -41,11 +41,11 @@ same that is exposed to the client as the connection ID.
} }
}, },
"attributes": { "attributes": {
"state": "Session ready for routing", "state": "Session ready for routing", // Session state
"user": "maxuser", "user": "maxuser", // The user that this session uses
"remote": "::ffff:127.0.0.1", "remote": "::ffff:127.0.0.1", // The client address
"connected": "Mon Jul 17 11:10:39 2017", "connected": "Mon Jul 17 11:10:39 2017", // The time when the client connected
"idle": 23.800000000000001 "idle": 23.800000000000001 // How many seconds the session has been idle
}, },
"links": { "links": {
"self": "http://localhost:8989/v1/sessions/9" "self": "http://localhost:8989/v1/sessions/9"
@ -67,6 +67,7 @@ Get all sessions.
`Status: 200 OK` `Status: 200 OK`
```javascript ```javascript
// See `/v1/sessions/:id` for a descriptions of the fields
{ {
"links": { "links": {
"self": "http://localhost:8989/v1/sessions/" "self": "http://localhost:8989/v1/sessions/"

View File

@ -24,10 +24,10 @@ user name.
"self": "http://localhost:8989/v1/users/inet/my-user" "self": "http://localhost:8989/v1/users/inet/my-user"
}, },
"data": { "data": {
"id": "my-user", "id": "my-user", // Username
"type": "inet", "type": "inet", // User type
"attributes": { "attributes": {
"account": "admin" "account": "admin" // Type of the user, "admin" for read-write operations, "basic" for read-only
}, },
"relationships": { "relationships": {
"self": "http://localhost:8989/v1/users/inet/my-user" "self": "http://localhost:8989/v1/users/inet/my-user"
@ -49,6 +49,7 @@ Get all network users.
`Status: 200 OK` `Status: 200 OK`
```javascript ```javascript
// See `/v1/users/inet/` for a descriptions of the fields
{ {
"links": { "links": {
"self": "http://localhost:8989/v1/users/inet" "self": "http://localhost:8989/v1/users/inet"
@ -82,6 +83,7 @@ UNIX account name that has been enabled.
`Status: 200 OK` `Status: 200 OK`
```javascript ```javascript
// See `/v1/users/inet/` for a descriptions of the fields
{ {
"links": { "links": {
"self": "http://localhost:8989/v1/users/unix/maxscale" "self": "http://localhost:8989/v1/users/unix/maxscale"
@ -112,6 +114,7 @@ Get all enabled UNIX accounts.
`Status: 200 OK` `Status: 200 OK`
```javascript ```javascript
// See `/v1/users/inet/` for a descriptions of the fields
{ {
"links": { "links": {
"self": "http://localhost:8989/v1/users/unix" "self": "http://localhost:8989/v1/users/unix"
@ -145,6 +148,7 @@ accounts.
`Status: 200 OK` `Status: 200 OK`
```javascript ```javascript
// See `/v1/users/inet/` for a descriptions of the fields
{ {
"links": { "links": {
"self": "http://localhost:8989/v1/users/" "self": "http://localhost:8989/v1/users/"
@ -205,11 +209,11 @@ password _my-password_ that is allowed to execute only read-only operations.
```javascript ```javascript
{ {
"data": { "data": {
"id": "my-user", "id": "my-user", // The user to create
"type": "inet", "type": "inet", // The type of the user
"attributes": { "attributes": {
"password": "my-password", "password": "my-password", // The password to use for the user
"account": "basic" "account": "basic" // The type of the account
} }
} }
} }
@ -244,10 +248,10 @@ Here is an example request body enabling the UNIX account _jdoe_ for read-only o
```javascript ```javascript
{ {
"data": { "data": {
"id": "jdoe", "id": "jdoe", // Account name
"type": "unix" "type": "unix" // Account type
"attributes": { "attributes": {
"account": "basic" "account": "basic" // Type of the user account in MaxScale
} }
} }
} }