Skip to content

Commit

Permalink
docs: add docs on new APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
saw-jan committed Jul 9, 2024
1 parent 9e6b6bc commit 9de8d98
Showing 1 changed file with 66 additions and 5 deletions.
71 changes: 66 additions & 5 deletions tests/ociswrapper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ When run, **ociswrapper** starts an API server that exposes some endpoints to re
```bash
./bin/ociswrapper serve --bin=<path-to-ocis-binary>
```

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")
Expand Down Expand Up @@ -51,15 +54,73 @@ 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`

Rolls back the configuration to the starting point.

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": "<ocis-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": "<ocis-command>",
"inputs": ["value1"]
}
```

Returns:

```json
{
"status": "OK",
"exitCode": 0,
"message": "<commnad output>"
}
OR
{
"status": "ERROR",
"exitCode": <error-exit-code>,
"message": "<commnad output>"
}
```

- `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 started
- `500 Internal Server Error` - Unable to stop oCIS server

0 comments on commit 9de8d98

Please sign in to comment.