0

Retrieve the state of a VPC endpoint configuration

by
Published Apr 8, 2025

Retrieves detailed information about the VPC endpoint. 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
 * Retrieve the state of a VPC endpoint configuration
7
 * Retrieves detailed information about the VPC endpoint.
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: 'GET',
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