Interface SecretDao


public interface SecretDao
An interface for managing SealedSecret objects.
  • Method Details

    • put

      void put(Set<SealedSecret> sealedSecrets) throws SecretServiceException
      Stores a Set of SealedSecret objects. Implementations should ensure that any existing secret should be overwritten by those with the same identifier.
      Parameters:
      sealedSecrets - the set of SealedSecret objects to be stored. Must not be null.
      Throws:
      SecretServiceException - If an error occurs
    • get

      Retrieves a SealedSecret by its identifier. If a secret with the specified identifier exists, it is returned encapsulated in an Optional instance; otherwise, an empty Optional is returned.
      Parameters:
      identifier - the unique identifier of the secret to retrieve. Must not be null.
      Returns:
      an Optional containing the SealedSecret if found, or an empty Optional if not found.
      Throws:
      SecretServiceException - If an error occurs
    • get

      default Map<String,Optional<SealedSecret>> get(Set<String> identifiers) throws SecretServiceException
      Retrieves multiple SealedSecret objects by their identifiers.
      Parameters:
      identifiers - a set of unique identifiers for the secrets to retrieve. Must not be null.
      Returns:
      a Map where each key is an identifier from the input set, and each value is an Optional containing the corresponding SealedSecret if found, or an empty Optional if not found.
      Throws:
      SecretServiceException - If an error occurs
    • delete

      void delete(String identifier) throws SecretServiceException
      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

      default void delete(Set<String> identifiers) throws SecretServiceException
      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

      Set<String> getIdsForBackend(String backendId) throws SecretServiceException
      Retrieves a set of secret identifiers for all SealedSecret objects 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 Set of String identifiers for all secrets associated with the specified backend. Never null, but may be empty.
      Throws:
      SecretServiceException - If an error occurs