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 Summary
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractClusterApiClient(String username, String password, ClusterFacade core)Build a newAbstractClusterApiClientto work with a givenClusterFacade. -
Method Summary
Modifier and Type Method Description static StringbuildPath(String... paths)Assemble path elements to form an HTTP path: - if an element starts with a slash, it is kept.protected abstract TcreateBuilder(com.couchbase.client.deps.io.netty.handler.codec.http.HttpMethod method, String fullPath)Create the concretebuildersreturned by concrete implementations.Tdelete(String... paths)Prepare a DELETE request for the cluster API on a given path.Tget(String... paths)Prepare a GET request for the cluster API on a given path.Tpost(String... paths)Prepare a POST request for the cluster API on a given path.Tput(String... paths)Prepare a PUT request for the cluster API on a given path.
-
Field Details
-
username
-
password
-
core
-
-
Constructor Details
-
AbstractClusterApiClient
Build a newAbstractClusterApiClientto work with a givenClusterFacade.- Parameters:
username- the login to use for REST api calls (eg. administrative username).password- the password associated with the username.core- theClusterFacadethrough which to sen requests.
-
-
Method Details
-
get
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
RestBuilderMarkerused to further configure the request (either sync or async). Use itsexecute()methods to trigger the request.
-
post
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
RestBuilderMarkerused to further configure the request (either sync or async). Use itsexecute()methods to trigger the request.
-
put
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
RestBuilderMarkerused to further configure the request (either sync or async). Use itsexecute()methods to trigger the request.
-
delete
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
RestBuilderMarkerused to further configure the request (either sync or async). Use itsexecute()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 concretebuildersreturned by concrete implementations. Builders will be either capable of synchronous or asynchronous execution, depending on type T. -
buildPath
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.
-