Update Resources-Filter.md
Updated filter resource documentation with up-to-date request output.
This commit is contained in:
@ -8,7 +8,7 @@ services can use the same filter and a single service can use multiple filters.
|
|||||||
### Get a filter
|
### Get a filter
|
||||||
|
|
||||||
Get a single filter. The _:name_ in the URI must be a valid filter name with all
|
Get a single filter. The _:name_ in the URI must be a valid filter name with all
|
||||||
whitespace replaced with hyphens. The filter names are case-insensitive.
|
whitespace replaced with hyphens. The filter names are case-sensitive.
|
||||||
|
|
||||||
```
|
```
|
||||||
GET /filters/:name
|
GET /filters/:name
|
||||||
@ -16,32 +16,38 @@ GET /filters/:name
|
|||||||
|
|
||||||
#### Response
|
#### Response
|
||||||
|
|
||||||
```
|
`Status: 200 OK`
|
||||||
Status: 200 OK
|
|
||||||
|
|
||||||
|
```javascript
|
||||||
{
|
{
|
||||||
"name": "Query Logging Filter",
|
"links": {
|
||||||
"module": "qlafilter",
|
"self": "http://localhost:8989/v1/filters/Hint-Filter"
|
||||||
"parameters": {
|
|
||||||
"filebase": {
|
|
||||||
"value": "/var/log/maxscale/qla/log.",
|
|
||||||
"configurable": false
|
|
||||||
},
|
},
|
||||||
"match": {
|
"data": {
|
||||||
"value": "select.*from.*t1",
|
"id": "Hint-Filter",
|
||||||
"configurable": true
|
"type": "filters",
|
||||||
|
"relationships": {
|
||||||
|
"services": { // All serices that use this filter
|
||||||
|
"links": {
|
||||||
|
"self": "http://localhost:8989/v1/services/"
|
||||||
|
},
|
||||||
|
"data": [] // No service is using this filter
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"services": [
|
"attributes": {
|
||||||
"/services/my-service",
|
"module": "hintfilter",
|
||||||
"/services/my-second-service"
|
"parameters": {} // Filter parameters
|
||||||
]
|
},
|
||||||
|
"links": {
|
||||||
|
"self": "http://localhost:8989/v1/filters/Hint-Filter"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Supported Request Parameter
|
#### Supported Request Parameter
|
||||||
|
|
||||||
- `fields`
|
- `pretty`
|
||||||
|
|
||||||
### Get all filters
|
### Get all filters
|
||||||
|
|
||||||
@ -53,99 +59,37 @@ GET /filters
|
|||||||
|
|
||||||
#### Response
|
#### Response
|
||||||
|
|
||||||
```
|
`Status: 200 OK`
|
||||||
Status: 200 OK
|
|
||||||
|
|
||||||
[
|
```javascript
|
||||||
{
|
{
|
||||||
"name": "Query Logging Filter",
|
"links": {
|
||||||
"module": "qlafilter",
|
"self": "http://localhost:8989/v1/filters/"
|
||||||
"parameters": {
|
|
||||||
"filebase": {
|
|
||||||
"value": "/var/log/maxscale/qla/log.",
|
|
||||||
"configurable": false
|
|
||||||
},
|
},
|
||||||
"match": {
|
"data": [ // Array of filter resources
|
||||||
"value": "select.*from.*t1",
|
{
|
||||||
"configurable": true
|
"id": "Hint-Filter",
|
||||||
|
"type": "filters",
|
||||||
|
"relationships": {
|
||||||
|
"services": {
|
||||||
|
"links": {
|
||||||
|
"self": "http://localhost:8989/v1/services/"
|
||||||
|
},
|
||||||
|
"data": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"services": [
|
"attributes": {
|
||||||
"/services/my-service",
|
"module": "hintfilter",
|
||||||
"/services/my-second-service
|
"parameters": {}
|
||||||
|
},
|
||||||
|
"links": {
|
||||||
|
"self": "http://localhost:8989/v1/filters/Hint-Filter"
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
{
|
|
||||||
"name": "DBFW Filter",
|
|
||||||
"module": "dbfwfilter",
|
|
||||||
"parameters": {
|
|
||||||
{
|
|
||||||
"name": "rules",
|
|
||||||
"value": "/etc/maxscale-rules",
|
|
||||||
"configurable": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"services": [
|
|
||||||
"/services/my-second-service
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Supported Request Parameter
|
#### Supported Request Parameter
|
||||||
|
|
||||||
- `fields`
|
- `pretty`
|
||||||
- `range`
|
|
||||||
|
|
||||||
### Update a filter
|
|
||||||
|
|
||||||
**Note**: The update mechanisms described here are provisional and most likely
|
|
||||||
will change in the future. This description is only for design purposes and
|
|
||||||
does not yet work.
|
|
||||||
|
|
||||||
Partially update a filter. The _:name_ in the URI must map to a filter name
|
|
||||||
and the request body must be a valid JSON Patch document which is applied to the
|
|
||||||
resource.
|
|
||||||
|
|
||||||
```
|
|
||||||
PATCH /filter/:name
|
|
||||||
```
|
|
||||||
|
|
||||||
### Modifiable Fields
|
|
||||||
|
|
||||||
|Field |Type |Description |
|
|
||||||
|------------|-------|---------------------------------|
|
|
||||||
|parameters |object |Module specific filter parameters|
|
|
||||||
|
|
||||||
```
|
|
||||||
[
|
|
||||||
{ "op": "replace", "path": "/parameters/rules/value", "value": "/etc/new-rules" },
|
|
||||||
{ "op": "add", "path": "/parameters/action/value", "value": "allow" }
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Response
|
|
||||||
|
|
||||||
Response contains the modified resource.
|
|
||||||
|
|
||||||
```
|
|
||||||
Status: 200 OK
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "DBFW Filter",
|
|
||||||
"module": "dbfwfilter",
|
|
||||||
"parameters": {
|
|
||||||
"rules": {
|
|
||||||
"value": "/etc/new-rules",
|
|
||||||
"configurable": false
|
|
||||||
},
|
|
||||||
"action": {
|
|
||||||
"value": "allow",
|
|
||||||
"configurable": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"services": [
|
|
||||||
"/services/my-second-service"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
Reference in New Issue
Block a user