Skip to content

An ultra simple API integration for OpenStack in JavaScript

Notifications You must be signed in to change notification settings

AddoSolutions/nodestack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NodeStack - OpenStack API Tool for Node.JS

This is simply a lack of any other tool to work with OpenStack for me in Node.JS and learning many painful lessons on it's usage.

Installing

npm install nodestack --save

From there you can include the library with:

var OpenstackClient = require('nodestack');

or with

import OpenstackClient from 'nodestack';

Usage

This application will first do all the authentication for you, and then will add all the needed headers for you to do anything further. You can see this in practice in test.js

There are two ways to authenticate, the main way is:

var client = new OpenstackClient("http://10.0.0.10:5000", "admin","password","ethode");

The second way (if you have some other preferred way of authentication) is:

var client = new OpenstackClient("http://10.0.0.10:5000", {
	"passwordCredentials": {
		"username": "admin",
		"password": "password"
	},
	"tenantName": "ethode"
});

You can see how this is done here: http://developer.openstack.org/api-ref-identity-v2.html. This application is using authentication API version 2.0.

Making Calls

Once you have your working client then you can do whatever you need:

client.get("http://10.0.0.10:8774/v2/{object-id}/servers/detail", function(data){
	console.log("Found " + data.servers.length + " servers!");
});

Be sure to check out the docs to learn how to actually do things! http://developer.openstack.org/api-ref-compute-v2.1.html

Things I'd like to do:

  • Automatically get URL's for each service and map an object to it (ex client.compute.get(…))
  • Better Error Checking

About

An ultra simple API integration for OpenStack in JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published