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