mirror of
https://github.com/yldio/copilot.git
synced 2024-12-26 20:00:05 +02:00
27 lines
480 B
JavaScript
27 lines
480 B
JavaScript
'use strict';
|
|
|
|
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
|
|
};
|
|
};
|