0.2.2 • Published 3 years ago

vyos-client v0.2.2

Weekly downloads
11
License
MIT
Repository
github
Last release
3 years ago

vyos-client

npm docs license build

A simple to use client for the VyOS HTTP API.

For more information and setup instructions, see docs.vyos.io/HTTP-API.

import { Vyos } from 'vyos-client';
const client = new Vyos('https://my-vyos.local', 'API-KEY')

/* Modify configuration */
await client.config.get('system host-name') // 'my-vyos'
// 'my-vyos'
await client.config.set('system host-name', 'vyos')

/* Update OS images */
await client.images.add('https://downloads.vyos.io/rolling/current/amd64/vyos-1.4-rolling-202101301326-amd64.iso')
await client.images.remove('1.4-rolling-202101301326')

/* Run operational mode commands */
await client.ops.show('date')
// 'Mon 15 Feb 2021 10:54:54 PM EST\n'
await client.ops.generate('wireguard default-keypair');

For local testing, a Node.js repl is included.

Set the URL and KEY environment vars when running, or add them to a .env file.

$ npm install
$ npm run build
$ URL=https://my-vyos.local KEY=API-KEY npm run repl
v> await v.config.show('system host-name')
'my-vyos'
0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago