Skip to content

Instantly share code, notes, and snippets.

@funnylookinhat
Last active January 3, 2016 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save funnylookinhat/8477307 to your computer and use it in GitHub Desktop.
Save funnylookinhat/8477307 to your computer and use it in GitHub Desktop.
this._computeClient = require('pkgcloud').createClient('compute',{
enableExtensions: true,
provider: this._stackProvider,
username: this._stackUsername,
apiKey: this._stackApiKey,
authUrl: this._stackAuthUrl
});
this._storageClient = require('pkgcloud').createClient('storage',{
enableExtensions: true,
provider: this._stackProvider,
username: this._stackUsername,
apiKey: this._stackApiKey,
authUrl: this._stackAuthUrl
});
this._dnsClient = require('pkgcloud').createClient('dns',{
enableExtensions: true,
provider: this._stackProvider,
username: this._stackUsername,
apiKey: this._stackApiKey,
authUrl: this._stackAuthUrl
});
// Or with a callback ( better )
this._computeClient = null;
var _this = this;
require('pkgcloud').createClient('compute',{
enableExtensions: true,
provider: this._stackProvider,
username: this._stackUsername,
apiKey: this._stackApiKey,
authUrl: this._stackAuthUrl
}, function (err, client) {
_this._computeClient = client;
});
@kenperkins
Copy link

why not just have service be an option?

@kenperkins
Copy link

for example:

var client = pkgcloud.createClient({
  service: 'compute',
  provider: 'rackspace',
  ...
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment