Package com.atlassian.secrets.api
Interface SecretDao
public interface SecretDao
An interface for managing
SealedSecret objects.-
Method Summary
Modifier and TypeMethodDescriptionvoidDeletes a sealed secret by its identifier.Retrieves aSealedSecretby its identifier.getIdsForBackend(String backendId) Retrieves a set of secret identifiers for allSealedSecretobjects store within a specific backend.voidput(Set<SealedSecret> sealedSecrets) Stores aSetofSealedSecretobjects.
-
Method Details
-
put
Stores aSetofSealedSecretobjects. Implementations should ensure that any existing secret should be overwritten by those with the same identifier.- Parameters:
sealedSecrets- the set ofSealedSecretobjects to be stored. Must not be null.- Throws:
SecretServiceException- If an error occurs
-
get
Retrieves aSealedSecretby its identifier. If a secret with the specified identifier exists, it is returned encapsulated in anOptionalinstance; otherwise, an emptyOptionalis returned.- Parameters:
identifier- the unique identifier of the secret to retrieve. Must not be null.- Returns:
- an
Optionalcontaining theSealedSecretif found, or an emptyOptionalif not found. - Throws:
SecretServiceException- If an error occurs
-
delete
Deletes a sealed secret by its identifier. If a secret with the specified identifier exists, its data is permanently deleted. The method should do nothing (except perhaps write a log message) if no secret exists- Parameters:
identifier- the unique identifier of the secret to delete. Must not be null.- Throws:
SecretServiceException- If an error occurs
-
getIdsForBackend
Retrieves a set of secret identifiers for allSealedSecretobjects store within a specific backend. This method is useful for identifying all secrets to be migrated from one backend to another. If no secrets are associated with the given backend, an empty set is returned.- Parameters:
backendId- the identifier of the backend for which secret identifiers are to be retrieved. Must not be null.- Returns:
- a
SetofStringidentifiers for all secrets associated with the specified backend. Never null, but may be empty. - Throws:
SecretServiceException- If an error occurs
-