//native
type Render = {
apiKey: string
}
/**
* Trigger maintenance run
* Trigger the scheduled maintenance run with the provided ID.
Triggering maintenance is asynchronous. To check whether maintenance has started, use the [Retrieve maintenance run](https://api-docs.render.com/reference/retrieve-maintenance) endpoint.
As maintenance progresses, the run's `state` will change from `scheduled` to other values, such as `in_progress` and `succeeded`.
*/
export async function main(auth: Render, maintenanceRunParam: string) {
const url = new URL(`https://api.render.com/v1/maintenance/${maintenanceRunParam}/trigger`)
const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 235 days ago