Package org.springframework.vault.core
Class VaultVersionedKeyValueTemplate
java.lang.Object
org.springframework.vault.core.VaultVersionedKeyValueTemplate
- All Implemented Interfaces:
VaultKeyValueOperationsSupport
,VaultVersionedKeyValueOperations
public class VaultVersionedKeyValueTemplate
extends Object
implements VaultVersionedKeyValueOperations
Default implementation of
VaultVersionedKeyValueOperations
.- Since:
- 2.1
- Author:
- Mark Paluch, Maciej Drozdzowski
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.vault.core.VaultKeyValueOperationsSupport
VaultKeyValueOperationsSupport.KeyValueBackend
-
Constructor Summary
ConstructorDescriptionVaultVersionedKeyValueTemplate
(VaultOperations vaultOperations, String path) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Delete the secret atpath
.void
delete
(String path, Versioned.Version... versionsToDelete) Delete one or moreversions
of the secret atpath
.void
destroy
(String path, Versioned.Version... versionsToDelete) Permanently remove the specifiedversions
of the secret atpath
.get
(String path, Versioned.Version version) Read the requestedVersioned.Version
of the secret atpath
.<T> Versioned<T>
get
(String path, Versioned.Version version, Class<T> responseType) Read the requestedVersioned.Version
of the secret atpath
and deserialize the secret to the givenresponseType
.Enumerate keys from a Vault path.Write theversioned secret
atpath
.void
undelete
(String path, Versioned.Version... versionsToDelete) Undelete (restore) one or moreversions
of the secret atpath
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.vault.core.VaultKeyValueOperationsSupport
delete, getApiVersion, list
Methods inherited from interface org.springframework.vault.core.VaultVersionedKeyValueOperations
get, get
-
Constructor Details
-
VaultVersionedKeyValueTemplate
- Parameters:
vaultOperations
- must not be null.path
- must not be empty or null.
-
-
Method Details
-
get
Description copied from interface:VaultVersionedKeyValueOperations
Read the requestedVersioned.Version
of the secret atpath
.- Specified by:
get
in interfaceVaultVersionedKeyValueOperations
- Parameters:
path
- must not be null.version
- must not be null.- Returns:
- the data. May be null if the path does not exist.
-
get
@Nullable public <T> Versioned<T> get(String path, Versioned.Version version, Class<T> responseType) Description copied from interface:VaultVersionedKeyValueOperations
Read the requestedVersioned.Version
of the secret atpath
and deserialize the secret to the givenresponseType
.- Specified by:
get
in interfaceVaultVersionedKeyValueOperations
- 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
Description copied from interface:VaultVersionedKeyValueOperations
Write theversioned secret
atpath
.body
may be either plain secrets (e.g. map) orVersioned
objects. UsingVersioned
will apply versioning for Compare-and-Set (CAS).- Specified by:
put
in interfaceVaultVersionedKeyValueOperations
- Parameters:
path
- must not be null.body
- must not be null.- Returns:
- the resulting
Versioned.Metadata
.
-
delete
Description copied from interface:VaultVersionedKeyValueOperations
Delete one or moreversions
of the secret atpath
.- Specified by:
delete
in interfaceVaultVersionedKeyValueOperations
- Parameters:
path
- must not be null.versionsToDelete
- must not be null or empty.
-
undelete
Description copied from interface:VaultVersionedKeyValueOperations
Undelete (restore) one or moreversions
of the secret atpath
.- Specified by:
undelete
in interfaceVaultVersionedKeyValueOperations
- Parameters:
path
- must not be null.versionsToDelete
- must not be null or empty.
-
destroy
Description copied from interface:VaultVersionedKeyValueOperations
Permanently remove the specifiedversions
of the secret atpath
.- Specified by:
destroy
in interfaceVaultVersionedKeyValueOperations
- Parameters:
path
- must not be null.versionsToDelete
- must not be null or empty.
-
opsForKeyValueMetadata
Description copied from interface:VaultVersionedKeyValueOperations
- Specified by:
opsForKeyValueMetadata
in interfaceVaultVersionedKeyValueOperations
- Returns:
- the operations interface to interact with the Vault Key/Value metadata backend
-
list
Description copied from interface:VaultKeyValueOperationsSupport
Enumerate keys from a Vault path.- Parameters:
path
- must not be null.- Returns:
- the data. May be null if the path does not exist.
-
getApiVersion
- Returns:
- the used API version.
-
delete
Description copied from interface:VaultKeyValueOperationsSupport
Delete the secret atpath
.- Specified by:
delete
in interfaceVaultKeyValueOperationsSupport
- Parameters:
path
- must not be null.
-