Class SecretResponse
- java.lang.Object
-
- de.stklcode.jvault.connector.model.response.VaultDataResponse
-
- de.stklcode.jvault.connector.model.response.SecretResponse
-
- All Implemented Interfaces:
VaultResponse
- Direct Known Subclasses:
CredentialsResponse
public class SecretResponse extends VaultDataResponse
Vault response for secret request.- Since:
- 0.1
- Author:
- Stefan Kalscheuer
-
-
Constructor Summary
Constructors Constructor Description SecretResponse()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Objectget(String key)Get a single value for given key.<T> Tget(String key, Class<T> type)Get response parsed as JSON.Map<String,Object>getData()Get complete data object.VersionMetadatagetMetadata()Get secret metadata.StringgetValue()Deprecated.Deprecated artifact, will be removed at latest at v1.0.0<T> TgetValue(Class<T> type)Deprecated.Deprecated artifact, will be removed at latest at v1.0.0voidsetData(Map<String,Object> data)Set data.-
Methods inherited from class de.stklcode.jvault.connector.model.response.VaultDataResponse
getLeaseDuration, getLeaseId, getWarnings, isRenewable
-
-
-
-
Method Detail
-
setData
public final void setData(Map<String,Object> data) throws InvalidResponseException
Description copied from class:VaultDataResponseSet data. To be implemented in the specific subclasses, as data can be of arbitrary structure.- Specified by:
setDatain classVaultDataResponse- Parameters:
data- Raw response data- Throws:
InvalidResponseException- on parsing errors
-
getData
public final Map<String,Object> getData()
Get complete data object.- Returns:
- data map
- Since:
- 0.4.0
-
getMetadata
public final VersionMetadata getMetadata()
Get secret metadata. This is only available for KV v2 secrets.- Returns:
- Metadata of the secret.
- Since:
- 0.8
-
get
public final Object get(String key)
Get a single value for given key.- Parameters:
key- the key- Returns:
- the value or
nullif absent - Since:
- 0.4.0
-
getValue
@Deprecated public final String getValue()
Deprecated.Deprecated artifact, will be removed at latest at v1.0.0Get data element for key "value". Method for backwards compatibility in case of simple secrets.- Returns:
- the value
-
getValue
@Deprecated public final <T> T getValue(Class<T> type) throws InvalidResponseException
Deprecated.Deprecated artifact, will be removed at latest at v1.0.0Get response parsed as JSON.- Type Parameters:
T- Class to parse response- Parameters:
type- Class to parse response- Returns:
- Parsed object
- Throws:
InvalidResponseException- on parsing error- Since:
- 0.3
-
get
public final <T> T get(String key, Class<T> type) throws InvalidResponseException
Get response parsed as JSON.- Type Parameters:
T- Class to parse response- Parameters:
key- the keytype- Class to parse response- Returns:
- Parsed object or
nullif absent - Throws:
InvalidResponseException- on parsing error- Since:
- 0.4.0
-
-