MXS-1220: Update users resource documentation
Updated the users resource documentation.
This commit is contained in:
@ -5,57 +5,207 @@ MaxScale's configuration.
|
|||||||
|
|
||||||
## Resource Operations
|
## Resource Operations
|
||||||
|
|
||||||
### Get all users
|
### Get network user
|
||||||
|
|
||||||
Get all administrative users.
|
Get a single network user. The The _:name_ in the URI must be a valid network
|
||||||
|
user name.
|
||||||
|
|
||||||
```
|
```
|
||||||
GET /users
|
GET /v1/users/inet/:name
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Response
|
#### Response
|
||||||
|
|
||||||
```
|
`Status: 200 OK`
|
||||||
Status: 200 OK
|
|
||||||
|
|
||||||
[
|
```javascript
|
||||||
{
|
{
|
||||||
"name": "jdoe"
|
"links": {
|
||||||
|
"self": "http://localhost:8989/v1/users/inet/my-user"
|
||||||
},
|
},
|
||||||
{
|
"data": {
|
||||||
"name": "dba"
|
"id": "my-user",
|
||||||
},
|
"type": "inet",
|
||||||
{
|
"relationships": {
|
||||||
"name": "admin"
|
"self": "http://localhost:8989/v1/users/inet/my-user"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### Supported Request Parameter
|
#### Supported Request Parameter
|
||||||
|
|
||||||
- `fields`
|
- `pretty`
|
||||||
- `range`
|
|
||||||
|
|
||||||
### Create a user
|
### Get all network users
|
||||||
|
|
||||||
Create a new administrative user.
|
Get all network users.
|
||||||
|
|
||||||
```
|
```
|
||||||
PUT /users
|
GET /v1/users/inet
|
||||||
```
|
```
|
||||||
|
|
||||||
### Modifiable Fields
|
#### Response
|
||||||
|
|
||||||
All of the following fields need to be defined in the request body.
|
`Status: 200 OK`
|
||||||
|
|
||||||
|Field |Type |Description |
|
```javascript
|
||||||
|---------|------|-------------------------|
|
|
||||||
|name |string|Username, consisting of alphanumeric characters|
|
|
||||||
|password |string|Password for the new user|
|
|
||||||
|
|
||||||
```
|
|
||||||
{
|
{
|
||||||
"name": "foo",
|
"links": {
|
||||||
"password": "bar"
|
"self": "http://localhost:8989/v1/users/inet"
|
||||||
|
},
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "my-user",
|
||||||
|
"type": "inet",
|
||||||
|
"relationships": {
|
||||||
|
"self": "http://localhost:8989/v1/users/inet/my-user"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Supported Request Parameter
|
||||||
|
|
||||||
|
- `pretty`
|
||||||
|
|
||||||
|
### Get enabled UNIX account
|
||||||
|
|
||||||
|
Get a single enabled UNIX account. The The _:name_ in the URI must be a valid
|
||||||
|
UNIX account name that has been enabled.
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /v1/users/unix/:name
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Response
|
||||||
|
|
||||||
|
`Status: 200 OK`
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
"links": {
|
||||||
|
"self": "http://localhost:8989/v1/users/unix"
|
||||||
|
},
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "maxscale",
|
||||||
|
"type": "unix",
|
||||||
|
"relationships": {
|
||||||
|
"self": "http://localhost:8989/v1/users/unix/maxscale"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Supported Request Parameter
|
||||||
|
|
||||||
|
- `pretty`
|
||||||
|
|
||||||
|
### Get all enabled UNIX accounts
|
||||||
|
|
||||||
|
Get all enabled UNIX accounts.
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /v1/users/unix
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Response
|
||||||
|
|
||||||
|
`Status: 200 OK`
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
"links": {
|
||||||
|
"self": "http://localhost:8989/v1/users/unix"
|
||||||
|
},
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "maxscale",
|
||||||
|
"type": "unix",
|
||||||
|
"relationships": {
|
||||||
|
"self": "http://localhost:8989/v1/users/unix/maxscale"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Supported Request Parameter
|
||||||
|
|
||||||
|
- `pretty`
|
||||||
|
|
||||||
|
### Get all users
|
||||||
|
|
||||||
|
Get all administrative users. This fetches both network users and local UNIX
|
||||||
|
accounts.
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /v1/users
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Response
|
||||||
|
|
||||||
|
`Status: 200 OK`
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
"links": {
|
||||||
|
"self": "http://localhost:8989/v1/users/"
|
||||||
|
},
|
||||||
|
"data": [ // List of all users
|
||||||
|
{
|
||||||
|
"id": "my-user",
|
||||||
|
"type": "inet", // A network user
|
||||||
|
"relationships": {
|
||||||
|
"self": "http://localhost:8989/v1/users/inet/my-user"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "maxscale",
|
||||||
|
"type": "unix", // A local UNIX account
|
||||||
|
"relationships": {
|
||||||
|
"self": "http://localhost:8989/v1/users/unix/maxscale"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Supported Request Parameter
|
||||||
|
|
||||||
|
- `pretty`
|
||||||
|
|
||||||
|
### Create a network user
|
||||||
|
|
||||||
|
Create a new network user.
|
||||||
|
|
||||||
|
```
|
||||||
|
PUT /v1/users/inet
|
||||||
|
```
|
||||||
|
|
||||||
|
The request body must fulfill the following requirements.
|
||||||
|
|
||||||
|
- The `/data/id`, `/data/type` and `/data/attributes/password` fields must be
|
||||||
|
defined.
|
||||||
|
- The `/data/id` field defines the name of the account
|
||||||
|
- The `/data/attributes/password` field defines the password for this user.
|
||||||
|
- The value of the `/data/type` field must always be `inet`.
|
||||||
|
|
||||||
|
Here is an example request body defining the network user _my-user_ with the
|
||||||
|
password _my-password_.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"id": "my-user",
|
||||||
|
"type": "inet",
|
||||||
|
"attributes": {
|
||||||
|
"password": "my-password"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -65,13 +215,58 @@ All of the following fields need to be defined in the request body.
|
|||||||
Status: 204 No Content
|
Status: 204 No Content
|
||||||
```
|
```
|
||||||
|
|
||||||
### Delete a user
|
### Enable a UNIX account
|
||||||
|
|
||||||
Delete a user. The _:name_ part of the URI must be a valid user name. The user
|
This enables an existing UNIX account on the system for administrative
|
||||||
names are case-insensitive.
|
operations.
|
||||||
|
|
||||||
```
|
```
|
||||||
DELETE /users/:name
|
PUT /v1/users/unix
|
||||||
|
```
|
||||||
|
|
||||||
|
The request body must fulfill the following requirements.
|
||||||
|
|
||||||
|
- The `/data/id` and `/data/type` fields must be defined.
|
||||||
|
- The `/data/id` field defines the name of the account
|
||||||
|
- The value of the `/data/type` field must always be `unix`.
|
||||||
|
|
||||||
|
Here is an example request body enabling the UNIX account _jdoe_.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"id": "jdoe",
|
||||||
|
"type": "unix"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Response
|
||||||
|
|
||||||
|
```
|
||||||
|
Status: 204 No Content
|
||||||
|
```
|
||||||
|
|
||||||
|
### Delete a network user
|
||||||
|
|
||||||
|
The _:name_ part of the URI must be a valid user name.
|
||||||
|
|
||||||
|
```
|
||||||
|
DELETE /v1/users/inet/:name
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Response
|
||||||
|
|
||||||
|
```
|
||||||
|
Status: 204 No Content
|
||||||
|
```
|
||||||
|
|
||||||
|
### Disable a UNIX account
|
||||||
|
|
||||||
|
The _:name_ part of the URI must be a valid user name.
|
||||||
|
|
||||||
|
```
|
||||||
|
DELETE /v1/users/unix/:name
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Response
|
#### Response
|
||||||
|
Reference in New Issue
Block a user