VPC API
Private networks, gateway, firewall, NAT, VPN, and backups. API v2.10.
Overview
A VPC is a private VLAN and IPv4 network in one datacentre, with a VyOS gateway.
Post JSON to https://api.rackcorp.net/api/rest/v2.10/json.php with Authorization: Bearer.
Results sit next to code. They are not wrapped in data.
Creating a VPC also creates its VLAN and an auto-generated IPv4 network.
Firewall, NAT, management SSH, and VPN updates replace the whole list you send and then refresh the gateway.
Give each rule an id from 1 to 99999 and keep that id when you update it. A rule you leave out is deleted.
Lifecycle
| Command | Required | Optional |
|---|---|---|
network.vpc.create | name (1–255), dc_id | customer_id (defaults to the key's customer), configuration object, load_balancer_ha (boolean), consumer_type + consumer_id |
network.vpc.get | id | |
network.vpc.getall | resStart (default 0), resWindow (default 50, max 500), dc_id, customer_id, operational_status, keyword (name or id), stdname or stdName (customer trading name) | |
network.vpc.update | id | name, customer_id (moves the VPC), load_balancer_mode (none, single, dual), load_balancer_ha, load_balancer_activate |
network.vpc.redeploy | id (or vpcId) | Reinstalls the VyOS gateway. Fails until a gateway VM exists. |
network.vpc.delete | id | Refused while delete_blockers on get is non-empty. |
network.vpc.history.getall | id or vpc_id | resStart, resWindow |
consumer_type is APPLICATION or RANCHER. consumer_id must belong to the same customer as the VPC.
{
"cmd": "network.vpc.create",
"name": "app-private",
"dc_id": 4,
"customer_id": 1234
}
get returns vpc: id, name, customer, datacentre, VLAN, IP network and gateway, gateway device, public gateway addresses,
status, operational_status, gateway_operational_status, can_redeploy, configuration,
can_delete, delete_blockers, network_addresses, and a short history.
getall returns matches and vpcs.
load_balancer_mode replaces the older load_balancer_ha boolean.
none has no dedicated load balancer, single is one node, dual is a pair.
load_balancer_activate: true starts a dedicated load balancer that is not running yet.
Firewall
network.vpc.firewall.getall and network.vpc.firewall.update. Both require vpc_id. Update also requires rules, the full list.
| Rule field | Values |
|---|---|
id | Integer 1–99999. Required. Keep it stable across updates. |
action | accept, drop, reject |
protocol | Empty (any), icmp, tcp, udp |
source_addr, dest_addr | IPv4 address or CIDR. Empty means any. |
source_ports, dest_ports | A port, or start-end. Empty means any. Rules apply after NAT, so dest_ports is the translated port. |
comment | Optional string. |
{
"cmd": "network.vpc.firewall.update",
"vpc_id": 42,
"rules": [
{"id": 1, "action": "accept", "protocol": "tcp", "source_addr": "", "dest_addr": "", "source_ports": "", "dest_ports": "443", "comment": "https"}
]
}Get returns rules. Update returns {"code":"OK"}.
NAT
network.vpc.nat.getall and network.vpc.nat.update. Update replaces every rule. Only destination NAT is accepted today.
| Rule field | Values |
|---|---|
id | Integer 1–99999 |
kind | dnat |
protocol | Empty, tcp, or udp |
inbound_port, outbound_port | 0–65535. 0 on inbound matches every port. Outbound defaults to the inbound port. |
outbound_addr | Required IPv4 address. The translated destination. |
comment | Optional |
Management SSH
network.vpc.mgmtssh.get needs vpc_id. It returns configured, port (2322), and networks.
network.vpc.mgmtssh.update needs vpc_id and networks, an array of IPv4 CIDRs allowed to reach the gateway management port.
An empty array clears the allow list.
VPN
network.vpc.vpn.getall returns tunnels. network.vpc.vpn.update replaces them. kind is wireguard or ipsec. id is the stable tunnel id.
| Kind | Fields |
|---|---|
wireguard | address, listen_port (default 51820), listen_sources (CIDR list), keepalive (default 25), private_key (omit or send empty to keep or generate; rotate_key: true generates a new key), peers: name, public_key, address, port, allowed_ips, keepalive. A single flat peer (peer_public_key, peer_address, peer_port, allowed_ips) is still accepted. |
ipsec | peer_address, psk (generated when empty), local_prefix, remote_prefix, dh_group (default 14) |
Config backups
Each firewall, NAT, SSH, or VPN save stores a snapshot.
network.vpc.backup.getall with vpc_id returns snapshots.
network.vpc.backup.restore needs vpc_id and version (integer, at least 1) and pushes that snapshot back to the gateway.