@@ 2646-2664 (lines=19) @@ | ||
2643 | if community: |
|
2644 | cmd.add_element("community", community) |
|
2645 | ||
2646 | if privacy_algorithm is not None or privacy_password: |
|
2647 | _xmlprivacy = cmd.add_element("privacy") |
|
2648 | ||
2649 | if privacy_algorithm is not None: |
|
2650 | if not isinstance( |
|
2651 | privacy_algorithm, self.types.SnmpPrivacyAlgorithm |
|
2652 | ): |
|
2653 | raise InvalidArgumentType( |
|
2654 | function=self.create_credential.__name__, |
|
2655 | argument='privacy_algorithm', |
|
2656 | arg_type=SnmpPrivacyAlgorithm.__name__, |
|
2657 | ) |
|
2658 | ||
2659 | _xmlprivacy.add_element( |
|
2660 | "algorithm", privacy_algorithm.value |
|
2661 | ) |
|
2662 | ||
2663 | if privacy_password: |
|
2664 | _xmlprivacy.add_element("password", privacy_password) |
|
2665 | ||
2666 | if credential_type == CredentialType.PGP_ENCRYPTION_KEY: |
|
2667 | if not public_key: |
|
@@ 2768-2784 (lines=17) @@ | ||
2765 | if community: |
|
2766 | cmd.add_element("community", community) |
|
2767 | ||
2768 | if privacy_algorithm is not None or privacy_password is not None: |
|
2769 | _xmlprivacy = cmd.add_element("privacy") |
|
2770 | ||
2771 | if privacy_algorithm is not None: |
|
2772 | if not isinstance( |
|
2773 | privacy_algorithm, self.types.SnmpPrivacyAlgorithm |
|
2774 | ): |
|
2775 | raise InvalidArgumentType( |
|
2776 | function=self.modify_credential.__name__, |
|
2777 | argument='privacy_algorithm', |
|
2778 | arg_type=SnmpPrivacyAlgorithm.__name__, |
|
2779 | ) |
|
2780 | ||
2781 | _xmlprivacy.add_element("algorithm", privacy_algorithm.value) |
|
2782 | ||
2783 | if privacy_password is not None: |
|
2784 | _xmlprivacy.add_element("password", privacy_password) |
|
2785 | ||
2786 | if public_key: |
|
2787 | _xmlkey = cmd.add_element("key") |