oCIS Wrapper
A tool that wraps the oCIS binary and provides a way to re-configure the running oCIS instance.
When run, ociswrapper starts an API server that exposes some endpoints to re-configure the oCIS server.
Usage
-
Build
make build -
Run
./bin/ociswrapper serve --bin=<path-to-ocis-binary>To check other available options:
./bin/ociswrapper serve --help--url string oCIS server url (default "https://localhost:9200") --retry string Number of retries to start oCIS server (default "5") -p, --port string Wrapper API server port (default "5200") --admin-username string admin username for oCIS server --admin-password string admin password for oCIS server
Access the API server at http://localhost:5200.
Also, see ./bin/ociswrapper help for more information.
API
ociswrapper exposes two endpoints:
-
PUT /configUpdates the configuration of the running oCIS instance. Body of the request should be a JSON object with the following structure:
{ "ENV_KEY1": "value1", "ENV_KEY2": "value2" }Returns:
200 OK- oCIS is successfully reconfigured400 Bad Request- request body is not a valid JSON object500 Internal Server Error- oCIS server is not running
-
DELETE /rollbackRolls back the configuration to the starting point.
Returns:
200 OK- rollback is successful500 Internal Server Error- oCIS server is not running
-
POST /commandExecutes the provided command on the oCIS server. The body of the request should be a JSON object with the following structure:
{ "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:
{ "command": "<ocis-command>", "inputs": ["value1"] }Returns:
{ "status": "OK", "exitCode": 0, "message": "<command output>" } OR { "status": "ERROR", "exitCode": <error-exit-code>, "message": "<command output>" }200 OK- command is successfully executed400 Bad Request- request body is not a valid JSON object500 Internal Server Error
-
POST /startStarts the oCIS server.
Returns:
200 OK- oCIS server is started409 Conflict- oCIS server is already running500 Internal Server Error- Unable to start oCIS server
-
POST /stopStops the oCIS server.
Returns:
200 OK- oCIS server is stopped500 Internal Server Error- Unable to stop oCIS server