2016-10-10 18:37:26 +03:00
|
|
|
const request = require('./request');
|
|
|
|
|
|
|
|
const snapshots = {
|
2017-04-27 21:26:15 +03:00
|
|
|
list: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('listMachineSnapshots', ctx);
|
|
|
|
},
|
2017-04-27 21:26:15 +03:00
|
|
|
get: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('getMachineSnapshot', ctx);
|
|
|
|
},
|
2017-04-27 21:26:15 +03:00
|
|
|
create: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('createMachineSnapshot', ctx);
|
|
|
|
},
|
2017-04-27 21:26:15 +03:00
|
|
|
destroy: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('deleteMachineSnapshot', ctx);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const metadata = {
|
2017-04-27 21:26:15 +03:00
|
|
|
list: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('', ctx);
|
|
|
|
},
|
2017-04-27 21:26:15 +03:00
|
|
|
get: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('', ctx);
|
|
|
|
},
|
2017-04-27 21:26:15 +03:00
|
|
|
update: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('', ctx);
|
|
|
|
},
|
2017-04-27 21:26:15 +03:00
|
|
|
destroy: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('', ctx);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const firewall = {
|
2017-04-27 21:26:15 +03:00
|
|
|
enable: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('enableMachineFirewall', ctx);
|
|
|
|
},
|
2017-04-27 21:26:15 +03:00
|
|
|
disable: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('disableMachineFirewall', ctx);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const tags = {
|
2017-04-27 21:26:15 +03:00
|
|
|
list: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('listMachineTags', ctx);
|
|
|
|
},
|
2017-04-27 21:26:15 +03:00
|
|
|
get: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('getMachineTag', ctx);
|
|
|
|
},
|
2017-04-27 21:26:15 +03:00
|
|
|
add: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('addMachineTags', ctx);
|
|
|
|
},
|
2017-04-27 21:26:15 +03:00
|
|
|
replace: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('replaceMachineTags', ctx);
|
|
|
|
},
|
2017-04-27 21:26:15 +03:00
|
|
|
destroy: ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
const method = ctx.tag ? 'deleteMachineTag' : 'deleteMachineTags';
|
|
|
|
return request(method, ctx);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.list = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('listMachines', ctx);
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.get = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('getMachine', ctx);
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.create = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('createMachine', ctx);
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.stop = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('stopMachine', ctx);
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.start = uuid => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('startMachine', uuid);
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.startFromSnapshot = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('startMachineFromSnapshot', ctx);
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.reboot = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('rebootMachine', ctx);
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.resize = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('', ctx);
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.rename = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('', ctx);
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.destroy = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('deleteMachine', ctx);
|
|
|
|
};
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
module.exports.audit = ctx => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return request('machineAudit', ctx);
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports.snapshots = snapshots;
|
|
|
|
module.exports.metadata = metadata;
|
|
|
|
module.exports.firewall = firewall;
|
|
|
|
module.exports.tags = tags;
|