io.reactiverse.elasticsearch.client.ClusterClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elasticsearch-client Show documentation
Show all versions of elasticsearch-client Show documentation
Reactiverse Elasticsearch client
/*
[NOTE] This is an automatically generated file.
Do not make changes to this file but to the shim code generator.
*/
package io.reactiverse.elasticsearch.client;
import io.vertx.core.*;
import org.elasticsearch.client.*;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.settings.ClusterGetSettingsRequest;
import org.elasticsearch.action.admin.cluster.settings.ClusterGetSettingsResponse;
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
import org.elasticsearch.rest.RestStatus;
import java.io.IOException;
import static java.util.Collections.emptySet;
import static java.util.Collections.singleton;
class ClusterClientImpl implements ClusterClient {
private final Vertx vertx;
private final org.elasticsearch.client.ClusterClient delegate;
ClusterClientImpl(Vertx vertx, org.elasticsearch.client.ClusterClient delegate) {
this.vertx = vertx;
this.delegate = delegate;
}
@Override()
public void putSettingsAsync(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest, RequestOptions options, Handler> handler) {
Context context = vertx.getOrCreateContext();
delegate.putSettingsAsync(clusterUpdateSettingsRequest, options, new ActionListener() {
@Override
public void onResponse(ClusterUpdateSettingsResponse value) {
context.runOnContext(v -> handler.handle(Future.succeededFuture(value)));
}
@Override
public void onFailure(Exception e) {
context.runOnContext(v -> handler.handle(Future.failedFuture(e)));
}
});
}
@Override()
public void getSettingsAsync(ClusterGetSettingsRequest clusterGetSettingsRequest, RequestOptions options, Handler> handler) {
Context context = vertx.getOrCreateContext();
delegate.getSettingsAsync(clusterGetSettingsRequest, options, new ActionListener() {
@Override
public void onResponse(ClusterGetSettingsResponse value) {
context.runOnContext(v -> handler.handle(Future.succeededFuture(value)));
}
@Override
public void onFailure(Exception e) {
context.runOnContext(v -> handler.handle(Future.failedFuture(e)));
}
});
}
@Override()
public void healthAsync(ClusterHealthRequest healthRequest, RequestOptions options, Handler> handler) {
Context context = vertx.getOrCreateContext();
delegate.healthAsync(healthRequest, options, new ActionListener() {
@Override
public void onResponse(ClusterHealthResponse value) {
context.runOnContext(v -> handler.handle(Future.succeededFuture(value)));
}
@Override
public void onFailure(Exception e) {
context.runOnContext(v -> handler.handle(Future.failedFuture(e)));
}
});
}
}