ilorest
Version:
iLO REST JavaScript Library
119 lines (108 loc) • 3.74 kB
Markdown
[](https://travis-ci.org/HewlettPackard/javascript-ilorest-library)
[](https://badge.fury.io/js/ilorest)
[](https://coveralls.io/github/HewlettPackard/javascript-ilorest-library?branch=master)
[](https://snyk.io/test/github/hewlettpackard/javascript-ilorest-library)
[](https://david-dm.org/HewlettPackard/javascript-ilorest-library)
[](https://raw.githubusercontent.com/HewlettPackard/javascript-ilorest-library/master/LICENSE)
[](https://gitter.im/HewlettPackard/javascript-ilorest-library?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
> JavaScript Library for Hewlett Packard Enterprise iLO RESTful/Redfish API
```
$ npm install -g windows-build-tools
$ npm install --save ilorest
```
```
$ npm install --save ilorest
```
```
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();
});
```
```
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();
});
```
This project uses [Gulp](http://gulpjs.com/). To build the project:
- NPM depedency install
```
$ npm install
```
- Build the project
```
$ npm run compile
$ npm run prepublish
```
```
$ npm install ilorest
$ browserify -r ilorest --im > bundle.js
```
Apache-2.0 © [Hewlett Packard Enterprise](https://www.hpe.com)