Class SecretDocument
java.lang.Object
org.springframework.vault.repository.convert.SecretDocument
Vault database exchange object containing data before/after it's exchanged with Vault.
A
SecretDocument
is basically an object with an id
and a body
represented as Map
of String
and Object
. It can be created
from
an Id and
VaultResponse
.
A secret document can hold simple properties, list
properties and nested objects as Map
s.
- Since:
- 2.0
- Author:
- Mark Paluch
-
Constructor Summary
ConstructorDescriptionCreate a new, emptySecretDocument
.SecretDocument
(String id) SecretDocument
(String id, Map<String, Object> body) SecretDocument
(Map<String, Object> body) Create a newSecretDocument
given abody map
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
static SecretDocument
from
(String id, VaultResponse vaultResponse) Retrieve a value from the secret document by itskey
.getBody()
getId()
Return the required Id or throwIllegalStateException
if the Id is not set.int
hashCode()
void
Set a value in the secret document.void
Set the identifier value.void
setVersion
(Integer version) toString()
-
Constructor Details
-
SecretDocument
public SecretDocument()Create a new, emptySecretDocument
. -
SecretDocument
Create a newSecretDocument
given abody map
.- Parameters:
body
- must not be null.
-
SecretDocument
- Parameters:
id
- may be null.body
- must not be null.
-
SecretDocument
- Parameters:
id
- may be null.version
- for versioned secrets, may be null if not available.body
- must not be null.- Since:
- 2.4
-
SecretDocument
-
-
Method Details
-
from
- Parameters:
id
- must not be null.vaultResponse
- must not be null.- Returns:
- the
SecretDocument
.
-
getId
- Returns:
- the identifier or null if the identifier is not set.
-
getRequiredId
Return the required Id or throwIllegalStateException
if the Id is not set.- Returns:
- the required Id.
- Throws:
IllegalStateException
- if the Id is not set.- Since:
- 2.4
-
setId
Set the identifier value.- Parameters:
id
- may be null.
-
getVersion
- Returns:
- the version number, may be
null
if absent. - Since:
- 2.4
-
setVersion
- Parameters:
version
-- Since:
- 2.4
-
getBody
- Returns:
- the body of this
SecretDocument
-
get
Retrieve a value from the secret document by itskey
.- Parameters:
key
- must not be null.- Returns:
- the value or null, if the value is not present.
-
put
Set a value in the secret document.- Parameters:
key
- must not be null.value
- must not be null.
-
equals
-
hashCode
public int hashCode() -
toString
-