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