Skip to content

Commit 25d1a6c

Browse files
committed
added REST to docs
1 parent a37fe74 commit 25d1a6c

13 files changed

+121
-43
lines changed

docs/README.md

+25-4
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,38 @@ API functions, examples, and references to multiple client libraries which can
77
communicate with an OpenStorage server.
88

99
## Quick Example
10-
Here is a super quick example of how to get cluster information from an OpenStorage
11-
server using a mock container running the gRPC server and using [Polyglot](https://github.com/grpc-ecosystem/polyglot) as the gRPC client.
10+
Here is a quick example of how to get cluster information from an OpenStorage
11+
server. In this example we will be using the mock SDK container as the
12+
server:
13+
14+
* Start up the container
15+
16+
```
17+
$ docker run -d -p 9100:9100 -p 9110:9110 openstorage/mock-sdk-server
18+
```
19+
20+
* Running the gRPC server and using [Polyglot](https://github.com/grpc-ecosystem/polyglot) as the gRPC client.
1221

1322
```
14-
$ docker run -d -p 9100:9100 openstorage/mock-sdk-server
1523
$ wget https://github.com/grpc-ecosystem/polyglot/releases/download/v1.6.0/polyglot.jar
1624
$ echo {} | java -jar polyglot.jar \
1725
--command=call \
1826
--endpoint=localhost:9100 \
1927
--full_method=openstorage.api.OpenStorageCluster/Enumerate
2028
```
2129

30+
* Run using the REST gRPC Gateway
31+
32+
```
33+
$ curl -X POST "http://localhost:9110/v1/cluster/enumerate" \
34+
-H "accept: application/json" \
35+
-H "Content-Type: application/json" \
36+
-d "{}"
37+
```
38+
2239
Results in:
2340

24-
```yaml
41+
```json
2542
{
2643
"cluster": {
2744
"status": "STATUS_OK",
@@ -41,3 +58,7 @@ Results in:
4158
}
4259
}
4360
```
61+
62+
* Check out more REST information by looking at the [Swagger](https://swagger.io) located
63+
at [http://localhost:9110/swagger-ui/](http://localhost:9110/swagger-ui/)
64+

docs/arch.md

+15-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66
The software development kit for OpenStorage is based on [gRPC](https://grpc.io/),
77
allowing clients to be automatically generated in multiple languages.
88

9-
Different OpenStorage drivers may run the OpenStorage gRPC server on different
10-
locations. Please, refer to your deployed driver documentation for instructions
11-
on how to setup a connection to the gRPC server.
12-
13-
In this document, examples will refer to both the [OpenStorage SDK Mock](installing.md)
14-
and Portworx drivers.
9+
Different OpenStorage drivers may run the OpenStorage gRPC and REST servers on
10+
different locations. Please, refer to your deployed driver documentation for
11+
instructions on how to setup a connection to the gRPC server.
1512

1613
OpenStorage API calls are ment to be idempotent to ensure consistency across calls, unless
1714
otherwise specified.
@@ -20,5 +17,17 @@ otherwise specified.
2017
The gRPC bindings are created from [`api/api.proto`](https://github.com/libopenstorage/openstorage/blob/master/api/api.proto) file
2118
available in the OpenStorage github repo.
2219

20+
## REST gRPC Gateway
21+
REST clients can benefit from the SDK server's [gRPC REST Gateway](https://github.com/grpc-ecosystem/grpc-gateway)
22+
which is able to translate REST calls to gRPC requests.
23+
24+
[Swagger](https://swagger.io/) is also provided by going to the REST gRPC Gateway
25+
and passing the path `/swagger-ui`.
26+
2327
## Error Handling
2428
All API calls use the [standard gRPC status](https://github.com/grpc/grpc/blob/master/src/proto/grpc/status/status.proto).
29+
30+
## OpenStorage SDK Implementations
31+
In this document, examples will refer to both the [OpenStorage SDK Mock](installing.md)
32+
and Portworx OpenStorage drivers.
33+

docs/images/arch.ditaa

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
+---------------+ +----------------------------------+
22
| | | |
3+
| REST Client | ----> | gRPC REST Gateway |
4+
| | | |
5+
+---------------+ +----------------------------------+
6+
|
7+
|
8+
|
9+
|
10+
+---------------+ +----------------------------------+
11+
| | | |
312
| gRPC Client | ----> | gRPC SDK |
413
| | | |
514
+---------------+ +----------------------------------+

docs/images/arch.png

3.6 KB
Loading

docs/installing.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,12 @@ OpenStorage provides mock SDK server as a container which can be run using the
9494
command:
9595

9696
```
97-
$ docker run -d -p 9100:9100 openstorage/mock-sdk-server
97+
$ docker run --rm -d -p 9110:9110 -p 9100:9100 openstorage/mock-sdk-server
9898
```
9999

100+
Port 9110 is the REST gRPC Gateway location for all REST calls. Port 9100 is
101+
the gRPC port.
102+
100103
This will run OpenStorage server with an in-memory driver implementation called
101104
`fake`. You can then point your gRPC client to `localhost:9100`.
105+

w/arch.html

+12-6
Original file line numberDiff line numberDiff line change
@@ -228,18 +228,24 @@ <h1 id="architecture">Architecture</h1>
228228
<h2 id="overview">Overview</h2>
229229
<p>The software development kit for OpenStorage is based on <a href="https://grpc.io/" target="_blank">gRPC</a>,
230230
allowing clients to be automatically generated in multiple languages.</p>
231-
<p>Different OpenStorage drivers may run the OpenStorage gRPC server on different
232-
locations. Please, refer to your deployed driver documentation for instructions
233-
on how to setup a connection to the gRPC server.</p>
234-
<p>In this document, examples will refer to both the <a href="installing.html">OpenStorage SDK Mock</a>
235-
and Portworx drivers.</p>
231+
<p>Different OpenStorage drivers may run the OpenStorage gRPC and REST servers on
232+
different locations. Please, refer to your deployed driver documentation for
233+
instructions on how to setup a connection to the gRPC server.</p>
236234
<p>OpenStorage API calls are ment to be idempotent to ensure consistency across calls, unless
237235
otherwise specified.</p>
238236
<h2 id="protocol-buffers-grpc-source-file">Protocol Buffers gRPC Source File</h2>
239237
<p>The gRPC bindings are created from <a href="https://github.com/libopenstorage/openstorage/blob/master/api/api.proto" target="_blank"><code>api/api.proto</code></a> file
240238
available in the OpenStorage github repo.</p>
239+
<h2 id="rest-grpc-gateway">REST gRPC Gateway</h2>
240+
<p>REST clients can benefit from the SDK server&apos;s <a href="https://github.com/grpc-ecosystem/grpc-gateway" target="_blank">gRPC REST Gateway</a>
241+
which is able to translate REST calls to gRPC requests.</p>
242+
<p><a href="https://swagger.io/" target="_blank">Swagger</a> is also provided by going to the REST gRPC Gateway
243+
and passing the path <code>/swagger-ui</code>.</p>
241244
<h2 id="error-handling">Error Handling</h2>
242245
<p>All API calls use the <a href="https://github.com/grpc/grpc/blob/master/src/proto/grpc/status/status.proto" target="_blank">standard gRPC status</a>.</p>
246+
<h2 id="openstorage-sdk-implementations">OpenStorage SDK Implementations</h2>
247+
<p>In this document, examples will refer to both the <a href="installing.html">OpenStorage SDK Mock</a>
248+
and Portworx OpenStorage drivers.</p>
243249

244250

245251
</section>
@@ -283,7 +289,7 @@ <h1 class="search-results-title">No results matching "<span class='search-query'
283289
<script>
284290
var gitbook = gitbook || [];
285291
gitbook.push(function() {
286-
gitbook.page.hasChanged({"page":{"title":"Architecture","level":"1.3","depth":1,"next":{"title":"Installing","level":"1.4","depth":1,"path":"installing.md","ref":"installing.md","articles":[]},"previous":{"title":"Status","level":"1.2","depth":1,"path":"status.md","ref":"status.md","articles":[]},"dir":"ltr"},"config":{"plugins":["codetabs","toggle-chapters","toggle-headers","edit-link","prism","github","page-toc","-highlight","-sharing"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/libopenstorage/openstorage/"},"search":{},"page-toc":{"position":"top","selector":".markdown-section h1, .markdown-section h2","showByDefault":false},"codetabs":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"toggle-headers":{},"fontsettings":{"theme":"white","family":"sans","size":2},"edit-link":{"label":"Edit this page","base":"https://github.com/libopenstorage/libopenstorage.github.io/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":true},"toggle-chapters":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"OpenStorage API","gitbook":">=3.2.1"},"file":{"path":"arch.md","mtime":"2018-04-30T19:44:09.808Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-05-07T20:00:55.138Z"},"basePath":".","book":{"language":""}});
292+
gitbook.page.hasChanged({"page":{"title":"Architecture","level":"1.3","depth":1,"next":{"title":"Installing","level":"1.4","depth":1,"path":"installing.md","ref":"installing.md","articles":[]},"previous":{"title":"Status","level":"1.2","depth":1,"path":"status.md","ref":"status.md","articles":[]},"dir":"ltr"},"config":{"plugins":["codetabs","toggle-chapters","toggle-headers","edit-link","prism","github","page-toc","-highlight","-sharing"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/libopenstorage/openstorage/"},"search":{},"page-toc":{"position":"top","selector":".markdown-section h1, .markdown-section h2","showByDefault":false},"codetabs":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"toggle-headers":{},"fontsettings":{"theme":"white","family":"sans","size":2},"edit-link":{"label":"Edit this page","base":"https://github.com/libopenstorage/libopenstorage.github.io/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":true},"toggle-chapters":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"OpenStorage API","gitbook":">=3.2.1"},"file":{"path":"arch.md","mtime":"2018-05-07T20:19:09.544Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-05-07T20:26:35.679Z"},"basePath":".","book":{"language":""}});
287293
});
288294
</script>
289295
</div>

w/generated-api.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3424,7 +3424,7 @@ <h1 class="search-results-title">No results matching "<span class='search-query'
34243424
<script>
34253425
var gitbook = gitbook || [];
34263426
gitbook.push(function() {
3427-
gitbook.page.hasChanged({"page":{"title":"API Refernce","level":"1.5","depth":1,"previous":{"title":"Installing","level":"1.4","depth":1,"path":"installing.md","ref":"installing.md","articles":[]},"dir":"ltr"},"config":{"plugins":["codetabs","toggle-chapters","toggle-headers","edit-link","prism","github","page-toc","-highlight","-sharing"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/libopenstorage/openstorage/"},"search":{},"page-toc":{"position":"top","selector":".markdown-section h1, .markdown-section h2","showByDefault":false},"codetabs":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"toggle-headers":{},"fontsettings":{"theme":"white","family":"sans","size":2},"edit-link":{"label":"Edit this page","base":"https://github.com/libopenstorage/libopenstorage.github.io/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":true},"toggle-chapters":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"OpenStorage API","gitbook":">=3.2.1"},"file":{"path":"generated-api.md","mtime":"2018-05-07T20:00:54.220Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-05-07T20:00:55.138Z"},"basePath":".","book":{"language":""}});
3427+
gitbook.page.hasChanged({"page":{"title":"API Refernce","level":"1.5","depth":1,"previous":{"title":"Installing","level":"1.4","depth":1,"path":"installing.md","ref":"installing.md","articles":[]},"dir":"ltr"},"config":{"plugins":["codetabs","toggle-chapters","toggle-headers","edit-link","prism","github","page-toc","-highlight","-sharing"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/libopenstorage/openstorage/"},"search":{},"page-toc":{"position":"top","selector":".markdown-section h1, .markdown-section h2","showByDefault":false},"codetabs":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"toggle-headers":{},"fontsettings":{"theme":"white","family":"sans","size":2},"edit-link":{"label":"Edit this page","base":"https://github.com/libopenstorage/libopenstorage.github.io/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":true},"toggle-chapters":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"OpenStorage API","gitbook":">=3.2.1"},"file":{"path":"generated-api.md","mtime":"2018-05-07T20:00:54.220Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-05-07T20:26:35.679Z"},"basePath":".","book":{"language":""}});
34283428
});
34293429
</script>
34303430
</div>

w/images/arch.ditaa

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
+---------------+ +----------------------------------+
22
| | | |
3+
| REST Client | ----> | gRPC REST Gateway |
4+
| | | |
5+
+---------------+ +----------------------------------+
6+
|
7+
|
8+
|
9+
|
10+
+---------------+ +----------------------------------+
11+
| | | |
312
| gRPC Client | ----> | gRPC SDK |
413
| | | |
514
+---------------+ +----------------------------------+

w/images/arch.png

3.6 KB
Loading

0 commit comments

Comments
 (0)