0

Get folder info for a folder

by
Published Oct 17, 2025

Can be used by the following roles assigned at the organization or folder scope: - ORG_ADMIN - CLUSTER_ADMIN - CLUSTER_OPERATOR_WRITER - CLUSTER_DEVELOPER - CLUSTER_CREATOR - FOLDER_ADMIN - FOLDER_MOVER

Script cockroachdb Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Cockroachdb = {
3
  token: string;
4
};
5
/**
6
 * Get folder info for a folder
7
 * Can be used by the following roles assigned at the organization or folder scope:
8
- ORG_ADMIN
9
- CLUSTER_ADMIN
10
- CLUSTER_OPERATOR_WRITER
11
- CLUSTER_DEVELOPER
12
- CLUSTER_CREATOR
13
- FOLDER_ADMIN
14
- FOLDER_MOVER
15

16
 */
17
export async function main(auth: Cockroachdb, folder_id: string) {
18
  const url = new URL(
19
    `https://cockroachlabs.cloud/api/v1/folders/${folder_id}`,
20
  );
21

22
  const response = await fetch(url, {
23
    method: "GET",
24
    headers: {
25
      Authorization: "Bearer " + auth.token,
26
    },
27
    body: undefined,
28
  });
29
  if (!response.ok) {
30
    const text = await response.text();
31
    throw new Error(`${response.status} ${text}`);
32
  }
33
  return await response.json();
34
}
35