vyos-client
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

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'

Readme

Keywords

Package Sidebar

Install

npm i vyos-client

Weekly Downloads

0

Version

0.2.2

License

MIT

Unpacked Size

3.78 kB

Total Files

3

Last publish

Collaborators

  • foltik