@@ 747-788 (lines=42) @@ | ||
744 | preferences=preferences, |
|
745 | ) |
|
746 | ||
747 | def create_tls_certificate( |
|
748 | self, |
|
749 | name: str, |
|
750 | certificate: str, |
|
751 | *, |
|
752 | comment: Optional[str] = None, |
|
753 | trust: Optional[bool] = None, |
|
754 | ) -> Any: |
|
755 | """Create a new TLS certificate |
|
756 | ||
757 | Arguments: |
|
758 | name: Name of the TLS certificate, defaulting to the MD5 |
|
759 | fingerprint. |
|
760 | certificate: The Base64 encoded certificate data (x.509 DER or PEM). |
|
761 | comment: Comment for the TLS certificate. |
|
762 | trust: Whether the certificate is trusted. |
|
763 | ||
764 | Returns: |
|
765 | The response. See :py:meth:`send_command` for details. |
|
766 | """ |
|
767 | if not name: |
|
768 | raise RequiredArgument( |
|
769 | function=self.create_tls_certificate.__name__, argument='name' |
|
770 | ) |
|
771 | if not certificate: |
|
772 | raise RequiredArgument( |
|
773 | function=self.create_tls_certificate.__name__, |
|
774 | argument='certificate', |
|
775 | ) |
|
776 | ||
777 | cmd = XmlCommand("create_tls_certificate") |
|
778 | ||
779 | if comment: |
|
780 | cmd.add_element("comment", comment) |
|
781 | ||
782 | cmd.add_element("name", name) |
|
783 | cmd.add_element("certificate", certificate) |
|
784 | ||
785 | if trust: |
|
786 | cmd.add_element("trust", _to_bool(trust)) |
|
787 | ||
788 | return self._send_xml_command(cmd) |
|
789 | ||
790 | def get_aggregates( |
|
791 | self, |
|
@@ 1452-1489 (lines=38) @@ | ||
1449 | ||
1450 | return self._send_xml_command(cmd) |
|
1451 | ||
1452 | def modify_tls_certificate( |
|
1453 | self, |
|
1454 | tls_certificate_id: str, |
|
1455 | *, |
|
1456 | name: Optional[str] = None, |
|
1457 | comment: Optional[str] = None, |
|
1458 | trust: Optional[bool] = None, |
|
1459 | ) -> Any: |
|
1460 | """Modifies an existing TLS certificate. |
|
1461 | ||
1462 | Arguments: |
|
1463 | tls_certificate_id: UUID of the TLS certificate to be modified. |
|
1464 | name: Name of the TLS certificate, defaulting to the MD5 fingerprint |
|
1465 | comment: Comment for the TLS certificate. |
|
1466 | trust: Whether the certificate is trusted. |
|
1467 | ||
1468 | Returns: |
|
1469 | The response. See :py:meth:`send_command` for details. |
|
1470 | """ |
|
1471 | if not tls_certificate_id: |
|
1472 | raise RequiredArgument( |
|
1473 | function=self.modify_tls_certificate.__name__, |
|
1474 | argument='tls_certificate_id', |
|
1475 | ) |
|
1476 | ||
1477 | cmd = XmlCommand("modify_tls_certificate") |
|
1478 | cmd.set_attribute("tls_certificate_id", str(tls_certificate_id)) |
|
1479 | ||
1480 | if comment: |
|
1481 | cmd.add_element("comment", comment) |
|
1482 | ||
1483 | if name: |
|
1484 | cmd.add_element("name", name) |
|
1485 | ||
1486 | if trust: |
|
1487 | cmd.add_element("trust", _to_bool(trust)) |
|
1488 | ||
1489 | return self._send_xml_command(cmd) |
|
1490 | ||
1491 | def clone_tls_certificate(self, tls_certificate_id: str) -> Any: |
|
1492 | """Modifies an existing TLS certificate. |
@@ 620-661 (lines=42) @@ | ||
617 | preferences=preferences, |
|
618 | ) |
|
619 | ||
620 | def create_tls_certificate( |
|
621 | self, |
|
622 | name: str, |
|
623 | certificate: str, |
|
624 | *, |
|
625 | comment: Optional[str] = None, |
|
626 | trust: Optional[bool] = None, |
|
627 | ) -> Any: |
|
628 | """Create a new TLS certificate |
|
629 | ||
630 | Arguments: |
|
631 | name: Name of the TLS certificate, defaulting to the MD5 |
|
632 | fingerprint. |
|
633 | certificate: The Base64 encoded certificate data (x.509 DER or PEM). |
|
634 | comment: Comment for the TLS certificate. |
|
635 | trust: Whether the certificate is trusted. |
|
636 | ||
637 | Returns: |
|
638 | The response. See :py:meth:`send_command` for details. |
|
639 | """ |
|
640 | if not name: |
|
641 | raise RequiredArgument( |
|
642 | function=self.create_tls_certificate.__name__, argument='name' |
|
643 | ) |
|
644 | if not certificate: |
|
645 | raise RequiredArgument( |
|
646 | function=self.create_tls_certificate.__name__, |
|
647 | argument='certificate', |
|
648 | ) |
|
649 | ||
650 | cmd = XmlCommand("create_tls_certificate") |
|
651 | ||
652 | if comment: |
|
653 | cmd.add_element("comment", comment) |
|
654 | ||
655 | cmd.add_element("name", name) |
|
656 | cmd.add_element("certificate", certificate) |
|
657 | ||
658 | if trust: |
|
659 | cmd.add_element("trust", _to_bool(trust)) |
|
660 | ||
661 | return self._send_xml_command(cmd) |
|
662 | ||
663 | def get_aggregates( |
|
664 | self, |
|
@@ 1325-1362 (lines=38) @@ | ||
1322 | ||
1323 | return self._send_xml_command(cmd) |
|
1324 | ||
1325 | def modify_tls_certificate( |
|
1326 | self, |
|
1327 | tls_certificate_id: str, |
|
1328 | *, |
|
1329 | name: Optional[str] = None, |
|
1330 | comment: Optional[str] = None, |
|
1331 | trust: Optional[bool] = None, |
|
1332 | ) -> Any: |
|
1333 | """Modifies an existing TLS certificate. |
|
1334 | ||
1335 | Arguments: |
|
1336 | tls_certificate_id: UUID of the TLS certificate to be modified. |
|
1337 | name: Name of the TLS certificate, defaulting to the MD5 fingerprint |
|
1338 | comment: Comment for the TLS certificate. |
|
1339 | trust: Whether the certificate is trusted. |
|
1340 | ||
1341 | Returns: |
|
1342 | The response. See :py:meth:`send_command` for details. |
|
1343 | """ |
|
1344 | if not tls_certificate_id: |
|
1345 | raise RequiredArgument( |
|
1346 | function=self.modify_tls_certificate.__name__, |
|
1347 | argument='tls_certificate_id', |
|
1348 | ) |
|
1349 | ||
1350 | cmd = XmlCommand("modify_tls_certificate") |
|
1351 | cmd.set_attribute("tls_certificate_id", str(tls_certificate_id)) |
|
1352 | ||
1353 | if comment: |
|
1354 | cmd.add_element("comment", comment) |
|
1355 | ||
1356 | if name: |
|
1357 | cmd.add_element("name", name) |
|
1358 | ||
1359 | if trust: |
|
1360 | cmd.add_element("trust", _to_bool(trust)) |
|
1361 | ||
1362 | return self._send_xml_command(cmd) |
|
1363 | ||
1364 | def clone_tls_certificate(self, tls_certificate_id: str) -> Any: |
|
1365 | """Modifies an existing TLS certificate. |