1 | |
2 | |
3 | * Add a secret to the project |
4 | * - Add a secret to the project. |
5 | - If the secret key already exists, then it will be replaced by the new one. |
6 | - If the secret value points toward an existing secret key, it will be considered as an alias. |
7 |
|
8 | */ |
9 | export async function main(auth: RT.Qovery, projectId: string, body: Body) { |
10 | const url = new URL(`https://api.qovery.com/project/${projectId}/secret`) |
11 |
|
12 | const response = await fetch(url, { |
13 | method: 'POST', |
14 | headers: { |
15 | 'Content-Type': 'application/json', |
16 | Authorization: 'Token ' + auth.apiKey |
17 | }, |
18 | body: JSON.stringify(body) |
19 | }) |
20 | if (!response.ok) { |
21 | const text = await response.text() |
22 | throw new Error(`${response.status} ${text}`) |
23 | } |
24 | return await response.json() |
25 | } |
26 |
|
27 | |
28 | |
29 | * This file was automatically generated by json-schema-to-typescript. |
30 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
31 | * and run json-schema-to-typescript to regenerate this file. |
32 | */ |
33 |
|
34 | export interface Body { |
35 | |
36 | * key is case sensitive |
37 | */ |
38 | key: string |
39 | |
40 | * value of the secret. Clear value will never be returned |
41 | */ |
42 | value?: string |
43 | |
44 | * should be set for file only. variable mount path make secret a file (where file should be mounted). |
45 | */ |
46 | mount_path?: string |
47 | |
48 | * optional variable description (255 character maximum) |
49 | */ |
50 | description?: string |
51 | enable_interpolation_in_file?: boolean |
52 | [k: string]: unknown |
53 | } |
54 |
|