imperva/incapsula-cli

Cache Rules output inconsistent

Opened this issue · 0 comments

The cache list-cache-settings-rule operation returns inconsistent structure when cache rules are defined vs when they are not:

Cache Rules Exist

[
    {
        "action": "HTTP_CACHE_MAKE_STATIC",
        "disabledByCacheMode": false,
        "enabled": true,
        "filter": "URL == \"/commons-9a37b461e14cdb912bf2.js\"",
        "name": "Force cache",
        "rule_id": 106200,
        "ttl": 3600
    }
]

No Cache Rules

{
    "debug_info": {
        "Site has no Cache rules": "GET - /api/prov/v2/sites/***/settings/cache/rules/",
        "id-info": "999999"
    },
    "res": 0,
    "res_message": "OK"
}

Scripts can currently check for the existence of the debug_info key to determine if there are existing rules or not - however, if we restructure the output like the example below, the check for debug_info could be eliminated and we'd have a consistent output.

{
    "rules" : [],
    "debug_info": {
        "Site has no Cache rules": "GET - /api/prov/v2/sites/***/settings/cache/rules/",
        "id-info": "999999"
    },
    "res": 0,
    "res_message": "OK"
}