npm install @octaspace/api.js
import { Octa, KeyError, UUIDError, ApiError } from '@octaspace/api.js';
const octa = new Octa('your-api-key');
Fetch this from Settings of Cube portal.
Pass type ("wg" or "openvpn") and nodeid (number) as parameter.
const createdVPN = await octa.createVPN('type', 1);
Returns UUID
const vpnDetails = await octa.getVPN('uuid');
await octa.stopVPN('uuid');
const vpnNodes = await octa.getVPNNodes();
Pass image (string), disk size(number), env(optional), and nodeid (number) as parameter.
const createdMR = await octa.createMR('image', 1, nodeid, {"env1":"value","env2":"value"});
const mrDetails = await octa.getMR('uuid');
await octa.stopMR('uuid');
const mrNodes = await octa.getMRNodes();
const accountDetails = await octa.getAccountInfo();
const accountBalance = await octa.getAccountBalance();
Note: checkout lib/src/types.ts
for detail information about what they return.
KeyError
: Thrown for issues with the API key. Ex: Wrong API KeyUUIDError
: Thrown for issues with the UUID.ApiError
: Generic API error. Ex: Due to Network Error
MIT License - see LICENSE file for details.