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