iLO REST JavaScript Library


Keywords
Hewlett Packard Enterprise, HPE, ilorest, RESTful
License
Apache-2.0
Install
npm install ilorest@1.0.2

Documentation

Build Status npm version Coverage Status Known Vulnerabilities Dependency Status License

ilorest

Join the chat at https://gitter.im/HewlettPackard/javascript-ilorest-library

JavaScript Library for Hewlett Packard Enterprise iLO RESTful/Redfish API

Installation

Windows

$ npm install -g windows-build-tools
$ npm install --save ilorest

Linux

$ npm install --save ilorest

Usage

HTTP(s) mode

var rest = require('ilorest');
var client = rest.redfishClient('https://10.10.10.10');
client.login()
    .then((res) => {
        console.log('Login');
        return res;
    })
    .then((res) => {
        var root = client.root;
        var promises = [];
        console.log(root);
        if (root.Links) {
            for (let x in root) {
                if (root.hasOwnProperty(x) && root[x].hasOwnProperty('@odata.id')) {
                    promises.push(client.get(root[x]['@odata.id'])
                        .then((res) => console.log(res.body)));
                }
            }
            return promises;
        }
        throw Error('No link(s)');
    })
    .spread(() => {
        console.log('Get link(s) informations');
    })
    .catch((err) => {
        console.log(err);
    })
    .finally((res) => {
        console.log('Logout');
        return client.logout();
    });

Local(Blobstore) mode

var rest = require('ilorest');
var client = rest.redfishClient('blobstore://');
client.login()
    .then((res) => {
        console.log('Login');
        return client.getRootObject();
    })
    .then((res) => {
        var root = res.data;
        var promises = [];
        console.log(root);
        if (root.Links) {
            for (let x in root) {
                if (root.hasOwnProperty(x) && root[x].hasOwnProperty('@odata.id')) {
                    promises.push(client.get(root[x]['@odata.id'])
                        .then((res) => console.log(res.body)));
                }
            }
            return promises;
        }
        throw Error('No link(s)');
    })
    .spread(() => {
        console.log('Get link(s) informations');
    })
    .catch((err) => {
        console.log(err);
    })
    .finally((res) => {
        console.log('Logout');
        return client.logout();
    });

Build from source

This project uses Gulp. To build the project:

  • NPM depedency install
$ npm install
  • Build the project
$ npm run compile
$ npm run prepublish

Browserify

$ npm install ilorest

$ browserify -r ilorest --im > bundle.js

License

Apache-2.0 © Hewlett Packard Enterprise