npm

Need private packages and team management tools?Check out npm Orgs. »

vultr

0.0.9 • Public • Published

node-vultr

Node.JS Promise-based library to communicate with the Vultr API

Test coverage is currently 100%, although some tests involving actually creating the VPS's itself are currently not tested.

This library creates a new instance of "Vultr" for you, exposing a few libraries and methods you can use to communicate.

To start a new Vultr instance:

var Vultr = require('vultr');
 
var vultrInstance = new Vultr(apiKey);

apiKey is your Vultr API key.

Enable the Vultr API

You can generate a Vultr API key from the Settings page.

Running the integration tests

It's safe for you to run the integration tests, simply copy config/data.example.js to config/data.js and fill out your real API key. Run npm test to run the tests.

Account

vultrInstance.account.info

vultrInstance.account.info().then(function(info) {
  // Returns Object with account info
})

DNS

vultrInstance.dns.list

vultrInstance.dns.list().then(function(list) {
  // Returns array with DNS entries  
})

vultrInstance.dns.createDomain

vultrInstance.dns.createDomain('dualdev.com')

vultrInstance.dns.createRecord

vultrInstance.dns.createRecord({
  'domain': 'dualdev.com',
  'name': 'test',
  'type': 'A',
  'data': '127.0.0.1'
})

vultrInstance.dns.records

vultrInstance.dns.records('dualdev.com').then(function(list) {
  // Returns array with DNS entries
})

vultrInstance.dns.deleteRecord

vultrInstance.dns.deleteRecord({
  'domain': 'dualdev.com',
  'id': id
})

vultrInstance.dns.deleteDomain

vultrInstance.dns.deleteDomain('dualdev.com');

OS

vultrInstance.os.list

vultrInstance.os.list().then(function(list) {
  // Returns array with OS objects
})

ISO

vultrInstance.iso.list

vultrInstance.iso.list().then(function(list) {
  // Returns array with ISO objects
})

vultrInstance.iso.createFromUrl

vultrInstance.iso.createFromUrl().then(function(list) {
  // Returns Object with ISO upload status
})

Backup

vultrInstance.backup.list

vultrInstance.backup.list().then(function(list) {
  // Returns array with Backup objects
})

Plans

vultrInstance.plans.list

vultrInstance.plans.list().then(function(list) {
  // Returns array with PLAN objects
})

Regions

vultrInstance.regions.list

vultrInstance.regions.list().then(function(list) {
  // Returns array of REGION objects
})

vultrInstance.regions.availability

Retrieve a list of the VPSPLANIDs currently available in this location. (DCID can be retrieved from vultrInstance.regions.list())

vultrInstance.regions.availability(DCID).then(function(plans) {
  // Returns array of PLAN objects
})

Server

vultrInstance.server.list

vultrInstance.server.list().then(function(list) {
  // Returns array of vps's
})

vultrInstance.server.bandwidth

SUBID is the VPS ID

vultrInstance.server.bandwidth(SUBID).then(function(bandwidth) {
  // Returns bandwidth objects
})

vultrInstance.server.reboot

SUBID is the VPS ID

vultrInstance.server.reboot(SUBID)

vultrInstance.server.halt

SUBID is the VPS ID

vultrInstance.server.halt(SUBID)

vultrInstance.server.start

SUBID is the VPS ID. This function also RESTARTS an already running VPS.

vultrInstance.server.start(SUBID)

vultrInstance.server.destroy

SUBID is the VPS ID

vultrInstance.server.destroy(SUBID)

vultrInstance.server.reinstall

SUBID is the VPS ID

vultrInstance.server.reinstall(SUBID)

vultrInstance.server.restoreSnapshot

SUBID is the VPS ID. SNAPSHOTID can be retrieved from vultrInstance.snapshot.list().

vultrInstance.server.restoreSnapshot(SUBID, SNAPSHOTID)

vultrInstance.server.restoreBackup

SUBID is the VPS ID. BACKUPID cannot be retrieved yet (asked Vultr support about this).

vultrInstance.server.restoreSnapshot(SUBID, BACKUPID)

vultrInstance.server.create

create returns SUBID, this is used in many other calls. PLAN, OS and REGION can be retrieved from the services offering the same name.

vultrInstance.server.create({
  'plan': PLAN,
  'os': OS,
  'region': REGION
})

vultrInstance.server.listIpv4

SUBID is the VPS ID.

