io.quarkus.vault.transit.VaultBatchException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-vault Show documentation
Show all versions of quarkus-vault Show documentation
Store your credentials securely in HashiCorp Vault
package io.quarkus.vault.transit;
import static java.util.stream.Collectors.toMap;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Predicate;
import io.quarkus.vault.VaultException;
import io.quarkus.vault.runtime.transit.VaultTransitBatchResult;
/**
* Base class for batch exceptions.
*/
public abstract class VaultBatchException extends VaultException {
protected Map filter(Map results, Predicate predicate,
Function function) {
return results.entrySet().stream()
.filter(entry -> predicate.test(entry.getValue()))
.collect(toMap(Map.Entry::getKey, entry -> function.apply(entry.getValue())));
}
protected Map getErrors(Map results) {
return filter(results, VaultTransitBatchResult::isInError, VaultTransitBatchResult::getError);
}
protected Map getValid(Map results) {
return filter(results, VaultTransitBatchResult::isValid, VaultTransitBatchResult::getValue);
}
public VaultBatchException(String message) {
super(message);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy