You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
1.4 KiB
JavaScript
87 lines
1.4 KiB
JavaScript
"use strict";
|
|
|
|
require("@babel/register");
|
|
const Promise = require("bluebird");
|
|
const errorChain = require("error-chain");
|
|
const createAPI = require("../src/api");
|
|
|
|
// const query = {
|
|
// hardware: {
|
|
// drives: {
|
|
// path: true,
|
|
// smartHealth: true,
|
|
// size: true,
|
|
// rpm: true,
|
|
// serialNumber: true,
|
|
// model: true,
|
|
// modelFamily: true,
|
|
// firmwareVersion: true,
|
|
|
|
// blockDevice: {
|
|
// name: true
|
|
// },
|
|
|
|
// partitions: {
|
|
// $key: "allBlockDevices",
|
|
// name: true,
|
|
// size: true,
|
|
|
|
// mounts: {
|
|
// mountpoint: true
|
|
// },
|
|
|
|
// children: {
|
|
// $recurse: true,
|
|
// $recurseLimit: Infinity, // 3 by default
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// };
|
|
|
|
// const query = {
|
|
// resources: {
|
|
// lvm: {
|
|
// createPhysicalVolume: {
|
|
// $arguments: {
|
|
// path: "/dev/loop3"
|
|
// },
|
|
// path: true,
|
|
// totalSpace: true,
|
|
// freeSpace: true
|
|
// }
|
|
// }
|
|
// }
|
|
// };
|
|
|
|
const query = {
|
|
resources: {
|
|
blockDevices: {
|
|
// $arguments: { names: ["sdb"] },
|
|
name: true,
|
|
path: true,
|
|
mounts: {
|
|
mountpoint: true,
|
|
filesystem: true,
|
|
totalSpace: true,
|
|
// children: {
|
|
// $recurse: true
|
|
// }
|
|
},
|
|
children: {
|
|
$recurse: true
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
const api = createAPI();
|
|
|
|
return Promise.try(() => {
|
|
return api.query(query);
|
|
}).then((result) => {
|
|
console.dir(result, { depth: null });
|
|
}).catch((error) => {
|
|
console.error(errorChain.render(error));
|
|
});
|