edit large file storage settings

Script windmill Verified

by hugo697 ยท 3/6/2024

The script

Submitted by hugo697 Typescript (fetch-only)
Verified 370 days ago
1
/**
2
 * edit large file storage settings
3
 *
4
 */
5
export async function main(
6
  workspace: string,
7
  body: {
8
    large_file_storage?: {
9
      type?: "S3Storage" | "AzureBlobStorage";
10
      s3_resource_path?: string;
11
      azure_blob_resource_path?: string;
12
      public_resource?: boolean;
13
      [k: string]: unknown;
14
    };
15
    [k: string]: unknown;
16
  }
17
) {
18
  const url = new URL(
19
    `${BASE_URL}/api/w/${workspace}/workspaces/edit_large_file_storage_config`
20
  );
21

22
  const response = await fetch(url, {
23
    method: "POST",
24
    headers: {
25
      "Content-Type": "application/json",
26
      Authorization: "Bearer " + WM_TOKEN,
27
    },
28
    body: JSON.stringify(body),
29
  });
30
  if (!response.ok) {
31
    const text = await response.text();
32
    throw new Error(`${response.status} ${text}`);
33
  }
34
  return await response.json();
35
}
36