//native
type Neondb = {
apiKey: string
}
/**
* Assign or update a VPC endpoint restriction
* Configures the specified VPC endpoint as restriction for the project,
or updates the existing restriction. When a VPC endpoint is assigned
as a restriction, only connections from this specific VPC are accepted.
Note that a VPC endpoint can only used as a restriction on a project
after it has been assigned to the parent organization.
This endpoint is under active development and its semantics may change in the future.
*/
export async function main(
auth: Neondb,
project_id: string,
vpc_endpoint_id: string,
body: { label: string }
) {
const url = new URL(
`https://console.neon.tech/api/v2/projects/${project_id}/vpc-endpoints/${vpc_endpoint_id}`
)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 428 days ago