| @@ 698-739 (lines=42) @@ | ||
| 695 | preferences=preferences, |
|
| 696 | ) |
|
| 697 | ||
| 698 | def create_tls_certificate( |
|
| 699 | self, |
|
| 700 | name: str, |
|
| 701 | certificate: str, |
|
| 702 | *, |
|
| 703 | comment: Optional[str] = None, |
|
| 704 | trust: Optional[bool] = None, |
|
| 705 | ) -> Any: |
|
| 706 | """Create a new TLS certificate |
|
| 707 | ||
| 708 | Arguments: |
|
| 709 | name: Name of the TLS certificate, defaulting to the MD5 |
|
| 710 | fingerprint. |
|
| 711 | certificate: The Base64 encoded certificate data (x.509 DER or PEM). |
|
| 712 | comment: Comment for the TLS certificate. |
|
| 713 | trust: Whether the certificate is trusted. |
|
| 714 | ||
| 715 | Returns: |
|
| 716 | The response. See :py:meth:`send_command` for details. |
|
| 717 | """ |
|
| 718 | if not name: |
|
| 719 | raise RequiredArgument( |
|
| 720 | function=self.create_tls_certificate.__name__, argument='name' |
|
| 721 | ) |
|
| 722 | if not certificate: |
|
| 723 | raise RequiredArgument( |
|
| 724 | function=self.create_tls_certificate.__name__, |
|
| 725 | argument='certificate', |
|
| 726 | ) |
|
| 727 | ||
| 728 | cmd = XmlCommand("create_tls_certificate") |
|
| 729 | ||
| 730 | if comment: |
|
| 731 | cmd.add_element("comment", comment) |
|
| 732 | ||
| 733 | cmd.add_element("name", name) |
|
| 734 | cmd.add_element("certificate", certificate) |
|
| 735 | ||
| 736 | if trust: |
|
| 737 | cmd.add_element("trust", to_bool(trust)) |
|
| 738 | ||
| 739 | return self._send_xml_command(cmd) |
|
| 740 | ||
| 741 | def get_aggregates( |
|
| 742 | self, |
|
| @@ 1403-1440 (lines=38) @@ | ||
| 1400 | ||
| 1401 | return self._send_xml_command(cmd) |
|
| 1402 | ||
| 1403 | def modify_tls_certificate( |
|
| 1404 | self, |
|
| 1405 | tls_certificate_id: str, |
|
| 1406 | *, |
|
| 1407 | name: Optional[str] = None, |
|
| 1408 | comment: Optional[str] = None, |
|
| 1409 | trust: Optional[bool] = None, |
|
| 1410 | ) -> Any: |
|
| 1411 | """Modifies an existing TLS certificate. |
|
| 1412 | ||
| 1413 | Arguments: |
|
| 1414 | tls_certificate_id: UUID of the TLS certificate to be modified. |
|
| 1415 | name: Name of the TLS certificate, defaulting to the MD5 fingerprint |
|
| 1416 | comment: Comment for the TLS certificate. |
|
| 1417 | trust: Whether the certificate is trusted. |
|
| 1418 | ||
| 1419 | Returns: |
|
| 1420 | The response. See :py:meth:`send_command` for details. |
|
| 1421 | """ |
|
| 1422 | if not tls_certificate_id: |
|
| 1423 | raise RequiredArgument( |
|
| 1424 | function=self.modify_tls_certificate.__name__, |
|
| 1425 | argument='tls_certificate_id', |
|
| 1426 | ) |
|
| 1427 | ||
| 1428 | cmd = XmlCommand("modify_tls_certificate") |
|
| 1429 | cmd.set_attribute("tls_certificate_id", str(tls_certificate_id)) |
|
| 1430 | ||
| 1431 | if comment: |
|
| 1432 | cmd.add_element("comment", comment) |
|
| 1433 | ||
| 1434 | if name: |
|
| 1435 | cmd.add_element("name", name) |
|
| 1436 | ||
| 1437 | if trust: |
|
| 1438 | cmd.add_element("trust", to_bool(trust)) |
|
| 1439 | ||
| 1440 | return self._send_xml_command(cmd) |
|
| 1441 | ||
| 1442 | def clone_alert(self, alert_id: str) -> Any: |
|
| 1443 | """Clone an existing alert |
|