Create or replace a rule

PUT
/v1/{namespace}/config/{firewall}/rules/{id}

Authorization

headerAuthorizationBearer <token>

A personal or service access token, sent as Authorization: Bearer <token>. See access tokens.

Path Parameters

namespace*string

The namespace id.

firewall*string

The firewall id.

id*string

The rule id.

Request Body

application/json
  1. body

A rule: what to do with the packages its selector matches. A request is blocked when any enabled blocking rule matches it and no exception lets it through.

id*string

The rule id, unique within the firewall. Exceptions refer to it.

disabled?boolean

Whether the rule is switched off. A disabled rule is kept but never evaluated.

executionPhase*string

Request phase a rule is evaluated in.

Value in"versions""download""upload"
selector*

Which packages the rule applies to.

ruleEffect*

What happens when the rule matches.

description?string

A description of the rule. Log entries use it as their message when the rule gives none of its own.

Response Body

The stored rule.

application/json
  1. response

A rule: what to do with the packages its selector matches. A request is blocked when any enabled blocking rule matches it and no exception lets it through.

id*string

The rule id, unique within the firewall. Exceptions refer to it.

disabled?boolean

Whether the rule is switched off. A disabled rule is kept but never evaluated.

executionPhase*string

Request phase a rule is evaluated in.

Value in"versions""download""upload"
selector*

Which packages the rule applies to.

ruleEffect*

What happens when the rule matches.

description?string

A description of the rule. Log entries use it as their message when the rule gives none of its own.

curl -X PUT 'https://eu-sov-1.bytesafecloud.eu/v1/my-namespace-id/config/my-firewall-id/rules/block-malware' \  -H 'Content-Type: application/json' \  -d '{  "description": "Block packages with known malware.",  "executionPhase": "download",  "id": "block-malware",  "ruleEffect": {    "block": true,    "log": true  },  "selector": {    "function": {      "name": "malware"    }  }}'
{  "id": "block-malware",  "executionPhase": "download",  "selector": {    "function": {      "name": "malware"    }  },  "ruleEffect": {    "block": true,    "log": true  },  "description": "Block packages with known malware."}