| @@ 199-229 (lines=31) @@ | ||
| 196 | ||
| 197 | return self._send_xml_command(cmd) |
|
| 198 | ||
| 199 | def get_scanners( |
|
| 200 | self, |
|
| 201 | *, |
|
| 202 | filter: Optional[str] = None, |
|
| 203 | filter_id: Optional[str] = None, |
|
| 204 | trash: Optional[bool] = None, |
|
| 205 | details: Optional[bool] = None, |
|
| 206 | ) -> Any: |
|
| 207 | """Request a list of scanners |
|
| 208 | ||
| 209 | Arguments: |
|
| 210 | filter: Filter term to use for the query |
|
| 211 | filter_id: UUID of an existing filter to use for the query |
|
| 212 | trash: Whether to get the trashcan scanners instead |
|
| 213 | details: Whether to include extra details like tasks using this |
|
| 214 | scanner |
|
| 215 | ||
| 216 | Returns: |
|
| 217 | The response. See :py:meth:`send_command` for details. |
|
| 218 | """ |
|
| 219 | cmd = XmlCommand("get_scanners") |
|
| 220 | ||
| 221 | add_filter(cmd, filter, filter_id) |
|
| 222 | ||
| 223 | if trash is not None: |
|
| 224 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 225 | ||
| 226 | if details is not None: |
|
| 227 | cmd.set_attribute("details", to_bool(details)) |
|
| 228 | ||
| 229 | return self._send_xml_command(cmd) |
|
| 230 | ||
| 231 | def get_scanner(self, scanner_id: str) -> Any: |
|
| 232 | """Request a single scanner |
|
| @@ 254-283 (lines=30) @@ | ||
| 251 | ||
| 252 | return self._send_xml_command(cmd) |
|
| 253 | ||
| 254 | def get_targets( |
|
| 255 | self, |
|
| 256 | *, |
|
| 257 | filter: Optional[str] = None, |
|
| 258 | filter_id: Optional[str] = None, |
|
| 259 | trash: Optional[bool] = None, |
|
| 260 | tasks: Optional[bool] = None, |
|
| 261 | ) -> Any: |
|
| 262 | """Request a list of targets |
|
| 263 | ||
| 264 | Arguments: |
|
| 265 | filter: Filter term to use for the query |
|
| 266 | filter_id: UUID of an existing filter to use for the query |
|
| 267 | trash: Whether to get the trashcan targets instead |
|
| 268 | tasks: Whether to include list of tasks that use the target |
|
| 269 | ||
| 270 | Returns: |
|
| 271 | The response. See :py:meth:`send_command` for details. |
|
| 272 | """ |
|
| 273 | cmd = XmlCommand("get_targets") |
|
| 274 | ||
| 275 | add_filter(cmd, filter, filter_id) |
|
| 276 | ||
| 277 | if trash is not None: |
|
| 278 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 279 | ||
| 280 | if tasks is not None: |
|
| 281 | cmd.set_attribute("tasks", to_bool(tasks)) |
|
| 282 | ||
| 283 | return self._send_xml_command(cmd) |
|
| 284 | ||
| 285 | def modify_target( |
|
| 286 | self, |
|
| @@ 360-388 (lines=29) @@ | ||
| 357 | ||
| 358 | return self._send_xml_command(cmd) |
|
| 359 | ||
| 360 | def get_alerts( |
|
| 361 | self, |
|
| 362 | *, |
|
| 363 | filter: Optional[str] = None, |
|
| 364 | filter_id: Optional[str] = None, |
|
| 365 | trash: Optional[bool] = None, |
|
| 366 | tasks: Optional[bool] = None, |
|
| 367 | ) -> Any: |
|
| 368 | """Request a list of alerts |
|
| 369 | ||
| 370 | Arguments: |
|
| 371 | filter: Filter term to use for the query |
|
| 372 | filter_id: UUID of an existing filter to use for the query |
|
| 373 | trash: True to request the alerts in the trashcan |
|
| 374 | tasks: Whether to include the tasks using the alerts |
|
| 375 | Returns: |
|
| 376 | The response. See :py:meth:`send_command` for details. |
|
| 377 | """ |
|
| 378 | cmd = XmlCommand("get_alerts") |
|
| 379 | ||
| 380 | add_filter(cmd, filter, filter_id) |
|
| 381 | ||
| 382 | if trash is not None: |
|
| 383 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 384 | ||
| 385 | if tasks is not None: |
|
| 386 | cmd.set_attribute("tasks", to_bool(tasks)) |
|
| 387 | ||
| 388 | return self._send_xml_command(cmd) |
|
| 389 | ||
| 390 | def get_alert(self, alert_id: str, *, tasks: Optional[bool] = None) -> Any: |
|
| 391 | """Request a single alert |
|
| @@ 1754-1783 (lines=30) @@ | ||
| 1751 | ||
| 1752 | return self._send_xml_command(cmd) |
|
| 1753 | ||
| 1754 | def get_tags( |
|
| 1755 | self, |
|
| 1756 | *, |
|
| 1757 | filter: Optional[str] = None, |
|
| 1758 | filter_id: Optional[str] = None, |
|
| 1759 | trash: Optional[bool] = None, |
|
| 1760 | names_only: Optional[bool] = None, |
|
| 1761 | ) -> Any: |
|
| 1762 | """Request a list of tags |
|
| 1763 | ||
| 1764 | Arguments: |
|
| 1765 | filter: Filter term to use for the query |
|
| 1766 | filter_id: UUID of an existing filter to use for the query |
|
| 1767 | trash: Whether to get tags from the trashcan instead |
|
| 1768 | names_only: Whether to get only distinct tag names |
|
| 1769 | ||
| 1770 | Returns: |
|
| 1771 | The response. See :py:meth:`send_command` for details. |
|
| 1772 | """ |
|
| 1773 | cmd = XmlCommand("get_tags") |
|
| 1774 | ||
| 1775 | add_filter(cmd, filter, filter_id) |
|
| 1776 | ||
| 1777 | if trash is not None: |
|
| 1778 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 1779 | ||
| 1780 | if names_only is not None: |
|
| 1781 | cmd.set_attribute("names_only", to_bool(names_only)) |
|
| 1782 | ||
| 1783 | return self._send_xml_command(cmd) |
|
| 1784 | ||
| 1785 | def get_tag(self, tag_id: str) -> Any: |
|
| 1786 | """Request a single tag |
|
| @@ 1611-1640 (lines=30) @@ | ||
| 1608 | cmd.set_attribute("role_id", role_id) |
|
| 1609 | return self._send_xml_command(cmd) |
|
| 1610 | ||
| 1611 | def get_schedules( |
|
| 1612 | self, |
|
| 1613 | *, |
|
| 1614 | filter: Optional[str] = None, |
|
| 1615 | filter_id: Optional[str] = None, |
|
| 1616 | trash: Optional[bool] = None, |
|
| 1617 | tasks: Optional[bool] = None, |
|
| 1618 | ) -> Any: |
|
| 1619 | """Request a list of schedules |
|
| 1620 | ||
| 1621 | Arguments: |
|
| 1622 | filter: Filter term to use for the query |
|
| 1623 | filter_id: UUID of an existing filter to use for the query |
|
| 1624 | trash: Whether to get the trashcan schedules instead |
|
| 1625 | tasks: Whether to include tasks using the schedules |
|
| 1626 | ||
| 1627 | Returns: |
|
| 1628 | The response. See :py:meth:`send_command` for details. |
|
| 1629 | """ |
|
| 1630 | cmd = XmlCommand("get_schedules") |
|
| 1631 | ||
| 1632 | add_filter(cmd, filter, filter_id) |
|
| 1633 | ||
| 1634 | if trash is not None: |
|
| 1635 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 1636 | ||
| 1637 | if tasks is not None: |
|
| 1638 | cmd.set_attribute("tasks", to_bool(tasks)) |
|
| 1639 | ||
| 1640 | return self._send_xml_command(cmd) |
|
| 1641 | ||
| 1642 | def get_schedule( |
|
| 1643 | self, schedule_id: str, *, tasks: Optional[bool] = None |
|
| @@ 1336-1365 (lines=30) @@ | ||
| 1333 | """ |
|
| 1334 | return self._send_xml_command(XmlCommand("get_feeds")) |
|
| 1335 | ||
| 1336 | def get_filters( |
|
| 1337 | self, |
|
| 1338 | *, |
|
| 1339 | filter: Optional[str] = None, |
|
| 1340 | filter_id: Optional[str] = None, |
|
| 1341 | trash: Optional[bool] = None, |
|
| 1342 | alerts: Optional[bool] = None, |
|
| 1343 | ) -> Any: |
|
| 1344 | """Request a list of filters |
|
| 1345 | ||
| 1346 | Arguments: |
|
| 1347 | filter: Filter term to use for the query |
|
| 1348 | filter_id: UUID of an existing filter to use for the query |
|
| 1349 | trash: Whether to get the trashcan filters instead |
|
| 1350 | alerts: Whether to include list of alerts that use the filter. |
|
| 1351 | ||
| 1352 | Returns: |
|
| 1353 | The response. See :py:meth:`send_command` for details. |
|
| 1354 | """ |
|
| 1355 | cmd = XmlCommand("get_filters") |
|
| 1356 | ||
| 1357 | add_filter(cmd, filter, filter_id) |
|
| 1358 | ||
| 1359 | if trash is not None: |
|
| 1360 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 1361 | ||
| 1362 | if alerts is not None: |
|
| 1363 | cmd.set_attribute("alerts", to_bool(alerts)) |
|
| 1364 | ||
| 1365 | return self._send_xml_command(cmd) |
|
| 1366 | ||
| 1367 | def get_filter( |
|
| 1368 | self, filter_id: str, *, alerts: Optional[bool] = None |
|