garage-admin-sdk-generator/javascript/README.md

10 KiB

garage_administration_api_v0garage_v0_8_0

GarageAdministrationApiV0garageV080 - JavaScript client for garage_administration_api_v0garage_v0_8_0 Administrate your Garage cluster programatically, including status, layout, keys, buckets, and maintainance tasks.

Disclaimer: The API is not stable yet, hence its v0 tag. The API can change at any time, and changes can include breaking backward compatibility. Read the changelog and upgrade your scripts before upgrading. Additionnaly, this specification is very early stage and can contain bugs, especially on error return codes/types that are not tested yet. Do not expect a well finished and polished product!

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: v0.8.0
  • Package version: v0.8.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install garage_administration_api_v0garage_v0_8_0 --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your garage_administration_api_v0garage_v0_8_0 from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var GarageAdministrationApiV0garageV080 = require('garage_administration_api_v0garage_v0_8_0');

var defaultClient = GarageAdministrationApiV0garageV080.ApiClient.instance;
// Configure Bearer access token for authorization: bearerAuth
var bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

var api = new GarageAdministrationApiV0garageV080.BucketApi()
var allowBucketKeyRequest = new GarageAdministrationApiV0garageV080.AllowBucketKeyRequest(); // {AllowBucketKeyRequest} Aliases to put on the new bucket 
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.allowBucketKey(allowBucketKeyRequest, callback);

Documentation for API Endpoints

All URIs are relative to http://localhost:3903/v0

Class Method HTTP request Description
GarageAdministrationApiV0garageV080.BucketApi allowBucketKey POST /bucket/allow Allow key
GarageAdministrationApiV0garageV080.BucketApi createBucket POST /bucket Create a bucket
GarageAdministrationApiV0garageV080.BucketApi deleteBucket DELETE /bucket?id={bucket_id} Delete a bucket
GarageAdministrationApiV0garageV080.BucketApi deleteBucketGlobalAlias DELETE /bucket/alias/global Delete a global alias
GarageAdministrationApiV0garageV080.BucketApi deleteBucketLocalAlias DELETE /bucket/alias/local Delete a local alias
GarageAdministrationApiV0garageV080.BucketApi denyBucketKey POST /bucket/deny Deny key
GarageAdministrationApiV0garageV080.BucketApi findBucketInfo GET /bucket?globalAlias={alias} Find a bucket
GarageAdministrationApiV0garageV080.BucketApi getBucketInfo GET /bucket?id={bucket_id} Get a bucket
GarageAdministrationApiV0garageV080.BucketApi listBuckets GET /bucket List all buckets
GarageAdministrationApiV0garageV080.BucketApi putBucketGlobalAlias PUT /bucket/alias/global Add a global alias
GarageAdministrationApiV0garageV080.BucketApi putBucketLocalAlias PUT /bucket/alias/local Add a local alias
GarageAdministrationApiV0garageV080.BucketApi updateBucket PUT /bucket?id={bucket_id} Update a bucket
GarageAdministrationApiV0garageV080.KeyApi addKey POST /key Create a new API key
GarageAdministrationApiV0garageV080.KeyApi deleteKey DELETE /key?id={access_key} Delete a key
GarageAdministrationApiV0garageV080.KeyApi getKey GET /key?id={access_key} Get key information
GarageAdministrationApiV0garageV080.KeyApi importKey POST /key/import Import an existing key
GarageAdministrationApiV0garageV080.KeyApi listKeys GET /key List all keys
GarageAdministrationApiV0garageV080.KeyApi searchKey GET /key?search={pattern} Select key by pattern
GarageAdministrationApiV0garageV080.KeyApi updateKey POST /key?id={access_key} Update a key
GarageAdministrationApiV0garageV080.LayoutApi addLayout POST /layout Send modifications to the cluster layout
GarageAdministrationApiV0garageV080.LayoutApi applyLayout POST /layout/apply Apply staged layout
GarageAdministrationApiV0garageV080.LayoutApi getLayout GET /layout Details on the current and staged layout
GarageAdministrationApiV0garageV080.LayoutApi revertLayout POST /layout/revert Clear staged layout
GarageAdministrationApiV0garageV080.NodesApi addNode POST /connect Connect target node to other Garage nodes
GarageAdministrationApiV0garageV080.NodesApi getNodes GET /status Status of this node and other nodes in the cluster

Documentation for Models

Documentation for Authorization

bearerAuth

  • Type: Bearer authentication