@InterfaceAudience.Public @InterfaceStability.Experimental public abstract class AbstractClusterApiClient<T extends RestBuilderMarker> extends Object
An utility class to execute generic HTTP calls on a cluster’s REST API.
| Modifier and Type | Field and Description |
|---|---|
protected ClusterFacade |
core |
protected String |
password |
protected String |
username |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractClusterApiClient(String username,
String password,
ClusterFacade core)
Build a new
AbstractClusterApiClient to work with a given ClusterFacade. |
| Modifier and Type | Method and 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 concrete
builders 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.
|
protected final String username
protected final String password
protected final ClusterFacade core
protected AbstractClusterApiClient(String username, String password, ClusterFacade core)
Build a new AbstractClusterApiClient to work with a given ClusterFacade.
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.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.
paths - the elements of the path.RestBuilderMarker used to further configure the request (either sync or async). Use its execute() methods to trigger the request.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.
paths - the elements of the path.RestBuilderMarker used to further configure the request (either sync or async). Use its execute() methods to trigger the request.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.
paths - the elements of the path.RestBuilderMarker used to further configure the request (either sync or async). Use its execute() methods to trigger the request.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.
paths - the elements of the path.RestBuilderMarker used to further configure the request (either sync or async). Use its execute() methods to trigger the request.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.
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.
paths - the elements of the path.Copyright © 2015 Couchbase, Inc.