@@ 646-687 (lines=42) @@ | ||
643 | ||
644 | return self._send_xml_command(cmd) |
|
645 | ||
646 | def create_tls_certificate( |
|
647 | self, |
|
648 | name: str, |
|
649 | certificate: str, |
|
650 | *, |
|
651 | comment: Optional[str] = None, |
|
652 | trust: Optional[bool] = None, |
|
653 | ) -> Any: |
|
654 | """Create a new TLS certificate |
|
655 | ||
656 | Arguments: |
|
657 | name: Name of the TLS certificate, defaulting to the MD5 |
|
658 | fingerprint. |
|
659 | certificate: The Base64 encoded certificate data (x.509 DER or PEM). |
|
660 | comment: Comment for the TLS certificate. |
|
661 | trust: Whether the certificate is trusted. |
|
662 | ||
663 | Returns: |
|
664 | The response. See :py:meth:`send_command` for details. |
|
665 | """ |
|
666 | if not name: |
|
667 | raise RequiredArgument( |
|
668 | function=self.create_tls_certificate.__name__, argument='name' |
|
669 | ) |
|
670 | if not certificate: |
|
671 | raise RequiredArgument( |
|
672 | function=self.create_tls_certificate.__name__, |
|
673 | argument='certificate', |
|
674 | ) |
|
675 | ||
676 | cmd = XmlCommand("create_tls_certificate") |
|
677 | ||
678 | if comment: |
|
679 | cmd.add_element("comment", comment) |
|
680 | ||
681 | cmd.add_element("name", name) |
|
682 | cmd.add_element("certificate", certificate) |
|
683 | ||
684 | if trust: |
|
685 | cmd.add_element("trust", to_bool(trust)) |
|
686 | ||
687 | return self._send_xml_command(cmd) |
|
688 | ||
689 | def get_aggregates( |
|
690 | self, |
|
@@ 1351-1388 (lines=38) @@ | ||
1348 | ||
1349 | return self._send_xml_command(cmd) |
|
1350 | ||
1351 | def modify_tls_certificate( |
|
1352 | self, |
|
1353 | tls_certificate_id: str, |
|
1354 | *, |
|
1355 | name: Optional[str] = None, |
|
1356 | comment: Optional[str] = None, |
|
1357 | trust: Optional[bool] = None, |
|
1358 | ) -> Any: |
|
1359 | """Modifies an existing TLS certificate. |
|
1360 | ||
1361 | Arguments: |
|
1362 | tls_certificate_id: UUID of the TLS certificate to be modified. |
|
1363 | name: Name of the TLS certificate, defaulting to the MD5 fingerprint |
|
1364 | comment: Comment for the TLS certificate. |
|
1365 | trust: Whether the certificate is trusted. |
|
1366 | ||
1367 | Returns: |
|
1368 | The response. See :py:meth:`send_command` for details. |
|
1369 | """ |
|
1370 | if not tls_certificate_id: |
|
1371 | raise RequiredArgument( |
|
1372 | function=self.modify_tls_certificate.__name__, |
|
1373 | argument='tls_certificate_id', |
|
1374 | ) |
|
1375 | ||
1376 | cmd = XmlCommand("modify_tls_certificate") |
|
1377 | cmd.set_attribute("tls_certificate_id", str(tls_certificate_id)) |
|
1378 | ||
1379 | if comment: |
|
1380 | cmd.add_element("comment", comment) |
|
1381 | ||
1382 | if name: |
|
1383 | cmd.add_element("name", name) |
|
1384 | ||
1385 | if trust: |
|
1386 | cmd.add_element("trust", to_bool(trust)) |
|
1387 | ||
1388 | return self._send_xml_command(cmd) |
|
1389 | ||
1390 | def clone_alert(self, alert_id: str) -> Any: |
|
1391 | """Clone an existing alert |