io.vertx.config.vault.client

## Class SlimVaultClient

- java.lang.Object
- - io.vertx.config.vault.client.SlimVaultClient

-     public class SlimVaultClient
      extends Object

  A very simple Vault client - does not intend to be complete.
  Author:
    Clement Escoffier

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `TOKEN_HEADER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SlimVaultClient(Vertx vertx, JsonObject configuration)` Creates an instance of `SlimVaultClient`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### TOKEN_HEADER

          public static final String TOKEN_HEADER

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SlimVaultClient

          public SlimVaultClient(Vertx vertx,
                                 JsonObject configuration)

      Creates an instance of `SlimVaultClient`.
      Parameters:
        `vertx` - the vert.x instance
        `configuration` - the configuration. This configuration can contain the underlying Web Client configuration.

  - ### Method Detail

    - #### close

          public void close()

      Closes the client.

    - #### read

          public void read(String path,
                           Handler<AsyncResult<Secret>> responseHandler)

      Reads a secret from `path`.
      Parameters:
        `path` - the path
        `responseHandler` - the callback invoked with the result

    - #### write

          public void write(String path,
                            JsonObject secrets,
                            Handler<AsyncResult<Secret>> resultHandler)

      Write a secret to `path`.
      Parameters:
        `path` - the path
        `resultHandler` - the callback invoked with the result

    - #### list

          public void list(String path,
                           Handler<AsyncResult<List<String>>> resultHandler)

      Lists secrets from path (children).
      Parameters:
        `path` - the path
        `resultHandler` - the callback invoked with the result

    - #### delete

          public void delete(String path,
                             Handler<AsyncResult<Void>> resultHandler)

      Deletes a secret from `path`.
      Parameters:
        `path` - the path
        `resultHandler` - the callback invoked with the result

    - #### createToken

          public void createToken(TokenRequest tokenRequest,
                                  Handler<AsyncResult<Auth>> resultHandler)

      Creates a new token.
      Parameters:
        `tokenRequest` - the token request
        `resultHandler` - the callback invoked with the result.

    - #### loginWithAppRole

          public void loginWithAppRole(String roleId,
                                       String secretId,
                                       Handler<AsyncResult<Auth>> resultHandler)

      Logs in against the `AppRole` backend.
      Parameters:
        `roleId` - the role id
        `secretId` - the secret id
        `resultHandler` - the callback invoked with the result

    - #### loginWithUserCredentials

          public void loginWithUserCredentials(String username,
                                               String password,
                                               Handler<AsyncResult<Auth>> resultHandler)

      Logs in against the `userpass` backend.
      Parameters:
        `username` - the username
        `password` - the password
        `resultHandler` - the callback invoked with the result

    - #### loginWithCert

          public void loginWithCert(Handler<AsyncResult<Auth>> resultHandler)

      Logs in against the `Cert` backend. Certificates are configured directly on the client instance.
      Parameters:
        `resultHandler` - the callback invoked with the result

    - #### renewSelf

          public void renewSelf(long leaseDurationInSecond,
                                Handler<AsyncResult<Auth>> resultHandler)

      Renews the current token.
      Parameters:
        `leaseDurationInSecond` - the extension in second
        `resultHandler` - the callback invoked with the result

    - #### lookupSelf

          public void lookupSelf(Handler<AsyncResult<Lookup>> resultHandler)

      Looks up for the current token metadata.
      Parameters:
        `resultHandler` - the callback invoked with the result

    - #### getToken

          public String getToken()

      Returns:
        the current token.

    - #### setToken

          public SlimVaultClient setToken(String token)

      Sets the token.
      Parameters:
        `token` - the new token
      Returns:
        the current `SlimVaultClient`

Copyright © 2021 Eclipse. All rights reserved.