Repository navigation
Add Recast Rules API support - #1024
Conversation
|
Overall looks good, however I'd want to see more documentation in the docstring. Take a look at this as a good example: https://github.com/tenable/pyTenable/blob/main/tenable/io/agents.py#L44-L100 |
|
|
||
|
|
||
| class RecastRulesAPI(TIOEndpoint): | ||
| """The Tenable Vulnerability Management Recast Rules API.""" |
There was a problem hiding this comment.
Improve documentation
| expires_at: str | None = None, | ||
| disabled_details: dict[str, Any] | None = None, | ||
| ) -> dict[str, Any]: | ||
| """Create a recast rule.""" |
There was a problem hiding this comment.
Improve documentation
| sort: list[str] | None = None, | ||
| next: str | None = None, | ||
| ) -> dict[str, Any]: | ||
| """Search recast rules.""" |
There was a problem hiding this comment.
Improve documentation
| return self._api.post('v1/recast/rules/search', json=payload).json() | ||
|
|
||
| def details(self, rule_id: str) -> dict[str, Any]: | ||
| """Retrieve a recast rule by UUID.""" |
There was a problem hiding this comment.
Improve documentation
| expires_at: str | None = None, | ||
| disabled_details: dict[str, Any] | None = None, | ||
| ) -> dict[str, Any]: | ||
| """Update a recast rule by UUID.""" |
There was a problem hiding this comment.
Improve documentation
| ).json() | ||
|
|
||
| def delete(self, rule_id: str) -> dict[str, Any]: | ||
| """Delete a recast rule by UUID.""" |
There was a problem hiding this comment.
Improve documentation
| ).json() | ||
|
|
||
| def filters(self) -> dict[str, Any]: | ||
| """Retrieve the available recast rule filters.""" |
There was a problem hiding this comment.
Improve documentation
|
I expanded the Recast Rules API docstrings in d2e3402 with parameter descriptions, return values, and usage examples following the existing endpoint style. The current PR checks, including Python 3.11–3.14 unit tests and the documentation build, have passed. |
Description
This adds a
tio.recast_rulesinterface for the Tenable Vulnerability Management Recast Rules API. The interface supports creating, searching, retrieving, updating, and deleting rules, along with listing the available rule filters. It validates documented resource types, UUIDs, payload types, and the search limit while passing API-defined filter and sort objects through unchanged.The interface uses the published
/v1/recast/rulespaths for all six operations and is included in the generated API documentation. No dependencies are required.Fixes #967
Type of change
How Has This Been Tested?
Request-level tests exercise all six endpoints without live credentials and assert HTTP methods, paths, JSON payloads, response handling, and invalid resource-type/limit behavior.
uv run --python 3.12 --isolated --group dev pytest -q -o addopts= tests/io/test_recast_rules.py(4 passed)just lint 3.12just audituv run --python 3.12 --isolated --group docs sphinx-build -W -b html docs /tmp/pytenable-docs-recastb48a0a4(run)Test Configuration:
Checklist: