diff --git a/spring-credhub-core/src/main/java/org/springframework/credhub/core/CredHubOperations.java b/spring-credhub-core/src/main/java/org/springframework/credhub/core/CredHubOperations.java
index e423774..9b243cd 100644
--- a/spring-credhub-core/src/main/java/org/springframework/credhub/core/CredHubOperations.java
+++ b/spring-credhub-core/src/main/java/org/springframework/credhub/core/CredHubOperations.java
@@ -55,7 +55,7 @@ public interface CredHubOperations {
* @param
the credential parameter implementation type
* @return the details of the generated credential
*/
- CredentialDetails generate(ParametersRequest parametersRequest);
+ CredentialDetails generate(final ParametersRequest parametersRequest);
/**
* Regenerate a credential in CredHub. Only credentials that were previously generated can be
@@ -65,7 +65,7 @@ public interface CredHubOperations {
* @param the credential implementation type
* @return the details of the regenerated credential
*/
- CredentialDetails regenerate(CredentialName name);
+ CredentialDetails regenerate(final CredentialName name);
/**
* Retrieve a credential using its ID, as returned in a write request.
@@ -75,7 +75,7 @@ public interface CredHubOperations {
* @param the credential implementation type
* @return the details of the retrieved credential
*/
- CredentialDetails getById(final String id, Class credentialType);
+ CredentialDetails getById(final String id, final Class credentialType);
/**
* Retrieve a credential using its name, as passed to a write request.
@@ -86,7 +86,7 @@ public interface CredHubOperations {
* @param the credential implementation type
* @return the details of the retrieved credential
*/
- CredentialDetails getByName(final CredentialName name, Class credentialType);
+ CredentialDetails getByName(final CredentialName name, final Class credentialType);
/**
* Retrieve a credential using its name, as passed to a write request.
@@ -98,15 +98,29 @@ public interface CredHubOperations {
* @param the credential implementation type
* @return the details of the retrieved credential, including history
*/
- List> getByNameWithHistory(CredentialName name, Class credentialType);
+ List> getByNameWithHistory(final CredentialName name, final Class credentialType);
/**
- * Find a credential using a full or partial name.
+ * Retrieve a credential using its name, as passed to a write request.
+ * A collection of stored values for the named credential will be returned,
+ * with the specified number of historical values.
*
* @param name the name of the credential; must not be {@literal null}
- * @return a summary of the credential search results
+ * @param versions the number of historical versions to retrieve
+ * @param credentialType the type of credential expected to be returned
+ * @param the credential implementation type
+ * @return the details of the retrieved credential, including history
*/
- List findByName(CredentialName name);
+ List> getByNameWithHistory(final CredentialName name, int versions,
+ final Class credentialType);
+
+ /**
+ * Find a credential using a full or partial name.
+ *
+ * @param name the name of the credential; must not be {@literal null}
+ * @return a summary of the credential search results
+ */
+ List findByName(final CredentialName name);
/**
* Find a credential using a path.
@@ -114,14 +128,14 @@ public interface CredHubOperations {
* @param path the path to the credential; must not be {@literal null}
* @return a summary of the credential search results
*/
- List findByPath(String path);
+ List findByPath(final String path);
/**
* Delete a credential by its full name.
*
* @param name the name of the credential; must not be {@literal null}
*/
- void deleteByName(CredentialName name);
+ void deleteByName(final CredentialName name);
/**
* Get the permissions associated with a credential.
@@ -129,7 +143,7 @@ public interface CredHubOperations {
* @param name the name of the credential; must not be {@literal null}
* @return the collection of permissions associated with the credential
*/
- List getPermissions(CredentialName name);
+ List getPermissions(final CredentialName name);
/**
* Add permissions to an existing credential.
@@ -138,7 +152,7 @@ public interface CredHubOperations {
* @param permissions a collection of permissions to add
* @return the collection of permissions associated with the credential
*/
- List addPermissions(CredentialName name, CredentialPermission... permissions);
+ List addPermissions(final CredentialName name, final CredentialPermission... permissions);
/**
* Delete a permission associated with a credential.
@@ -146,7 +160,7 @@ public interface CredHubOperations {
* @param name the name of the credential; must not be {@literal null}
* @param actor the actor of the permission; must not be {@literal null}
*/
- void deletePermission(CredentialName name, Actor actor);
+ void deletePermission(final CredentialName name, final Actor actor);
/**
* Search the provided data structure of bound service credentials, looking for
@@ -208,7 +222,7 @@ public interface CredHubOperations {
* @return the serviceData structure with CredHub references replaced by stored
* credential values
*/
- ServicesData interpolateServiceData(ServicesData serviceData);
+ ServicesData interpolateServiceData(final ServicesData serviceData);
/**
* Allow interaction with the configured {@link RestTemplate} not provided
diff --git a/spring-credhub-core/src/main/java/org/springframework/credhub/core/CredHubTemplate.java b/spring-credhub-core/src/main/java/org/springframework/credhub/core/CredHubTemplate.java
index 2643f58..e9c6a94 100644
--- a/spring-credhub-core/src/main/java/org/springframework/credhub/core/CredHubTemplate.java
+++ b/spring-credhub-core/src/main/java/org/springframework/credhub/core/CredHubTemplate.java
@@ -56,6 +56,7 @@ public class CredHubTemplate implements CredHubOperations {
static final String ID_URL_PATH = BASE_URL_PATH + "/{id}";
static final String NAME_URL_QUERY = BASE_URL_PATH + "?name={name}";
static final String NAME_URL_QUERY_CURRENT = NAME_URL_QUERY + "¤t=true";
+ static final String NAME_URL_QUERY_VERSIONS = NAME_URL_QUERY + "&versions={versions}";
static final String NAME_LIKE_URL_QUERY = BASE_URL_PATH + "?name-like={name}";
static final String PATH_URL_QUERY = BASE_URL_PATH + "?path={path}";
@@ -109,7 +110,7 @@ public class CredHubTemplate implements CredHubOperations {
public CredentialDetails doWithRestOperations(RestOperations restOperations) {
ResponseEntity> response =
restOperations.exchange(BASE_URL_PATH, PUT,
- new HttpEntity>(credentialRequest), ref);
+ new HttpEntity<>(credentialRequest), ref);
throwExceptionOnError(response);
@@ -130,7 +131,7 @@ public class CredHubTemplate implements CredHubOperations {
public CredentialDetails doWithRestOperations(RestOperations restOperations) {
ResponseEntity> response =
restOperations.exchange(BASE_URL_PATH, POST,
- new HttpEntity>(parametersRequest), ref);
+ new HttpEntity<>(parametersRequest), ref);
throwExceptionOnError(response);
@@ -149,12 +150,12 @@ public class CredHubTemplate implements CredHubOperations {
return doWithRest(new RestOperationsCallback>() {
@Override
public CredentialDetails doWithRestOperations(RestOperations restOperations) {
- Map request = new HashMap(1);
+ Map request = new HashMap<>(1);
request.put("name", name.getName());
ResponseEntity> response =
restOperations.exchange(REGENERATE_URL_PATH, POST,
- new HttpEntity