| @@ 197-227 (lines=31) @@ | ||
| 194 | ||
| 195 | return self._send_xml_command(cmd) |
|
| 196 | ||
| 197 | def get_scanners( |
|
| 198 | self, |
|
| 199 | *, |
|
| 200 | filter_string: Optional[str] = None, |
|
| 201 | filter_id: Optional[str] = None, |
|
| 202 | trash: Optional[bool] = None, |
|
| 203 | details: Optional[bool] = None, |
|
| 204 | ) -> Any: |
|
| 205 | """Request a list of scanners |
|
| 206 | ||
| 207 | Arguments: |
|
| 208 | filter_string: Filter term to use for the query |
|
| 209 | filter_id: UUID of an existing filter to use for the query |
|
| 210 | trash: Whether to get the trashcan scanners instead |
|
| 211 | details: Whether to include extra details like tasks using this |
|
| 212 | scanner |
|
| 213 | ||
| 214 | Returns: |
|
| 215 | The response. See :py:meth:`send_command` for details. |
|
| 216 | """ |
|
| 217 | cmd = XmlCommand("get_scanners") |
|
| 218 | ||
| 219 | add_filter(cmd, filter_string, filter_id) |
|
| 220 | ||
| 221 | if trash is not None: |
|
| 222 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 223 | ||
| 224 | if details is not None: |
|
| 225 | cmd.set_attribute("details", to_bool(details)) |
|
| 226 | ||
| 227 | return self._send_xml_command(cmd) |
|
| 228 | ||
| 229 | def get_scanner(self, scanner_id: str) -> Any: |
|
| 230 | """Request a single scanner |
|
| @@ 253-282 (lines=30) @@ | ||
| 250 | ||
| 251 | return self._send_xml_command(cmd) |
|
| 252 | ||
| 253 | def get_targets( |
|
| 254 | self, |
|
| 255 | *, |
|
| 256 | filter_string: Optional[str] = None, |
|
| 257 | filter_id: Optional[str] = None, |
|
| 258 | trash: Optional[bool] = None, |
|
| 259 | tasks: Optional[bool] = None, |
|
| 260 | ) -> Any: |
|
| 261 | """Request a list of targets |
|
| 262 | ||
| 263 | Arguments: |
|
| 264 | filter_string: Filter term to use for the query |
|
| 265 | filter_id: UUID of an existing filter to use for the query |
|
| 266 | trash: Whether to get the trashcan targets instead |
|
| 267 | tasks: Whether to include list of tasks that use the target |
|
| 268 | ||
| 269 | Returns: |
|
| 270 | The response. See :py:meth:`send_command` for details. |
|
| 271 | """ |
|
| 272 | cmd = XmlCommand("get_targets") |
|
| 273 | ||
| 274 | add_filter(cmd, filter_string, filter_id) |
|
| 275 | ||
| 276 | if trash is not None: |
|
| 277 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 278 | ||
| 279 | if tasks is not None: |
|
| 280 | cmd.set_attribute("tasks", to_bool(tasks)) |
|
| 281 | ||
| 282 | return self._send_xml_command(cmd) |
|
| 283 | ||
| 284 | def modify_target( |
|
| 285 | self, |
|
| @@ 173-202 (lines=30) @@ | ||
| 170 | ||
| 171 | return self._send_xml_command(cmd) |
|
| 172 | ||
| 173 | def get_filters( |
|
| 174 | self, |
|
| 175 | *, |
|
| 176 | filter_string: Optional[str] = None, |
|
| 177 | filter_id: Optional[str] = None, |
|
| 178 | trash: Optional[bool] = None, |
|
| 179 | alerts: Optional[bool] = None, |
|
| 180 | ) -> Any: |
|
| 181 | """Request a list of filters |
|
| 182 | ||
| 183 | Arguments: |
|
| 184 | filter_string: Filter term to use for the query |
|
| 185 | filter_id: UUID of an existing filter to use for the query |
|
| 186 | trash: Whether to get the trashcan filters instead |
|
| 187 | alerts: Whether to include list of alerts that use the filter. |
|
| 188 | ||
| 189 | Returns: |
|
| 190 | The response. See :py:meth:`send_command` for details. |
|
| 191 | """ |
|
| 192 | cmd = XmlCommand("get_filters") |
|
| 193 | ||
| 194 | add_filter(cmd, filter_string, filter_id) |
|
| 195 | ||
| 196 | if trash is not None: |
|
| 197 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 198 | ||
| 199 | if alerts is not None: |
|
| 200 | cmd.set_attribute("alerts", to_bool(alerts)) |
|
| 201 | ||
| 202 | return self._send_xml_command(cmd) |
|
| 203 | ||
| 204 | def get_filter( |
|
| 205 | self, filter_id: str, *, alerts: Optional[bool] = None |
|
| @@ 152-181 (lines=30) @@ | ||
| 149 | ||
| 150 | return self._send_xml_command(cmd) |
|
| 151 | ||
| 152 | def get_tags( |
|
| 153 | self, |
|
| 154 | *, |
|
| 155 | filter_string: Optional[str] = None, |
|
| 156 | filter_id: Optional[str] = None, |
|
| 157 | trash: Optional[bool] = None, |
|
| 158 | names_only: Optional[bool] = None, |
|
| 159 | ) -> Any: |
|
| 160 | """Request a list of tags |
|
| 161 | ||
| 162 | Arguments: |
|
| 163 | filter_string: Filter term to use for the query |
|
| 164 | filter_id: UUID of an existing filter to use for the query |
|
| 165 | trash: Whether to get tags from the trashcan instead |
|
| 166 | names_only: Whether to get only distinct tag names |
|
| 167 | ||
| 168 | Returns: |
|
| 169 | The response. See :py:meth:`send_command` for details. |
|
| 170 | """ |
|
| 171 | cmd = XmlCommand("get_tags") |
|
| 172 | ||
| 173 | add_filter(cmd, filter_string, filter_id) |
|
| 174 | ||
| 175 | if trash is not None: |
|
| 176 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 177 | ||
| 178 | if names_only is not None: |
|
| 179 | cmd.set_attribute("names_only", to_bool(names_only)) |
|
| 180 | ||
| 181 | return self._send_xml_command(cmd) |
|
| 182 | ||
| 183 | def get_tag(self, tag_id: str) -> Any: |
|
| 184 | """Request a single tag |
|
| @@ 142-171 (lines=30) @@ | ||
| 139 | ||
| 140 | return self._send_xml_command(cmd) |
|
| 141 | ||
| 142 | def get_schedules( |
|
| 143 | self, |
|
| 144 | *, |
|
| 145 | filter_string: Optional[str] = None, |
|
| 146 | filter_id: Optional[str] = None, |
|
| 147 | trash: Optional[bool] = None, |
|
| 148 | tasks: Optional[bool] = None, |
|
| 149 | ) -> Any: |
|
| 150 | """Request a list of schedules |
|
| 151 | ||
| 152 | Arguments: |
|
| 153 | filter_string: Filter term to use for the query |
|
| 154 | filter_id: UUID of an existing filter to use for the query |
|
| 155 | trash: Whether to get the trashcan schedules instead |
|
| 156 | tasks: Whether to include tasks using the schedules |
|
| 157 | ||
| 158 | Returns: |
|
| 159 | The response. See :py:meth:`send_command` for details. |
|
| 160 | """ |
|
| 161 | cmd = XmlCommand("get_schedules") |
|
| 162 | ||
| 163 | add_filter(cmd, filter_string, filter_id) |
|
| 164 | ||
| 165 | if trash is not None: |
|
| 166 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 167 | ||
| 168 | if tasks is not None: |
|
| 169 | cmd.set_attribute("tasks", to_bool(tasks)) |
|
| 170 | ||
| 171 | return self._send_xml_command(cmd) |
|
| 172 | ||
| 173 | def get_schedule( |
|
| 174 | self, schedule_id: str, *, tasks: Optional[bool] = None |
|
| @@ 357-385 (lines=29) @@ | ||
| 354 | ||
| 355 | return self._send_xml_command(cmd) |
|
| 356 | ||
| 357 | def get_alerts( |
|
| 358 | self, |
|
| 359 | *, |
|
| 360 | filter_string: Optional[str] = None, |
|
| 361 | filter_id: Optional[str] = None, |
|
| 362 | trash: Optional[bool] = None, |
|
| 363 | tasks: Optional[bool] = None, |
|
| 364 | ) -> Any: |
|
| 365 | """Request a list of alerts |
|
| 366 | ||
| 367 | Arguments: |
|
| 368 | filter: Filter term to use for the query |
|
| 369 | filter_id: UUID of an existing filter to use for the query |
|
| 370 | trash: True to request the alerts in the trashcan |
|
| 371 | tasks: Whether to include the tasks using the alerts |
|
| 372 | Returns: |
|
| 373 | The response. See :py:meth:`send_command` for details. |
|
| 374 | """ |
|
| 375 | cmd = XmlCommand("get_alerts") |
|
| 376 | ||
| 377 | add_filter(cmd, filter_string, filter_id) |
|
| 378 | ||
| 379 | if trash is not None: |
|
| 380 | cmd.set_attribute("trash", to_bool(trash)) |
|
| 381 | ||
| 382 | if tasks is not None: |
|
| 383 | cmd.set_attribute("tasks", to_bool(tasks)) |
|
| 384 | ||
| 385 | return self._send_xml_command(cmd) |
|
| 386 | ||
| 387 | def get_alert(self, alert_id: str, *, tasks: Optional[bool] = None) -> Any: |
|
| 388 | """Request a single alert |
|