//native
type Digitalocean = {
token: string;
};
/**
* Check Status of a Droplet Destroy with Associated Resources Request
* To check on the status of a request to destroy a Droplet with its associated
resources, send a GET request to the
`/v2/droplets/$DROPLET_ID/destroy_with_associated_resources/status` endpoint.
*/
export async function main(auth: Digitalocean, droplet_id: string) {
const url = new URL(
`https://api.digitalocean.com/v2/droplets/${droplet_id}/destroy_with_associated_resources/status`,
);
const response = await fetch(url, {
method: "GET",
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