//native
type Telnyx = {
apiKey: string
}
/**
* Update the Virtual Cross Connect
* Update the Virtual Cross Connect.Cloud IPs can only be patched during the `created` state, as GCE will only inform you of your generated IP once the pending connection requested has been accepted. Once the Virtual Cross Connect has moved to `provisioning`, the IPs can no longer be patched.Once the Virtual Cross Connect has moved to `provisioned` and you are ready to enable routing, you can toggle the routing announcements to `true`.
*/
export async function main(
auth: Telnyx,
id: string,
body: {
primary_enabled?: false | true
primary_routing_announcement?: false | true
primary_cloud_ip?: string
secondary_enabled?: false | true
secondary_routing_announcement?: false | true
secondary_cloud_ip?: string
}
) {
const url = new URL(`https://api.telnyx.com/v2/virtual_cross_connects/${id}`)
const response = await fetch(url, {
method: 'PATCH',
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