reedog117 / node-vsphere-soap

Node.js module for accessing VMware vCenter/ESXi hosts using SOAP
MIT License
32 stars 15 forks source link

node-vsphere-soap

Join the chat at https://gitter.im/reedog117/node-vsphere-soap

This is a Node.js module to connect to VMware vCenter servers and/or ESXi hosts and perform operations using the vSphere Web Services API. If you're feeling really adventurous, you can use this module to port vSphere operations from other languages (such as the Perl, Python, and Go libraries that exist) and have fully native Node.js code controlling your VMware virtual infrastructure!

This is very much in alpha.

Authors

Version

0.0.2-5

Installation

$ npm install node-vsphere-soap --save

Sample Code

To connect to a vCenter server:

var nvs = require('node-vsphere-soap');
var vc = new nvs.Client(host, user, password, sslVerify);
vc.once('ready', function() {
  // perform work here
});
vc.once('error', function(err) {
  // handle error here
});

Arguments

Events

Client instance variables

To run a command:

var vcCmd = vc.runCommand( commandToRun, arguments );
vcCmd.once('result', function( result, raw, soapHeader) {
  // handle results
});
vcCmd.once('error', function( err) {
  // handle errors
});    

Arguments

Events

Make sure you check out tests/vsphere-soap.test.js for examples on how to create commands to run

Development

node-vsphere-soap uses a number of open source projects to work properly:

Want to contribute? Great!

Todo's

Testing

I have been testing on a Mac with node v0.10.36 and both ESXi and vCenter 5.5.

To edit tests, edit the file test/vsphere-soap.test.js

To point the module at your own vCenter/ESXi host, edit config-test.stub.js and save it as config-test.js

To run test scripts:

$ npm test

License

MIT