Network Policy

POST /network-policy/rules

Changed on

Request

  • Base URL
    /api (relative, and the document was published on a file host, not at the API’s origin)
  • Auth
    HTTP bearer

Request body

actionstring required

allow or deny.

descriptionstring nullable
directionstring required

egress or ingress.

peer_kindstring required

service (by id), workload (<kind>/<id>) or cidr. host parses but is refused with 409 until a node runs the shared egress proxy that enforces hostname rules.

peer_refstring required
port_endinteger nullable
port_startinteger nullable

Omit both ports for every port (80/443 for a host rule).

protocolstring nullable

tcp (default), udp or any.

subject_idinteger required

Environment id for deployment; the row id for the other kinds.

subject_kindstring required

deployment (an environment), sandbox, service, function or job.

Example request

{
  "action": "allow",
  "direction": "egress",
  "peer_kind": "host",
  "peer_ref": "registry.example.test",
  "subject_kind": "sandbox"
}

Response

Rule created

actionstring required
created_atstring date-time required
created_byinteger nullable
descriptionstring nullable
directionstring required
enforceableboolean required

False for a host rule: hostname rules are enforced only by the shared egress proxy, which no node runs yet, so such a rule (stored before new ones were refused) is shown but never enforced.

idinteger required
link_idinteger nullable
link_tablestring nullable
originstring required

link rules are removed by unlinking, not deleted directly.

peer_kindstring required
peer_refstring required
port_endinteger nullable
port_startinteger nullable
protocolstring required
subject_idinteger required
subject_kindstring required
updated_atstring date-time required

Example response

{
  "action": "allow",
  "direction": "egress",
  "origin": "operator",
  "peer_kind": "service",
  "peer_ref": "12",
  "protocol": "tcp",
  "subject_kind": "sandbox"
}

Changes

    • breaking

      removed the required property extensions from the response with the status

    • breaking

      removed the required property extensions from the response with the status

    • breaking

      removed the required property extensions from the response with the status

    1 more change in this revision