|
21 | 21 | Reports, |
22 | 22 | ResourceNames, |
23 | 23 | ResourceType, |
| 24 | + Scanners, |
| 25 | + ScannerType, |
24 | 26 | ) |
25 | 27 |
|
26 | 28 |
|
@@ -446,3 +448,156 @@ def modify_report_config( |
446 | 448 | report_config_id, name=name, comment=comment, params=params |
447 | 449 | ) |
448 | 450 | ) |
| 451 | + |
| 452 | + def create_scanner( |
| 453 | + self, |
| 454 | + name: str, |
| 455 | + host: str, |
| 456 | + port: Union[str, int], |
| 457 | + scanner_type: ScannerType, |
| 458 | + credential_id: str, |
| 459 | + *, |
| 460 | + ca_pub: Optional[str] = None, |
| 461 | + comment: Optional[str] = None, |
| 462 | + relay_host: Optional[str] = None, |
| 463 | + relay_port: Optional[Union[str, int]] = None, |
| 464 | + ) -> T: |
| 465 | + """Create a new scanner |
| 466 | +
|
| 467 | + Args: |
| 468 | + name: Name of the new scanner |
| 469 | + host: Hostname or IP address of the scanner |
| 470 | + port: Port of the scanner |
| 471 | + scanner_type: Type of the scanner |
| 472 | + credential_id: UUID of client certificate credential for the |
| 473 | + scanner |
| 474 | + ca_pub: Certificate of CA to verify scanner certificate |
| 475 | + comment: Comment for the scanner |
| 476 | + relay_host: Hostname or IP address of the scanner relay |
| 477 | + relay_port: Port of the scanner relay |
| 478 | + """ |
| 479 | + return self._send_request_and_transform_response( |
| 480 | + Scanners.create_scanner( |
| 481 | + name, |
| 482 | + host, |
| 483 | + port, |
| 484 | + scanner_type, |
| 485 | + credential_id, |
| 486 | + ca_pub=ca_pub, |
| 487 | + comment=comment, |
| 488 | + relay_host=relay_host, |
| 489 | + relay_port=relay_port, |
| 490 | + ) |
| 491 | + ) |
| 492 | + |
| 493 | + def modify_scanner( |
| 494 | + self, |
| 495 | + scanner_id: EntityID, |
| 496 | + *, |
| 497 | + name: Optional[str] = None, |
| 498 | + host: Optional[str] = None, |
| 499 | + port: Optional[int] = None, |
| 500 | + scanner_type: Optional[ScannerType] = None, |
| 501 | + credential_id: Optional[EntityID] = None, |
| 502 | + ca_pub: Optional[str] = None, |
| 503 | + comment: Optional[str] = None, |
| 504 | + relay_host: Optional[str] = None, |
| 505 | + relay_port: Optional[Union[str, int]] = None, |
| 506 | + ) -> T: |
| 507 | + """Modify an existing scanner |
| 508 | +
|
| 509 | + Args: |
| 510 | + scanner_id: UUID of the scanner to modify |
| 511 | + name: New name of the scanner |
| 512 | + host: New hostname or IP address of the scanner |
| 513 | + port: New port of the scanner |
| 514 | + scanner_type: New type of the scanner |
| 515 | + credential_id: New UUID of client certificate credential for the |
| 516 | + scanner |
| 517 | + ca_pub: New certificate of CA to verify scanner certificate |
| 518 | + comment: New comment for the scanner |
| 519 | + relay_host: Hostname or IP address of the scanner relay |
| 520 | + relay_port: Port of the scanner relay |
| 521 | + """ |
| 522 | + return self._send_request_and_transform_response( |
| 523 | + Scanners.modify_scanner( |
| 524 | + scanner_id, |
| 525 | + name=name, |
| 526 | + host=host, |
| 527 | + port=port, |
| 528 | + scanner_type=scanner_type, |
| 529 | + credential_id=credential_id, |
| 530 | + ca_pub=ca_pub, |
| 531 | + comment=comment, |
| 532 | + relay_host=relay_host, |
| 533 | + relay_port=relay_port, |
| 534 | + ) |
| 535 | + ) |
| 536 | + |
| 537 | + def get_scanners( |
| 538 | + self, |
| 539 | + *, |
| 540 | + filter_string: Optional[str] = None, |
| 541 | + filter_id: Optional[EntityID] = None, |
| 542 | + trash: Optional[bool] = None, |
| 543 | + details: Optional[bool] = None, |
| 544 | + ) -> T: |
| 545 | + """Request a list of scanners |
| 546 | +
|
| 547 | + Args: |
| 548 | + filter_string: Filter term to use for the query |
| 549 | + filter_id: UUID of an existing filter to use for the query |
| 550 | + trash: Whether to get the trashcan scanners instead |
| 551 | + details: Whether to include extra details like tasks using this |
| 552 | + scanner |
| 553 | + """ |
| 554 | + return self._send_request_and_transform_response( |
| 555 | + Scanners.get_scanners( |
| 556 | + filter_string=filter_string, |
| 557 | + filter_id=filter_id, |
| 558 | + trash=trash, |
| 559 | + details=details, |
| 560 | + ) |
| 561 | + ) |
| 562 | + |
| 563 | + def get_scanner(self, scanner_id: EntityID) -> T: |
| 564 | + """Request a single scanner |
| 565 | +
|
| 566 | + Args: |
| 567 | + scanner_id: UUID of an existing scanner |
| 568 | + """ |
| 569 | + return self._send_request_and_transform_response( |
| 570 | + Scanners.get_scanner(scanner_id) |
| 571 | + ) |
| 572 | + |
| 573 | + def verify_scanner(self, scanner_id: EntityID) -> T: |
| 574 | + """Verify an existing scanner |
| 575 | +
|
| 576 | + Args: |
| 577 | + scanner_id: UUID of an existing scanner |
| 578 | + """ |
| 579 | + return self._send_request_and_transform_response( |
| 580 | + Scanners.verify_scanner(scanner_id) |
| 581 | + ) |
| 582 | + |
| 583 | + def clone_scanner(self, scanner_id: EntityID) -> T: |
| 584 | + """Clone an existing scanner |
| 585 | +
|
| 586 | + Args: |
| 587 | + scanner_id: UUID of an existing scanner |
| 588 | + """ |
| 589 | + return self._send_request_and_transform_response( |
| 590 | + Scanners.clone_scanner(scanner_id) |
| 591 | + ) |
| 592 | + |
| 593 | + def delete_scanner( |
| 594 | + self, scanner_id: EntityID, ultimate: Optional[bool] = False |
| 595 | + ) -> T: |
| 596 | + """Delete an existing scanner |
| 597 | +
|
| 598 | + Args: |
| 599 | + scanner_id: UUID of an existing scanner |
| 600 | + """ |
| 601 | + return self._send_request_and_transform_response( |
| 602 | + Scanners.delete_scanner(scanner_id, ultimate=ultimate) |
| 603 | + ) |
0 commit comments