Search in sources :

Example 1 with DeletedSecret

use of com.azure.security.keyvault.secrets.models.DeletedSecret in project lowkey-vault by nagyesta.

the class SecretsStepDefs method countSecretsWithKeyNamePrefixAreDeleted.

@Given("{int} secrets with {name} prefix are deleted")
public void countSecretsWithKeyNamePrefixAreDeleted(final int count, final String prefix) {
    final List<String> deleted = IntStream.range(0, count).mapToObj(i -> {
        final DeletedSecret actual = context.getClient(context.getSecretServiceVersion()).beginDeleteSecret(prefix + (i + 1)).waitForCompletion().getValue();
        context.setLastDeleted(actual);
        return actual;
    }).map(DeletedSecret::getRecoveryId).collect(Collectors.toList());
    context.setDeletedRecoveryIds(deleted);
}
Also used : DeletedSecret(com.azure.security.keyvault.secrets.models.DeletedSecret) Given(io.cucumber.java.en.Given)

Example 2 with DeletedSecret

use of com.azure.security.keyvault.secrets.models.DeletedSecret in project lowkey-vault by nagyesta.

the class SecretsStepDefs method theSecretIsPurged.

@When("the secret is purged")
public void theSecretIsPurged() {
    final DeletedSecret deleted = context.getLastDeleted();
    context.getClient(context.getSecretServiceVersion()).purgeDeletedSecret(deleted.getName());
}
Also used : DeletedSecret(com.azure.security.keyvault.secrets.models.DeletedSecret) When(io.cucumber.java.en.When)

Example 3 with DeletedSecret

use of com.azure.security.keyvault.secrets.models.DeletedSecret in project lowkey-vault by nagyesta.

the class SecretsStepDefs method theSecretIsDeleted.

@And("the secret is deleted")
public void theSecretIsDeleted() {
    final DeletedSecret actual = context.getClient(context.getSecretServiceVersion()).beginDeleteSecret(context.getLastResult().getName()).waitForCompletion().getValue();
    context.setLastDeleted(actual);
}
Also used : DeletedSecret(com.azure.security.keyvault.secrets.models.DeletedSecret) And(io.cucumber.java.en.And)

Example 4 with DeletedSecret

use of com.azure.security.keyvault.secrets.models.DeletedSecret in project lowkey-vault by nagyesta.

the class SecretsStepDefs method secretIsRecovered.

@When("secret is recovered")
public void secretIsRecovered() {
    final DeletedSecret deleted = context.getLastDeleted();
    final KeyVaultSecret secret = context.getClient(context.getSecretServiceVersion()).beginRecoverDeletedSecret(deleted.getName()).waitForCompletion().getValue();
    context.addFetchedSecret(secret.getName(), secret);
}
Also used : KeyVaultSecret(com.azure.security.keyvault.secrets.models.KeyVaultSecret) DeletedSecret(com.azure.security.keyvault.secrets.models.DeletedSecret) When(io.cucumber.java.en.When)

Aggregations

DeletedSecret (com.azure.security.keyvault.secrets.models.DeletedSecret)4 When (io.cucumber.java.en.When)2 KeyVaultSecret (com.azure.security.keyvault.secrets.models.KeyVaultSecret)1 And (io.cucumber.java.en.And)1 Given (io.cucumber.java.en.Given)1