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