diff --git a/docs/rest-server/API.md b/docs/rest-server/API.md index 405a54b5ef..55a21c83b9 100644 --- a/docs/rest-server/API.md +++ b/docs/rest-server/API.md @@ -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 +``` + +*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 +``` + +*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 +``` + +*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." } ```