summaryrefslogtreecommitdiffstats
path: root/done/GlusterFS 3.7/rest-api.md
blob: e967d2852d5c94421e6ad2cacc2fc8b836d6fe4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
Feature
-------

REST API for GlusterFS

Summary
-------

Provides REST API for Gluster Volume and Peer Management.

Owners
------

Aravinda VK <mail@aravindavk.in> (http://aravindavk.in)

Current status
--------------

REST API is not available in GlusterFS.

Detailed Description
--------------------

GlusterFS REST service can be started by running following command in
any node.

        sudo glusterrest -p 8080

Features:

-   No Separate server required, command can be run in any one node.
-   Provides Basic authentication(user groups can be added)
-   Any REST client can be used.
-   JSON output

Benefit to GlusterFS
--------------------

Provides REST API for GlusterFS cluster.

Scope
-----

### Nature of proposed change

New code.

### Implications on manageability

### Implications on presentation layer

### Implications on persistence layer

### Implications on 'GlusterFS' backend

### Modification to GlusterFS metadata

### Implications on 'glusterd'

How To Test
-----------

User Experience
---------------

Dependencies
------------

Documentation
-------------

### Usage:

New CLI command will be available \`glusterrest\`,

    usage: glusterrest [-h] [-p PORT] [--users USERS] 
                       [--no-password-hash] 

    optional arguments:
      -h, --help            show this help message and exit
      -p PORT, --port PORT  PORT Number
      -u USERS, --users USERS
                            Users JSON file
      --no-password-hash    No Password Hash
     

Following command will start the REST server in the given port(8080 in
this example).

        sudo glusterrest -p 8080 --users /root/secured_dir/gluster_users.json

Format of users json file(List of key value pairs, username and
password):

    [
    {"username": "aravindavk", "password": "5ebe2294ecd0e0f08eab7690d2a6ee69"}
    ]

Password is md5 hash, if no hash required then use --no-password-hash
while running glusterrest command.

### API Documentation

Getting list of peers

        GET    /api/1/peers

Peer Probe

        CREATE    /api/1/peers/:hostname

Peer Detach

        DELETE    /api/1/peers/:hostname

Creating Gluster volumes

        CREATE /api/1/volumes/:name
        CREATE /api/1/volumes/:name/force

Deleting Gluster Volume

        DELETE /api/1/volumes/:name
        DELETE /api/1/volumes/:name/stop

Gluster volume actions

        POST   /api/1/volumes/:name/start
        POST   /api/1/volumes/:name/stop
        POST   /api/1/volumes/:name/start-force
        POST   /api/1/volumes/:name/stop-force
        POST   /api/1/volumes/:name/restart

Gluster Volume modifications

        PUT    /api/1/volumes/:name/add-brick
        PUT    /api/1/volumes/:name/remove-brick
        PUT    /api/1/volumes/:name/set
        PUT    /api/1/volumes/:name/reset

Getting volume information

        GET    /api/1/volumes
        GET    /api/1/volumes/:name

Status
------

50% Coding complete, Started writing documentation.

Comments and Discussion
-----------------------