Share a port

Give a port of the VM a URL, for the internet or for the devices of the tenant.

POST /v1/tenants/{tenant}/vms/{name}/ports

curl -X POST "https://api.shako.dev/v1/tenants/acme/vms/web1/ports" \
  -H "Authorization: Bearer $SHAKO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"port":8000,"access":"public"}'

201 (excerpt)

{
  "name": "web1",
  "port": 8000,
  "url": "https://web1-8000--acme.shakoapp.dev",
  "tcp": "tcp.shako.dev:10042",
  "warnings": []
}

Authenticate with Authorization: Bearer <API key> on https://api.shako.dev. Role: contributor or owner.

Path parameters

tenantstringrequired
The tenant's name, from GET /v1/tenants.
namestringrequired
The VM's name.

Request body

portinteger, 1 to 65535required
The port in the VM, 1 to 65535. A program must listen on it on 0.0.0.0, not on 127.0.0.1.
accessstring (public, private)default: public
public: anyone on the internet can open the URL. private: only the devices of the tenant can open it.

Response

201 with the shared port object.

Behavior

warnings in the answer says if no program listens on the port of an awake VM yet (then a request gets 502), or if the public port is usually a database's.

The errors. All the endpoints of Ports.