1 | |
2 | |
3 | * Edit a database |
4 | * To edit a database you must have the admin permission |
5 | */ |
6 | export async function main(auth: RT.Qovery, databaseId: string, body: Body) { |
7 | const url = new URL(`https://api.qovery.com/database/${databaseId}`) |
8 |
|
9 | const response = await fetch(url, { |
10 | method: 'PUT', |
11 | headers: { |
12 | 'Content-Type': 'application/json', |
13 | Authorization: 'Token ' + auth.apiKey |
14 | }, |
15 | body: JSON.stringify(body) |
16 | }) |
17 | if (!response.ok) { |
18 | const text = await response.text() |
19 | throw new Error(`${response.status} ${text}`) |
20 | } |
21 | return await response.json() |
22 | } |
23 |
|
24 | |
25 | |
26 | * This file was automatically generated by json-schema-to-typescript. |
27 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
28 | * and run json-schema-to-typescript to regenerate this file. |
29 | */ |
30 |
|
31 | export interface Body { |
32 | |
33 | * name is case-insensitive |
34 | */ |
35 | name?: string |
36 | |
37 | * give a description to this database |
38 | */ |
39 | description?: string |
40 | version?: string |
41 | accessibility?: 'PRIVATE' | 'PUBLIC' |
42 | |
43 | * unit is millicores (m). 1000m = 1 cpu. |
44 | * This field will be ignored for managed DB (instance type will be used instead). |
45 | * |
46 | */ |
47 | cpu?: number |
48 | |
49 | * unit is MB. 1024 MB = 1GB |
50 | * This field will be ignored for managed DB (instance type will be used instead). |
51 | * Default value is linked to the database type: |
52 | * - MANAGED: 100 |
53 | * - CONTAINER |
54 | * - POSTGRES: 100 |
55 | * - REDIS: 100 |
56 | * - MYSQL: 512 |
57 | * - MONGODB: 256 |
58 | * |
59 | */ |
60 | memory?: number |
61 | |
62 | * unit is GB |
63 | */ |
64 | storage?: number |
65 | |
66 | * Database instance type to be used for this database. The list of values can be retrieved via the endpoint /{CloudProvider}/managedDatabase/instanceType/{region}/{dbType}. This field SHOULD NOT be set for container DB. |
67 | */ |
68 | instance_type?: string |
69 | annotations_groups?: { |
70 | id: string |
71 | [k: string]: unknown |
72 | }[] |
73 | labels_groups?: { |
74 | id: string |
75 | [k: string]: unknown |
76 | }[] |
77 | |
78 | * Icon URI representing the database. |
79 | */ |
80 | icon_uri?: string |
81 | [k: string]: unknown |
82 | } |
83 |
|