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
No known key found for this signature in database
GPG Key ID: 5CE746D557ACC499
4 changed files with 44 additions and 37 deletions

View File

@ -120,22 +120,22 @@ value of `threads`.
"type": "threads",
"attributes": {
"stats": {
"reads": 2,
"writes": 0,
"errors": 0,
"hangups": 0,
"accepts": 0,
"reads": 2, // Number of read events received
"writes": 0, // Number of write events received
"errors": 0, // Number of error events received
"hangups": 0, // Number of hangup events received
"accepts": 0, // Number of accepted connections
"blocking_polls": 180,
"event_queue_length": 1,
"max_event_queue_length": 1,
"max_exec_time": 0,
"max_queue_time": 0,
"current_descriptors": 1,
"total_descriptors": 1,
"load": {
"last_second": 0,
"last_minute": 0,
"last_hour": 0
"current_descriptors": 1, // Current number of managed file descriptors
"total_descriptors": 1, // Total number of managed file descriptors
"load": { // Average load as a percentage from 0 to 100
"last_second": 0, // Average load over the last second
"last_minute": 0, // Average load over the last minute
"last_hour": 0 // Average load over the last hour
}
}
},
@ -144,7 +144,7 @@ value of `threads`.
}
}
}
```
1```
## Get information for all threads
@ -159,6 +159,7 @@ Get the information for all threads. Returns a collection of threads resources.
`Status: 200 OK`
```javascript
// See `/v1/maxscale/threads/:id` for a descriptions of the fields
{
"links": {
"self": "http://localhost:8989/v1/maxscale/threads/"
@ -316,7 +317,7 @@ location where the log files are stored.
"log_to_shm": false
},
"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",
"warning",
"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"
},
"data": {
"id": "MariaDB-Monitor",
"id": "MariaDB-Monitor", // Name of the monitor
"type": "monitors",
"relationships": {
"servers": {
"servers": { // Servers that are monitored by this monitor
"links": {
"self": "http://localhost:8989/v1/servers/"
},
@ -44,9 +44,9 @@ all whitespace replaced with hyphens. The monitor names are case-sensitive.
}
},
"attributes": {
"module": "mariadbmon",
"state": "Running",
"parameters": {
"module": "mariadbmon", // The module that the monitor uses
"state": "Running", // Monitor state
"parameters": { // Monitor parameters
"user": "maxuser",
"password": "maxpwd",
"monitor_interval": 10000,
@ -64,7 +64,7 @@ all whitespace replaced with hyphens. The monitor names are case-sensitive.
"allow_cluster_recovery": true,
"journal_max_age": 28800
},
"monitor_diagnostics": {
"monitor_diagnostics": { // Diagnostic output from the monitor, depends on the monitor module
"monitor_id": 0,
"detect_stale_master": true,
"detect_stale_slave": true,
@ -117,10 +117,11 @@ GET /v1/monitors
Get all monitors.
#### Response
// See `/v1/monitors/:name` for a descriptions of the fields
`Status: 200 OK`
```javascript
{
"links": {
"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"
},
"data": {
"id": "9",
"id": "9", // The session ID, same as the one sent to the client
"type": "sessions",
"relationships": {
"services": {
"services": { // The service that the session uses
"links": {
"self": "http://localhost:8989/v1/services/"
},
@ -41,11 +41,11 @@ same that is exposed to the client as the connection ID.
}
},
"attributes": {
"state": "Session ready for routing",
"user": "maxuser",
"remote": "::ffff:127.0.0.1",
"connected": "Mon Jul 17 11:10:39 2017",
"idle": 23.800000000000001
"state": "Session ready for routing", // Session state
"user": "maxuser", // The user that this session uses
"remote": "::ffff:127.0.0.1", // The client address
"connected": "Mon Jul 17 11:10:39 2017", // The time when the client connected
"idle": 23.800000000000001 // How many seconds the session has been idle
},
"links": {
"self": "http://localhost:8989/v1/sessions/9"
@ -67,6 +67,7 @@ Get all sessions.
`Status: 200 OK`
```javascript
// See `/v1/sessions/:id` for a descriptions of the fields
{
"links": {
"self": "http://localhost:8989/v1/sessions/"

View File

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