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