public class VaultSysTemplate extends Object implements VaultSysOperations
VaultSysOperations
.Constructor and Description |
---|
VaultSysTemplate(VaultOperations vaultOperations)
Create a new
VaultSysTemplate with the given VaultOperations . |
Modifier and Type | Method and Description |
---|---|
void |
authMount(String path,
VaultMount vaultMount)
Mounts an auth backend
VaultMount to path . |
void |
authUnmount(String path)
Unmounts the auth backend mount at
path . |
void |
createOrUpdatePolicy(String name,
Policy policy)
Create or update a
Policy . |
void |
deletePolicy(String name)
Delete a
Policy by its name. |
Map<String,VaultMount> |
getAuthMounts() |
Map<String,VaultMount> |
getMounts() |
Policy |
getPolicy(String name)
Read a
Policy by its name. |
List<String> |
getPolicyNames()
Lists policy names stored in Vault.
|
VaultUnsealStatus |
getUnsealStatus() |
VaultHealth |
health()
Return the health status of Vault.
|
VaultInitializationResponse |
initialize(VaultInitializationRequest vaultInitializationRequest)
Initialize Vault with a
VaultInitializationRequest . |
boolean |
isInitialized() |
void |
mount(String path,
VaultMount vaultMount)
Mounts a secret backend
VaultMount to path . |
void |
seal()
Seal vault.
|
void |
unmount(String path)
Unmounts the secret backend mount at
path . |
VaultUnsealStatus |
unseal(String keyShare)
Unseal vault.
|
public VaultSysTemplate(VaultOperations vaultOperations)
VaultSysTemplate
with the given VaultOperations
.vaultOperations
- must not be null.public boolean isInitialized()
isInitialized
in interface VaultSysOperations
public VaultInitializationResponse initialize(VaultInitializationRequest vaultInitializationRequest)
VaultSysOperations
VaultInitializationRequest
.initialize
in interface VaultSysOperations
vaultInitializationRequest
- must not be null.VaultInitializationResponse
.public void seal()
VaultSysOperations
seal
in interface VaultSysOperations
public VaultUnsealStatus unseal(String keyShare)
VaultSysOperations
VaultUnsealStatus.getProgress()
for progress.unseal
in interface VaultSysOperations
keyShare
- must not be empty and not null.VaultUnsealStatus
.public VaultUnsealStatus getUnsealStatus()
getUnsealStatus
in interface VaultSysOperations
VaultUnsealStatus
.public void mount(String path, VaultMount vaultMount)
VaultSysOperations
VaultMount
to path
.mount
in interface VaultSysOperations
path
- must not be empty or null.vaultMount
- must not be null.public Map<String,VaultMount> getMounts()
getMounts
in interface VaultSysOperations
Map
of all secret backend mounts
.public void unmount(String path)
VaultSysOperations
path
.unmount
in interface VaultSysOperations
path
- must not be empty or null.public void authMount(String path, VaultMount vaultMount) throws VaultException
VaultSysOperations
VaultMount
to path
.authMount
in interface VaultSysOperations
path
- must not be empty or null.vaultMount
- must not be null.VaultException
public Map<String,VaultMount> getAuthMounts() throws VaultException
getAuthMounts
in interface VaultSysOperations
Map
of all auth backend mounts
.VaultException
public void authUnmount(String path) throws VaultException
VaultSysOperations
path
.authUnmount
in interface VaultSysOperations
path
- must not be empty or null.VaultException
public List<String> getPolicyNames() throws VaultException
VaultSysOperations
getPolicyNames
in interface VaultSysOperations
VaultException
@Nullable public Policy getPolicy(String name) throws VaultException
VaultSysOperations
Policy
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.getPolicy
in interface VaultSysOperations
Policy
or null, if the policy was not found.VaultException
public void createOrUpdatePolicy(String name, Policy policy) throws VaultException
VaultSysOperations
Policy
.createOrUpdatePolicy
in interface VaultSysOperations
name
- the policy name, must not be null or empty.VaultException
public void deletePolicy(String name) throws VaultException
VaultSysOperations
Policy
by its name.deletePolicy
in interface VaultSysOperations
name
- the policy name, must not be null or empty.VaultException
public VaultHealth health()
VaultSysOperations
health
in interface VaultSysOperations
VaultHealth
.Copyright © 2016–2020 Pivotal Software, Inc.. All rights reserved.