Adding rules¶
To define a rule, you need to specify the Target
and the rule Chain
:
Target
- the visibility scope within which the request is executed:
Namespace
Container
User
Group
Chain
- a rule chain defined for a specific Target
.
Chains are strictly separated by protocol purpose:
chains intended for the node (native protocol) do not intersect with chains for S3.
Example Chain
:
{
"ID": "",
"Rules": [
{
"Status": "Allow",
"Actions": {
"Inverted": false,
"Names": [
"GetObject"
]
},
"Resources": {
"Inverted": false,
"Names": [
"native:object/*"
]
},
"Any": false,
"Condition": [
{
"Op": "StringEquals",
"Object": "Resource",
"Key": "Department",
"Value": "HR"
}
]
}
],
"MatchType": "DenyPriority"
}
Parameter | Description |
---|---|
ID | Chain ID. Unique within a single Target, but not unique across different Targets. |
Rules | List of rules. |
Rules.Status | Policy application status: Allow, AccessDenied, QuotaLimitReached, NoRuleFound |
Rules.Actions | Information about the methods being checked. |
Rules.Actions.Inverted | Method inversion flag. For example, if set to true, the action will not apply only to the methods specified in Rules.Actions.Name. |
Rules.Actions.Name | Operations constants (see the list here). |
Rules.Resources | Resources on which the action is performed. |
Rules.Resources.Inverted | Resource inversion flag. For example, if set to true, the action will not apply only to the resources specified in Rules.Resources.Name. |
Rules.Resources.Name | Resource names, strictly following the format specified in the scheme. |
Rules.Any | Flag indicating that the rule triggers if at least one condition is met. |
Rules.Condition | Conditions for triggering this rule. Define checks on request properties or properties of the resource passed in the request. |
Rules.Condition.Op | Condition operators, such as StringEquals, NumericEquals, etc. |
Rules.Condition.Object | The object of the check - what the condition is applied to(Request, Resource). |
Rules.Condition.Key | Key for defining the condition. |
Rules.Condition.Value | Value for defining the condition. |
MatchType | Rule selection priority: whether APE should persistently iterate and encounter a Deny or return the status based on the first matching rule. |
- DenyPriority: Denies the request if Deny is specified. (Recommended) |
|
- FirstMatch: Returns the action of the first rule that matches the request. |
Note
The rule will be applied after 1-2 blocks have passed.
Arguments:
- Execution context
- Method arguments, which includes:
- Target
- Chain
- Additional headers (optional)
Result:
- Rule ID
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|