Piper Push Cache Documentation Download Samples Contact  

Access

The access section is used to define how clients connect to Piper. Each entry in the access element must have a key that specifies the IP address and port that clients can connect to. The value associated with each key is a JSON object that contains the five operations that are possible. The default for each is that all access to that operation is denied unless specified otherwise. To allow access a sub element of the operation should have a key that identifies a pattern that matches some set of source IP addresses from which the operation is allowed. The '*' character is a wildcard that matches all addresses.

Exclusions to the address pattern can ne includes as sub elements of the allow pattern. This approach continue alternating between allows and denies.

{
    "access": {
        ":7660": {
            "get": {
                "*": {}
            },
            "put": {
                "*": {}
            },
            "update": {
                "*.*.*.*": {}
            },
            "delete": {
                "*": {}
            },
            "admin": {
                "192.168.10.*": {}
            }
        }
    }
}

Note: Currently the access feature only supports identifying a port. All other information is ignored and all operations are assumed to be allow-all.

The operations are:

get An HTTP GET can be used to retrieve a copy of a JSON record in the cache. Following a REST like API the path should begin with '/record/' and be followed by the desired record identifier. The returned contents will be a JSON document string or a not found error.
put An HTTP PUT or a message over NATS can be used to insert a new record in the cache. The path must begin with '/record/' followed by the record identifier for the new JSON record. The record itself should be in the contents of the HTTP request or in the message.
update Updates are typically done over HTTP or via messages over NATS. If an HTTP POST is used then forms on web pages or Javascript can be used to modify the cache. A single field in the form should contain the JSON record and the form action attribute should include the record identifier. Any of the form enctypes are support. Those types are 'application/x-www-form-urlencoded', 'multipart/form-data', and 'text/plain'.
delete Records can be deleted with either a DELETE HTTP request or with a PUT that indicates the new record should be a JSON null. Delete paths should begin with '/record/' followed by the record identifier.
admin Administrative operations include clearing the cache and shutting down the server.