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.default voidDeletes multiple sealed secrets by their identifiers.Retrieves aSealedSecretby its identifier.default Map<String, Optional<SealedSecret>> Retrieves multipleSealedSecretobjects by their identifiers.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
-
get
default Map<String,Optional<SealedSecret>> get(Set<String> identifiers) throws SecretServiceException Retrieves multipleSealedSecretobjects by their identifiers.- Parameters:
identifiers- a set of unique identifiers for the secrets to retrieve. Must not be null.- Returns:
- a
Mapwhere each key is an identifier from the input set, and each value is anOptionalcontaining the correspondingSealedSecretif 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
-
delete
Deletes multiple sealed secrets by their identifiers. If a secret with a specified identifier exists, its data is permanently deleted. The method should do nothing for identifiers that don't exist (except perhaps write log messages).- Parameters:
identifiers- a set of unique identifiers for the secrets 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
-