MaxScale/Documentation/REST-API/Resources-Filter.md
Markus Makela 59e615eb3c Create initial REST API documentation
The Resources document lists all currently known resources and will be converted
to a list of separate resource documents once the individual resource documents
are done. The Headers and Response Codes document contains a list of request and
response headers and the HTTP return codes. This is a work in progress and will
be expanded upon.

Added initial versions of the filter, monitor, session and user resource
documents. These provide information about various parts of MaxScale and
allow interaction.

All PATCH operations expect a JSON Patch type document in the request
body. Examples modified accordingly.

Add MaxScale resource document which describes the resources that give the
global configuration options and show statistics.

The resources that link to other resources provide values as a list of
relative links. This reduces the amount of sent data when the client
doesn't require all parts of the resource.

Since the updating is not yet implement, it should be stated that the update API
will most likely be modified at some point.

The module resource is similar to `maxadmin show modules` and the log
resource contains status information about logs. The log resource also has
an "action" resource at `/maxscale/logs/flush` which flushes logs to disk
and rotates them.

Added start and stop entry points for services and monitors. Also added
missing service parameters to the list of parameters that can be updated.

The documentation lists listeners as a sub-resource of the
service. This allows the listeners of a particular service to be queried.
2016-11-07 14:20:44 +02:00

3.0 KiB

Filter Resource

A filter resource represents an instance of a filter inside MaxScale. Multiple services can use the same filter and a single service can use multiple filters.

Resource Operations

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.

GET /filters/:name

Response

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"
    ]
}

Supported Request Parameter

  • fields

Get all filters

Get all filters.

GET /filters

Response

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
        ]
    },
    {
        "name": "DBFW Filter",
        "module": "dbfwfilter",
        "parameters": {
            {
                "name": "rules",
                "value": "/etc/maxscale-rules",
                "configurable": false
            }
        },
        "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"
    ]
}