@@ 2292-2310 (lines=19) @@ | ||
2289 | if community: |
|
2290 | cmd.add_element("community", community) |
|
2291 | ||
2292 | if privacy_algorithm is not None or privacy_password: |
|
2293 | _xmlprivacy = cmd.add_element("privacy") |
|
2294 | ||
2295 | if privacy_algorithm is not None: |
|
2296 | if not isinstance( |
|
2297 | privacy_algorithm, self.types.SnmpPrivacyAlgorithm |
|
2298 | ): |
|
2299 | raise InvalidArgumentType( |
|
2300 | function=self.create_credential.__name__, |
|
2301 | argument='privacy_algorithm', |
|
2302 | arg_type=SnmpPrivacyAlgorithm.__name__, |
|
2303 | ) |
|
2304 | ||
2305 | _xmlprivacy.add_element( |
|
2306 | "algorithm", privacy_algorithm.value |
|
2307 | ) |
|
2308 | ||
2309 | if privacy_password: |
|
2310 | _xmlprivacy.add_element("password", privacy_password) |
|
2311 | ||
2312 | if credential_type == CredentialType.PGP_ENCRYPTION_KEY: |
|
2313 | if not public_key: |
|
@@ 2414-2430 (lines=17) @@ | ||
2411 | if community: |
|
2412 | cmd.add_element("community", community) |
|
2413 | ||
2414 | if privacy_algorithm is not None or privacy_password is not None: |
|
2415 | _xmlprivacy = cmd.add_element("privacy") |
|
2416 | ||
2417 | if privacy_algorithm is not None: |
|
2418 | if not isinstance( |
|
2419 | privacy_algorithm, self.types.SnmpPrivacyAlgorithm |
|
2420 | ): |
|
2421 | raise InvalidArgumentType( |
|
2422 | function=self.modify_credential.__name__, |
|
2423 | argument='privacy_algorithm', |
|
2424 | arg_type=SnmpPrivacyAlgorithm.__name__, |
|
2425 | ) |
|
2426 | ||
2427 | _xmlprivacy.add_element("algorithm", privacy_algorithm.value) |
|
2428 | ||
2429 | if privacy_password is not None: |
|
2430 | _xmlprivacy.add_element("password", privacy_password) |
|
2431 | ||
2432 | if public_key: |
|
2433 | _xmlkey = cmd.add_element("key") |