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 protected
AbstractClusterApiClient(String username, String password, ClusterFacade core)
Build a newAbstractClusterApiClient
to work with a givenClusterFacade
. -
Method Summary
Modifier and Type Method Description static String
buildPath(String... paths)
Assemble path elements to form an HTTP path: - if an element starts with a slash, it is kept.protected abstract T
createBuilder(com.couchbase.client.deps.io.netty.handler.codec.http.HttpMethod method, String fullPath)
Create the concretebuilders
returned by concrete implementations.T
delete(String... paths)
Prepare a DELETE request for the cluster API on a given path.T
get(String... paths)
Prepare a GET request for the cluster API on a given path.T
post(String... paths)
Prepare a POST request for the cluster API on a given path.T
put(String... paths)
Prepare a PUT request for the cluster API on a given path.
-
Field Details
-
username
-
password
-
core
-
-
Constructor Details
-
AbstractClusterApiClient
Build a newAbstractClusterApiClient
to 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
- theClusterFacade
through 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
RestBuilderMarker
used 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
RestBuilderMarker
used 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
RestBuilderMarker
used 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
RestBuilderMarker
used 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 concretebuilders
returned 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.
-