This commit is contained in:
JUDIT GRESKOVITS 2017-05-24 18:09:25 +01:00
commit 597f1b628b
2 changed files with 68 additions and 22 deletions

View File

@ -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
};
};

View File

@ -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"