Hi Gourav,
There’s a a RawManager API for making HTTP requests to the Manager service (port 8091 / 18091).
CAVEAT: As of 3.1 it’s an “uncommitted” API, meaning it can change without notice in a patch version.
Here’s some sample code that uses RawManager
to fetch the URL you’re interested in:
static Mono<JsonObject> bucketStats(Cluster cluster, String bucketName) {
String uri = "/pools/default/buckets/" + urlEncode(bucketName);
return RawManager.call(cluster, RawManagerRequest.get(ServiceType.MANAGER, uri))
.map(response -> {
if (response.httpStatus() == 404) {
throw BucketNotFoundException.forBucket(bucketName);
}
return response.contentAs(JsonObject.class);
});
}
static String urlEncode(String s) {
try {
return URLEncoder.encode(s, StandardCharsets.UTF_8.name())
.replace("+", "%20"); // Make sure spaces are encoded as "%20"
// so the result can be used in path components and with "application/x-www-form-urlencoded"
} catch (UnsupportedEncodingException inconceivable) {
throw new AssertionError("UTF-8 not supported", inconceivable);
}
}
Thanks,
David