satellite/admin: add a readme about endpoints

Change-Id: I720fcdf6af3860ad4c8566de85c39e9f06f7cb01
This commit is contained in:
Egon Elbre 2020-04-28 20:06:59 +03:00
parent 85c45cd56f
commit cafa7a5f0b
2 changed files with 56 additions and 0 deletions

55
satellite/admin/README.md Normal file
View File

@ -0,0 +1,55 @@
# satellite/admin
Satellite Admin package provides API endpoints for administrative tasks.
Requires setting `Authorization` header for requests.
## GET /api/user/{user-email}
This endpoint returns information about user and their projects.
A successful response:
```json
{
"user":{
"id": "12345678-1234-1234-1234-123456789abc",
"fullName": "Alice Bob",
"email":"alice@example.test"
},
"projects":[
{
"id": "abcabcab-1234-abcd-abcd-abecdefedcab",
"name": "Project",
"description": "Project to store data.",
"ownerId": "12345678-1234-1234-1234-123456789abc"
}
]
}
```
## GET /api/project/{project-id}/limit
This endpoint returns information about project limits.
A successful response:
```json
{
"usage": {
"amount":"0 B",
"bytes":0
},
"rate":{
"rps":0
}
}
```
## POST /api/project/{project-id}/limit?usage={value}
Updates usage limit for a project.
## POST /api/project/{project-id}/limit?rate={value}
Updates rate limit for a project.

View File

@ -60,6 +60,7 @@ func NewServer(log *zap.Logger, listener net.Listener, db DB, config Config) *Se
next: server.mux,
}
// When adding new options, also update README.md
server.mux.HandleFunc("/api/user/{useremail}", server.userInfo).Methods("GET")
server.mux.HandleFunc("/api/project/{project}/limit", server.getProjectLimit).Methods("GET")
server.mux.HandleFunc("/api/project/{project}/limit", server.putProjectLimit).Methods("PUT", "POST")