CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/api/v2/compute/control.ts
Views: 687
1
/*
2
Controlling compute servers
3
*/
4
5
import getAccountId from "lib/account/get-account";
6
//import { start, stop, state } from "@cocalc/server/compute/control";
7
//import getParams from "lib/api/get-params";
8
9
export default async function handle(req, res) {
10
try {
11
res.json(await get(req));
12
} catch (err) {
13
res.json({ error: `${err.message}` });
14
return;
15
}
16
}
17
18
async function get(req) {
19
const account_id = await getAccountId(req);
20
if (!account_id) {
21
throw Error("must be signed in");
22
}
23
throw Error("NOT implemented yet");
24
// const { id, action } = getParams(req);
25
26
// // disable this for now, obviously!
27
28
// switch (action) {
29
// case "start":
30
// return await start({ id, account_id });
31
// case "stop":
32
// return await stop({ id, account_id });
33
// case "state": // update the state by using the cloud provider api
34
// return { state: await state({ id, account_id }) };
35
// default:
36
// throw Error(`unknown action ${action}`);
37
// }
38
}
39
40