//native
type Neondb = {
apiKey: string
}
/**
* Assign or update a VPC endpoint
* Assigns the specified VPC endpoint to the specified organization
or updates the existing assignment.
This endpoint is under active development and its semantics may change in the future.
*/
export async function main(
auth: Neondb,
org_id: string,
region_id: string,
vpc_endpoint_id: string,
body: { label: string }
) {
const url = new URL(
`https://console.neon.tech/api/v2/organizations/${org_id}/vpc/region/${region_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