コード例 #1
0
ファイル: azure.js プロジェクト: findhit/coreos
Azure.addInitHook(function () {

    // Generate credentials
    var credentials = this.credentials = new azureCommon.CertificateCloudCredentials({
        subscriptionId: this.subscription,
        pem: this.pem,
    });

    this.computeManagementClient = computeManagement.createComputeManagementClient( credentials );
    this.storageManagementClient = storageManagement.createStorageManagementClient( credentials );

});
コード例 #2
0
var computeManagement = require('azure-mgmt-compute');
var fs = require('fs');
var azure = require('azure');

var computeManagementClient = computeManagement.createComputeManagementClient(computeManagement.createCertificateCloudCredentials({
    subscriptionId: '3f09c367-93e0-4b61-bbe5-dcb5c686bf8a',
    pem: fs.readFileSync('Pay-As-You-Go.pem').toString()
}));

var d = require('domain').create();
    

exports.list = function(req, res) {
    d.on('error', function (err) {
        // handle the error safely
        console.log(err);
        res.send('Nothing deployed');
    });

    // catch the uncaught errors in this asynchronous or synchronous code block
    d.run(function () {
    // the asynchronous or synchronous code that we want to catch thrown errors on
    computeManagementClient.deployments.getBySlot(req.params.id, 'Production', function (err, result) {
        if (err) {
            console.error(err);
        } else {
            res.send(result);
        }
    });
});