Interface VaultVersionedKeyValueOperations

All Superinterfaces:
VaultKeyValueOperationsSupport
All Known Implementing Classes:
VaultVersionedKeyValueTemplate

public interface VaultVersionedKeyValueOperations extends VaultKeyValueOperationsSupport
Interface that specifies a basic set of Vault operations using Vault's versioned Key/Value (kv version 2) secret backend. Paths used in this operations interface are relative and outgoing requests prepend paths with the according operation-specific prefix.

Clients using versioned Key/Value must be aware they are reading from a versioned backend as the versioned Key/Value API (kv version 2) is different from the unversioned Key/Value API (kv version 1).

Since:
2.1
Author:
Mark Paluch
See Also:
  • Method Details

    • get

      default @Nullable Versioned<Map<String,Object>> get(String path)
      Read the most recent secret at path.
      Specified by:
      get in interface VaultKeyValueOperationsSupport
      Parameters:
      path - must not be null.
      Returns:
      the data. May be null if the path does not exist.
    • get

      <T> @Nullable Versioned<T> get(String path, Versioned.Version version)
      Read the requested Versioned.Version of the secret at path.
      Parameters:
      path - must not be null.
      version - must not be null.
      Returns:
      the data. May be null if the path does not exist.
    • get

      default <T> @Nullable Versioned<T> get(String path, Class<T> responseType)
      Read the most recent secret at path and deserialize the secret to the given responseType.
      Parameters:
      path - must not be null.
      responseType - must not be null.
      Returns:
      the data. May be null if the path does not exist.
    • get

      <T> @Nullable Versioned<T> get(String path, Versioned.Version version, Class<T> responseType)
      Read the requested Versioned.Version of the secret at path and deserialize the secret to the given responseType.
      Parameters:
      path - must not be null.
      version - must not be null.
      responseType - must not be null.
      Returns:
      the data. May be null if the path does not exist.
    • put

      Versioned.Metadata put(String path, Object body)
      Write the versioned secret at path. body may be either plain secrets (e.g. map) or Versioned objects. Using Versioned will apply versioning for Compare-and-Set (CAS).
      Parameters:
      path - must not be null.
      body - must not be null.
      Returns:
      the resulting Versioned.Metadata.
    • delete

      void delete(String path, Versioned.Version... versionsToDelete)
      Delete one or more versions of the secret at path.
      Parameters:
      path - must not be null.
      versionsToDelete - must not be null or empty.
    • undelete

      void undelete(String path, Versioned.Version... versionsToDelete)
      Undelete (restore) one or more versions of the secret at path.
      Parameters:
      path - must not be null.
      versionsToDelete - must not be null or empty.
    • destroy

      void destroy(String path, Versioned.Version... versionsToDelete)
      Permanently remove the specified versions of the secret at path.
      Parameters:
      path - must not be null.
      versionsToDelete - must not be null or empty.
    • opsForKeyValueMetadata

      VaultKeyValueMetadataOperations opsForKeyValueMetadata()
      Returns:
      the operations interface to interact with the Vault Key/Value metadata backend