2017-07-14 14:17:28 +03:00
|
|
|
'use strict';
|
|
|
|
|
2017-07-13 20:22:00 +03:00
|
|
|
const Find = require('lodash.find');
|
|
|
|
|
|
|
|
module.exports = ({ machines = [], networks = [] }) => {
|
|
|
|
const getMachine = (machineId, cb) => {
|
|
|
|
cb(null, Find(machines, ['id', machineId]));
|
|
|
|
};
|
|
|
|
|
|
|
|
const getNetwork = (networkId, cb) => {
|
|
|
|
cb(null, Find(networks, ['id', networkId]));
|
|
|
|
};
|
|
|
|
|
|
|
|
const createClient = (opts, cb) => {
|
|
|
|
return cb(null, {
|
|
|
|
cloudapi: {
|
|
|
|
getMachine,
|
|
|
|
getNetwork
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
createClient
|
|
|
|
};
|
|
|
|
};
|