public class SlimVaultClient extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
TOKEN_HEADER |
| Constructor and Description |
|---|
SlimVaultClient(io.vertx.core.Vertx vertx,
io.vertx.core.json.JsonObject configuration)
Creates an instance of
SlimVaultClient. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the client.
|
void |
createToken(TokenRequest tokenRequest,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Auth>> resultHandler)
Creates a new token.
|
void |
delete(String path,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> resultHandler)
Deletes a secret from `path`.
|
String |
getToken() |
void |
list(String path,
io.vertx.core.Handler<io.vertx.core.AsyncResult<List<String>>> resultHandler)
Lists secrets from path (children).
|
void |
loginWithAppRole(String roleId,
String secretId,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Auth>> resultHandler)
Logs in against the `AppRole` backend.
|
void |
loginWithCert(io.vertx.core.Handler<io.vertx.core.AsyncResult<Auth>> resultHandler)
Logs in against the `Cert` backend.
|
void |
loginWithUserCredentials(String username,
String password,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Auth>> resultHandler)
Logs in against the `userpass` backend.
|
void |
lookupSelf(io.vertx.core.Handler<io.vertx.core.AsyncResult<Lookup>> resultHandler)
Looks up for the current token metadata.
|
void |
read(String path,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Secret>> responseHandler)
Reads a secret from `path`.
|
void |
renewSelf(long leaseDurationInSecond,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Auth>> resultHandler)
Renews the current token.
|
SlimVaultClient |
setToken(String token)
Sets the token.
|
void |
write(String path,
io.vertx.core.json.JsonObject secrets,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Secret>> resultHandler)
Write a secret to `path`.
|
public static final String TOKEN_HEADER
public SlimVaultClient(io.vertx.core.Vertx vertx,
io.vertx.core.json.JsonObject configuration)
SlimVaultClient.vertx - the vert.x instanceconfiguration - the configuration. This configuration can contain the underlying Web Client configuration.public void close()
public void read(String path, io.vertx.core.Handler<io.vertx.core.AsyncResult<Secret>> responseHandler)
path - the pathresponseHandler - the callback invoked with the resultpublic void write(String path, io.vertx.core.json.JsonObject secrets, io.vertx.core.Handler<io.vertx.core.AsyncResult<Secret>> resultHandler)
path - the pathresultHandler - the callback invoked with the resultpublic void list(String path, io.vertx.core.Handler<io.vertx.core.AsyncResult<List<String>>> resultHandler)
path - the pathresultHandler - the callback invoked with the resultpublic void delete(String path, io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> resultHandler)
path - the pathresultHandler - the callback invoked with the resultpublic void createToken(TokenRequest tokenRequest, io.vertx.core.Handler<io.vertx.core.AsyncResult<Auth>> resultHandler)
tokenRequest - the token requestresultHandler - the callback invoked with the result.public void loginWithAppRole(String roleId, String secretId, io.vertx.core.Handler<io.vertx.core.AsyncResult<Auth>> resultHandler)
roleId - the role idsecretId - the secret idresultHandler - the callback invoked with the resultpublic void loginWithUserCredentials(String username, String password, io.vertx.core.Handler<io.vertx.core.AsyncResult<Auth>> resultHandler)
username - the usernamepassword - the passwordresultHandler - the callback invoked with the resultpublic void loginWithCert(io.vertx.core.Handler<io.vertx.core.AsyncResult<Auth>> resultHandler)
resultHandler - the callback invoked with the resultpublic void renewSelf(long leaseDurationInSecond,
io.vertx.core.Handler<io.vertx.core.AsyncResult<Auth>> resultHandler)
leaseDurationInSecond - the extension in secondresultHandler - the callback invoked with the resultpublic void lookupSelf(io.vertx.core.Handler<io.vertx.core.AsyncResult<Lookup>> resultHandler)
resultHandler - the callback invoked with the resultpublic String getToken()
public SlimVaultClient setToken(String token)
token - the new tokenSlimVaultClientCopyright © 2019 Eclipse. All rights reserved.