Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
VC update API doc (#1816)
Browse files Browse the repository at this point in the history
* refine api doc

* refine doc

* refine

* refine
  • Loading branch information
mzmssg authored Dec 5, 2018
1 parent 97b8207 commit b7e8451
Showing 1 changed file with 215 additions and 3 deletions.
218 changes: 215 additions & 3 deletions docs/rest-server/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -771,10 +771,222 @@ Status: 200
"numJobs":0,
"numPendingJobs":0,
"resourcesUsed":{
"memory":0,
"vCores":0,
"GPUs":0
"memory":0,
"vCores":0,
"GPUs":0
},
"state":"running"
}
```
*Response if the virtual cluster does not exist*
```
Status: 404

{
"code": "NoVirtualClusterError",
"message": "Virtual cluster $vcname is not found."
}
```
*Response if a server error occured*
```
Status: 500

{
"code": "UnknownError",
"message": "*Upstream error messages*"
}
```
### `PUT virtual-clusters/:vcName` (administrator only)
Add or update virtual cluster quota in the system, don't allow to operate "default" vc.
*Request*
```
PUT /api/v1/virtual-clusters/:vcName
Authorization: Bearer <ACCESS_TOKEN>
```
*Parameters*
```
{
"vcCapacity": new capacity
}
```
*Response if succeeded*
```
Status: 201

{
"message": "Update vc: $vcName to capacity: $vcCapacity successfully."
}
```
*Response if try to update "default" vc*
```
Status: 403

{
"code": "ForbiddenUserError",
"message": "Don't allow to update default vc"
}
```
*Response if current user has no permission*
```
Status: 403

{
"code": "ForbiddenUserError",
"message": "Non-admin is not allow to do this operation."
}
```
*Response if no enough quota*
```
Status: 403

{
"code": "NoEnoughQuotaError",
"message": "No enough quota in default vc."
}
```
*Response if "default" virtual cluster does not exist*
```
Status: 404

{
"code": "NoVirtualClusterError",
"message": "Default virtual cluster is not found, can't allocate or free resource."
}
```
*Response if a server error occured*
```
Status: 500

{
"code": "UnknownError",
"message": "*Upstream error messages*"
}
```
### `DELETE virtual-clusters/:vcName` (administrator only)
remove virtual cluster in the system, don't allow to operate "default" vc.
*Request*
```
DELETE /api/v1/virtual-clusters/:vcName
Authorization: Bearer <ACCESS_TOKEN>
```
*Response if succeeded*
```
Status: 201

{
"message": "Remove vc: $vcName successfully."
}
```
*Response if current user has no permission*
```
Status: 403

{
"code": "ForbiddenUserError",
"message": "Non-admin is not allow to do this operation."
}
```
*Response if try to update "default" vc*
```
Status: 403

{
"code": "ForbiddenUserError",
"message": "Don't allow to remove default vc."
}
```
*Response if the virtual cluster does not exist*
```
Status: 404

{
"code": "NoVirtualClusterError",
"message": "Virtual cluster $vcname is not found."
}
```
*Response if "default" virtual cluster does not exist*
```
Status: 404

{
"code": "NoVirtualClusterError",
"message": "Default virtual cluster is not found, can't allocate or free resource."
}
```
*Response if a server error occured*
```
Status: 500

{
"code": "UnknownError",
"message": "*Upstream error messages*"
}
```
### `PUT virtual-clusters/:vcName/status` (administrator only)
Change virtual cluster status, don't allow to operate "default" vc.
*Request*
```
PUT /api/v1/virtual-clusters/:vcName/status
Authorization: Bearer <ACCESS_TOKEN>
```
*Parameters*
```
{
"vcStatus": "running" | "stopped"
}
```
*Response if succeeded*
```
Status: 201

{
"message": "Update vc: $vcName to status: $vcStatus successfully."
}
```
*Response if try to update "default" vc*
```
Status: 403

{
"code": "ForbiddenUserError",
"message": "Don't allow to update default vc"
}
```
*Response if current user has no permission*
```
Status: 403

{
"code": "ForbiddenUserError",
"message": "Non-admin is not allow to do this operation."
}
```
Expand Down

0 comments on commit b7e8451

Please sign in to comment.