From d8ab9c53a8a1c6ff5c5b0815c744da838c58b41a Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 9 Jul 2024 11:47:54 +0545 Subject: [PATCH] docs: add docs on new APIs --- tests/ociswrapper/README.md | 71 ++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 5 deletions(-) diff --git a/tests/ociswrapper/README.md b/tests/ociswrapper/README.md index cd57f2b7e67..6186e272678 100644 --- a/tests/ociswrapper/README.md +++ b/tests/ociswrapper/README.md @@ -17,10 +17,13 @@ When run, **ociswrapper** starts an API server that exposes some endpoints to re ```bash ./bin/ociswrapper serve --bin= ``` + To check other available options: + ```bash ./bin/ociswrapper serve --help ``` + ```bash --url string oCIS server url (default "https://localhost:9200") --retry string Number of retries to start oCIS server (default "5") @@ -51,9 +54,9 @@ Also, see `./bin/ociswrapper help` for more information. Returns: - * `200 OK` - oCIS is successfully reconfigured - * `400 Bad Request` - request body is not a valid JSON object - * `500 Internal Server Error` - oCIS server is not running + - `200 OK` - oCIS is successfully reconfigured + - `400 Bad Request` - request body is not a valid JSON object + - `500 Internal Server Error` - oCIS server is not running 2. `DELETE /rollback` @@ -61,5 +64,63 @@ Also, see `./bin/ociswrapper help` for more information. Returns: - * `200 OK` - rollback is successful - * `500 Internal Server Error` - oCIS server is not running + - `200 OK` - rollback is successful + - `500 Internal Server Error` - oCIS server is not running + +3. `POST /command` + + Executes the provided command on the oCIS server. The body of the request should be a JSON object with the following structure: + + ```yml + { + "command": "", # without the ocis binary. e.g. "list" + } + ``` + + If the command requires user input, the body of the request should be a JSON object with the following structure: + + ```json + { + "command": "", + "inputs": ["value1"] + } + ``` + + Returns: + + ```json + { + "status": "OK", + "exitCode": 0, + "message": "" + } + OR + { + "status": "ERROR", + "exitCode": , + "message": "" + } + ``` + + - `200 OK` - command is successfully executed + - `400 Bad Request` - request body is not a valid JSON object + - `500 Internal Server Error` + +4. `POST /start` + + Starts the oCIS server. + + Returns: + + - `200 OK` - oCIS server is started + - `409 Conflict` - oCIS server is already running + - `500 Internal Server Error` - Unable to start oCIS server + +5. `POST /stop` + + Stops the oCIS server. + + Returns: + + - `200 OK` - oCIS server is stopped + - `500 Internal Server Error` - Unable to stop oCIS server