//native
type Render = {
apiKey: string
}
/**
* Create Postgres export
* Create an [export](https://docs.render.com/postgresql-backups#logical-backups) of a Postgres instance by ID.
*/
export async function main(auth: Render, postgresId: string) {
const url = new URL(`https://api.render.com/v1/postgres/${postgresId}/export`)
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