Class SlimVaultClient
java.lang.Object
io.vertx.config.vault.client.SlimVaultClient
A very simple Vault client - does not intend to be complete.
- Author:
- Clement Escoffier
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSlimVaultClient(Vertx vertx, JsonObject configuration) Creates an instance ofSlimVaultClient. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the client.createToken(TokenRequest tokenRequest) voidcreateToken(TokenRequest tokenRequest, Completable<Auth> resultHandler) Creates a new token.voiddelete(String path, Completable<Void> resultHandler) Deletes a secret from `path`.getToken()voidlist(String path, Completable<List<String>> resultHandler) Lists secrets from path (children).loginWithAppRole(String roleId, String secretId) voidloginWithAppRole(String roleId, String secretId, Completable<Auth> resultHandler) Logs in against the `AppRole` backend.voidloginWithCert(Completable<Auth> resultHandler) Logs in against the `Cert` backend.loginWithUserCredentials(String username, String password) voidloginWithUserCredentials(String username, String password, Completable<Auth> resultHandler) Logs in against the `userpass` backend.voidlookupSelf(Completable<Lookup> resultHandler) Looks up for the current token metadata.voidread(String path, Completable<Secret> responseHandler) Reads a secret from `path`.renewSelf(long leaseDurationInSecond) voidrenewSelf(long leaseDurationInSecond, Completable<Auth> resultHandler) Renews the current token.Sets the token.write(String path, JsonObject secrets) voidwrite(String path, JsonObject secrets, Completable<Secret> resultHandler) Write a secret to `path`.
-
Field Details
-
TOKEN_HEADER
- See Also:
-
-
Constructor Details
-
SlimVaultClient
Creates an instance ofSlimVaultClient.- Parameters:
vertx- the vert.x instanceconfiguration- the configuration. This configuration can contain the underlying Web Client configuration.
-
-
Method Details
-
close
public void close()Closes the client. -
read
-
read
Reads a secret from `path`.- Parameters:
path- the pathresponseHandler- the callback invoked with the result
-
write
-
write
Write a secret to `path`.- Parameters:
path- the pathresultHandler- the callback invoked with the result
-
list
-
list
Lists secrets from path (children).- Parameters:
path- the pathresultHandler- the callback invoked with the result
-
delete
-
delete
Deletes a secret from `path`.- Parameters:
path- the pathresultHandler- the callback invoked with the result
-
createToken
-
createToken
Creates a new token.- Parameters:
tokenRequest- the token requestresultHandler- the callback invoked with the result.
-
loginWithAppRole
-
loginWithAppRole
Logs in against the `AppRole` backend.- Parameters:
roleId- the role idsecretId- the secret idresultHandler- the callback invoked with the result
-
loginWithUserCredentials
-
loginWithUserCredentials
public void loginWithUserCredentials(String username, String password, Completable<Auth> resultHandler) Logs in against the `userpass` backend.- Parameters:
username- the usernamepassword- the passwordresultHandler- the callback invoked with the result
-
loginWithCert
-
loginWithCert
Logs in against the `Cert` backend. Certificates are configured directly on the client instance.- Parameters:
resultHandler- the callback invoked with the result
-
renewSelf
-
renewSelf
Renews the current token.- Parameters:
leaseDurationInSecond- the extension in secondresultHandler- the callback invoked with the result
-
lookupSelf
-
lookupSelf
Looks up for the current token metadata.- Parameters:
resultHandler- the callback invoked with the result
-
getToken
- Returns:
- the current token.
-
setToken
Sets the token.- Parameters:
token- the new token- Returns:
- the current
SlimVaultClient
-