Class VaultRequest<T extends VaultRequest<T>>

Type Parameters:
T - type of the subclass
All Implemented Interfaces:
ApiRequest<T>
Direct Known Subclasses:
CaCertificateGet.Request, CertificateGet.Request, ConfigureK8s.Request, CreateAppRole.Request, CreateCubbyhole.Request, CreateKey.Request, CreateKv1.Request, CreateKv2.Request, CreatePolicy.Request, CreateRole.Request, CreateToken.Request, CreateTokenRole.Request, CrlGet.Request, DbConfigure.Request, DbCreateRole.Request, DbDelete.Request, DbDeleteRole.Request, DbGet.Request, Decrypt.Request, DecryptBatch.Request, DeleteAllKv2.Request, DeleteAppRole.Request, DeleteCubbyhole.Request, DeleteKey.Request, DeleteKv1.Request, DeleteKv2.Request, DeletePolicy.Request, DeleteRole.Request, DeleteTokenRole.Request, DestroyKv2.Request, DestroySecretId.Request, DisableAuth.Request, DisableEngine.Request, EnableAuth.Request, EnableEngine.Request, Encrypt.Request, EncryptBatch.Request, GenerateSecretId.Request, GenerateSelfSignedRoot.Request, GetCubbyhole.Request, GetKv1.Request, GetKv2.Request, Hmac.Request, IssueCertificate.Request, ListSecrets.Request, Login.Request, Login.Request, PkiRole.Request, ReadRoleId.Request, RenewToken.Request, RevokeAndOrphanToken.Request, RevokeCertificate.Request, RevokeToken.Request, Sign.Request, SignCsr.Request, UndeleteKv2.Request, UpdateCubbyhole.Request, UpdateKeyConfig.Request, UpdateKv1.Request, UpdateKv2.Request, Verify.Request

public abstract class VaultRequest<T extends VaultRequest<T>> extends ApiJsonRequest<T>
Common helper methods for Vault Requests.
  • Constructor Details

    • VaultRequest

      public VaultRequest()
  • Method Details

    • addCommaDelimitedArray

      protected static void addCommaDelimitedArray(JsonObjectBuilder json, String name, List<String> values)
      Add aa list of values as a comma delimited string instead of a JSON Array.
      Parameters:
      json - the builder
      name - name of the property
      values - list of values
    • add

      public T add(String name, Duration duration)
      Add a duration formatted in Vault manner, as a string with duration.
      Parameters:
      name - name of the property
      duration - duration to add
      Returns:
      updated request
    • addToCommaDelimitedArray

      public T addToCommaDelimitedArray(String name, String element)
      Add a string to an array represented as a comma delimited string in the request JSON.
      Parameters:
      name - key in the json payload
      element - element of the array
      Returns:
      updated request
    • preBuild

      protected void preBuild(JsonBuilderFactory factory, JsonObjectBuilder payload)
      Description copied from class: ApiJsonBuilder
      Called before adding properties defined in this request.
      Overrides:
      preBuild in class ApiJsonBuilder<T extends VaultRequest<T>>
      Parameters:
      factory - json factory
      payload - payload builder
    • durationToTtl

      public static String durationToTtl(Duration duration)
      Duration to time to live in HCP Vault format. The format is "5h" for exact hour values, "5m" for exact minute values, or "5s" when seconds are part of the value.
      Parameters:
      duration - duration
      Returns:
      String of that duration