diff options
author | Alex <alex@adnab.me> | 2022-11-16 10:51:04 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2022-11-16 10:51:04 +0000 |
commit | bcc97724707aaa39fd64490cdd81aa5073285f33 (patch) | |
tree | 41e0535d0aaf8cfb095576c3c0d41213197dd003 /doc/book/build/javascript.md | |
parent | c4e4cc1156e10fb0a840666873efa1e4dfb7c884 (diff) | |
parent | cf23aee1831e464b2a445a1ffb302086f32dd6e5 (diff) | |
download | garage-bcc97724707aaa39fd64490cdd81aa5073285f33.tar.gz garage-bcc97724707aaa39fd64490cdd81aa5073285f33.zip |
Merge pull request 'OpenAPI spec for admin API' (#379) from ecosystem/openapi into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/379
Diffstat (limited to 'doc/book/build/javascript.md')
-rw-r--r-- | doc/book/build/javascript.md | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/doc/book/build/javascript.md b/doc/book/build/javascript.md new file mode 100644 index 00000000..ff009ffe --- /dev/null +++ b/doc/book/build/javascript.md @@ -0,0 +1,55 @@ ++++ +title = "Javascript" +weight = 10 ++++ + +## S3 + +*Coming soon*. + +Some refs: + - Minio SDK + - [Reference](https://docs.min.io/docs/javascript-client-api-reference.html) + + - Amazon aws-sdk-js + - [Installation](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/getting-started.html) + - [Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html) + - [Example](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/s3-example-creating-buckets.html) + +## K2V + +*Coming soon* + +## Administration + +Install the SDK with: + +```bash +npm install --save git+https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-js.git +``` + +A short example: + +```javascript +const garage = require('garage_administration_api_v0garage_v0_8_0'); + +const api = new garage.ApiClient("http://127.0.0.1:3903/v0"); +api.authentications['bearerAuth'].accessToken = "s3cr3t"; + +const [node, layout, key, bucket] = [ + new garage.NodesApi(api), + new garage.LayoutApi(api), + new garage.KeyApi(api), + new garage.BucketApi(api), +]; + +node.getNodes().then((data) => { + console.log(`nodes: ${Object.values(data.knownNodes).map(n => n.hostname)}`) +}, (error) => { + console.error(error); +}); +``` + +See also: + - [sdk repository](https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-js) + - [examples](https://git.deuxfleurs.fr/garage-sdk/garage-admin-sdk-generator/src/branch/main/example/javascript) |