client_41.py 921 B

1234567891011121314151617181920212223
  1. def get_azure_secret_value(self, vault_name, key_name, version=None, **kwargs):
  2. '''
  3. @dev get secret from azure key vault
  4. @param vault_name name of key vault
  5. @param key_name the name of secret
  6. @param key_value the value of secret
  7. @return value of secret(KeyVaultSecret)
  8. '''
  9. secret = None
  10. update_mempool = True
  11. key = self.create_memory_key_with_args(vault_name, key_name, version, "value")
  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).value
  16. else:
  17. update_mempool = False
  18. else:
  19. secret = azure_get_secret(vault_name, key_name, version, **kwargs).value
  20. if update_mempool:
  21. self.set_memory_key_value(key, secret)
  22. return secret