client_40.py 924 B

1234567891011121314151617181920212223
  1. def get_azure_secret(self, vault_name, key_name, version=None, **kwargs):
  2. '''
  3. @dev get secret from azure key vault
  4. @param vault_name key vault name
  5. @param key_name sercrt's key
  6. @param version version of the secret to get. if unspecified, gets the latest version
  7. @return secret(KeyVaultSecret)
  8. '''
  9. update_mempool = True
  10. secret = None
  11. key = self.create_memory_key_with_args(vault_name, key_name, version)
  12. if self.use_mempool:
  13. secret = self.get_memory_key_value(key)
  14. if not secret:
  15. secret = azure_get_secret(vault_name, key_name, version, **kwargs)
  16. else:
  17. update_mempool = False
  18. else:
  19. secret = azure_get_secret(vault_name, key_name, version, **kwargs)
  20. if update_mempool:
  21. self.set_memory_key_value(key, secret)
  22. return secret