From e7a6aec0106455b1869e4047d4ffe0326a48ecf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Sun, 14 May 2017 10:36:09 +0300 Subject: [PATCH] Update Resources-Filter.md Updated filter resource documentation with up-to-date request output. --- Documentation/REST-API/Resources-Filter.md | 160 +++++++-------------- 1 file changed, 52 insertions(+), 108 deletions(-) diff --git a/Documentation/REST-API/Resources-Filter.md b/Documentation/REST-API/Resources-Filter.md index 2235209b1..44617f3ae 100644 --- a/Documentation/REST-API/Resources-Filter.md +++ b/Documentation/REST-API/Resources-Filter.md @@ -8,7 +8,7 @@ services can use the same filter and a single service can use multiple filters. ### Get a filter 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 @@ -16,32 +16,38 @@ GET /filters/:name #### Response -``` -Status: 200 OK +`Status: 200 OK` +```javascript { - "name": "Query Logging Filter", - "module": "qlafilter", - "parameters": { - "filebase": { - "value": "/var/log/maxscale/qla/log.", - "configurable": false - }, - "match": { - "value": "select.*from.*t1", - "configurable": true - } + "links": { + "self": "http://localhost:8989/v1/filters/Hint-Filter" }, - "services": [ - "/services/my-service", - "/services/my-second-service" - ] + "data": { + "id": "Hint-Filter", + "type": "filters", + "relationships": { + "services": { // All serices that use this filter + "links": { + "self": "http://localhost:8989/v1/services/" + }, + "data": [] // No service is using this filter + } + }, + "attributes": { + "module": "hintfilter", + "parameters": {} // Filter parameters + }, + "links": { + "self": "http://localhost:8989/v1/filters/Hint-Filter" + } + } } ``` #### Supported Request Parameter -- `fields` +- `pretty` ### Get all filters @@ -53,99 +59,37 @@ GET /filters #### Response -``` -Status: 200 OK +`Status: 200 OK` -[ - { - "name": "Query Logging Filter", - "module": "qlafilter", - "parameters": { - "filebase": { - "value": "/var/log/maxscale/qla/log.", - "configurable": false - }, - "match": { - "value": "select.*from.*t1", - "configurable": true - } - }, - "services": [ - "/services/my-service", - "/services/my-second-service - ] +```javascript +{ + "links": { + "self": "http://localhost:8989/v1/filters/" }, - { - "name": "DBFW Filter", - "module": "dbfwfilter", - "parameters": { - { - "name": "rules", - "value": "/etc/maxscale-rules", - "configurable": false + "data": [ // Array of filter resources + { + "id": "Hint-Filter", + "type": "filters", + "relationships": { + "services": { + "links": { + "self": "http://localhost:8989/v1/services/" + }, + "data": [] + } + }, + "attributes": { + "module": "hintfilter", + "parameters": {} + }, + "links": { + "self": "http://localhost:8989/v1/filters/Hint-Filter" } - }, - "services": [ - "/services/my-second-service - ] - } -] + } + ] +} ``` #### Supported Request Parameter -- `fields` -- `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" - ] -} -``` +- `pretty`