From 1a9a79caa4c6eabdce0062215c36b2bc64536b02 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Mon, 14 Dec 2015 20:10:57 -0800 Subject: [PATCH 1/3] Use NetworkModule for transport/http related extensions This is the xplugins side of elastic/elasticsearch#15434. Original commit: elastic/x-pack-elasticsearch@728d8b728a299c6d2427850cbb9074aa03c0a4e6 --- .../license/plugin/LicensePlugin.java | 11 +++-- .../collector/AbstractCollectorTestCase.java | 10 +++-- .../license/LicenseIntegrationTests.java | 9 ++-- .../elasticsearch/shield/ShieldPlugin.java | 41 ++++++++++--------- .../integration/LicensingTests.java | 8 ++-- .../shield/audit/AuditTrailModuleTests.java | 4 +- .../transport/TransportFilterTests.java | 8 ++-- .../org/elasticsearch/xpack/XPackPlugin.java | 14 +------ .../elasticsearch/watcher/WatcherPlugin.java | 41 ++++++++++++------- 9 files changed, 75 insertions(+), 71 deletions(-) diff --git a/elasticsearch/x-pack/license-plugin/src/main/java/org/elasticsearch/license/plugin/LicensePlugin.java b/elasticsearch/x-pack/license-plugin/src/main/java/org/elasticsearch/license/plugin/LicensePlugin.java index b4556f40fe1..dadb239372f 100644 --- a/elasticsearch/x-pack/license-plugin/src/main/java/org/elasticsearch/license/plugin/LicensePlugin.java +++ b/elasticsearch/x-pack/license-plugin/src/main/java/org/elasticsearch/license/plugin/LicensePlugin.java @@ -12,6 +12,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Module; +import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.plugin.action.delete.DeleteLicenseAction; import org.elasticsearch.license.plugin.action.delete.TransportDeleteLicenseAction; @@ -25,7 +26,6 @@ import org.elasticsearch.license.plugin.rest.RestDeleteLicenseAction; import org.elasticsearch.license.plugin.rest.RestGetLicenseAction; import org.elasticsearch.license.plugin.rest.RestPutLicenseAction; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.rest.RestModule; import java.util.ArrayList; import java.util.Collection; @@ -60,11 +60,10 @@ public class LicensePlugin extends Plugin { return "Internal Elasticsearch Licensing Plugin"; } - public void onModule(RestModule module) { - // Register REST endpoint - module.addRestAction(RestPutLicenseAction.class); - module.addRestAction(RestGetLicenseAction.class); - module.addRestAction(RestDeleteLicenseAction.class); + public void onModule(NetworkModule module) { + module.registerRestHandler(RestPutLicenseAction.class); + module.registerRestHandler(RestGetLicenseAction.class); + module.registerRestHandler(RestDeleteLicenseAction.class); } public void onModule(ActionModule module) { diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/AbstractCollectorTestCase.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/AbstractCollectorTestCase.java index 49ccbd0b29f..a92f5c73480 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/AbstractCollectorTestCase.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/collector/AbstractCollectorTestCase.java @@ -14,6 +14,7 @@ import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Module; +import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.license.core.License; @@ -28,13 +29,16 @@ import org.elasticsearch.marvel.shield.SecuredClient; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.node.Node; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.rest.RestModule; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.xpack.XPackPlugin; import org.junit.Before; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; @@ -201,7 +205,7 @@ public class AbstractCollectorTestCase extends MarvelIntegTestCase { } @Override - public void onModule(RestModule module) { + public void onModule(NetworkModule module) { } @Override diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/license/LicenseIntegrationTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/license/LicenseIntegrationTests.java index 150eb3c766c..00cca19e475 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/license/LicenseIntegrationTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/license/LicenseIntegrationTests.java @@ -11,21 +11,18 @@ import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Module; +import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.index.IndexModule; -import org.elasticsearch.index.IndexService; import org.elasticsearch.license.core.License; import org.elasticsearch.license.plugin.LicensePlugin; import org.elasticsearch.license.plugin.core.LicenseState; import org.elasticsearch.license.plugin.core.Licensee; import org.elasticsearch.license.plugin.core.LicenseeRegistry; import org.elasticsearch.license.plugin.core.LicensesManagerService; -import org.elasticsearch.rest.RestModule; -import org.elasticsearch.xpack.XPackPlugin; import org.elasticsearch.marvel.test.MarvelIntegTestCase; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.xpack.XPackPlugin; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; +import org.elasticsearch.xpack.XPackPlugin; import java.util.ArrayList; import java.util.Arrays; @@ -100,7 +97,7 @@ public class LicenseIntegrationTests extends MarvelIntegTestCase { } @Override - public void onModule(RestModule module) { + public void onModule(NetworkModule module) { } @Override diff --git a/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/ShieldPlugin.java b/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/ShieldPlugin.java index aac2975ea7f..fdf1ce197c7 100644 --- a/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/ShieldPlugin.java +++ b/elasticsearch/x-pack/shield/src/main/java/org/elasticsearch/shield/ShieldPlugin.java @@ -12,12 +12,11 @@ import org.elasticsearch.cluster.ClusterModule; import org.elasticsearch.cluster.settings.Validator; import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.inject.Module; +import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; -import org.elasticsearch.http.HttpServerModule; import org.elasticsearch.index.IndexModule; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.rest.RestModule; import org.elasticsearch.shield.action.ShieldActionFilter; import org.elasticsearch.shield.action.ShieldActionModule; import org.elasticsearch.shield.action.authc.cache.ClearRealmCacheAction; @@ -48,11 +47,15 @@ import org.elasticsearch.shield.transport.ShieldTransportModule; import org.elasticsearch.shield.transport.filter.IPFilter; import org.elasticsearch.shield.transport.netty.ShieldNettyHttpServerTransport; import org.elasticsearch.shield.transport.netty.ShieldNettyTransport; -import org.elasticsearch.transport.TransportModule; import org.elasticsearch.xpack.XPackPlugin; import java.nio.file.Path; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; /** * @@ -141,6 +144,9 @@ public class ShieldPlugin extends Plugin { } Settings.Builder settingsBuilder = Settings.settingsBuilder(); + settingsBuilder.put(NetworkModule.TRANSPORT_TYPE_KEY, ShieldPlugin.NAME); + settingsBuilder.put(NetworkModule.TRANSPORT_SERVICE_TYPE_KEY, ShieldPlugin.NAME); + settingsBuilder.put(NetworkModule.HTTP_TYPE_KEY, ShieldPlugin.NAME); addUserSettings(settingsBuilder); addTribeSettings(settingsBuilder); addQueryCacheSettings(settingsBuilder); @@ -185,32 +191,27 @@ public class ShieldPlugin extends Plugin { module.registerAction(ClearRealmCacheAction.INSTANCE, TransportClearRealmCacheAction.class); } - public void onModule(TransportModule module) { + public void onModule(NetworkModule module) { + // we want to expose the shield rest action even when the plugin is disabled + module.registerRestHandler(RestShieldInfoAction.class); + if (enabled == false) { return; } - module.setTransport(ShieldNettyTransport.class, ShieldPlugin.NAME); + + module.registerTransport(ShieldPlugin.NAME, ShieldNettyTransport.class); if (clientMode) { - module.setTransportService(ShieldClientTransportService.class, ShieldPlugin.NAME); + module.registerTransportService(ShieldPlugin.NAME, ShieldClientTransportService.class); } else { - module.setTransportService(ShieldServerTransportService.class, ShieldPlugin.NAME); + module.registerTransportService(ShieldPlugin.NAME, ShieldServerTransportService.class); } - } - public void onModule(HttpServerModule module) { - if (enabled && clientMode == false) { - module.setHttpServerTransport(ShieldNettyHttpServerTransport.class, ShieldPlugin.NAME); + if (clientMode == false) { + module.registerRestHandler(RestClearRealmCacheAction.class); + module.registerHttpTransport(ShieldPlugin.NAME, ShieldNettyHttpServerTransport.class); } } - public void onModule(RestModule module) { - if (enabled && clientMode == false) { - module.addRestAction(RestClearRealmCacheAction.class); - } - // we want to expose the shield rest action even when the plugin is disabled - module.addRestAction(RestShieldInfoAction.class); - } - public void onModule(AuthorizationModule module) { if (enabled && AuditTrailModule.auditingEnabled(settings)) { module.registerReservedRole(IndexAuditUserHolder.ROLE); diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/LicensingTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/LicensingTests.java index 928b0a043a9..9de9bae2d6e 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/LicensingTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/integration/LicensingTests.java @@ -22,6 +22,7 @@ import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.inject.AbstractModule; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Module; +import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.core.License.OperationMode; import org.elasticsearch.license.plugin.LicensePlugin; @@ -29,7 +30,6 @@ import org.elasticsearch.license.plugin.core.LicenseState; import org.elasticsearch.license.plugin.core.Licensee; import org.elasticsearch.license.plugin.core.LicenseeRegistry; import org.elasticsearch.node.Node; -import org.elasticsearch.rest.RestModule; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.shield.ShieldPlugin; import org.elasticsearch.shield.authc.support.UsernamePasswordToken; @@ -46,7 +46,9 @@ import java.util.List; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; -import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; /** * @@ -253,7 +255,7 @@ public class LicensingTests extends ShieldIntegTestCase { } @Override - public void onModule(RestModule module) { + public void onModule(NetworkModule module) { } @Override diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/audit/AuditTrailModuleTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/audit/AuditTrailModuleTests.java index 207cc8b4aac..1ce2aeb1a62 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/audit/AuditTrailModuleTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/audit/AuditTrailModuleTests.java @@ -18,7 +18,6 @@ import org.elasticsearch.shield.audit.logfile.LoggingAuditTrail; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPoolModule; -import org.elasticsearch.transport.TransportModule; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; @@ -56,11 +55,10 @@ public class AuditTrailModuleTests extends ESTestCase { Injector injector = Guice.createInjector( new SettingsModule(settings, new SettingsFilter(settings)), new AuditTrailModule(settings), - new TransportModule(settings), new CircuitBreakerModule(settings), new ThreadPoolModule(pool), new Version.Module(Version.CURRENT), - new NetworkModule(new NetworkService(settings)) + new NetworkModule(new NetworkService(settings), settings, false) ); AuditTrail auditTrail = injector.getInstance(AuditTrail.class); assertThat(auditTrail, instanceOf(AuditTrailService.class)); diff --git a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/transport/TransportFilterTests.java b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/transport/TransportFilterTests.java index 6cf3d0e9f7a..3bf60884e1a 100644 --- a/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/transport/TransportFilterTests.java +++ b/elasticsearch/x-pack/shield/src/test/java/org/elasticsearch/shield/transport/TransportFilterTests.java @@ -12,6 +12,7 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.shield.action.ShieldActionMapper; @@ -24,7 +25,6 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.Transport; import org.elasticsearch.transport.TransportChannel; import org.elasticsearch.transport.TransportException; -import org.elasticsearch.transport.TransportModule; import org.elasticsearch.transport.TransportRequest; import org.elasticsearch.transport.TransportRequestHandler; import org.elasticsearch.transport.TransportResponse; @@ -291,12 +291,12 @@ public class TransportFilterTests extends ESIntegTestCase { public String description() { return "a mock transport service for testing"; } - public void onModule(TransportModule transportModule) { - transportModule.addTransportService("filter-mock", InternalPluginServerTransportService.class); + public void onModule(NetworkModule module) { + module.registerTransportService("filter-mock", InternalPluginServerTransportService.class); } @Override public Settings additionalSettings() { - return Settings.builder().put(TransportModule.TRANSPORT_SERVICE_TYPE_KEY, "filter-mock").build(); + return Settings.builder().put(NetworkModule.TRANSPORT_SERVICE_TYPE_KEY, "filter-mock").build(); } } diff --git a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/XPackPlugin.java b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/XPackPlugin.java index df70ab2c53e..84347f29857 100644 --- a/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/XPackPlugin.java +++ b/elasticsearch/x-pack/src/main/java/org/elasticsearch/xpack/XPackPlugin.java @@ -12,17 +12,15 @@ import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; +import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.http.HttpServerModule; import org.elasticsearch.index.IndexModule; import org.elasticsearch.license.plugin.LicensePlugin; import org.elasticsearch.marvel.MarvelPlugin; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.rest.RestModule; import org.elasticsearch.script.ScriptModule; import org.elasticsearch.shield.ShieldPlugin; import org.elasticsearch.shield.authz.AuthorizationModule; -import org.elasticsearch.transport.TransportModule; import org.elasticsearch.watcher.WatcherPlugin; import java.security.AccessController; @@ -128,7 +126,7 @@ public class XPackPlugin extends Plugin { marvelPlugin.onModule(module); } - public void onModule(RestModule module) { + public void onModule(NetworkModule module) { licensePlugin.onModule(module); shieldPlugin.onModule(module); watcherPlugin.onModule(module); @@ -140,14 +138,6 @@ public class XPackPlugin extends Plugin { watcherPlugin.onModule(module); } - public void onModule(TransportModule module) { - shieldPlugin.onModule(module); - } - - public void onModule(HttpServerModule module) { - shieldPlugin.onModule(module); - } - public void onModule(AuthorizationModule module) { shieldPlugin.onModule(module); // FIXME clean these up diff --git a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/watcher/WatcherPlugin.java b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/watcher/WatcherPlugin.java index 7aa18ebc51e..aef44c9e58a 100644 --- a/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/watcher/WatcherPlugin.java +++ b/elasticsearch/x-pack/watcher/src/main/java/org/elasticsearch/watcher/WatcherPlugin.java @@ -17,10 +17,10 @@ import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.logging.support.LoggerMessageFormat; +import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.rest.RestModule; import org.elasticsearch.script.ScriptModule; import org.elasticsearch.shield.authz.AuthorizationModule; import org.elasticsearch.watcher.actions.WatcherActionModule; @@ -35,7 +35,16 @@ import org.elasticsearch.watcher.history.HistoryStore; import org.elasticsearch.watcher.input.InputModule; import org.elasticsearch.watcher.license.LicenseModule; import org.elasticsearch.watcher.license.WatcherLicensee; -import org.elasticsearch.watcher.rest.action.*; +import org.elasticsearch.watcher.rest.action.RestAckWatchAction; +import org.elasticsearch.watcher.rest.action.RestActivateWatchAction; +import org.elasticsearch.watcher.rest.action.RestDeleteWatchAction; +import org.elasticsearch.watcher.rest.action.RestExecuteWatchAction; +import org.elasticsearch.watcher.rest.action.RestGetWatchAction; +import org.elasticsearch.watcher.rest.action.RestHijackOperationAction; +import org.elasticsearch.watcher.rest.action.RestPutWatchAction; +import org.elasticsearch.watcher.rest.action.RestWatchServiceAction; +import org.elasticsearch.watcher.rest.action.RestWatcherInfoAction; +import org.elasticsearch.watcher.rest.action.RestWatcherStatsAction; import org.elasticsearch.watcher.shield.InternalWatcherUser; import org.elasticsearch.watcher.shield.ShieldIntegration; import org.elasticsearch.watcher.shield.WatcherShieldModule; @@ -74,7 +83,11 @@ import org.elasticsearch.xpack.XPackPlugin; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; import static org.elasticsearch.common.settings.Settings.settingsBuilder; @@ -177,18 +190,18 @@ public class WatcherPlugin extends Plugin { } } - public void onModule(RestModule module) { + public void onModule(NetworkModule module) { if (enabled && !transportClient) { - module.addRestAction(RestPutWatchAction.class); - module.addRestAction(RestDeleteWatchAction.class); - module.addRestAction(RestWatcherStatsAction.class); - module.addRestAction(RestWatcherInfoAction.class); - module.addRestAction(RestGetWatchAction.class); - module.addRestAction(RestWatchServiceAction.class); - module.addRestAction(RestAckWatchAction.class); - module.addRestAction(RestActivateWatchAction.class); - module.addRestAction(RestExecuteWatchAction.class); - module.addRestAction(RestHijackOperationAction.class); + module.registerRestHandler(RestPutWatchAction.class); + module.registerRestHandler(RestDeleteWatchAction.class); + module.registerRestHandler(RestWatcherStatsAction.class); + module.registerRestHandler(RestWatcherInfoAction.class); + module.registerRestHandler(RestGetWatchAction.class); + module.registerRestHandler(RestWatchServiceAction.class); + module.registerRestHandler(RestAckWatchAction.class); + module.registerRestHandler(RestActivateWatchAction.class); + module.registerRestHandler(RestExecuteWatchAction.class); + module.registerRestHandler(RestHijackOperationAction.class); } } From 6cf8f261e18906fbdefa7f5699570a199884361e Mon Sep 17 00:00:00 2001 From: Britta Weber Date: Wed, 16 Dec 2015 17:00:57 +0100 Subject: [PATCH 2/3] Update handler list to include synced flush see elastic/elasticsearch#15396 Original commit: elastic/x-pack-elasticsearch@e41ddbf9fa157e4775a07139f3fbd800fe1bd176 --- .../src/test/resources/org/elasticsearch/transport/actions | 1 + .../src/test/resources/org/elasticsearch/transport/handlers | 1 + 2 files changed, 2 insertions(+) diff --git a/elasticsearch/x-pack/shield/src/test/resources/org/elasticsearch/transport/actions b/elasticsearch/x-pack/shield/src/test/resources/org/elasticsearch/transport/actions index 497a82ba8b3..6c214da44cc 100644 --- a/elasticsearch/x-pack/shield/src/test/resources/org/elasticsearch/transport/actions +++ b/elasticsearch/x-pack/shield/src/test/resources/org/elasticsearch/transport/actions @@ -28,6 +28,7 @@ indices:admin/delete indices:admin/get indices:admin/exists indices:admin/flush +indices:admin/synced_flush indices:admin/forcemerge indices:admin/mapping/put indices:admin/mappings/fields/get diff --git a/elasticsearch/x-pack/shield/src/test/resources/org/elasticsearch/transport/handlers b/elasticsearch/x-pack/shield/src/test/resources/org/elasticsearch/transport/handlers index f5914626809..bf8a2982b59 100644 --- a/elasticsearch/x-pack/shield/src/test/resources/org/elasticsearch/transport/handlers +++ b/elasticsearch/x-pack/shield/src/test/resources/org/elasticsearch/transport/handlers @@ -14,6 +14,7 @@ indices:admin/forcemerge[n] indices:admin/flush[s] indices:admin/flush[s][p] indices:admin/flush[s][r] +indices:admin/synced_flush indices:admin/mappings/fields/get[index] indices:admin/mappings/fields/get[index][s] indices:admin/refresh[s] From 267b86c57f53dd79ca4c50563b69cca14fc8cd98 Mon Sep 17 00:00:00 2001 From: Britta Weber Date: Wed, 16 Dec 2015 17:40:30 +0100 Subject: [PATCH 3/3] Marvel: add implementation for synced flush to SecuredClient see elastic/elasticsearch#15396 Original commit: elastic/x-pack-elasticsearch@c60c2717382b67b20c564e0cdf655cf61235d69c --- .../marvel/shield/SecuredClient.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/shield/SecuredClient.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/shield/SecuredClient.java index 8ac4ddd3980..04713390d39 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/shield/SecuredClient.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/shield/SecuredClient.java @@ -129,6 +129,10 @@ import org.elasticsearch.action.admin.indices.flush.FlushAction; import org.elasticsearch.action.admin.indices.flush.FlushRequest; import org.elasticsearch.action.admin.indices.flush.FlushRequestBuilder; import org.elasticsearch.action.admin.indices.flush.FlushResponse; +import org.elasticsearch.action.admin.indices.flush.SyncedFlushAction; +import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest; +import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequestBuilder; +import org.elasticsearch.action.admin.indices.flush.SyncedFlushResponse; import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeAction; import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest; import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequestBuilder; @@ -260,6 +264,7 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.indices.flush.SyncedFlushService; import org.elasticsearch.threadpool.ThreadPool; /** @@ -791,6 +796,21 @@ public class SecuredClient implements Client { return (new FlushRequestBuilder(this, FlushAction.INSTANCE)).setIndices(indices); } + @Override + public ActionFuture syncedFlush(SyncedFlushRequest syncedFlushRequest) { + return this.execute(SyncedFlushAction.INSTANCE, syncedFlushRequest); + } + + @Override + public void syncedFlush(SyncedFlushRequest syncedFlushRequest, ActionListener actionListener) { + this.execute(SyncedFlushAction.INSTANCE, syncedFlushRequest, actionListener); + } + + @Override + public SyncedFlushRequestBuilder prepareSyncedFlush(String... indices) { + return (new SyncedFlushRequestBuilder(this, SyncedFlushAction.INSTANCE)).setIndices(indices); + } + public void getMappings(GetMappingsRequest request, ActionListener listener) { this.execute(GetMappingsAction.INSTANCE, request, listener); }