1 | |
2 | |
3 | * Edit helm |
4 | * - To edit the helm you must have the admin permission. |
5 |
|
6 | */ |
7 | export async function main(auth: RT.Qovery, helmId: string, body: Body) { |
8 | const url = new URL(`https://api.qovery.com/helm/${helmId}`) |
9 |
|
10 | const response = await fetch(url, { |
11 | method: 'PUT', |
12 | headers: { |
13 | 'Content-Type': 'application/json', |
14 | Authorization: 'Token ' + auth.apiKey |
15 | }, |
16 | body: JSON.stringify(body) |
17 | }) |
18 | if (!response.ok) { |
19 | const text = await response.text() |
20 | throw new Error(`${response.status} ${text}`) |
21 | } |
22 | return await response.json() |
23 | } |
24 |
|
25 | |
26 | |
27 | * This file was automatically generated by json-schema-to-typescript. |
28 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
29 | * and run json-schema-to-typescript to regenerate this file. |
30 | */ |
31 |
|
32 | export type Body = { |
33 | ports?: ({ |
34 | name?: string |
35 | |
36 | * The listening port of your service. |
37 | */ |
38 | internal_port: number |
39 | |
40 | * The exposed port for your service. This is optional. If not set a default port will be used. |
41 | */ |
42 | external_port?: number |
43 | namespace?: string |
44 | protocol?: 'HTTP' | 'GRPC' |
45 | |
46 | * is the default port to use for domain |
47 | */ |
48 | is_default?: boolean |
49 | [k: string]: unknown |
50 | } & ( |
51 | | { |
52 | service_selectors?: KubernetesSelector[] |
53 | [k: string]: unknown |
54 | } |
55 | | { |
56 | service_name?: string |
57 | [k: string]: unknown |
58 | } |
59 | ))[] |
60 | [k: string]: unknown |
61 | } & { |
62 | |
63 | * name is case insensitive |
64 | */ |
65 | name: string |
66 | description?: string |
67 | |
68 | * Maximum number of seconds allowed for helm to run before killing it and mark it as failed |
69 | * |
70 | */ |
71 | timeout_sec?: number |
72 | |
73 | * Indicates if the 'environment preview option' is enabled. |
74 | * If enabled, a preview environment will be automatically cloned when `/preview` endpoint is called or when a new commit is updated. |
75 | * If not specified, it takes the value of the `auto_preview` property from the associated environment. |
76 | * |
77 | */ |
78 | auto_preview?: boolean |
79 | |
80 | * Specify if the helm will be automatically updated after receiving a new image tag or a new commit according to the source type. |
81 | * |
82 | */ |
83 | auto_deploy: boolean |
84 | source: |
85 | | { |
86 | git_repository?: { |
87 | |
88 | * application git repository URL |
89 | */ |
90 | url: string |
91 | |
92 | * Name of the branch to use. This is optional |
93 | * If not specified, then the branch used is the `main` or `master` one |
94 | * |
95 | */ |
96 | branch?: string |
97 | |
98 | * indicates the root path of the application. |
99 | */ |
100 | root_path?: string |
101 | |
102 | * The git token id on Qovery side |
103 | */ |
104 | git_token_id?: string |
105 | [k: string]: unknown |
106 | } |
107 | [k: string]: unknown |
108 | } |
109 | | { |
110 | helm_repository?: { |
111 | |
112 | * The id of the helm repository |
113 | */ |
114 | repository?: string |
115 | |
116 | * The name of the chart in the repository |
117 | */ |
118 | chart_name?: string |
119 | |
120 | * The version of the chart to use |
121 | */ |
122 | chart_version?: string |
123 | [k: string]: unknown |
124 | } |
125 | [k: string]: unknown |
126 | } |
127 | |
128 | * The extra arguments to pass to helm |
129 | */ |
130 | arguments: string[] |
131 | |
132 | * If we should allow the chart to deploy object outside his specified namespace. |
133 | * Setting this flag to true, requires special rights |
134 | * |
135 | */ |
136 | allow_cluster_wide_resources?: boolean |
137 | |
138 | * Specify helm values you want to set or override |
139 | * |
140 | */ |
141 | values_override: { |
142 | |
143 | * The input is in json array format: [ [$KEY,$VALUE], [...] ] |
144 | */ |
145 | set?: string[][] |
146 | |
147 | * The input is in json array format: [ [$KEY,$VALUE], [...] ] |
148 | */ |
149 | set_string?: string[][] |
150 | |
151 | * The input is in json array format: [ [$KEY,$VALUE], [...] ] |
152 | */ |
153 | set_json?: string[][] |
154 | file?: { |
155 | git?: { |
156 | git_repository: { |
157 | |
158 | * application git repository URL |
159 | */ |
160 | url: string |
161 | |
162 | * Name of the branch to use. This is optional |
163 | * If not specified, then the branch used is the `main` or `master` one |
164 | * |
165 | */ |
166 | branch?: string |
167 | |
168 | * indicates the root path of the application. |
169 | */ |
170 | root_path?: string |
171 | |
172 | * The git token id on Qovery side |
173 | */ |
174 | git_token_id?: string |
175 | provider: 'BITBUCKET' | 'GITHUB' | 'GITLAB' |
176 | [k: string]: unknown |
177 | } |
178 | |
179 | * List of path inside your git repository to locate values file. Must start by a / |
180 | */ |
181 | paths: string[] |
182 | [k: string]: unknown |
183 | } |
184 | raw?: { |
185 | values?: { |
186 | |
187 | * The name of the value file |
188 | */ |
189 | name?: string |
190 | |
191 | * The content of the value file |
192 | */ |
193 | content?: string |
194 | [k: string]: unknown |
195 | }[] |
196 | [k: string]: unknown |
197 | } |
198 | [k: string]: unknown |
199 | } |
200 | [k: string]: unknown |
201 | } |
202 | |
203 | * Icon URI representing the helm service. |
204 | */ |
205 | icon_uri?: string |
206 | [k: string]: unknown |
207 | } |
208 |
|
209 | export interface KubernetesSelector { |
210 | key: string |
211 | value: string |
212 | [k: string]: unknown |
213 | } |
214 |
|