Class CredHubCredentialTemplate
java.lang.Object
org.springframework.credhub.core.credential.CredHubCredentialTemplate
- All Implemented Interfaces:
CredHubCredentialOperations
Implements the interactions with CredHub to save, retrieve, and delete credentials.
- Author:
- Scott Frederick
-
Constructor Summary
ConstructorsConstructorDescriptionCredHubCredentialTemplate(CredHubOperations credHubOperations) Create a newCredHubCredentialTemplate. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteByName(CredentialName name) Delete a credential by its full name.findByName(CredentialName name) Find a credential using a full or partial name.findByPath(String path) Find a credential using a path.<T,P> CredentialDetails<T> generate(ParametersRequest<P> parametersRequest) Generate a new credential in CredHub, or overwrite an existing credential with a new generated value.<T> CredentialDetails<T>Retrieve a credential using its ID, as returned in a write request.<T> CredentialDetails<T>getByName(CredentialName name, Class<T> credentialType) Retrieve a credential using its name, as passed to a write request.<T> List<CredentialDetails<T>>getByNameWithHistory(CredentialName name, int versions, Class<T> credentialType) Retrieve a credential using its name, as passed to a write request.<T> List<CredentialDetails<T>>getByNameWithHistory(CredentialName name, Class<T> credentialType) Retrieve a credential using its name, as passed to a write request.<T> CredentialDetails<T>regenerate(CredentialName name, Class<T> credentialType) Regenerate a credential in CredHub.<T> CredentialDetails<T>write(CredentialRequest<T> credentialRequest) Write a new credential to CredHub, or overwrite an existing credential with a new value.
-
Constructor Details
-
CredHubCredentialTemplate
Create a newCredHubCredentialTemplate.- Parameters:
credHubOperations- theCredHubOperationsto use for interactions with CredHub
-
-
Method Details
-
write
Description copied from interface:CredHubCredentialOperationsWrite a new credential to CredHub, or overwrite an existing credential with a new value.- Specified by:
writein interfaceCredHubCredentialOperations- Type Parameters:
T- the credential implementation type- Parameters:
credentialRequest- the credential to write to CredHub; must not be null- Returns:
- the details of the written credential
-
generate
Description copied from interface:CredHubCredentialOperationsGenerate a new credential in CredHub, or overwrite an existing credential with a new generated value.- Specified by:
generatein interfaceCredHubCredentialOperations- Type Parameters:
T- the credential implementation typeP- the credential parameter implementation type- Parameters:
parametersRequest- the parameters of the new credential to generate in CredHub; must not be null- Returns:
- the details of the generated credential
-
regenerate
Description copied from interface:CredHubCredentialOperationsRegenerate a credential in CredHub. Only credentials that were previously generated can be re-generated.- Specified by:
regeneratein interfaceCredHubCredentialOperations- Type Parameters:
T- the credential implementation type- Parameters:
name- the name of the credential; must not be nullcredentialType- the type of the credential to be regenerated; must not be null- Returns:
- the details of the regenerated credential
-
getById
Description copied from interface:CredHubCredentialOperationsRetrieve a credential using its ID, as returned in a write request.- Specified by:
getByIdin interfaceCredHubCredentialOperations- Type Parameters:
T- the credential implementation type- Parameters:
id- the ID of the credential; must not be nullcredentialType- the type of the credential to be retrieved; must not be null- Returns:
- the details of the retrieved credential
-
getByName
Description copied from interface:CredHubCredentialOperationsRetrieve a credential using its name, as passed to a write request. Only the current credential value will be returned.- Specified by:
getByNamein interfaceCredHubCredentialOperations- Type Parameters:
T- the credential implementation type- Parameters:
name- the name of the credential; must not be nullcredentialType- the type of credential expected to be returned- Returns:
- the details of the retrieved credential
-
getByNameWithHistory
public <T> List<CredentialDetails<T>> getByNameWithHistory(CredentialName name, Class<T> credentialType) Description copied from interface:CredHubCredentialOperationsRetrieve a credential using its name, as passed to a write request. A collection of all stored values for the named credential will be returned, including historical values.- Specified by:
getByNameWithHistoryin interfaceCredHubCredentialOperations- Type Parameters:
T- the credential implementation type- Parameters:
name- the name of the credential; must not be nullcredentialType- the type of credential expected to be returned- Returns:
- the details of the retrieved credential, including history
-
getByNameWithHistory
public <T> List<CredentialDetails<T>> getByNameWithHistory(CredentialName name, int versions, Class<T> credentialType) Description copied from interface:CredHubCredentialOperationsRetrieve 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.- Specified by:
getByNameWithHistoryin interfaceCredHubCredentialOperations- Type Parameters:
T- the credential implementation type- Parameters:
name- the name of the credential; must not be nullversions- the number of historical versions to retrievecredentialType- the type of credential expected to be returned- Returns:
- the details of the retrieved credential, including history
-
findByName
Description copied from interface:CredHubCredentialOperationsFind a credential using a full or partial name.- Specified by:
findByNamein interfaceCredHubCredentialOperations- Parameters:
name- the name of the credential; must not be null- Returns:
- a summary of the credential search results
-
findByPath
Description copied from interface:CredHubCredentialOperationsFind a credential using a path.- Specified by:
findByPathin interfaceCredHubCredentialOperations- Parameters:
path- the path to the credential; must not be null- Returns:
- a summary of the credential search results
-
deleteByName
Description copied from interface:CredHubCredentialOperationsDelete a credential by its full name.- Specified by:
deleteByNamein interfaceCredHubCredentialOperations- Parameters:
name- the name of the credential; must not be null
-