//native
type Digitalocean = {
token: string;
};
/**
* Add Container Registry to Kubernetes Clusters
* To integrate the container registry with Kubernetes clusters, send a POST request to `/v2/kubernetes/registry`.
*/
export async function main(
auth: Digitalocean,
body: { cluster_uuids?: string[] },
) {
const url = new URL(`https://api.digitalocean.com/v2/kubernetes/registry`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 536 days ago