Skip to content

Instantly share code, notes, and snippets.

@aravindavk
Last active December 21, 2015 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aravindavk/6961564b4b1d966b8845 to your computer and use it in GitHub Desktop.
Save aravindavk/6961564b4b1d966b8845 to your computer and use it in GitHub Desktop.
Gluster REST Server - A solution for Glusterd 1.0

Root Endpoint and Version

Root endpoint will be http(s)://hostname/v1

Client Errors

Unauthorized access will result in 401 UnAuthorized response.

HTTP/1.1 401 Unauthorized
Content-Type: application/json
Content-Length: 26
 
{"message":"Unauthorized"}

Invalid JSON will result in a 400 Bad Request response.

HTTP/1.1 400 Bad Request
Content-Type: application/json
Content-Length: 35

{"message":"Problems parsing JSON"}

Invalid fields will result in a 422 Unprocessable Entity response.

HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json
Content-Length: 176

{
    "message": "Invalid inputs",
    "errors": [
        {
            "field": "name",
            "code": "missing_field"
        }
    ]
}

Server Errors

If all the inputs are valid but failed to execute the required Gluster commands

HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Content-Length: 79

{"message":"Connection failed. Please check if gluster daemon is operational."}

Register/Add user

Admin user can be created by running /register. With this endpoint only first user can be created and first user will become Admin.

Only first user creation will work without authentication, Admin access required to create more users(Not Yet implemented)

PUT /users/:username

Parameters:

Name Type Description
password string Password
groups string Add the user to Groups

Change Password

Registerd user can change password using this REST endpoint

POST /users/:username/passwd

Parameters:

Name Type Description
current_password string Current Password
new_password string New Password

Peers

Attach

PUT /peers/:hostname

Parameters:

None

Output:

HTTP/1.1 201 Created

{"id": "307b3c4b-63be-473e-ba6d-ea9c33ebefe6"}

Detach

DELETE /peers/:hostname

Parameters:

None

Output:

HTTP/1.1 204 No Content

Volume Lifecycle

Create

PUT /volumes/:name

Start

POST /volumes/:name/start

Stop

POST /volumes/:name/stop

Restart

POST /volumes/:name/restart

Delete

DELETE /volumes/:name

Geo-replication

Create

PUT /georep/:mastervol/:slaveurl/:slavevol

Parameters:

Name Type Description
force bool Optional. Force option to recreate the same session

Start

POST /georep/:mastervol/:slavehost/:slavevol/start

Parameters:

Name Type Description
force bool Optional. Force option to start the session

Stop

POST /georep/:mastervol/:slavehost/:slavevol/stop

Parameters:

Name Type Description
force bool Optional. Force option to stop the session

Restart

POST /georep/:mastervol/:slavehost/:slavevol/restart

Parameters:

Name Type Description
force bool Optional. Force option to restart the session

Status

GET /georep

Parameters:

Name Type Description
master_volume string Optional. Master Volume Name
slave_url string Optional. Slave Host username@slavehost
slave_volume string Optional. Slave Volume Name

Snapshot

Create

PUT /snapshot/:name

Clone

POST /snapshot/:name/clone

Restore

POST /snapshot/:name/restore

Delete

DELETE /snapshot/:name

Activate

POST /snapshot/:name/activate

Deactivate

POST /snapshot/:name/deactivate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment