public class VaultClient extends Object
New API requests are created via the "newRequest" method, passing in the request class to instantiate.
Modifier and Type | Class and Description |
---|---|
static class |
VaultClient.AuthenticationType
Type of Authentication with the Vault API
|
Modifier and Type | Field and Description |
---|---|
static String |
VAULT_API_VERSION
The current Vault API Version "v21.1".
|
Modifier | Constructor and Description |
---|---|
protected |
VaultClient() |
Modifier and Type | Method and Description |
---|---|
String |
getAPIEndpoint(boolean includeVersion)
Get the fully formed root API URL consisting of the Vault DNS
|
String |
getAPIEndpoint(String endpoint)
Get a fully formed API URL consisting of the Vault DNS,
API version, and the API endpoint.
|
String |
getAPIEndpoint(String endpoint,
boolean includeVersion)
Get a fully formed API URL consisting of the Vault DNS,
API version, and the API endpoint.
|
AuthenticationResponse |
getAuthenticationResponse() |
String |
getLoginEndpoint(String endpoint)
Get a fully formed API URL consisting of the Vault login URL
and the API endpoint.
|
String |
getPassword() |
String |
getSessionId() |
String |
getUserId() |
String |
getUsername() |
VaultClientId |
getVaultClientId() |
String |
getVaultDNS() |
String |
getVaultUrl() |
boolean |
hasSessionId() |
Boolean |
isLogApiErrorsEnabled()
Indicates whether or not to log api errors.
|
<T> T |
newRequest(Class<T> requestClass)
Instantiate a new request to the Vault API endpoint.
|
protected void |
setAuthenticationResponse(AuthenticationResponse authenticationResponse) |
VaultClient |
setLogApiErrors(boolean logApiErrors)
Sets whether or not to log api errors.
|
void |
setPassword(String password) |
void |
setUsername(String username) |
protected void |
setVaultClientId(VaultClientId vaultClientId)
Set the client id for Vault API requests
VaultClientId |
void |
setVaultDNS(String vaultDNS) |
boolean |
validateSession()
Validate the current sessionId.
|
public static final String VAULT_API_VERSION
public <T> T newRequest(Class<T> requestClass)
The Vault Client Id is required for all new requests. An error is thrown if no client id is set.
T
- The request class to instantiaterequestClass
- The request class to instantiatepublic String getVaultDNS()
public void setVaultDNS(String vaultDNS)
vaultDNS
- Vault DNS in format "myvault.veevavault.com"public String getVaultUrl()
public String getUsername()
public String getPassword()
public void setPassword(String password)
password
- to setpublic void setUsername(String username)
username
- to setpublic VaultClientId getVaultClientId()
protected void setVaultClientId(VaultClientId vaultClientId)
VaultClientId
vaultClientId
- Vault Client Idpublic String getAPIEndpoint(boolean includeVersion)
includeVersion
- include versionpublic String getAPIEndpoint(String endpoint)
endpoint
- API endpoint in form "/objects/documents"public String getAPIEndpoint(String endpoint, boolean includeVersion)
endpoint
- API endpoint in form "/objects/documents"includeVersion
- include version in final endpointpublic String getLoginEndpoint(String endpoint)
endpoint
- API endpoint in form "/objects/documents"public AuthenticationResponse getAuthenticationResponse()
public String getSessionId()
public boolean hasSessionId()
public String getUserId()
public VaultClient setLogApiErrors(boolean logApiErrors)
logApiErrors
- true/falseVaultClient
public Boolean isLogApiErrorsEnabled()
protected void setAuthenticationResponse(AuthenticationResponse authenticationResponse)
public boolean validateSession()
Copyright © 2021. All rights reserved.