//native
type Neondb = {
apiKey: string
}
/**
* Start a compute endpoint
* Starts a compute endpoint. The compute endpoint is ready to use
after the last operation in chain finishes successfully.
You can obtain a `project_id` by listing the projects for your Neon account.
You can obtain an `endpoint_id` by listing your project's compute endpoints.
An `endpoint_id` has an `ep-` prefix.
For information about compute endpoints, see [Manage computes](https://neon.tech/docs/manage/endpoints/).
*/
export async function main(auth: Neondb, project_id: string, endpoint_id: string) {
const url = new URL(
`https://console.neon.tech/api/v2/projects/${project_id}/endpoints/${endpoint_id}/start`
)
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.json()
}
Submitted by hugo697 428 days ago