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/cloud-filesystem/get.ts
Views: 688
1
/*
2
Get a list of cloud file systems:
3
4
- all cloud file systems that you own across all projects - no params
5
- all cloud file systems in a particular project (whether or not you own them) - specify project_id
6
- a specific cloud file system - specify id
7
8
Always returns an array of cloud file system objects.
9
*/
10
11
import getAccountId from "lib/account/get-account";
12
import { userGetCloudFilesystems } from "@cocalc/server/compute/cloud-filesystem/get";
13
import getParams from "lib/api/get-params";
14
15
export default async function handle(req, res) {
16
try {
17
res.json(await get(req));
18
} catch (err) {
19
res.json({ error: `${err.message}` });
20
return;
21
}
22
}
23
24
async function get(req) {
25
const account_id = await getAccountId(req);
26
if (!account_id) {
27
throw Error("must be signed in");
28
}
29
const { id, project_id } = getParams(req);
30
31
return await userGetCloudFilesystems({
32
id,
33
account_id,
34
project_id,
35
});
36
}
37
38