imperva / imperva/incapsula-cli
Cache Rules output inconsistent
- Dominant language
- Python
- Stars
- 33
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
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"
}
```
Contributor guide
Research direction
Start at the `cache list-cache-settings-rule` operation and compare its output when cache rules exist with the output when none exist. The change is complete when the no-rules response includes a `rules` array alongside the existing `debug_info`, `res`, and `res_message` fields, matching the proposed structure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100