Create or replace a rule
AuthorizationBearer <token>A personal or service access token, sent as Authorization: Bearer <token>. See access tokens.
namespace*stringThe namespace id.
firewall*stringThe firewall id.
id*stringThe rule id.
application/json- 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*stringThe rule id, unique within the firewall. Exceptions refer to it.
disabled?booleanWhether the rule is switched off. A disabled rule is kept but never evaluated.
executionPhase*stringRequest phase a rule is evaluated in.
"versions""download""upload"selector*Which packages the rule applies to.
ruleEffect*What happens when the rule matches.
description?stringA description of the rule. Log entries use it as their message when the rule gives none of its own.
The stored rule.
application/json- 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*stringThe rule id, unique within the firewall. Exceptions refer to it.
disabled?booleanWhether the rule is switched off. A disabled rule is kept but never evaluated.
executionPhase*stringRequest phase a rule is evaluated in.
"versions""download""upload"selector*Which packages the rule applies to.
ruleEffect*What happens when the rule matches.
description?stringA 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."}