Eval-Script
Summary
An Eval-Script
is a group of ordered Eval-Script Steps related by a common script_name
field. Eval-Scripts
are invoked using the eval-script filter es()
Definition
Field | Value | Description |
---|---|---|
Name | string | short-code used in es filter (not unique – shared by other steps in the script) |
Steps | array of Eval-Script Steps | JSON array of Eval-Script Steps |
REST Operations
GET eval-script?<query-parameters>
Return eval-script
resources identified by query paramters:
Query Parameters:
parameter | type | default | comments |
---|---|---|---|
script_name | string | EvalScript name to match |
PUT eval-script
Upsert eval-script
resource identied by Name
from JSON body. Eval-Script Steps within Steps
are upserted using eval-script
Name
and eval-script-step
sequence-id
. script-name
specified within a nested Eval-Script Step is overridden by the top-level Name
.)
JSON body parameters:
Field | Value | Description |
---|---|---|
Name | string | short-code used in es filter (not unique – shared by other steps in the script) |
Steps | array of Eval-Script Steps | JSON array of Eval-Script Steps |
POST eval-script
Upsert eval-script
resource identied by Name
from JSON body. Eval-Script Steps within Steps
are upserted using eval-script
Name
and eval-script-step
sequence-id
. script-name
specified within a nested Eval-Script Step is overridden by the top-level Name
.)
JSON body parameters:
Field | Value | Description |
---|---|---|
Name | string | short-code used in es filter (not unique – shared by other steps in the script) |
Steps | array of Eval-Script Steps | JSON array of Eval-Script Steps |
DELETE
Delete eval-script
resources identified by query paramters:
Query Parameters:
parameter | type | default | comments |
---|---|---|---|
script_name | string | EvalScript name to match |
Usage Example
Create EvalScript "no-hockey-in-mexico"
which blocks specific content based on URI-path and X-Geo-ASN header
curl --location --request POST 'http://localhost:8082/api/v1/eval-script?script_name=no-hockey-in-mexico' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJiYWtlcnkiLCJncm91cHMiOltdLCJpYXQiOjE2NjQzODU5OTIsImV4cCI6MTY2NDQwMDM5MiwiaXNzIjoiQ0JTLVZURyJ9.AQ378IQjJAzRbch0HBQAP2eDPLAgl2xKFz97SHCHL7gd-3wJ93D-VlZ9OiDs3B4_QpBF3E82OOVPdhcrm72eAK8Uep_YhyYm90nxrmHwoUEcECJu-2VRxjcmXDiUviAfJIeJyiMKun0wG4prKq98k_imGbedqCNor1mfnnncqaUsk-PlnUYRexcbYTwwP6wJ61La2TLf8sYeH-1qb4TEXzdA7eEglrLJYStDX1rUDTMx509ra4K58W4w3HTYH3WjlFpuxv3YecbKWmkcBAsqvxblDy3Yn8difO0u1VHkoWBd-8Lj95s1qp08Zm-Y8f0PtV7FZ13FRGXYVl7r0xS4ug' \
--data-raw '[
{
"name": "no-hockey-in-mexico-DEMO1",
"steps": [
{
"sequence_id": 1,
"action": {
"name": "hockeyallstars-COPY",
"header_name": null,
"match": [
"*/d4cbdb65dfad/*"
],
"operation": "EQUALS",
"negation": false,
"description": "hockey all stars"
}
},
{
"sequence_id": 2,
"action": {
"name": "mex-COPY",
"header_name": "X-Geo-Asn",
"match": [
"MX:*"
],
"operation": "EQUALS",
"negation": false,
"description": "match Mexico"
}
},
{
"sequence_id": 3,
"action": "err"
}
]
}
]'