Interface to the HP Cloud API (unofficial)
Currently Hew supports a subset of the HP Cloud API:
npm install hew
For clarity, examples use the popular
Hew works just as well without it, or with an alternative async utility.
var Hew = require'hew'async = require'async';// things you need to setvar yourRegion = HewDEFAULT_REGION;var yourAccessKey = '…';var yourSecretKey = '…';var yourTenantName = '…';var qname = 'my-test-message-queue';// obtain an authentication tokenvar token = yourRegion yourAccessKey yourSecretKeyyourTenantName;// create a Messaging controllervar messaging = token;asyncseries// create the test queuemessagingcreateQueueqname cb;// post a message to the queuevar message =temperature: 22scale: 'Celsius'weather: 'sunny';messagingsendqname message cb;// retrieve a message from the queuemessagingreceiveqnameif err return cberr;console.logmessage;cb;;// delete the test queuemessagingdeleteQueueqname cb;if err console.error'error:' err;else console.log'done';;
Warning: Do not run unit tests against your production HP Cloud account. Create an additional account for testing. Testing will create, update and delete resources in your HP Cloud account. While the tests try to avoid affecting “real” data, and they do clean up after themselves, there is no guarantee that everything will work properly.
tests/config.json(an example is provided).