Ruleset Resource
Description
This resource is for manipulating individual ruleset entries in a zone. Currently rulesets map exclusively to AT61 regexes.
GET /rulesets/:ID
Get data about the selected ruleset.
GET Parameters
| Name | Required | Type | Description | Default Value |
|---|---|---|---|---|
| :ID | Yes | URL | The unique numeric ID of the ruleset. |
GET Response Values
| Name | Type | Description |
|---|---|---|
| description | JSON String | A description of the applied ruleset. |
| protocol | JSON String | The protocol used for the ruleset. Will be one of "TCP", "UDP", or "ICMP". |
| application | JSON String | The application used by this ruleset. Currently only "regex" is supported. |
| port | JSON Number | The destination port to which this ruleset applies. If 0, applies to any traffic over the selected protocol. |
| enabled | JSON Boolean | Whether or not the ruleset is enabled. |
| ruleset_resource | JSON String | The resource for this ruleset. Should return the resource used for the GET request. |
| zone_resource | JSON String | The zone resource for the zone which is using this ruleset. |
| rules | JSON Array | A list of rules in the ruleset. Current this defaults to contain a single object, containing each of the elements listed below. |
| field | JSON String | This will default to "Regex". |
| predicate | JSON String | This will default to "is". |
| value | JSON String | This is a backslash escaped representation of the rule. Practically speaking, this will be the regex that is applied in the listed zone. |
| rule_resource | JSON String | The rule resource for the individual rule object. |
Example GET Request
GET /rulesets/118
Example GET Response
{
"description": "Regex Name",
"protocol": "TCP",
"application": "regex",
"port": 80,
"enabled": true,
"ruleset_resource": "/rulesets/118",
"zone_resource": "/zones/2031",
"rules": [
{
"field": "Regex",
"predicate": "is",
"value": "(?i)\\x0d\\x0aUser-Agent: [^\\x0d]*WordPress[^\\x0d]*\\x0d\\x0a",
"rule_resource": "/rules/107"
}
]
}
PUT /ruleset/:ID
Updates the given ruleset. In order to update a ruleset, it must be part of the current ruleset revision for the zone.
PUT Parameters
| Name | Required | Type | Description | Default Value |
|---|---|---|---|---|
| :ID | Yes | URL | The unique numeric ID of the ruleset. | |
| description | No | JSON String | A new description of the 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. Current 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. |
PUT Response Values
The response will return an updated ruleset object. Because rulesets are tracked via revision, in order to update the ruleset it must be part of the zone's current revision of rulesets, which will now include the new ruleset object instead of the old one.
Example PUT Request
PUT /rulesets/118
JSON Body:
{
"data": {
"port": 80,
"protocol": "TCP",
"rules": [
{
"field": "Regex",
"predicate": "is",
"value": "(?i)\\x0d\\x0aUser-Agent: [^\\x0d]*Gigabot[^\\x0d]*\\x0d\\x0a"
}
]
}
}
Example PUT Response
HTTP/1.1 200 OK
{
"description": null,
"protocol": "TCP",
"application": "regex",
"port": 80,
"enabled": null,
"ruleset_resource": "/rulesets/120",
"zone_resource": "/zones/2031",
"rules": [
{
"field": "Regex",
"predicate": "is",
"value": "(?i)\\x0d\\x0aUser-Agent: [^\\x0d]*Gigabot[^\\x0d]*\\x0d\\x0a",
"rule_resource": "/rules/108"
}
]
}
DELETE /ruleset/:ID
Removes the ruleset. In order to be removed, the ruleset must be in the current ruleset revision of the zone it is applied to.
DELETE Parameters
| Name | Required | Type | Description | Default Value |
|---|---|---|---|---|
| :ID | Yes | URL | The unique numeric ID of the ruleset. |
Example DELETE Request
DELETE /rulesets/120
Example DELETE Response
HTTP/1.1 200 OK