Class AbstractClusterApiClient<T extends RestBuilderMarker>

java.lang.Object
com.couchbase.client.java.cluster.api.AbstractClusterApiClient<T>
Direct Known Subclasses:
AsyncClusterApiClient, ClusterApiClient

@Public
@Experimental
public abstract class AbstractClusterApiClient<T extends RestBuilderMarker>
extends Object
An utility class to execute generic HTTP calls on a cluster's REST API.
Since:
2.3.2
Author:
Simon Baslé
  • Field Details

    • username

      protected final String username
    • password

      protected final String password
    • core

      protected final ClusterFacade core
  • Constructor Details

    • AbstractClusterApiClient

      protected AbstractClusterApiClient​(String username, String password, ClusterFacade core)
      Build a new AbstractClusterApiClient to work with a given ClusterFacade.
      Parameters:
      username - the login to use for REST api calls (eg. administrative username).
      password - the password associated with the username.
      core - the ClusterFacade through which to sen requests.
  • Method Details

    • get

      public T get​(String... paths)
      Prepare a GET request for the cluster API on a given path. The elements of the path are processed as follows: - if an element starts with a slash, it is kept. Otherwise a trailing slash is added. - if an element ends with a slash, it is removed. - if an element is null, it is ignored.
      Parameters:
      paths - the elements of the path.
      Returns:
      a RestBuilderMarker used to further configure the request (either sync or async). Use its execute() methods to trigger the request.
    • post

      public T post​(String... paths)
      Prepare a POST request for the cluster API on a given path. The elements of the path are processed as follows: - if an element starts with a slash, it is kept. Otherwise a trailing slash is added. - if an element ends with a slash, it is removed. - if an element is null, it is ignored.
      Parameters:
      paths - the elements of the path.
      Returns:
      a RestBuilderMarker used to further configure the request (either sync or async). Use its execute() methods to trigger the request.
    • put

      public T put​(String... paths)
      Prepare a PUT request for the cluster API on a given path. The elements of the path are processed as follows: - if an element starts with a slash, it is kept. Otherwise a trailing slash is added. - if an element ends with a slash, it is removed. - if an element is null, it is ignored.
      Parameters:
      paths - the elements of the path.
      Returns:
      a RestBuilderMarker used to further configure the request (either sync or async). Use its execute() methods to trigger the request.
    • delete

      public T delete​(String... paths)
      Prepare a DELETE request for the cluster API on a given path. The elements of the path are processed as follows: - if an element starts with a slash, it is kept. Otherwise a trailing slash is added. - if an element ends with a slash, it is removed. - if an element is null, it is ignored.
      Parameters:
      paths - the elements of the path.
      Returns:
      a RestBuilderMarker used to further configure the request (either sync or async). Use its execute() methods to trigger the request.
    • createBuilder

      protected abstract T createBuilder​(com.couchbase.client.deps.io.netty.handler.codec.http.HttpMethod method, String fullPath)
      Create the concrete builders returned by concrete implementations. Builders will be either capable of synchronous or asynchronous execution, depending on type T.
    • buildPath

      public static String buildPath​(String... paths)
      Assemble path elements to form an HTTP path: - if an element starts with a slash, it is kept. Otherwise a trailing slash is added. - if an element ends with a slash, it is removed. - if an element is null, it is ignored.
      Parameters:
      paths - the elements of the path.
      Returns:
      returns the full path.