Path: blob/master/src/packages/next/pages/api/v2/compute/control.ts
1451 views
/*1Controlling compute servers2*/34import getAccountId from "lib/account/get-account";5//import { start, stop, state } from "@cocalc/server/compute/control";6//import getParams from "lib/api/get-params";78export default async function handle(req, res) {9try {10res.json(await get(req));11} catch (err) {12res.json({ error: `${err.message}` });13return;14}15}1617async function get(req) {18const account_id = await getAccountId(req);19if (!account_id) {20throw Error("must be signed in");21}22throw Error("NOT implemented yet");23// const { id, action } = getParams(req);2425// // disable this for now, obviously!2627// switch (action) {28// case "start":29// return await start({ id, account_id });30// case "stop":31// return await stop({ id, account_id });32// case "state": // update the state by using the cloud provider api33// return { state: await state({ id, account_id }) };34// default:35// throw Error(`unknown action ${action}`);36// }37}383940