Giter Club home page Giter Club logo

node-vultr's Introduction

WARNING: project is no longer actively maintained, make sure to update any dependencies if you plan on using this in your project.

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

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

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

vultrInstance.startupscript.destroy

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

vultrInstance.startupscript.destroy(SCRIPTID)

node-vultr's People

Contributors

deviavir avatar martinlevesque avatar snyk-bot avatar thedanieljlewis avatar travispaul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-vultr's Issues

Support all API parameters?

Am I correct in understanding this doesn't support the full range of Vultr's API parameters?

For .server.create(), for example, the documentation shows only support for OS, region, and plan ID, but it doesn't show support for any of the other parameters the API offers, like SSH keys, startup scripts, and other server options.

Auto Retry mechanism on 503?

Don't know if this could be included as an option feature, I added the following function (query) to add a retry mechanism:

async function wait(seconds) {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve()
    }, seconds * 1000);
  });
}

vultrInstance.query = async function(category, func, ...params) {
  for (let retry = 0; retry <= 7; ++retry) { // max trials
    try {
      return await vultrInstance[category][func](...params);
    } catch(err) {
      if (err.statusCode !== 503) {
        throw err;
      } else {
        await wait(2);
      }
    }
  }
}


but perhaps could be interesting to have it as an option instead of the default 1 second timeout before the request.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Vulnerability

npm i vultr and then npm audit resturns:

                       === npm audit security report ===

# Run  npm install [email protected]  to resolve 1 vulnerability
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Low           β”‚ Prototype Pollution                                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Package       β”‚ lodash                                                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Dependency of β”‚ vultr                                                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Path          β”‚ vultr > request-promise > lodash                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ More info     β”‚ https://nodesecurity.io/advisories/577                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


found 1 low severity vulnerability in 217 scanned packages
  run `npm audit fix` to fix 1 of them.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.