Package org.springframework.vault.core
Class VaultSysTemplate
java.lang.Object
org.springframework.vault.core.VaultSysTemplate
- All Implemented Interfaces:
VaultSysOperations
Default implementation of
VaultSysOperations
.- Author:
- Mark Paluch
-
Constructor Summary
ConstructorDescriptionVaultSysTemplate
(VaultOperations vaultOperations) Create a newVaultSysTemplate
with the givenVaultOperations
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
authMount
(String path, VaultMount vaultMount) Mounts an auth backendVaultMount
topath
.void
authUnmount
(String path) Unmounts the auth backend mount atpath
.void
createOrUpdatePolicy
(String name, Policy policy) Create or update aPolicy
.void
deletePolicy
(String name) Delete aPolicy
by its name.Read aPolicy
by its name.Lists policy names stored in Vault.health()
Return the health status of Vault.initialize
(VaultInitializationRequest vaultInitializationRequest) Initialize Vault with aVaultInitializationRequest
.boolean
void
mount
(String path, VaultMount vaultMount) Mounts a secret backendVaultMount
topath
.void
seal()
Seal vault.void
Unmounts the secret backend mount atpath
.Unseal vault.
-
Constructor Details
-
VaultSysTemplate
Create a newVaultSysTemplate
with the givenVaultOperations
.- Parameters:
vaultOperations
- must not be null.
-
-
Method Details
-
isInitialized
public boolean isInitialized()- Specified by:
isInitialized
in interfaceVaultSysOperations
- Returns:
- true if Vault is initialized.
- See Also:
-
initialize
public VaultInitializationResponse initialize(VaultInitializationRequest vaultInitializationRequest) Description copied from interface:VaultSysOperations
Initialize Vault with aVaultInitializationRequest
.- Specified by:
initialize
in interfaceVaultSysOperations
- Parameters:
vaultInitializationRequest
- must not be null.- Returns:
- the
VaultInitializationResponse
. - See Also:
-
seal
public void seal()Description copied from interface:VaultSysOperations
Seal vault.- Specified by:
seal
in interfaceVaultSysOperations
- See Also:
-
unseal
Description copied from interface:VaultSysOperations
Unseal vault. SeeVaultUnsealStatus.getProgress()
for progress.- Specified by:
unseal
in interfaceVaultSysOperations
- Parameters:
keyShare
- must not be empty and not null.- Returns:
- the
VaultUnsealStatus
. - See Also:
-
getUnsealStatus
- Specified by:
getUnsealStatus
in interfaceVaultSysOperations
- Returns:
- the
VaultUnsealStatus
. - See Also:
-
mount
Description copied from interface:VaultSysOperations
Mounts a secret backendVaultMount
topath
.- Specified by:
mount
in interfaceVaultSysOperations
- Parameters:
path
- must not be empty or null.vaultMount
- must not be null.- See Also:
-
getMounts
- Specified by:
getMounts
in interfaceVaultSysOperations
- Returns:
Map
of all secret backendmounts
.- See Also:
-
unmount
Description copied from interface:VaultSysOperations
Unmounts the secret backend mount atpath
.- Specified by:
unmount
in interfaceVaultSysOperations
- Parameters:
path
- must not be empty or null.- See Also:
-
authMount
Description copied from interface:VaultSysOperations
Mounts an auth backendVaultMount
topath
.- Specified by:
authMount
in interfaceVaultSysOperations
- Parameters:
path
- must not be empty or null.vaultMount
- must not be null.- Throws:
VaultException
- See Also:
-
getAuthMounts
- Specified by:
getAuthMounts
in interfaceVaultSysOperations
- Returns:
Map
of all auth backendmounts
.- Throws:
VaultException
- See Also:
-
authUnmount
Description copied from interface:VaultSysOperations
Unmounts the auth backend mount atpath
.- Specified by:
authUnmount
in interfaceVaultSysOperations
- Parameters:
path
- must not be empty or null.- Throws:
VaultException
- See Also:
-
getPolicyNames
Description copied from interface:VaultSysOperations
Lists policy names stored in Vault.- Specified by:
getPolicyNames
in interfaceVaultSysOperations
- Returns:
- policy names.
- Throws:
VaultException
- See Also:
-
getPolicy
Description copied from interface:VaultSysOperations
Read aPolicy
by its name. Policies are either represented as HCL (HashiCorp configuration language) or JSON. Retrieving policies is only possible if the policy is represented as JSON.- Specified by:
getPolicy
in interfaceVaultSysOperations
- Returns:
- the
Policy
or null, if the policy was not found. - Throws:
VaultException
- See Also:
-
createOrUpdatePolicy
Description copied from interface:VaultSysOperations
Create or update aPolicy
.- Specified by:
createOrUpdatePolicy
in interfaceVaultSysOperations
- Parameters:
name
- the policy name, must not be null or empty.- Throws:
VaultException
- See Also:
-
deletePolicy
Description copied from interface:VaultSysOperations
Delete aPolicy
by its name.- Specified by:
deletePolicy
in interfaceVaultSysOperations
- Parameters:
name
- the policy name, must not be null or empty.- Throws:
VaultException
- See Also:
-
health
Description copied from interface:VaultSysOperations
Return the health status of Vault.- Specified by:
health
in interfaceVaultSysOperations
- Returns:
- the
VaultHealth
. - See Also:
-