//native
type Digitalocean = {
token: string;
};
/**
* Start Database Maintenance
* To start the installation of updates for a database cluster, send a PUT request to `/v2/databases/$DATABASE_ID/install_update`.
A successful request will receive a 204 No Content status code with no body in response.
*/
export async function main(auth: Digitalocean, database_cluster_uuid: string) {
const url = new URL(
`https://api.digitalocean.com/v2/databases/${database_cluster_uuid}/install_update`,
);
const response = await fetch(url, {
method: "PUT",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 536 days ago