Interface RESTClient

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
HTTPClient

public interface RESTClient extends Closeable
Interface for a basic HTTP Client for interfacing with the REST catalog.

Referred from core/src/main/java/org/apache/iceberg/rest/RESTClient.java

  • Method Details

    • head

      default void head(String path, Supplier<Map<String,String>> headers, Consumer<ErrorResponse> errorHandler)
      Perform a HEAD request on the specified path with the given headers and error handling.
      Parameters:
      path - The path to be requested.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
    • head

      void head(String path, Map<String,String> headers, Consumer<ErrorResponse> errorHandler)
      Perform a HEAD request on the specified path with the given headers and error handling.
      Parameters:
      path - The path to be requested.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
    • delete

      default <T extends RESTResponse> T delete(String path, Map<String,String> queryParams, Class<T> responseType, Supplier<Map<String,String>> headers, Consumer<ErrorResponse> errorHandler)
      Perform a DELETE request on the specified path with given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      queryParams - The query parameters to be included in the request.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the DELETE request.
    • delete

      default <T extends RESTResponse> T delete(String path, Class<T> responseType, Supplier<Map<String,String>> headers, Consumer<ErrorResponse> errorHandler)
      Perform a DELETE request on the specified path with given information and no query parameters.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the DELETE request.
    • delete

      default <T extends RESTResponse> T delete(String path, Class<T> responseType, Map<String,String> headers, Consumer<ErrorResponse> errorHandler)
      Perform a DELETE request on the specified path with given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the DELETE request.
    • delete

      <T extends RESTResponse> T delete(String path, Map<String,String> queryParams, Class<T> responseType, Map<String,String> headers, Consumer<ErrorResponse> errorHandler)
      Perform a DELETE request on the specified path with given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      queryParams - The query parameters to be included in the request (ignored).
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the DELETE request.
    • get

      default <T extends RESTResponse> T get(String path, Class<T> responseType, Supplier<Map<String,String>> headers, Consumer<ErrorResponse> errorHandler)
      Perform a GET request on the specified path with given information and no query parameters.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the GET request.
    • get

      default <T extends RESTResponse> T get(String path, Class<T> responseType, Map<String,String> headers, Consumer<ErrorResponse> errorHandler)
      Perform a GET request on the specified path with given information and no query parameters.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the GET request.
    • get

      default <T extends RESTResponse> T get(String path, Map<String,String> queryParams, Class<T> responseType, Supplier<Map<String,String>> headers, Consumer<ErrorResponse> errorHandler)
      Perform a GET request on the specified path with given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      queryParams - The query parameters to be included in the request.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the GET request.
    • get

      <T extends RESTResponse> T get(String path, Map<String,String> queryParams, Class<T> responseType, Map<String,String> headers, Consumer<ErrorResponse> errorHandler)
      Perform a GET request on the specified path with given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      queryParams - The query parameters to be included in the request.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the GET request.
    • post

      default <T extends RESTResponse> T post(String path, RESTRequest body, Class<T> responseType, Supplier<Map<String,String>> headers, Consumer<ErrorResponse> errorHandler)
      Perform a POST request on the specified path with given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      body - The request body to be included in the POST request.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the POST request.
    • post

      default <T extends RESTResponse> T post(String path, RESTRequest body, Class<T> responseType, Supplier<Map<String,String>> headers, Consumer<ErrorResponse> errorHandler, Consumer<Map<String,String>> responseHeaders)
      Perform a POST request on the specified path with a given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      body - The request body to be included in the POST request.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      responseHeaders - The consumer for handling response headers (unsupported in this method).
      Returns:
      The response of the POST request.
    • post

      default <T extends RESTResponse> T post(String path, RESTRequest body, Class<T> responseType, Map<String,String> headers, Consumer<ErrorResponse> errorHandler, Consumer<Map<String,String>> responseHeaders)
      Perform a POST request on the specified path with a given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      body - The request body to be included in the POST request.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      responseHeaders - The consumer for handling response headers (unsupported in this method).
      Returns:
      The response of the POST request.
      Throws:
      UnsupportedOperationException - If trying to handle response headers (unsupported).
    • post

      <T extends RESTResponse> T post(String path, RESTRequest body, Class<T> responseType, Map<String,String> headers, Consumer<ErrorResponse> errorHandler)
      Perform a POST request on the specified path with given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      body - The request body to be included in the POST request.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the POST request.
    • put

      default <T extends RESTResponse> T put(String path, RESTRequest body, Class<T> responseType, Supplier<Map<String,String>> headers, Consumer<ErrorResponse> errorHandler)
      Perform a PUT request on the specified path with given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      body - The request body to be included in the PUT request.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the PUT request.
    • put

      default <T extends RESTResponse> T put(String path, RESTRequest body, Class<T> responseType, Supplier<Map<String,String>> headers, Consumer<ErrorResponse> errorHandler, Consumer<Map<String,String>> responseHeaders)
      Perform a PUT request on the specified path with given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      body - The request body to be included in the PUT request.
      responseType - The class representing the type of the response.
      headers - The supplier for providing headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      responseHeaders - The consumer for handling response headers.
      Returns:
      The response of the PUT request.
    • put

      default <T extends RESTResponse> T put(String path, RESTRequest body, Class<T> responseType, Map<String,String> headers, Consumer<ErrorResponse> errorHandler, Consumer<Map<String,String>> responseHeaders)
      Perform a PUT request on the specified path with a request body, response type, headers, and error handling.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      body - The request body to be included in the PUT request.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      responseHeaders - This parameter is not supported and should be set to null.
      Returns:
      The response of the PUT request.
      Throws:
      UnsupportedOperationException - if responseHeaders is not null, as returning response headers is not supported.
    • put

      <T extends RESTResponse> T put(String path, RESTRequest body, Class<T> responseType, Map<String,String> headers, Consumer<ErrorResponse> errorHandler)
      Perform a PUT request on the specified path with given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      body - The request body to be included in the PUT request.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the PUT request.
    • patch

      <T extends RESTResponse> T patch(String path, RESTRequest body, Class<T> responseType, Map<String,String> headers, Consumer<ErrorResponse> errorHandler)
      Perform a PATCH request on the specified path with given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      body - The request body to be included in the PATCH request.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the PATCH request.
    • postForm

      default <T extends RESTResponse> T postForm(String path, Map<String,String> formData, Class<T> responseType, Supplier<Map<String,String>> headers, Consumer<ErrorResponse> errorHandler)
      Perform a POST request with form data on the specified path with the given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      formData - The form data to be included in the POST request body.
      responseType - The class representing the type of the response.
      headers - The supplier for providing headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the POST request.
    • postForm

      <T extends RESTResponse> T postForm(String path, Map<String,String> formData, Class<T> responseType, Map<String,String> headers, Consumer<ErrorResponse> errorHandler)
      Perform a POST request with form data on the specified path with the given information.
      Type Parameters:
      T - The type of the response.
      Parameters:
      path - The path to be requested.
      formData - The form data to be included in the POST request body.
      responseType - The class representing the type of the response.
      headers - The headers to be included in the request.
      errorHandler - The consumer for handling error responses.
      Returns:
      The response of the POST request.