1 | |
2 | |
3 | * Edit an environment deployment rule |
4 | * |
5 | */ |
6 | export async function main( |
7 | auth: RT.Qovery, |
8 | environmentId: string, |
9 | deploymentRuleId: string, |
10 | body: Body |
11 | ) { |
12 | const url = new URL( |
13 | `https://api.qovery.com/environment/${environmentId}/deploymentRule/${deploymentRuleId}` |
14 | ) |
15 |
|
16 | const response = await fetch(url, { |
17 | method: 'PUT', |
18 | headers: { |
19 | 'Content-Type': 'application/json', |
20 | Authorization: 'Token ' + auth.apiKey |
21 | }, |
22 | body: JSON.stringify(body) |
23 | }) |
24 | if (!response.ok) { |
25 | const text = await response.text() |
26 | throw new Error(`${response.status} ${text}`) |
27 | } |
28 | return await response.json() |
29 | } |
30 |
|
31 | |
32 | |
33 | * This file was automatically generated by json-schema-to-typescript. |
34 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
35 | * and run json-schema-to-typescript to regenerate this file. |
36 | */ |
37 |
|
38 | export interface Body { |
39 | on_demand_preview?: boolean |
40 | auto_preview?: boolean |
41 | auto_stop?: boolean |
42 | timezone: string |
43 | start_time: string |
44 | stop_time: string |
45 | weekdays: ('MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY')[] |
46 | [k: string]: unknown |
47 | } |
48 |
|