Zudoku
Unikraft Cloud Network Shield Plugin API

Policies

Server

List Policies

GET
http://localhost:8080
/policies

List every policy in force, in the order they were written.

List Policies › Responses

Every policy in force.

The response carrying the policy set.
status
​string · enum · required

The status of the response.

Enum values:
success
error
partial_success
​object · required

The response data for this request.

op_time_us
​integer · uint64 · required

The operation time in microseconds.

message
​string

An optional message providing additional information about the status.

A list of errors which may have occurred during the request.


Replace All Policies

PUT
http://localhost:8080
/policies

Replace the whole policy set. A policy whose id is in both keeps its counters, address sets and listener where the change leaves them meaning the same thing. 409 is returned when an id appears twice, and 422 when the set is refused: a policy fails validation, two policies collide, the set needs more address sets or listeners than the shield has, or it would leave a secret bound to a policy that is gone, or substituting into none.

Replace All Policies › Request Body

A policy rule.
id
​string · required

The policy's id: 1 to 64 ASCII letters, digits, ., _ and -, but not . or .., unique among the policies.

Example: allow-github-https
direction
​string · enum · required

Which way the connections go.

Enum values:
outbound
inbound
handler
​string · enum · required

How matched connections are carried; inbound, http or passthrough.

Enum values:
http
https
passthrough
​object · required

What the policy applies to.

priority
​integer · int32

(OPTIONAL) Evaluation priority, highest first.

Default: 100
request_limit
​object | null

(OPTIONAL) A cap on requests. Not on passthrough, nor inbound.

connection_limit
​object | null

(OPTIONAL) A cap on new connections. Not inbound.

Replace All Policies › Responses

The policy set as it now stands.

The response carrying the policy set.
status
​string · enum · required

The status of the response.

Enum values:
success
error
partial_success
​object · required

The response data for this request.

op_time_us
​integer · uint64 · required

The operation time in microseconds.

message
​string

An optional message providing additional information about the status.

A list of errors which may have occurred during the request.


Add Policies

POST
http://localhost:8080
/policies

Add policies, as an array even of one, which is added whole or not at all. 201 is returned with the policies added. 409 is returned when an id is taken or appears twice, and 422 when the addition is refused.

Add Policies › Request Body

A policy rule.
id
​string · required

The policy's id: 1 to 64 ASCII letters, digits, ., _ and -, but not . or .., unique among the policies.

Example: allow-github-https
direction
​string · enum · required

Which way the connections go.

Enum values:
outbound
inbound
handler
​string · enum · required

How matched connections are carried; inbound, http or passthrough.

Enum values:
http
https
passthrough
​object · required

What the policy applies to.

priority
​integer · int32

(OPTIONAL) Evaluation priority, highest first.

Default: 100
request_limit
​object | null

(OPTIONAL) A cap on requests. Not on passthrough, nor inbound.

connection_limit
​object | null

(OPTIONAL) A cap on new connections. Not inbound.

Add Policies › Responses

The policies added.

The response carrying the policy set.
status
​string · enum · required

The status of the response.

Enum values:
success
error
partial_success
​object · required

The response data for this request.

op_time_us
​integer · uint64 · required

The operation time in microseconds.

message
​string

An optional message providing additional information about the status.

A list of errors which may have occurred during the request.


Get Policy

GET
http://localhost:8080
/policies/{policy_id}

Get one policy by id. 404 is returned when no such policy exists.

Get Policy › path Parameters

policy_id
​string · required

Get Policy › Responses

The policy.

The response carrying one policy.
status
​string · enum · required

The status of the response.

Enum values:
success
error
partial_success
​object · required

The response data for this request.

op_time_us
​integer · uint64 · required

The operation time in microseconds.

message
​string

An optional message providing additional information about the status.

A list of errors which may have occurred during the request.


Replace Policy

PUT
http://localhost:8080
/policies/{policy_id}

Replace one policy, in place, leaving the others as they are. The policy and the set it leaves are checked as a whole-set replace checks them, and a refused replace changes nothing. A request counter is kept while the port keeps a request limit; a connection allowance is kept while the port's rule is unchanged, and starts full when the limit's numbers change. 404 is returned when no such policy exists, and 422 when the body names another id or the change is refused.

Replace Policy › path Parameters

policy_id
​string · required

Replace Policy › Request Body

The request to replace one policy, which the path names.
direction
​string · enum · required

Which way the connections go.

Enum values:
outbound
inbound
handler
​string · enum · required

How matched connections are carried; inbound, http or passthrough.

Enum values:
http
https
passthrough
​object · required

What the policy applies to.

id
​string

(OPTIONAL) The policy's id. Given, it has to be the path's.

priority
​integer · int32

(OPTIONAL) Evaluation priority, highest first.

Default: 100
request_limit
​object | null

(OPTIONAL) A cap on requests. Not on passthrough, nor inbound.

connection_limit
​object | null

(OPTIONAL) A cap on new connections. Not inbound.

Replace Policy › Responses

The policy as it now stands.

The response carrying one policy.
status
​string · enum · required

The status of the response.

Enum values:
success
error
partial_success
​object · required

The response data for this request.

op_time_us
​integer · uint64 · required

The operation time in microseconds.

message
​string

An optional message providing additional information about the status.

A list of errors which may have occurred during the request.


Delete Policy

DELETE
http://localhost:8080
/policies/{policy_id}

Delete one policy. 404 is returned when no such policy exists, and 409 when a secret is bound to it, or substitutes into nothing else.

Delete Policy › path Parameters

policy_id
​string · required

Delete Policy › Responses

The outcome of deleting the policy.

A response which carries no data of its own. `data` is `null`; the outcome of the request is the HTTP status code.
status
​string · enum · required

The status of the response.

Enum values:
success
error
partial_success
data
​required

The response data for this request.

op_time_us
​integer · uint64 · required

The operation time in microseconds.

message
​string

An optional message providing additional information about the status.

A list of errors which may have occurred during the request.