npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vultr

v0.0.9

Published

Promise-based library to communicate with the Vultr API

Downloads

49

Readme

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)