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 Maps.
- Since:
- 2.0
- Author:
- Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new, emptySecretDocument.SecretDocument(@Nullable String id, Map<String, Object> body) SecretDocument(String id) SecretDocument(Map<String, Object> body) Create a newSecretDocumentgiven abody map. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic SecretDocumentfrom(@Nullable String id, VaultResponse vaultResponse) @Nullable ObjectRetrieve a value from the secret document by itskey.getBody()@Nullable StringgetId()Return the required Id or throwIllegalStateExceptionif the Id is not set.@Nullable IntegerinthashCode()voidSet a value in the secret document.voidSet the identifier value.voidsetVersion(@Nullable Integer version) toString()
-
Constructor Details
-
SecretDocument
public SecretDocument()Create a new, emptySecretDocument. -
SecretDocument
Create a newSecretDocumentgiven 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 throwIllegalStateExceptionif 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
nullif 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
-