npm.io
5.0.1 • Published 2 years ago

@ovh-api/vps

Licence
MIT
Version
5.0.1
Deps
1
Size
67 kB
Vulns
0
Weekly
0
Stars
17

OVHCloud API client for vps region Europe

This module contains all typing needed to use OvhCloud vps APIs, with hi-level IntelliSense / Code Completion

NPM Version

Setup

With npm:

npm install --save @ovh-api/api
npm install --save @ovh-api/me
npm install --save @ovh-api/vps
... Add all APIs you needs

Usage

import OvhEngine from '@ovh-api/api';
import apiMe from '@ovh-api/me';
import apiVps from '@ovh-api/vps';

const ovhEngine = new OvhEngine({ 
    certCache: './cert-cache.json', // optional cache certificat on disk.
    accessRules: 'GET /vps, GET /vps/*, GET /me', // optional limit the requested privileges.
});

const api = {
    me: apiMe(ovhEngine),
    vps: apiVps(ovhEngine),
}

const test = async () => {
    const { nichandle } = await api.me.$get();
    const data = await api.vps.$get();
    console.log(`${nichandle} have the following services:`);
    console.log(data);
}