1 | |
2 | |
3 | * Create a container |
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}/container`) |
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 | storage?: { |
33 | id?: string |
34 | type: 'FAST_SSD' |
35 | |
36 | * unit is GB |
37 | * Minimum size is 4 GB |
38 | * |
39 | */ |
40 | size: number |
41 | mount_point: string |
42 | [k: string]: unknown |
43 | }[] |
44 | [k: string]: unknown |
45 | } & { |
46 | ports?: { |
47 | id?: string |
48 | name?: string |
49 | |
50 | * The listening port of your service. |
51 | */ |
52 | internal_port: number |
53 | |
54 | * The exposed port for your service. This is optional. If not set a default port will be used. |
55 | */ |
56 | external_port?: number |
57 | |
58 | * Expose the port to the world |
59 | */ |
60 | publicly_accessible: boolean |
61 | |
62 | * is the default port to use for domain |
63 | */ |
64 | is_default?: boolean |
65 | protocol?: 'HTTP' | 'GRPC' | 'TCP' | 'UDP' |
66 | |
67 | * Indicate the path or regex that must match for traffic to be accepted on your service |
68 | * i.e: /api/ will only accept http calls that start with /api/ |
69 | * Only valid for publicly_accessible HTTP or GRPC ports. |
70 | */ |
71 | public_path?: string |
72 | |
73 | * Indicate the new path that will be used to reach your service after replacement |
74 | * i.e: public_path -> /(.*) public_path_rewrite -> /api/$1 will append /api/ on all externaly requested url when reaching the service |
75 | * external/use url -> example.com/foobar -> url seen by the service -> example.com/api/foobar |
76 | * Only valid for publicly_accessible HTTP or GRPC ports. |
77 | */ |
78 | public_path_rewrite?: string |
79 | [k: string]: unknown |
80 | }[] |
81 | [k: string]: unknown |
82 | } & { |
83 | |
84 | * name is case insensitive |
85 | */ |
86 | name: string |
87 | |
88 | * give a description to this container |
89 | */ |
90 | description?: string |
91 | |
92 | * id of the linked registry |
93 | */ |
94 | registry_id: string |
95 | |
96 | * The image name pattern differs according to chosen container registry provider: |
97 | * * `ECR`: `repository` |
98 | * * `SCALEWAY_CR`: `namespace/image` |
99 | * * `DOCKER_HUB`: `image` or `repository/image` |
100 | * * `PUBLIC_ECR`: `registry_alias/repository` |
101 | * |
102 | */ |
103 | image_name: string |
104 | |
105 | * tag of the image container |
106 | */ |
107 | tag: string |
108 | arguments?: string[] |
109 | |
110 | * optional entrypoint when launching container |
111 | */ |
112 | entrypoint?: string |
113 | |
114 | * unit is millicores (m). 1000m = 1 cpu |
115 | */ |
116 | cpu?: number |
117 | |
118 | * unit is MB. 1024 MB = 1GB |
119 | */ |
120 | memory?: number |
121 | gpu?: number |
122 | |
123 | * Minimum number of instances running. This resource auto-scale based on the CPU and Memory consumption. |
124 | * Note: 0 means that there is no container running. |
125 | * |
126 | */ |
127 | min_running_instances?: number |
128 | |
129 | * Maximum number of instances running. This resource auto-scale based on the CPU and Memory consumption. |
130 | * Note: -1 means that there is no limit. |
131 | * |
132 | */ |
133 | max_running_instances?: number |
134 | healthchecks: { |
135 | readiness_probe?: { |
136 | type?: { |
137 | tcp?: { |
138 | port?: number |
139 | host?: string |
140 | [k: string]: unknown |
141 | } |
142 | http?: { |
143 | path?: string |
144 | scheme?: string |
145 | port?: number |
146 | [k: string]: unknown |
147 | } |
148 | exec?: { |
149 | command?: string[] |
150 | [k: string]: unknown |
151 | } |
152 | grpc?: { |
153 | service?: string |
154 | port?: number |
155 | [k: string]: unknown |
156 | } |
157 | [k: string]: unknown |
158 | } |
159 | initial_delay_seconds?: number |
160 | period_seconds?: number |
161 | timeout_seconds?: number |
162 | success_threshold?: number |
163 | failure_threshold?: number |
164 | [k: string]: unknown |
165 | } |
166 | liveness_probe?: { |
167 | type?: { |
168 | tcp?: { |
169 | port?: number |
170 | host?: string |
171 | [k: string]: unknown |
172 | } |
173 | http?: { |
174 | path?: string |
175 | scheme?: string |
176 | port?: number |
177 | [k: string]: unknown |
178 | } |
179 | exec?: { |
180 | command?: string[] |
181 | [k: string]: unknown |
182 | } |
183 | grpc?: { |
184 | service?: string |
185 | port?: number |
186 | [k: string]: unknown |
187 | } |
188 | [k: string]: unknown |
189 | } |
190 | initial_delay_seconds?: number |
191 | period_seconds?: number |
192 | timeout_seconds?: number |
193 | success_threshold?: number |
194 | failure_threshold?: number |
195 | [k: string]: unknown |
196 | } |
197 | [k: string]: unknown |
198 | } |
199 | |
200 | * Indicates if the 'environment preview option' is enabled for this container. |
201 | * If enabled, a preview environment will be automatically cloned when `/preview` endpoint is called. |
202 | * If not specified, it takes the value of the `auto_preview` property from the associated environment. |
203 | * |
204 | */ |
205 | auto_preview?: boolean |
206 | |
207 | * Specify if the container will be automatically updated after receiving a new image tag. |
208 | * The new image tag shall be communicated via the "Auto Deploy container" endpoint https://api-doc.qovery.com/#tag/Containers/operation/autoDeployContainerEnvironments |
209 | * |
210 | */ |
211 | auto_deploy?: boolean |
212 | annotations_groups?: { |
213 | id: string |
214 | [k: string]: unknown |
215 | }[] |
216 | labels_groups?: { |
217 | id: string |
218 | [k: string]: unknown |
219 | }[] |
220 | |
221 | * Icon URI representing the container. |
222 | */ |
223 | icon_uri?: string |
224 | [k: string]: unknown |
225 | } |
226 |
|