Removed unnecessary boolean results from API

This commit is contained in:
2016-11-13 18:05:36 +01:00
parent a80805a044
commit ecf398c9d0
4 changed files with 19 additions and 30 deletions

View File

@ -499,7 +499,7 @@ public class HTTPVaultConnector implements VaultConnector {
}
@Override
public boolean writeSecret(final String key, final String value) throws VaultConnectorException {
public void writeSecret(final String key, final String value) throws VaultConnectorException {
if (!isAuthorized())
throw new AuthorizationRequiredException();
@ -508,11 +508,12 @@ public class HTTPVaultConnector implements VaultConnector {
Map<String, String> param = new HashMap<>();
param.put("value", value);
return requestPost(PATH_SECRET + "/" + key, param).equals("");
if (!requestPost(PATH_SECRET + "/" + key, param).equals(""))
throw new InvalidResponseException("Received response where none was expected.");
}
@Override
public boolean deleteSecret(String key) throws VaultConnectorException {
public void deleteSecret(String key) throws VaultConnectorException {
if (!isAuthorized())
throw new AuthorizationRequiredException();
@ -521,13 +522,11 @@ public class HTTPVaultConnector implements VaultConnector {
/* Response should be code 204 without content */
if (!response.equals(""))
throw new InvalidResponseException("Received response where non was expected.");
return true;
throw new InvalidResponseException("Received response where none was expected.");
}
@Override
public boolean revoke(String leaseID) throws VaultConnectorException {
public void revoke(String leaseID) throws VaultConnectorException {
if (!isAuthorized())
throw new AuthorizationRequiredException();
@ -536,9 +535,7 @@ public class HTTPVaultConnector implements VaultConnector {
/* Response should be code 204 without content */
if (!response.equals(""))
throw new InvalidResponseException("Received response where non was expected.");
return true;
throw new InvalidResponseException("Received response where none was expected.");
}
@Override

View File

@ -387,28 +387,25 @@ public interface VaultConnector {
*
* @param key Secret path
* @param value Secret value
* @return TRUE on success
* @throws VaultConnectorException on error
*/
boolean writeSecret(final String key, final String value) throws VaultConnectorException;
void writeSecret(final String key, final String value) throws VaultConnectorException;
/**
* Delete secret from Vault.
*
* @param key Secret path
* @return TRUE on succevss
* @throws VaultConnectorException on error
*/
boolean deleteSecret(final String key) throws VaultConnectorException;
void deleteSecret(final String key) throws VaultConnectorException;
/**
* Revoke given lease immediately.
*
* @param leaseID the lease ID
* @return TRUE on success
* @throws VaultConnectorException on error
*/
boolean revoke(final String leaseID) throws VaultConnectorException;
void revoke(final String leaseID) throws VaultConnectorException;
/**
* Renew lease with given ID.