0

Delete a VPC endpoint

by
Published Apr 8, 2025

Deletes the specified VPC endpoint from the specified organization. This endpoint is under active development and its semantics may change in the future.

Script neondb Verified

The script

Submitted by hugo697 Bun
Verified 428 days ago
1
//native
2
type Neondb = {
3
	apiKey: string
4
}
5
/**
6
 * Delete a VPC endpoint
7
 * Deletes the specified VPC endpoint from the specified organization.
8
This endpoint is under active development and its semantics may change in the future.
9

10
 */
11
export async function main(
12
	auth: Neondb,
13
	org_id: string,
14
	region_id: string,
15
	vpc_endpoint_id: string
16
) {
17
	const url = new URL(
18
		`https://console.neon.tech/api/v2/organizations/${org_id}/vpc/region/${region_id}/vpc-endpoints/${vpc_endpoint_id}`
19
	)
20

21
	const response = await fetch(url, {
22
		method: 'DELETE',
23
		headers: {
24
			Authorization: 'Bearer ' + auth.apiKey
25
		},
26
		body: undefined
27
	})
28
	if (!response.ok) {
29
		const text = await response.text()
30
		throw new Error(`${response.status} ${text}`)
31
	}
32
	return await response.json()
33
}
34