Interface ApiRequest<T extends ApiRequest<T>>

Type Parameters:
T - type of the request
All Known Implementing Classes:
ApiJsonRequest, ApiRestRequest, 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, JsonRequest, ListSecrets.Request, Login.Request, Login.Request, MySqlConfigureRequest, OracleConfigureRequest, PkiRole.Request, ReadRoleId.Request, RenewToken.Request, RestRequest, RevokeAndOrphanToken.Request, RevokeCertificate.Request, RevokeToken.Request, Sign.Request, SignCsr.Request, UndeleteKv2.Request, UpdateCubbyhole.Request, UpdateKeyConfig.Request, UpdateKv1.Request, UpdateKv2.Request, VaultRequest, Verify.Request

public interface ApiRequest<T extends ApiRequest<T>>
Common base class for REST requests. This class acts as a mutable builder. Path is not a part of this request.
  • Method Details

    • addHeader

      T addHeader(String name, String... value)
      Add an HTTP header.
      Parameters:
      name - name of the header
      value - header value(s)
      Returns:
      updated request
    • addQueryParam

      T addQueryParam(String name, String... value)
      Add an HTTP query parameter.
      Parameters:
      name - name of the parameter
      value - parameter value(s)
      Returns:
      updated request
    • requestMediaType

      T requestMediaType(MediaType mediaType)
      The media type header, defaults to MediaType.APPLICATION_JSON when JSON entity is present, to MediaType.APPLICATION_OCTET_STREAM for publisher base requests, empty otherwise.
      Parameters:
      mediaType - media type of request
      Returns:
      updated request
    • responseMediaType

      T responseMediaType(MediaType mediaType)
      The accept header, defaults to MediaType.APPLICATION_JSON for most requests, except for requests that return publisher, which default to MediaType.APPLICATION_OCTET_STREAM.
      Parameters:
      mediaType - accepted media type
      Returns:
      updated request
    • requestId

      T requestId(String requestId)
      Configure request ID for logging (and possibly to send over the network).
      Parameters:
      requestId - request id
      Returns:
      updated request
    • headers

      Map<String,List<String>> headers()
      Returns immutable configured headers.
      Returns:
      headers configured for this request
    • queryParams

      Map<String,List<String>> queryParams()
      Returns immutable configured query parameters.
      Returns:
      query parameters configured for this request
    • toJson

      default Optional<JsonObject> toJson(JsonBuilderFactory factory)
      Return the JSON object used for POST and PUT requests (and other methods if needed). The default implementation returns an empty optional that can be used for GET, HEAD, DELETE methods (and other methods without an entity).
      Parameters:
      factory - builder factory to construct JSON object
      Returns:
      JSON if available on this request
    • requestMediaType

      Optional<MediaType> requestMediaType()
      Request media type.
      Returns:
      media type if configured
      See Also:
    • responseMediaType

      Optional<MediaType> responseMediaType()
      Response media type.
      Returns:
      media type if configured
      See Also:
    • requestId

      Optional<String> requestId()
      Configured request ID.
      Returns:
      request ID if configured