vultrInstance.server.listIpv4(SUBID).then(function(list) {
  // Returns object of ipv4 addresses  
})

vultrInstance.server.reverseSetIpv4

SUBID is the VPS ID.

vultrInstance.server.reverseSetIpv4(SUBID, IP, ENTRY)

vultrInstance.server.reverseDefaultIpv4

SUBID is the VPS ID.

vultrInstance.server.reverseDefaultIpv4(SUBID, IP)

vultrInstance.server.listIpv6

SUBID is the VPS ID.

vultrInstance.server.listIpv6(SUBID).then(function(list) {
  // Returns object of ipv6 addresses  
})

vultrInstance.server.reverseSetIpv6

SUBID is the VPS ID.

vultrInstance.server.reverseSetIpv6(SUBID, IP, ENTRY)

vultrInstance.server.reverseListIpv6

SUBID is the VPS ID.

vultrInstance.server.reverseListIpv6(SUBID).then(function(list) {
  // Returns object of reverse ipv6 entries
})

vultrInstance.server.reverseDeleteIpv6

SUBID is the VPS ID.

vultrInstance.server.reverseDeleteIpv6(SUBID, IP)

vultrInstance.server.setLabel

SUBID is the VPS ID. LABEL is a string of your choosing.

vultrInstance.server.setLabel(SUBID, LABEL)

vultrInstance.server.createIpv4

SUBID is the VPS ID. The second argument is "yes" or "no" to trigger a reboot.

vultrInstance.server.createIpv4(SUBID, 'no')

vultrInstance.server.destroyIpv4

SUBID is the VPS ID. The second argument is "yes" or "no" to trigger a reboot.

vultrInstance.server.destroyIpv4(SUBID, 'no')

vultrInstance.server.osChangeList

SUBID is the VPS ID.

vultrInstance.server.osChangeList(SUBID).then(function(list) {
  // Returns object of available OS's
})

vultrInstance.server.osChange

SUBID is the VPS ID.

vultrInstance.server.osChange(SUBID, OSID)

vultrInstance.server.upgradePlanlist

SUBID is the VPS ID.

vultrInstance.server.upgradePlanlist(SUBID).then(function(list) {
  // Returns object of available upgrade plans
})

vultrInstance.server.upgradePlan

SUBID is the VPS ID.

vultrInstance.server.upgradePlan(SUBID, PLANID)

Snapshot

vultrInstance.snapshot.list

vultrInstance.snapshot.list().then(function(list) {
  // Returns array of snapshot objects
})

vultrInstance.snapshot.create

SUBID is the VPS ID. DESCRIPTION is an optional description for this snapshot.

vultrInstance.snapshot.create(SUBID, DESCRIPTION)

vultrInstance.snapshot.destroy

SNAPSHOTID can be retrieved from vultrInstance.snapshopt.list().

vultrInstance.snapshot.destroy(SNAPSHOTID)

SSHKey

vultrInstance.sshkey.list

vultrInstance.sshkey.list().then(function(list) {
  // Returns array of sshkey objects
})

vultrInstance.sshkey.create

vultrInstance.sshkey.create(NAME, KEY)

vultrInstance.sshkey.update

SSHKEYID can be retrieved from vultrInstance.sshkey.list() or after calling vultrInstance.sshkey.create().

vultrInstance.sshkey.update(NAME, KEY, SSHKEYID)

vultrInstance.sshkey.destroy

SSHKEYID can be retrieved from vultrInstance.sshkey.list() or after calling vultrInstance.sshkey.create().

vultrInstance.sshkey.destroy(SSHKEYID)

StartupScript

vultrInstance.startupscript.list

vultrInstance.startupscript.list().then(function(list) {
  // Returns array of startupscript objects
})

vultrInstance.startupscript.create

vultrInstance.startupscript.create(NAME, KEY)

vultrInstance.startupscript.update

SSHKEYID can be retrieved from vultrInstance.startupscript.list() or after calling vultrInstance.startupscript.create().

vultrInstance.startupscript.update(NAME, KEY, SSHKEYID)

vultrInstance.startupscript.destroy

SSHKEYID can be retrieved from vultrInstance.startupscript.list() or after calling vultrInstance.startupscript.create().

vultrInstance.startupscript.destroy(SSHKEYID)

install

npm i vultr

Downloadsweekly downloads

215

version

0.0.9

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability