gasper_kaze_api
GasperKazeApi - JavaScript client for gasper_kaze_api
Handles authentication, creation/management of applications, databases, users and also provides a superuser API.
Only a superuser can avail the superuser API. A superuser can grant/revoke superuser privileges to other users. A default superuser is created every time a Gasper instance is launched whose credentials are defined in the admin
section of config.toml
, the main configuration file. A sample configuration file is available here.
Note:- Normally the applications and databases can only be managed by their owners but the superuser can bypass that check.
PS:- If you want to programmatically generate a client for this API, you can find the corresponding OpenAPI specifications here. We recommend using OpenAPI-Generator for generating clients.
This SDK is automatically generated by the OpenAPI Generator project:
- API version: 1.0
- Package version: 1.0
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen For more information, please visit https://chat.sdslabs.co
Installation
Node.js
Fornpm
To publish the library as a npm, please follow the procedure in "Publishing npm packages".
Then install it via:
npm install gasper_kaze_api --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 gasper_kaze_api 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 GasperKazeApi = require('gasper_kaze_api');
var defaultClient = GasperKazeApi.ApiClient.instance;
// Configure Bearer (JWT) access token for authorization: bearerAuth
var bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"
var api = new GasperKazeApi.AdminApi()
var authorization = Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9; // {String} Bearer Token Authentication
var app = "app_example"; // {String} The name of the application
api.deleteAppByAdmin(authorization, app).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
Documentation for API Endpoints
All URIs are relative to http://localhost:3000
Class | Method | HTTP request | Description |
---|---|---|---|
GasperKazeApi.AdminApi | deleteAppByAdmin | DELETE /admin/apps/{app} | Delete an application |
GasperKazeApi.AdminApi | deleteDbByAdmin | DELETE /admin/dbs/{db} | Delete a single database |
GasperKazeApi.AdminApi | deleteUserByAdmin | DELETE /admin/users/{userEmail} | Delete a single user |
GasperKazeApi.AdminApi | fetchAppByAdmin | GET /admin/apps/{app} | Fetch a single application |
GasperKazeApi.AdminApi | fetchAppsByAdmin | GET /admin/apps | Fetch all applications with/without a filter defined by query params |
GasperKazeApi.AdminApi | fetchDbByAdmin | GET /admin/dbs/{db} | Fetch a single database |
GasperKazeApi.AdminApi | fetchDbsByAdmin | GET /admin/dbs | Fetch all databases with/without a filter defined by query params |
GasperKazeApi.AdminApi | fetchNodeByAdmin | GET /admin/nodes/{type} | Fetch bind addresses(IP:Port) of a single microservice on all nodes |
GasperKazeApi.AdminApi | fetchNodesByAdmin | GET /admin/nodes | Fetch bind addresses(IP:Port) of all microservices on all nodes |
GasperKazeApi.AdminApi | fetchUserByAdmin | GET /admin/users/{userEmail} | Fetch a single user |
GasperKazeApi.AdminApi | fetchUsersByAdmin | GET /admin/users | Fetch all users with/without a filter defined by query params |
GasperKazeApi.AdminApi | grantSuperuserPrivilege | PATCH /admin/users/{userEmail}/grant | Grant superuser privileges to a single user |
GasperKazeApi.AdminApi | revokeSuperuserPrivilege | PATCH /admin/users/{userEmail}/revoke | Revoke superuser privileges from a single user |
GasperKazeApi.AppsApi | createApp | POST /apps/{language} | Create an application |
GasperKazeApi.AppsApi | deleteAppByUser | DELETE /apps/{app} | Delete an application owned by a user |
GasperKazeApi.AppsApi | fetchAppByUser | GET /apps/{app} | Fetch a single application owned by a user |
GasperKazeApi.AppsApi | fetchAppsByUser | GET /apps | Fetch all applications owned by a user |
GasperKazeApi.AppsApi | fetchLogsByUser | GET /apps/{app}/logs | Fetch logs of an application |
GasperKazeApi.AppsApi | fetchMetricsByUser | GET /apps/{app}/metrics | Fetch metrics of an application |
GasperKazeApi.AppsApi | fetchTerminalByUser | GET /apps/{app}/term | Fetch a browser terminal instance for an application owned by a user |
GasperKazeApi.AppsApi | rebuildAppByUser | PATCH /apps/{app}/rebuild | Rebuild an application |
GasperKazeApi.AppsApi | transferAppByUser | PATCH /apps/{app}/transfer/{userEmail} | Transfer ownership of an application to another user |
GasperKazeApi.AppsApi | updateAppByUser | PUT /apps/{app} | Update an application owned by a user |
GasperKazeApi.AuthApi | login | POST /auth/login | Login to get a Bearer token |
GasperKazeApi.AuthApi | refresh | GET /auth/refresh | Refresh JWT token using existing token |
GasperKazeApi.AuthApi | register | POST /auth/register | Register a user |
GasperKazeApi.DbsApi | createDB | POST /dbs/{databaseType} | Create a database |
GasperKazeApi.DbsApi | deleteDbByUser | DELETE /dbs/{db} | Delete a single database owned by a user |
GasperKazeApi.DbsApi | fetchDbByUser | GET /dbs/{db} | Fetch a single database owned by a user |
GasperKazeApi.DbsApi | fetchDbsByUser | GET /dbs | Fetch all databases owned by a user |
GasperKazeApi.DbsApi | transferDbByUser | PATCH /dbs/{db}/transfer/{userEmail} | Transfer ownership of a database to another user |
GasperKazeApi.UserApi | deleteUser | DELETE /user | Delete user |
GasperKazeApi.UserApi | fetchUser | GET /user | Fetch logged in user's info |
GasperKazeApi.UserApi | updatePassword | PUT /user/password | Update the password of the logged in user |
Documentation for Models
- GasperKazeApi.Application
- GasperKazeApi.Context
- GasperKazeApi.CreatedApplication
- GasperKazeApi.CreatedDatabase
- GasperKazeApi.CreatedUser
- GasperKazeApi.Database
- GasperKazeApi.Git
- GasperKazeApi.InlineObject
- GasperKazeApi.InlineResponse200
- GasperKazeApi.InlineResponse2001
- GasperKazeApi.InlineResponse20010
- GasperKazeApi.InlineResponse20011
- GasperKazeApi.InlineResponse20012
- GasperKazeApi.InlineResponse20013
- GasperKazeApi.InlineResponse20014
- GasperKazeApi.InlineResponse2001Resources
- GasperKazeApi.InlineResponse2002
- GasperKazeApi.InlineResponse2003
- GasperKazeApi.InlineResponse2004
- GasperKazeApi.InlineResponse2005
- GasperKazeApi.InlineResponse2006
- GasperKazeApi.InlineResponse2007
- GasperKazeApi.InlineResponse2008
- GasperKazeApi.InlineResponse2009
- GasperKazeApi.InlineResponse400
- GasperKazeApi.InlineResponse401
- GasperKazeApi.InlineResponse500
- GasperKazeApi.Login
- GasperKazeApi.LoginResponse
- GasperKazeApi.Metrics
- GasperKazeApi.User
Documentation for Authorization
bearerAuth
- Type: Bearer authentication (JWT)