mirror of
https://github.com/yldio/copilot.git
synced 2024-11-13 06:40:06 +02:00
Update graphi and map resolvers
This commit is contained in:
parent
ba5ccea851
commit
2e3a436594
@ -10,34 +10,80 @@ const internals = {
|
||||
|
||||
|
||||
exports.options = (data) => {
|
||||
const getPortal = function (args, request) {
|
||||
|
||||
const queryWrap = function (name) {
|
||||
return function (args, request) {
|
||||
return data[name](args);
|
||||
};
|
||||
};
|
||||
|
||||
const getDeploymentGroups = function (args, request) {
|
||||
const queries = [
|
||||
'portal',
|
||||
'deploymentGroups',
|
||||
'deploymentGroup',
|
||||
'services',
|
||||
'service',
|
||||
'instances',
|
||||
'instance',
|
||||
'metricTypes',
|
||||
'metricData',
|
||||
'package',
|
||||
'datacenters',
|
||||
'instanceMetric'
|
||||
];
|
||||
|
||||
const resolvers = {
|
||||
createDeploymentGroup: (args, request) => {
|
||||
return data.createDeploymentGroup(args.name);
|
||||
},
|
||||
|
||||
updateDeploymentGroup: (args, request) => {
|
||||
return data.updateDeploymentGroup(args.uuid, args.name);
|
||||
},
|
||||
|
||||
provisionManifest: (args, request) => {
|
||||
return data.provisionManifest(args.deploymentGroupUuid, args.type, args.format, args.raw);
|
||||
},
|
||||
|
||||
scale: (args, request) => {
|
||||
return data.scale(args.service, args.replicas);
|
||||
},
|
||||
|
||||
stopServices: (args, request) => {
|
||||
return data.stopServices(args.uuids);
|
||||
},
|
||||
|
||||
startServices: (args, request) => {
|
||||
return data.startServices(args.uuids);
|
||||
},
|
||||
|
||||
restartServices: (args, request) => {
|
||||
return data.restartServices(args.uuids);
|
||||
},
|
||||
|
||||
deleteServices: (args, request) => {
|
||||
return data.deleteServices(args.uuids);
|
||||
},
|
||||
|
||||
stopInstances: (args, request) => {
|
||||
return data.stopInstances(args.uuids);
|
||||
},
|
||||
|
||||
startInstances: (args, request) => {
|
||||
return data.startInstances(args.uuids);
|
||||
},
|
||||
|
||||
restartInstances: (args, request) => {
|
||||
return data.restartInstances(args.uuids);
|
||||
}
|
||||
};
|
||||
|
||||
const getDeploymentGroup = function (args, request) {
|
||||
|
||||
};
|
||||
|
||||
const getServiceScales = function (args, request) {
|
||||
|
||||
};
|
||||
|
||||
const getServiceScale = function (args, request) {
|
||||
|
||||
};
|
||||
queries.forEach((query) => {
|
||||
const functionName = 'get' + query[0].toUpperCase() + query.slice(1);
|
||||
resolvers[query] = queryWrap(functionName);
|
||||
});
|
||||
|
||||
return {
|
||||
schema: internals.schema,
|
||||
functions: {
|
||||
portal: getPortal,
|
||||
deploymentGroups: getDeploymentGroups,
|
||||
deploymentGroup: getDeploymentGroup,
|
||||
serviceScales: getServiceScales,
|
||||
serviceScale: getServiceScale
|
||||
}
|
||||
resolvers
|
||||
};
|
||||
};
|
||||
|
@ -24,7 +24,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"boom": "^4.3.1",
|
||||
"graphi": "^1.0.0",
|
||||
"graphi": "^2.0.0",
|
||||
"hoek": "^4.1.1",
|
||||
"joi": "^10.4.1",
|
||||
"portal-data": "^1.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user