//native
type Digitalocean = {
token: string;
};
/**
* Validate App Rollback
* Check whether an app can be rolled back to a specific deployment. This endpoint can also be used
to check if there are any warnings or validation conditions that will cause the rollback to proceed
under unideal circumstances. For example, if a component must be rebuilt as part of the rollback
causing it to take longer than usual.
*/
export async function main(
auth: Digitalocean,
app_id: string,
body: { deployment_id?: string; skip_pin?: false | true },
) {
const url = new URL(
`https://api.digitalocean.com/v2/apps/${app_id}/rollback/validate`,
);
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