Search in sources :

Example 1 with VaultSecret

use of com.sequenceiq.cloudbreak.service.secret.vault.VaultSecret in project cloudbreak by hortonworks.

the class SecretService method getByResponse.

/**
 * Fetches the secret from Secret's store. If the secret is not found then null is returned.
 * If the secret is null then null is returned.
 *
 * @param secretResponse SecretResponse that refers to a Secret in the Secret engine
 * @return Secret content or null if the secret secret is not found.
 */
public String getByResponse(SecretResponse secretResponse) {
    if (secretResponse == null) {
        return null;
    }
    VaultSecret vaultSecret = new VaultSecret(secretResponse.getEnginePath(), VaultKvV2Engine.class.getCanonicalName(), secretResponse.getSecretPath());
    String secretAsJson = new Gson().toJson(vaultSecret);
    return get(secretAsJson);
}
Also used : VaultSecret(com.sequenceiq.cloudbreak.service.secret.vault.VaultSecret) VaultKvV2Engine(com.sequenceiq.cloudbreak.service.secret.vault.VaultKvV2Engine) Gson(com.google.gson.Gson)

Aggregations

Gson (com.google.gson.Gson)1 VaultKvV2Engine (com.sequenceiq.cloudbreak.service.secret.vault.VaultKvV2Engine)1 VaultSecret (com.sequenceiq.cloudbreak.service.secret.vault.VaultSecret)1