1 | |
2 | |
3 | * Create a container registry |
4 | * |
5 | */ |
6 | export async function main(auth: RT.Qovery, organizationId: string, body: Body) { |
7 | const url = new URL(`https://api.qovery.com/organization/${organizationId}/containerRegistry`) |
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 interface Body { |
32 | name: string |
33 | |
34 | * The type of your container registry |
35 | */ |
36 | kind: |
37 | | 'ECR' |
38 | | 'SCALEWAY_CR' |
39 | | 'DOCKER_HUB' |
40 | | 'GITHUB_CR' |
41 | | 'GITHUB_ENTERPRISE_CR' |
42 | | 'GITLAB_CR' |
43 | | 'PUBLIC_ECR' |
44 | | 'DOCR' |
45 | | 'GENERIC_CR' |
46 | | 'GCP_ARTIFACT_REGISTRY' |
47 | | 'AZURE_CR' |
48 | description?: string |
49 | |
50 | * URL of the container registry: |
51 | * * For `DOCKER_HUB`: it must be `https://docker.io` (default with 'https://docker.io' if no url provided for `DOCKER_HUB`) |
52 | * * For `GITHUB_CR`: it must be `https://ghcr.io` (default with 'https://ghcr.io' if no url provided for `GITHUB_CR`) |
53 | * * For `GITLAB_CR`: it must be `https://registry.gitlab.com` (default with 'https://registry.gitlab.com' if no url provided for `GITLAB_CR`) |
54 | * * For others: it's required and must start by `https://` |
55 | * |
56 | */ |
57 | url?: string |
58 | |
59 | * This field is dependent of the container registry kind: |
60 | * * `ECR` needs in the config: region, access_key_id, secret_access_key |
61 | * * `SCALEWAY_CR` needs in the config: region, scaleway_access_key, scaleway_secret_key |
62 | * * `GCP_ARTIFACT_REGISTRY` needs in the config: region, json_credentials |
63 | * * `DOCKER_HUB` needs in the config (optional): username, password |
64 | * * `GITHUB_CR` needs in the config (optional): username, password |
65 | * * `GITLAB_CR` needs in the config (optional): username, password |
66 | * * `PUBLIC_ECR` doesn't need credentials info |
67 | * * `GENERIC_CR` needs in the config (optional): username, password |
68 | * * `DOCR` is not supported anymore |
69 | * |
70 | */ |
71 | config: { |
72 | |
73 | * Required if kind is `ECR` or `PUBLIC_ECR` |
74 | */ |
75 | access_key_id?: string |
76 | |
77 | * Required if kind is `ECR` or `PUBLIC_ECR` |
78 | */ |
79 | secret_access_key?: string |
80 | |
81 | * Required if kind is `ECR` or `SCALEWAY_CR` |
82 | */ |
83 | region?: string |
84 | |
85 | * Required if kind is `SCALEWAY_CR` |
86 | */ |
87 | scaleway_access_key?: string |
88 | |
89 | * Required if kind is `SCALEWAY_CR` |
90 | */ |
91 | scaleway_secret_key?: string |
92 | |
93 | * Required if kind is `SCALEWAY_CR` |
94 | */ |
95 | scaleway_project_id?: string |
96 | |
97 | * Required if kind is `GCP_ARTIFACT_REGISTRY` |
98 | */ |
99 | json_credentials?: string |
100 | |
101 | * optional, for kind `DOCKER_HUB` |
102 | * We encourage you to set credentials for Docker Hub due to the limits on the pull rate |
103 | * |
104 | */ |
105 | username?: string |
106 | |
107 | * optional, for kind `DOCKER_HUB` |
108 | * We encourage you to set credentials for Docker Hub due to the limits on the pull rate |
109 | * |
110 | */ |
111 | password?: string |
112 | |
113 | * For ECR, you can either set a static access_key or use a role arn that we are going to assume |
114 | */ |
115 | role_arn?: string |
116 | |
117 | * Required if kind is `AZURE_CR`. |
118 | */ |
119 | azure_tenant_id?: string |
120 | |
121 | * Required if kind is `AZURE_CR`. |
122 | */ |
123 | azure_subscription_id?: string |
124 | [k: string]: unknown |
125 | } |
126 | [k: string]: unknown |
127 | } |
128 |
|