Zone Ruleset Revision
Description
This resource is for listing rulesets in a zone or creating new ones. Currently rulesets map exclusively to AT61 regexes.
GET /zones/:ZONEID/revisions/:REVISIONID/rulesets
Get the list of rulesets used at this revision. This is a paged query.
GET Parameters
| Name | Required | Type | Description | Default Value |
|---|---|---|---|---|
| :ZONEID | Yes | URL Parameter | The unique numeric ID of the zone. | |
| :REVISIONID | Yes | URL Parameter | The revision number of the ruleset. | |
| q | No | Query Parameter | Filter returned entries in the revision by their application, protocol, or description. |
GET Response Values
Each returned element will be a ruleset resource represented as an object.
Example GET Request
GET /zones/2031/revisions/26/rulesets
Example GET Response
{
"rows": 1,
"data": [
{
"description": "Gigabot",
"protocol": "TCP",
"application": "regex",
"port": 80,
"enabled": true,
"ruleset_resource": "/rulesets/121",
"zone_resource": "/zones/2031",
"rules": [
{
"field": "Regex",
"predicate": "is",
"value": "(?i)\\x0d\\x0aUser-Agent: [^\\x0d]*Gigabot[^\\x0d]*\\x0d\\x0a",
"rule_resource": "/rules/109"
}
]
}
],
"start": 0
}
POST /zones/:ZONEID/revisions/:REVISIONID/rulesets
Create a new set of rulesets to use in the zone. Any entries created will be in addition to existing ruleset entries in the zone. The POST will only be accepted if the :REVISIONID is the current ruleset revision for the zone.
POST Parameters
| Name | Required | Type | Description | Default Value |
|---|---|---|---|---|
| :ZONEID | Yes | URL Parameter | The unique numeric ID of the zone you want to add ruleset entries. | |
| :REVISIONID | Yes | URL Parameter | The revision number of the ruleset. In order to successfully perform the POST, this must be the zone's current ruleset revision number. | |
| description | No | JSON String | A description of the new ruleset. | null |
| protocol | Yes | JSON String | The protocol that the ruleset should apply to. Must be one of "TCP", "UDP", or "ICMP". | |
| port | Yes | JSON Number | The destination port to which this ruleset applies. If 0, applies to any traffic over the selected protocol. | |
| enabled | No | JSON Boolean | Whether or not the ruleset is enabled. | null |
| rules | Yes | JSON Array | A list of rules in the ruleset. Currently this should contain a single object, containing each of the elements listed below. | |
| field | Yes | JSON String | Use the default value of "Regex". | |
| predicate | Yes | JSON String | Use the default value of "is". | |
| value | Yes | JSON String | Use a backslash escaped representation of the rule. Practically speaking, this will be the regex that is applied in the listed zone. |
Example POST Request
POST /zones/2031/revisions/26/rulesets
JSON Body:
{
"data": {
"description": "Wordpress",
"protocol": "TCP",
"application": "regex",
"port": 80,
"enabled": true,
"rules": [
{
"field": "Regex",
"predicate": "is",
"value": "(?i)\\x0d\\x0aUser-Agent: [^\\x0d]*Wordpress[^\\x0d]*\\x0d\\x0a"
}
]
}
}
Example POST Response
HTTP/1.1 201 Created