//native
type Neondb = {
apiKey: string
}
/**
* Suspend a compute endpoint
* Suspend the specified compute endpoint
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}/suspend`
)
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