diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java index 250bbd520dad7..c4567e22e0ba1 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java @@ -21,18 +21,15 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; -import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest; import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest; import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse; import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest; import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse; import org.elasticsearch.action.admin.indices.close.CloseIndexRequest; -import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; -import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.admin.indices.flush.FlushRequest; import org.elasticsearch.action.admin.indices.flush.FlushResponse; import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest; @@ -45,7 +42,6 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.admin.indices.open.OpenIndexRequest; import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; @@ -55,15 +51,14 @@ import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest; import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse; import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest; -import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse; import org.elasticsearch.action.admin.indices.shrink.ResizeRequest; import org.elasticsearch.action.admin.indices.shrink.ResizeResponse; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; -import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest; import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.rest.RestStatus; import java.io.IOException; @@ -93,9 +88,9 @@ public final class IndicesClient { * @return the response * @throws IOException in case there is a problem sending the request or parsing back the response */ - public DeleteIndexResponse delete(DeleteIndexRequest deleteIndexRequest, RequestOptions options) throws IOException { + public AcknowledgedResponse delete(DeleteIndexRequest deleteIndexRequest, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(deleteIndexRequest, RequestConverters::deleteIndex, options, - DeleteIndexResponse::fromXContent, emptySet()); + AcknowledgedResponse::fromXContent, emptySet()); } /** @@ -106,9 +101,9 @@ public DeleteIndexResponse delete(DeleteIndexRequest deleteIndexRequest, Request * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized * @param listener the listener to be notified upon request completion */ - public void deleteAsync(DeleteIndexRequest deleteIndexRequest, RequestOptions options, ActionListener listener) { + public void deleteAsync(DeleteIndexRequest deleteIndexRequest, RequestOptions options, ActionListener listener) { restHighLevelClient.performRequestAsyncAndParseEntity(deleteIndexRequest, RequestConverters::deleteIndex, options, - DeleteIndexResponse::fromXContent, listener, emptySet()); + AcknowledgedResponse::fromXContent, listener, emptySet()); } /** @@ -147,9 +142,9 @@ public void createAsync(CreateIndexRequest createIndexRequest, RequestOptions op * @return the response * @throws IOException in case there is a problem sending the request or parsing back the response */ - public PutMappingResponse putMapping(PutMappingRequest putMappingRequest, RequestOptions options) throws IOException { + public AcknowledgedResponse putMapping(PutMappingRequest putMappingRequest, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(putMappingRequest, RequestConverters::putMapping, options, - PutMappingResponse::fromXContent, emptySet()); + AcknowledgedResponse::fromXContent, emptySet()); } /** @@ -160,9 +155,10 @@ public PutMappingResponse putMapping(PutMappingRequest putMappingRequest, Reques * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized * @param listener the listener to be notified upon request completion */ - public void putMappingAsync(PutMappingRequest putMappingRequest, RequestOptions options, ActionListener listener) { + public void putMappingAsync(PutMappingRequest putMappingRequest, RequestOptions options, + ActionListener listener) { restHighLevelClient.performRequestAsyncAndParseEntity(putMappingRequest, RequestConverters::putMapping, options, - PutMappingResponse::fromXContent, listener, emptySet()); + AcknowledgedResponse::fromXContent, listener, emptySet()); } /** @@ -231,9 +227,9 @@ public void getFieldMappingAsync(GetFieldMappingsRequest getFieldMappingsRequest * @return the response * @throws IOException in case there is a problem sending the request or parsing back the response */ - public IndicesAliasesResponse updateAliases(IndicesAliasesRequest indicesAliasesRequest, RequestOptions options) throws IOException { + public AcknowledgedResponse updateAliases(IndicesAliasesRequest indicesAliasesRequest, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(indicesAliasesRequest, RequestConverters::updateAliases, options, - IndicesAliasesResponse::fromXContent, emptySet()); + AcknowledgedResponse::fromXContent, emptySet()); } /** @@ -245,9 +241,9 @@ public IndicesAliasesResponse updateAliases(IndicesAliasesRequest indicesAliases * @param listener the listener to be notified upon request completion */ public void updateAliasesAsync(IndicesAliasesRequest indicesAliasesRequest, RequestOptions options, - ActionListener listener) { + ActionListener listener) { restHighLevelClient.performRequestAsyncAndParseEntity(indicesAliasesRequest, RequestConverters::updateAliases, options, - IndicesAliasesResponse::fromXContent, listener, emptySet()); + AcknowledgedResponse::fromXContent, listener, emptySet()); } /** @@ -286,9 +282,9 @@ public void openAsync(OpenIndexRequest openIndexRequest, RequestOptions options, * @return the response * @throws IOException in case there is a problem sending the request or parsing back the response */ - public CloseIndexResponse close(CloseIndexRequest closeIndexRequest, RequestOptions options) throws IOException { + public AcknowledgedResponse close(CloseIndexRequest closeIndexRequest, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(closeIndexRequest, RequestConverters::closeIndex, options, - CloseIndexResponse::fromXContent, emptySet()); + AcknowledgedResponse::fromXContent, emptySet()); } /** @@ -299,9 +295,9 @@ public CloseIndexResponse close(CloseIndexRequest closeIndexRequest, RequestOpti * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized * @param listener the listener to be notified upon request completion */ - public void closeAsync(CloseIndexRequest closeIndexRequest, RequestOptions options, ActionListener listener) { + public void closeAsync(CloseIndexRequest closeIndexRequest, RequestOptions options, ActionListener listener) { restHighLevelClient.performRequestAsyncAndParseEntity(closeIndexRequest, RequestConverters::closeIndex, options, - CloseIndexResponse::fromXContent, listener, emptySet()); + AcknowledgedResponse::fromXContent, listener, emptySet()); } @@ -706,9 +702,9 @@ public void getAliasAsync(GetAliasesRequest getAliasesRequest, RequestOptions op * @return the response * @throws IOException in case there is a problem sending the request or parsing back the response */ - public UpdateSettingsResponse putSettings(UpdateSettingsRequest updateSettingsRequest, RequestOptions options) throws IOException { + public AcknowledgedResponse putSettings(UpdateSettingsRequest updateSettingsRequest, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(updateSettingsRequest, RequestConverters::indexPutSettings, options, - UpdateSettingsResponse::fromXContent, emptySet()); + AcknowledgedResponse::fromXContent, emptySet()); } /** @@ -720,9 +716,9 @@ public UpdateSettingsResponse putSettings(UpdateSettingsRequest updateSettingsRe * @param listener the listener to be notified upon request completion */ public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, RequestOptions options, - ActionListener listener) { + ActionListener listener) { restHighLevelClient.performRequestAsyncAndParseEntity(updateSettingsRequest, RequestConverters::indexPutSettings, options, - UpdateSettingsResponse::fromXContent, listener, emptySet()); + AcknowledgedResponse::fromXContent, listener, emptySet()); } /** @@ -734,10 +730,10 @@ public void putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, Reques * @return the response * @throws IOException in case there is a problem sending the request or parsing back the response */ - public PutIndexTemplateResponse putTemplate(PutIndexTemplateRequest putIndexTemplateRequest, - RequestOptions options) throws IOException { + public AcknowledgedResponse putTemplate(PutIndexTemplateRequest putIndexTemplateRequest, + RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(putIndexTemplateRequest, RequestConverters::putTemplate, options, - PutIndexTemplateResponse::fromXContent, emptySet()); + AcknowledgedResponse::fromXContent, emptySet()); } /** @@ -749,9 +745,9 @@ public PutIndexTemplateResponse putTemplate(PutIndexTemplateRequest putIndexTemp * @param listener the listener to be notified upon request completion */ public void putTemplateAsync(PutIndexTemplateRequest putIndexTemplateRequest, RequestOptions options, - ActionListener listener) { + ActionListener listener) { restHighLevelClient.performRequestAsyncAndParseEntity(putIndexTemplateRequest, RequestConverters::putTemplate, options, - PutIndexTemplateResponse::fromXContent, listener, emptySet()); + AcknowledgedResponse::fromXContent, listener, emptySet()); } /** diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/LicenseClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/LicenseClient.java index 589f187f397aa..ca6539daa0432 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/LicenseClient.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/LicenseClient.java @@ -21,6 +21,7 @@ import org.apache.http.HttpEntity; import org.elasticsearch.action.ActionListener; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.Streams; import org.elasticsearch.common.xcontent.DeprecationHandler; @@ -30,7 +31,6 @@ import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.protocol.xpack.license.DeleteLicenseRequest; -import org.elasticsearch.protocol.xpack.license.DeleteLicenseResponse; import org.elasticsearch.protocol.xpack.license.GetLicenseRequest; import org.elasticsearch.protocol.xpack.license.GetLicenseResponse; import org.elasticsearch.protocol.xpack.license.PutLicenseRequest; @@ -106,9 +106,9 @@ public void getLicenseAsync(GetLicenseRequest request, RequestOptions options, A * @return the response * @throws IOException in case there is a problem sending the request or parsing back the response */ - public DeleteLicenseResponse deleteLicense(DeleteLicenseRequest request, RequestOptions options) throws IOException { + public AcknowledgedResponse deleteLicense(DeleteLicenseRequest request, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(request, RequestConverters::deleteLicense, options, - DeleteLicenseResponse::fromXContent, emptySet()); + AcknowledgedResponse::fromXContent, emptySet()); } /** @@ -116,9 +116,9 @@ public DeleteLicenseResponse deleteLicense(DeleteLicenseRequest request, Request * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized * @param listener the listener to be notified upon request completion */ - public void deleteLicenseAsync(DeleteLicenseRequest request, RequestOptions options, ActionListener listener) { + public void deleteLicenseAsync(DeleteLicenseRequest request, RequestOptions options, ActionListener listener) { restHighLevelClient.performRequestAsyncAndParseEntity(request, RequestConverters::deleteLicense, options, - DeleteLicenseResponse::fromXContent, listener, emptySet()); + AcknowledgedResponse::fromXContent, listener, emptySet()); } /** diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java index 50d7465ae334a..e705ca12806ba 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java @@ -27,7 +27,6 @@ import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest; -import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptResponse; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptResponse; import org.elasticsearch.action.bulk.BulkRequest; @@ -53,6 +52,7 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchScrollRequest; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.update.UpdateRequest; import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.common.CheckedConsumer; @@ -916,9 +916,9 @@ public void getScriptAsync(GetStoredScriptRequest request, RequestOptions option * @return the response * @throws IOException in case there is a problem sending the request or parsing back the response */ - public DeleteStoredScriptResponse deleteScript(DeleteStoredScriptRequest request, RequestOptions options) throws IOException { + public AcknowledgedResponse deleteScript(DeleteStoredScriptRequest request, RequestOptions options) throws IOException { return performRequestAndParseEntity(request, RequestConverters::deleteScript, options, - DeleteStoredScriptResponse::fromXContent, emptySet()); + AcknowledgedResponse::fromXContent, emptySet()); } /** @@ -930,9 +930,9 @@ public DeleteStoredScriptResponse deleteScript(DeleteStoredScriptRequest request * @param listener the listener to be notified upon request completion */ public void deleteScriptAsync(DeleteStoredScriptRequest request, RequestOptions options, - ActionListener listener) { + ActionListener listener) { performRequestAsyncAndParseEntity(request, RequestConverters::deleteScript, options, - DeleteStoredScriptResponse::fromXContent, listener, emptySet()); + AcknowledgedResponse::fromXContent, listener, emptySet()); } /** diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/SnapshotClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/SnapshotClient.java index 319eb96a9f899..7df0df4836d68 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/SnapshotClient.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/SnapshotClient.java @@ -21,23 +21,21 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest; -import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest; -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; +import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest; +import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest; +import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse; -import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest; -import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse; -import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest; -import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import java.io.IOException; @@ -95,9 +93,9 @@ public void getRepositoryAsync(GetRepositoriesRequest getRepositoriesRequest, Re * @return the response * @throws IOException in case there is a problem sending the request or parsing back the response */ - public PutRepositoryResponse createRepository(PutRepositoryRequest putRepositoryRequest, RequestOptions options) throws IOException { + public AcknowledgedResponse createRepository(PutRepositoryRequest putRepositoryRequest, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(putRepositoryRequest, RequestConverters::createRepository, options, - PutRepositoryResponse::fromXContent, emptySet()); + AcknowledgedResponse::fromXContent, emptySet()); } /** @@ -109,9 +107,9 @@ public PutRepositoryResponse createRepository(PutRepositoryRequest putRepository * @param listener the listener to be notified upon request completion */ public void createRepositoryAsync(PutRepositoryRequest putRepositoryRequest, RequestOptions options, - ActionListener listener) { + ActionListener listener) { restHighLevelClient.performRequestAsyncAndParseEntity(putRepositoryRequest, RequestConverters::createRepository, options, - PutRepositoryResponse::fromXContent, listener, emptySet()); + AcknowledgedResponse::fromXContent, listener, emptySet()); } /** @@ -123,10 +121,10 @@ public void createRepositoryAsync(PutRepositoryRequest putRepositoryRequest, Req * @return the response * @throws IOException in case there is a problem sending the request or parsing back the response */ - public DeleteRepositoryResponse deleteRepository(DeleteRepositoryRequest deleteRepositoryRequest, RequestOptions options) + public AcknowledgedResponse deleteRepository(DeleteRepositoryRequest deleteRepositoryRequest, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(deleteRepositoryRequest, RequestConverters::deleteRepository, options, - DeleteRepositoryResponse::fromXContent, emptySet()); + AcknowledgedResponse::fromXContent, emptySet()); } /** @@ -138,9 +136,9 @@ public DeleteRepositoryResponse deleteRepository(DeleteRepositoryRequest deleteR * @param listener the listener to be notified upon request completion */ public void deleteRepositoryAsync(DeleteRepositoryRequest deleteRepositoryRequest, RequestOptions options, - ActionListener listener) { + ActionListener listener) { restHighLevelClient.performRequestAsyncAndParseEntity(deleteRepositoryRequest, RequestConverters::deleteRepository, options, - DeleteRepositoryResponse::fromXContent, listener, emptySet()); + AcknowledgedResponse::fromXContent, listener, emptySet()); } /** @@ -294,9 +292,9 @@ public void restoreAsync(RestoreSnapshotRequest restoreSnapshotRequest, RequestO * @return the response * @throws IOException in case there is a problem sending the request or parsing back the response */ - public DeleteSnapshotResponse delete(DeleteSnapshotRequest deleteSnapshotRequest, RequestOptions options) throws IOException { + public AcknowledgedResponse delete(DeleteSnapshotRequest deleteSnapshotRequest, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(deleteSnapshotRequest, RequestConverters::deleteSnapshot, options, - DeleteSnapshotResponse::fromXContent, emptySet()); + AcknowledgedResponse::fromXContent, emptySet()); } /** @@ -309,8 +307,8 @@ public DeleteSnapshotResponse delete(DeleteSnapshotRequest deleteSnapshotRequest * @param listener the listener to be notified upon request completion */ public void deleteAsync(DeleteSnapshotRequest deleteSnapshotRequest, RequestOptions options, - ActionListener listener) { + ActionListener listener) { restHighLevelClient.performRequestAsyncAndParseEntity(deleteSnapshotRequest, RequestConverters::deleteSnapshot, options, - DeleteSnapshotResponse::fromXContent, listener, emptySet()); + AcknowledgedResponse::fromXContent, listener, emptySet()); } } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java index 36a45999b51ee..533f6bcb22e25 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/IndicesClientIT.java @@ -27,18 +27,15 @@ import org.elasticsearch.action.admin.indices.alias.Alias; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions; -import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest; import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest; import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse; import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest; import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse; import org.elasticsearch.action.admin.indices.close.CloseIndexRequest; -import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; -import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.admin.indices.flush.FlushRequest; import org.elasticsearch.action.admin.indices.flush.FlushResponse; import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest; @@ -51,7 +48,6 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.admin.indices.open.OpenIndexRequest; import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; @@ -61,20 +57,19 @@ import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest; import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse; import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest; -import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse; import org.elasticsearch.action.admin.indices.shrink.ResizeRequest; import org.elasticsearch.action.admin.indices.shrink.ResizeResponse; import org.elasticsearch.action.admin.indices.shrink.ResizeType; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; -import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest; import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.WriteRequest; import org.elasticsearch.action.support.broadcast.BroadcastResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.cluster.metadata.AliasMetaData; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; @@ -411,7 +406,7 @@ public void testPutMapping() throws IOException { mappingBuilder.endObject().endObject().endObject(); putMappingRequest.source(mappingBuilder); - PutMappingResponse putMappingResponse = + AcknowledgedResponse putMappingResponse = execute(putMappingRequest, highLevelClient().indices()::putMapping, highLevelClient().indices()::putMappingAsync); assertTrue(putMappingResponse.isAcknowledged()); @@ -431,7 +426,7 @@ public void testGetMapping() throws IOException { mappingBuilder.endObject().endObject().endObject(); putMappingRequest.source(mappingBuilder); - PutMappingResponse putMappingResponse = + AcknowledgedResponse putMappingResponse = execute(putMappingRequest, highLevelClient().indices()::putMapping, highLevelClient().indices()::putMappingAsync); assertTrue(putMappingResponse.isAcknowledged()); @@ -467,7 +462,7 @@ public void testGetFieldMapping() throws IOException { mappingBuilder.endObject().endObject().endObject(); putMappingRequest.source(mappingBuilder); - PutMappingResponse putMappingResponse = + AcknowledgedResponse putMappingResponse = execute(putMappingRequest, highLevelClient().indices()::putMapping, highLevelClient().indices()::putMappingAsync); assertTrue(putMappingResponse.isAcknowledged()); @@ -497,7 +492,7 @@ public void testDeleteIndex() throws IOException { createIndex(indexName, Settings.EMPTY); DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(indexName); - DeleteIndexResponse deleteIndexResponse = + AcknowledgedResponse deleteIndexResponse = execute(deleteIndexRequest, highLevelClient().indices()::delete, highLevelClient().indices()::deleteAsync); assertTrue(deleteIndexResponse.isAcknowledged()); @@ -529,7 +524,7 @@ public void testUpdateAliases() throws IOException { AliasActions addAction = new AliasActions(AliasActions.Type.ADD).index(index).aliases(alias); addAction.routing("routing").searchRouting("search_routing").filter("{\"term\":{\"year\":2016}}"); aliasesAddRequest.addAliasAction(addAction); - IndicesAliasesResponse aliasesAddResponse = execute(aliasesAddRequest, highLevelClient().indices()::updateAliases, + AcknowledgedResponse aliasesAddResponse = execute(aliasesAddRequest, highLevelClient().indices()::updateAliases, highLevelClient().indices()::updateAliasesAsync); assertTrue(aliasesAddResponse.isAcknowledged()); assertThat(aliasExists(alias), equalTo(true)); @@ -547,7 +542,7 @@ public void testUpdateAliases() throws IOException { aliasesAddRemoveRequest.addAliasAction(addAction); AliasActions removeAction = new AliasActions(AliasActions.Type.REMOVE).index(index).alias(alias); aliasesAddRemoveRequest.addAliasAction(removeAction); - IndicesAliasesResponse aliasesAddRemoveResponse = execute(aliasesAddRemoveRequest, highLevelClient().indices()::updateAliases, + AcknowledgedResponse aliasesAddRemoveResponse = execute(aliasesAddRemoveRequest, highLevelClient().indices()::updateAliases, highLevelClient().indices()::updateAliasesAsync); assertTrue(aliasesAddRemoveResponse.isAcknowledged()); assertThat(aliasExists(alias), equalTo(false)); @@ -558,7 +553,7 @@ public void testUpdateAliases() throws IOException { IndicesAliasesRequest aliasesRemoveIndexRequest = new IndicesAliasesRequest(); AliasActions removeIndexAction = new AliasActions(AliasActions.Type.REMOVE_INDEX).index(index); aliasesRemoveIndexRequest.addAliasAction(removeIndexAction); - IndicesAliasesResponse aliasesRemoveIndexResponse = execute(aliasesRemoveIndexRequest, highLevelClient().indices()::updateAliases, + AcknowledgedResponse aliasesRemoveIndexResponse = execute(aliasesRemoveIndexRequest, highLevelClient().indices()::updateAliases, highLevelClient().indices()::updateAliasesAsync); assertTrue(aliasesRemoveIndexResponse.isAcknowledged()); assertThat(aliasExists(alias), equalTo(false)); @@ -654,7 +649,7 @@ public void testCloseExistingIndex() throws IOException { assertThat(response.getStatusLine().getStatusCode(), equalTo(RestStatus.OK.getStatus())); CloseIndexRequest closeIndexRequest = new CloseIndexRequest(index); - CloseIndexResponse closeIndexResponse = execute(closeIndexRequest, highLevelClient().indices()::close, + AcknowledgedResponse closeIndexResponse = execute(closeIndexRequest, highLevelClient().indices()::close, highLevelClient().indices()::closeAsync); assertTrue(closeIndexResponse.isAcknowledged()); @@ -1144,7 +1139,7 @@ public void testIndexPutSettings() throws IOException { assertThat(dynamicSetting.getDefault(Settings.EMPTY), not(dynamicSettingValue)); UpdateSettingsRequest dynamicSettingRequest = new UpdateSettingsRequest(); dynamicSettingRequest.settings(Settings.builder().put(dynamicSettingKey, dynamicSettingValue).build()); - UpdateSettingsResponse response = execute(dynamicSettingRequest, highLevelClient().indices()::putSettings, + AcknowledgedResponse response = execute(dynamicSettingRequest, highLevelClient().indices()::putSettings, highLevelClient().indices()::putSettingsAsync); assertTrue(response.isAcknowledged()); @@ -1227,7 +1222,7 @@ public void testPutTemplate() throws Exception { .mapping("doc", "host_name", "type=keyword", "description", "type=text") .alias(new Alias("alias-1").indexRouting("abc")).alias(new Alias("{index}-write").searchRouting("xyz")); - PutIndexTemplateResponse putTemplateResponse = execute(putTemplateRequest, + AcknowledgedResponse putTemplateResponse = execute(putTemplateRequest, highLevelClient().indices()::putTemplate, highLevelClient().indices()::putTemplateAsync); assertThat(putTemplateResponse.isAcknowledged(), equalTo(true)); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/SnapshotIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/SnapshotIT.java index 06aec70a01884..4616234f14509 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/SnapshotIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/SnapshotIT.java @@ -21,24 +21,22 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest; -import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest; -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse; -import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; -import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; -import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest; -import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest; -import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse; +import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; +import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; +import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest; +import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.repositories.fs.FsRepository; import org.elasticsearch.rest.RestStatus; @@ -55,7 +53,7 @@ public class SnapshotIT extends ESRestHighLevelClientTestCase { - private PutRepositoryResponse createTestRepository(String repository, String type, String settings) throws IOException { + private AcknowledgedResponse createTestRepository(String repository, String type, String settings) throws IOException { PutRepositoryRequest request = new PutRepositoryRequest(repository); request.settings(settings, XContentType.JSON); request.type(type); @@ -71,7 +69,7 @@ private CreateSnapshotResponse createTestSnapshot(CreateSnapshotRequest createSn } public void testCreateRepository() throws IOException { - PutRepositoryResponse response = createTestRepository("test", FsRepository.TYPE, "{\"location\": \".\"}"); + AcknowledgedResponse response = createTestRepository("test", FsRepository.TYPE, "{\"location\": \".\"}"); assertTrue(response.isAcknowledged()); } @@ -117,14 +115,14 @@ public void testSnapshotDeleteRepository() throws IOException { assertThat(1, equalTo(response.repositories().size())); DeleteRepositoryRequest deleteRequest = new DeleteRepositoryRequest(repository); - DeleteRepositoryResponse deleteResponse = execute(deleteRequest, highLevelClient().snapshot()::deleteRepository, + AcknowledgedResponse deleteResponse = execute(deleteRequest, highLevelClient().snapshot()::deleteRepository, highLevelClient().snapshot()::deleteRepositoryAsync); assertTrue(deleteResponse.isAcknowledged()); } public void testVerifyRepository() throws IOException { - PutRepositoryResponse putRepositoryResponse = createTestRepository("test", FsRepository.TYPE, "{\"location\": \".\"}"); + AcknowledgedResponse putRepositoryResponse = createTestRepository("test", FsRepository.TYPE, "{\"location\": \".\"}"); assertTrue(putRepositoryResponse.isAcknowledged()); VerifyRepositoryRequest request = new VerifyRepositoryRequest("test"); @@ -153,7 +151,7 @@ public void testGetSnapshots() throws IOException { String snapshot1 = "test_snapshot1"; String snapshot2 = "test_snapshot2"; - PutRepositoryResponse putRepositoryResponse = createTestRepository(repository, FsRepository.TYPE, "{\"location\": \".\"}"); + AcknowledgedResponse putRepositoryResponse = createTestRepository(repository, FsRepository.TYPE, "{\"location\": \".\"}"); assertTrue(putRepositoryResponse.isAcknowledged()); CreateSnapshotRequest createSnapshotRequest1 = new CreateSnapshotRequest(repository, snapshot1); @@ -187,7 +185,7 @@ public void testSnapshotsStatus() throws IOException { String testSnapshot = "snapshot"; String testIndex = "test_index"; - PutRepositoryResponse putRepositoryResponse = createTestRepository(testRepository, FsRepository.TYPE, "{\"location\": \".\"}"); + AcknowledgedResponse putRepositoryResponse = createTestRepository(testRepository, FsRepository.TYPE, "{\"location\": \".\"}"); assertTrue(putRepositoryResponse.isAcknowledged()); createIndex(testIndex, Settings.EMPTY); @@ -216,7 +214,7 @@ public void testRestoreSnapshot() throws IOException { String testIndex = "test_index"; String restoredIndex = testIndex + "_restored"; - PutRepositoryResponse putRepositoryResponse = createTestRepository(testRepository, FsRepository.TYPE, "{\"location\": \".\"}"); + AcknowledgedResponse putRepositoryResponse = createTestRepository(testRepository, FsRepository.TYPE, "{\"location\": \".\"}"); assertTrue(putRepositoryResponse.isAcknowledged()); createIndex(testIndex, Settings.EMPTY); @@ -250,7 +248,7 @@ public void testDeleteSnapshot() throws IOException { String repository = "test_repository"; String snapshot = "test_snapshot"; - PutRepositoryResponse putRepositoryResponse = createTestRepository(repository, FsRepository.TYPE, "{\"location\": \".\"}"); + AcknowledgedResponse putRepositoryResponse = createTestRepository(repository, FsRepository.TYPE, "{\"location\": \".\"}"); assertTrue(putRepositoryResponse.isAcknowledged()); CreateSnapshotRequest createSnapshotRequest = new CreateSnapshotRequest(repository, snapshot); @@ -260,7 +258,7 @@ public void testDeleteSnapshot() throws IOException { assertEquals(RestStatus.OK, createSnapshotResponse.status()); DeleteSnapshotRequest request = new DeleteSnapshotRequest(repository, snapshot); - DeleteSnapshotResponse response = execute(request, highLevelClient().snapshot()::delete, highLevelClient().snapshot()::deleteAsync); + AcknowledgedResponse response = execute(request, highLevelClient().snapshot()::delete, highLevelClient().snapshot()::deleteAsync); assertTrue(response.isAcknowledged()); } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/StoredScriptsIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/StoredScriptsIT.java index e6d380a4cc0e1..14734c4ab60a3 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/StoredScriptsIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/StoredScriptsIT.java @@ -23,9 +23,9 @@ import org.apache.http.util.EntityUtils; import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest; -import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptResponse; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentType; @@ -90,7 +90,7 @@ public void testDeleteStoredScript() throws Exception { deleteRequest.masterNodeTimeout("50s"); deleteRequest.timeout("50s"); - DeleteStoredScriptResponse deleteResponse = execute(deleteRequest, highLevelClient()::deleteScript, + AcknowledgedResponse deleteResponse = execute(deleteRequest, highLevelClient()::deleteScript, highLevelClient()::deleteScriptAsync); assertThat(deleteResponse.isAcknowledged(), equalTo(true)); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java index 36d562c501f47..2da4d306c2829 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/IndicesClientDocumentationIT.java @@ -25,7 +25,6 @@ import org.elasticsearch.action.admin.indices.alias.Alias; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions; -import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest; import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest; import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse; @@ -33,11 +32,9 @@ import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest; import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse; import org.elasticsearch.action.admin.indices.close.CloseIndexRequest; -import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; -import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.admin.indices.flush.FlushRequest; import org.elasticsearch.action.admin.indices.flush.FlushResponse; import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest; @@ -50,7 +47,6 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.admin.indices.open.OpenIndexRequest; import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; @@ -60,20 +56,19 @@ import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest; import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse; import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest; -import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse; import org.elasticsearch.action.admin.indices.shrink.ResizeRequest; import org.elasticsearch.action.admin.indices.shrink.ResizeResponse; import org.elasticsearch.action.admin.indices.shrink.ResizeType; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; -import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; import org.elasticsearch.action.admin.indices.validate.query.QueryExplanation; import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest; import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse; import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.action.support.DefaultShardOperationFailedException; import org.elasticsearch.action.support.IndicesOptions; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ESRestHighLevelClientTestCase; import org.elasticsearch.client.GetAliasesResponse; import org.elasticsearch.client.RequestOptions; @@ -220,7 +215,7 @@ public void testDeleteIndex() throws IOException { // end::delete-index-request-indicesOptions // tag::delete-index-execute - DeleteIndexResponse deleteIndexResponse = client.indices().delete(request, RequestOptions.DEFAULT); + AcknowledgedResponse deleteIndexResponse = client.indices().delete(request, RequestOptions.DEFAULT); // end::delete-index-execute // tag::delete-index-response @@ -255,10 +250,10 @@ public void testDeleteIndexAsync() throws Exception { DeleteIndexRequest request = new DeleteIndexRequest("posts"); // tag::delete-index-execute-listener - ActionListener listener = - new ActionListener() { + ActionListener listener = + new ActionListener() { @Override - public void onResponse(DeleteIndexResponse deleteIndexResponse) { + public void onResponse(AcknowledgedResponse deleteIndexResponse) { // <1> } @@ -480,7 +475,7 @@ public void testPutMapping() throws IOException { "}", // <1> XContentType.JSON); // end::put-mapping-request-source - PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); + AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); assertTrue(putMappingResponse.isAcknowledged()); } @@ -494,7 +489,7 @@ public void testPutMapping() throws IOException { jsonMap.put("properties", properties); request.source(jsonMap); // <1> //end::put-mapping-map - PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); + AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); assertTrue(putMappingResponse.isAcknowledged()); } { @@ -515,14 +510,14 @@ public void testPutMapping() throws IOException { builder.endObject(); request.source(builder); // <1> //end::put-mapping-xcontent - PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); + AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); assertTrue(putMappingResponse.isAcknowledged()); } { //tag::put-mapping-shortcut request.source("message", "type=text"); // <1> //end::put-mapping-shortcut - PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); + AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); assertTrue(putMappingResponse.isAcknowledged()); } @@ -536,7 +531,7 @@ public void testPutMapping() throws IOException { // end::put-mapping-request-masterTimeout // tag::put-mapping-execute - PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); + AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); // end::put-mapping-execute // tag::put-mapping-response @@ -558,10 +553,10 @@ public void testPutMappingAsync() throws Exception { PutMappingRequest request = new PutMappingRequest("twitter").type("tweet"); // tag::put-mapping-execute-listener - ActionListener listener = - new ActionListener() { + ActionListener listener = + new ActionListener() { @Override - public void onResponse(PutMappingResponse putMappingResponse) { + public void onResponse(AcknowledgedResponse putMappingResponse) { // <1> } @@ -601,7 +596,7 @@ public void testGetMapping() throws IOException { " }\n" + "}", // <1> XContentType.JSON); - PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); + AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); assertTrue(putMappingResponse.isAcknowledged()); } @@ -658,7 +653,7 @@ public void testGetMappingAsync() throws Exception { " }\n" + "}", // <1> XContentType.JSON); - PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); + AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); assertTrue(putMappingResponse.isAcknowledged()); } @@ -731,7 +726,7 @@ public void testGetFieldMapping() throws IOException, InterruptedException { " }\n" + "}", // <1> XContentType.JSON); - PutMappingResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); + AcknowledgedResponse putMappingResponse = client.indices().putMapping(request, RequestOptions.DEFAULT); assertTrue(putMappingResponse.isAcknowledged()); } @@ -1497,7 +1492,7 @@ public void testCloseIndex() throws Exception { // end::close-index-request-indicesOptions // tag::close-index-execute - CloseIndexResponse closeIndexResponse = client.indices().close(request, RequestOptions.DEFAULT); + AcknowledgedResponse closeIndexResponse = client.indices().close(request, RequestOptions.DEFAULT); // end::close-index-execute // tag::close-index-response @@ -1506,10 +1501,10 @@ public void testCloseIndex() throws Exception { assertTrue(acknowledged); // tag::close-index-execute-listener - ActionListener listener = - new ActionListener() { + ActionListener listener = + new ActionListener() { @Override - public void onResponse(CloseIndexResponse closeIndexResponse) { + public void onResponse(AcknowledgedResponse closeIndexResponse) { // <1> } @@ -1649,7 +1644,7 @@ public void testUpdateAliases() throws Exception { // end::update-aliases-request-masterTimeout // tag::update-aliases-execute - IndicesAliasesResponse indicesAliasesResponse = + AcknowledgedResponse indicesAliasesResponse = client.indices().updateAliases(request, RequestOptions.DEFAULT); // end::update-aliases-execute @@ -1665,10 +1660,10 @@ public void testUpdateAliases() throws Exception { request.addAliasAction(aliasAction); // tag::update-aliases-execute-listener - ActionListener listener = - new ActionListener() { + ActionListener listener = + new ActionListener() { @Override - public void onResponse(IndicesAliasesResponse indicesAliasesResponse) { + public void onResponse(AcknowledgedResponse indicesAliasesResponse) { // <1> } @@ -2056,7 +2051,7 @@ public void testIndexPutSettings() throws Exception { // end::put-settings-request-indicesOptions // tag::put-settings-execute - UpdateSettingsResponse updateSettingsResponse = + AcknowledgedResponse updateSettingsResponse = client.indices().putSettings(request, RequestOptions.DEFAULT); // end::put-settings-execute @@ -2066,11 +2061,11 @@ public void testIndexPutSettings() throws Exception { assertTrue(acknowledged); // tag::put-settings-execute-listener - ActionListener listener = - new ActionListener() { + ActionListener listener = + new ActionListener() { @Override - public void onResponse(UpdateSettingsResponse updateSettingsResponse) { + public void onResponse(AcknowledgedResponse updateSettingsResponse) { // <1> } @@ -2219,7 +2214,7 @@ public void testPutTemplate() throws Exception { request.create(false); // make test happy // tag::put-template-execute - PutIndexTemplateResponse putTemplateResponse = client.indices().putTemplate(request, RequestOptions.DEFAULT); + AcknowledgedResponse putTemplateResponse = client.indices().putTemplate(request, RequestOptions.DEFAULT); // end::put-template-execute // tag::put-template-response @@ -2228,10 +2223,10 @@ public void testPutTemplate() throws Exception { assertTrue(acknowledged); // tag::put-template-execute-listener - ActionListener listener = - new ActionListener() { + ActionListener listener = + new ActionListener() { @Override - public void onResponse(PutIndexTemplateResponse putTemplateResponse) { + public void onResponse(AcknowledgedResponse putTemplateResponse) { // <1> } @@ -2461,7 +2456,7 @@ public void testAnalyze() throws IOException, InterruptedException { .indices("my_index") .type("_doc") .source("my_field", "type=text,analyzer=english"); - PutMappingResponse pmResp = client.indices().putMapping(pmReq, RequestOptions.DEFAULT); + AcknowledgedResponse pmResp = client.indices().putMapping(pmReq, RequestOptions.DEFAULT); assertTrue(pmResp.isAcknowledged()); { diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/LicensingDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/LicensingDocumentationIT.java index 6146030999c56..3737bd70a8dae 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/LicensingDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/LicensingDocumentationIT.java @@ -22,12 +22,12 @@ import org.elasticsearch.Build; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.LatchedActionListener; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ESRestHighLevelClientTestCase; import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.common.Booleans; import org.elasticsearch.protocol.xpack.license.DeleteLicenseRequest; -import org.elasticsearch.protocol.xpack.license.DeleteLicenseResponse; import org.elasticsearch.protocol.xpack.license.GetLicenseRequest; import org.elasticsearch.protocol.xpack.license.GetLicenseResponse; import org.elasticsearch.protocol.xpack.license.LicensesStatus; @@ -120,7 +120,7 @@ public void onFailure(Exception e) { //tag::delete-license-execute DeleteLicenseRequest request = new DeleteLicenseRequest(); - DeleteLicenseResponse response = client.license().deleteLicense(request, RequestOptions.DEFAULT); + AcknowledgedResponse response = client.license().deleteLicense(request, RequestOptions.DEFAULT); //end::delete-license-execute //tag::delete-license-response @@ -132,9 +132,9 @@ public void onFailure(Exception e) { { DeleteLicenseRequest request = new DeleteLicenseRequest(); // tag::delete-license-execute-listener - ActionListener listener = new ActionListener() { + ActionListener listener = new ActionListener() { @Override - public void onResponse(DeleteLicenseResponse deleteLicenseResponse) { + public void onResponse(AcknowledgedResponse deleteLicenseResponse) { // <1> } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SnapshotClientDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SnapshotClientDocumentationIT.java index 922fcb984d94a..d1aed55f44e5b 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SnapshotClientDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SnapshotClientDocumentationIT.java @@ -22,27 +22,25 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.LatchedActionListener; import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest; -import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest; -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; +import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; -import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; -import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest; -import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotStats; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotStatus; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse; +import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; +import org.elasticsearch.action.support.IndicesOptions; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ESRestHighLevelClientTestCase; import org.elasticsearch.client.Request; import org.elasticsearch.client.RequestOptions; @@ -163,7 +161,7 @@ public void testSnapshotCreateRepository() throws IOException { // end::create-repository-request-verify // tag::create-repository-execute - PutRepositoryResponse response = client.snapshot().createRepository(request, RequestOptions.DEFAULT); + AcknowledgedResponse response = client.snapshot().createRepository(request, RequestOptions.DEFAULT); // end::create-repository-execute // tag::create-repository-response @@ -178,10 +176,10 @@ public void testSnapshotCreateRepositoryAsync() throws InterruptedException { PutRepositoryRequest request = new PutRepositoryRequest(repositoryName); // tag::create-repository-execute-listener - ActionListener listener = - new ActionListener() { + ActionListener listener = + new ActionListener() { @Override - public void onResponse(PutRepositoryResponse putRepositoryResponse) { + public void onResponse(AcknowledgedResponse putRepositoryResponse) { // <1> } @@ -388,7 +386,7 @@ public void testSnapshotDeleteRepository() throws IOException { // end::delete-repository-request-timeout // tag::delete-repository-execute - DeleteRepositoryResponse response = client.snapshot().deleteRepository(request, RequestOptions.DEFAULT); + AcknowledgedResponse response = client.snapshot().deleteRepository(request, RequestOptions.DEFAULT); // end::delete-repository-execute // tag::delete-repository-response @@ -403,10 +401,10 @@ public void testSnapshotDeleteRepositoryAsync() throws InterruptedException { DeleteRepositoryRequest request = new DeleteRepositoryRequest(); // tag::delete-repository-execute-listener - ActionListener listener = - new ActionListener() { + ActionListener listener = + new ActionListener() { @Override - public void onResponse(DeleteRepositoryResponse deleteRepositoryResponse) { + public void onResponse(AcknowledgedResponse deleteRepositoryResponse) { // <1> } @@ -752,7 +750,7 @@ public void testSnapshotDeleteSnapshot() throws IOException { // end::delete-snapshot-request-masterTimeout // tag::delete-snapshot-execute - DeleteSnapshotResponse response = client.snapshot().delete(request, RequestOptions.DEFAULT); + AcknowledgedResponse response = client.snapshot().delete(request, RequestOptions.DEFAULT); // end::delete-snapshot-execute // tag::delete-snapshot-response @@ -767,10 +765,10 @@ public void testSnapshotDeleteSnapshotAsync() throws InterruptedException { DeleteSnapshotRequest request = new DeleteSnapshotRequest(); // tag::delete-snapshot-execute-listener - ActionListener listener = - new ActionListener() { + ActionListener listener = + new ActionListener() { @Override - public void onResponse(DeleteSnapshotResponse deleteSnapshotResponse) { + public void onResponse(AcknowledgedResponse deleteSnapshotResponse) { // <1> } diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/StoredScriptsDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/StoredScriptsDocumentationIT.java index 0aadae73ce66d..b1374ca85b6a9 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/StoredScriptsDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/StoredScriptsDocumentationIT.java @@ -23,9 +23,9 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.LatchedActionListener; import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest; -import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptResponse; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ESRestHighLevelClientTestCase; import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.Response; @@ -154,7 +154,7 @@ public void testDeleteStoredScript() throws Exception { // end::delete-stored-script-request-timeout // tag::delete-stored-script-execute - DeleteStoredScriptResponse deleteResponse = client.deleteScript(deleteRequest, RequestOptions.DEFAULT); + AcknowledgedResponse deleteResponse = client.deleteScript(deleteRequest, RequestOptions.DEFAULT); // end::delete-stored-script-execute // tag::delete-stored-script-response @@ -164,10 +164,10 @@ public void testDeleteStoredScript() throws Exception { putStoredScript("calculate-score", scriptSource); // tag::delete-stored-script-execute-listener - ActionListener listener = - new ActionListener() { + ActionListener listener = + new ActionListener() { @Override - public void onResponse(DeleteStoredScriptResponse response) { + public void onResponse(AcknowledgedResponse response) { // <1> } diff --git a/modules/repository-url/src/test/java/org/elasticsearch/repositories/url/URLSnapshotRestoreTests.java b/modules/repository-url/src/test/java/org/elasticsearch/repositories/url/URLSnapshotRestoreTests.java index 9eb5e37a51c81..1a006f56bc3fa 100644 --- a/modules/repository-url/src/test/java/org/elasticsearch/repositories/url/URLSnapshotRestoreTests.java +++ b/modules/repository-url/src/test/java/org/elasticsearch/repositories/url/URLSnapshotRestoreTests.java @@ -20,9 +20,9 @@ package org.elasticsearch.repositories.url; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; -import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; @@ -120,7 +120,7 @@ public void testUrlRepository() throws Exception { assertThat(getSnapshotsResponse.getSnapshots().size(), equalTo(1)); logger.info("--> delete snapshot"); - DeleteSnapshotResponse deleteSnapshotResponse = client.admin().cluster().prepareDeleteSnapshot("test-repo", "test-snap").get(); + AcknowledgedResponse deleteSnapshotResponse = client.admin().cluster().prepareDeleteSnapshot("test-repo", "test-snap").get(); assertAcked(deleteSnapshotResponse); logger.info("--> list available shapshot again, no snapshots should be returned"); diff --git a/plugins/mapper-size/src/test/java/org/elasticsearch/index/mapper/size/SizeMappingIT.java b/plugins/mapper-size/src/test/java/org/elasticsearch/index/mapper/size/SizeMappingIT.java index d3980c191100a..d74baee3d56e3 100644 --- a/plugins/mapper-size/src/test/java/org/elasticsearch/index/mapper/size/SizeMappingIT.java +++ b/plugins/mapper-size/src/test/java/org/elasticsearch/index/mapper/size/SizeMappingIT.java @@ -19,8 +19,8 @@ package org.elasticsearch.index.mapper.size; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.get.GetResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.plugin.mapper.MapperSizePlugin; @@ -62,7 +62,7 @@ public void testThatUpdatingMappingShouldNotRemoveSizeMappingConfiguration() thr XContentBuilder updateMappingBuilder = jsonBuilder().startObject().startObject("properties").startObject("otherField").field("type", "text") .endObject().endObject().endObject(); - PutMappingResponse putMappingResponse = + AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping(index).setType(type).setSource(updateMappingBuilder).get(); assertAcked(putMappingResponse); @@ -84,7 +84,7 @@ public void testThatSizeCanBeSwitchedOnAndOff() throws Exception { // update some field in the mapping XContentBuilder updateMappingBuilder = jsonBuilder().startObject().startObject("_size").field("enabled", false).endObject().endObject(); - PutMappingResponse putMappingResponse = + AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping(index).setType(type).setSource(updateMappingBuilder).get(); assertAcked(putMappingResponse); diff --git a/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java index c328563b4b658..5c5ab4ee42692 100644 --- a/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java +++ b/plugins/repository-hdfs/src/test/java/org/elasticsearch/repositories/hdfs/HdfsTests.java @@ -19,9 +19,9 @@ package org.elasticsearch.repositories.hdfs; import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.bootstrap.JavaVersion; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; @@ -48,7 +48,7 @@ public void testSimpleWorkflow() { assumeFalse("https://github.com/elastic/elasticsearch/issues/31498", JavaVersion.current().equals(JavaVersion.parse("11"))); Client client = client(); - PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") + AcknowledgedResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("hdfs") .setSettings(Settings.builder() .put("uri", "hdfs:///") diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryAction.java index c5c72bb97f1e6..a31984e222793 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryAction.java @@ -20,11 +20,12 @@ package org.elasticsearch.action.admin.cluster.repositories.delete; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; /** * Unregister repository action */ -public class DeleteRepositoryAction extends Action { +public class DeleteRepositoryAction extends Action { public static final DeleteRepositoryAction INSTANCE = new DeleteRepositoryAction(); public static final String NAME = "cluster:admin/repository/delete"; @@ -34,8 +35,8 @@ private DeleteRepositoryAction() { } @Override - public DeleteRepositoryResponse newResponse() { - return new DeleteRepositoryResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryRequestBuilder.java index 2b56b71f6fc50..b6e8de24c5d7b 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryRequestBuilder.java @@ -20,12 +20,13 @@ package org.elasticsearch.action.admin.cluster.repositories.delete; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; /** * Builder for unregister repository request */ -public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder { +public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder { /** * Constructs unregister repository request builder diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryResponse.java deleted file mode 100644 index f67d74cd118ea..0000000000000 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryResponse.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.cluster.repositories.delete; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.xcontent.XContentParser; - -/** - * Unregister repository response - */ -public class DeleteRepositoryResponse extends AcknowledgedResponse { - - DeleteRepositoryResponse() { - } - - DeleteRepositoryResponse(boolean acknowledged) { - super(acknowledged); - } - - public static DeleteRepositoryResponse fromXContent(XContentParser parser) { - return new DeleteRepositoryResponse(parseAcknowledged(parser)); - } -} diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/TransportDeleteRepositoryAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/TransportDeleteRepositoryAction.java index 6baf834278bff..a39bb12e31e24 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/TransportDeleteRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/TransportDeleteRepositoryAction.java @@ -21,6 +21,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse; @@ -37,7 +38,7 @@ /** * Transport action for unregister repository operation */ -public class TransportDeleteRepositoryAction extends TransportMasterNodeAction { +public class TransportDeleteRepositoryAction extends TransportMasterNodeAction { private final RepositoriesService repositoriesService; @@ -55,8 +56,8 @@ protected String executor() { } @Override - protected DeleteRepositoryResponse newResponse() { - return new DeleteRepositoryResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override @@ -65,14 +66,14 @@ protected ClusterBlockException checkBlock(DeleteRepositoryRequest request, Clus } @Override - protected void masterOperation(final DeleteRepositoryRequest request, ClusterState state, final ActionListener listener) { + protected void masterOperation(final DeleteRepositoryRequest request, ClusterState state, final ActionListener listener) { repositoriesService.unregisterRepository( new RepositoriesService.UnregisterRepositoryRequest("delete_repository [" + request.name() + "]", request.name()) .masterNodeTimeout(request.masterNodeTimeout()).ackTimeout(request.timeout()), new ActionListener() { @Override public void onResponse(ClusterStateUpdateResponse unregisterRepositoryResponse) { - listener.onResponse(new DeleteRepositoryResponse(unregisterRepositoryResponse.isAcknowledged())); + listener.onResponse(new AcknowledgedResponse(unregisterRepositoryResponse.isAcknowledged())); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryAction.java index 801e0a513b077..7c98f591e0e1d 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryAction.java @@ -20,11 +20,12 @@ package org.elasticsearch.action.admin.cluster.repositories.put; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; /** * Register repository action */ -public class PutRepositoryAction extends Action { +public class PutRepositoryAction extends Action { public static final PutRepositoryAction INSTANCE = new PutRepositoryAction(); public static final String NAME = "cluster:admin/repository/put"; @@ -34,8 +35,8 @@ private PutRepositoryAction() { } @Override - public PutRepositoryResponse newResponse() { - return new PutRepositoryResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryRequestBuilder.java index 21b8e8713a19b..ea62bb4eee60a 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryRequestBuilder.java @@ -20,6 +20,7 @@ package org.elasticsearch.action.admin.cluster.repositories.put; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentType; @@ -29,7 +30,7 @@ /** * Register repository request builder */ -public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder { +public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder { /** * Constructs register repository request diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryResponse.java deleted file mode 100644 index 23aae119e0da5..0000000000000 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryResponse.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.cluster.repositories.put; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.xcontent.XContentParser; - -/** - * Register repository response - */ -public class PutRepositoryResponse extends AcknowledgedResponse { - - PutRepositoryResponse() { - } - - PutRepositoryResponse(boolean acknowledged) { - super(acknowledged); - } - - public static PutRepositoryResponse fromXContent(XContentParser parser) { - return new PutRepositoryResponse(parseAcknowledged(parser)); - } -} diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/TransportPutRepositoryAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/TransportPutRepositoryAction.java index 2ac4950c327f7..6f0339f46eecf 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/TransportPutRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/TransportPutRepositoryAction.java @@ -21,6 +21,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse; @@ -37,7 +38,7 @@ /** * Transport action for register repository operation */ -public class TransportPutRepositoryAction extends TransportMasterNodeAction { +public class TransportPutRepositoryAction extends TransportMasterNodeAction { private final RepositoriesService repositoriesService; @@ -55,8 +56,8 @@ protected String executor() { } @Override - protected PutRepositoryResponse newResponse() { - return new PutRepositoryResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override @@ -65,7 +66,7 @@ protected ClusterBlockException checkBlock(PutRepositoryRequest request, Cluster } @Override - protected void masterOperation(final PutRepositoryRequest request, ClusterState state, final ActionListener listener) { + protected void masterOperation(final PutRepositoryRequest request, ClusterState state, final ActionListener listener) { repositoriesService.registerRepository( new RepositoriesService.RegisterRepositoryRequest("put_repository [" + request.name() + "]", @@ -76,7 +77,7 @@ protected void masterOperation(final PutRepositoryRequest request, ClusterState @Override public void onResponse(ClusterStateUpdateResponse response) { - listener.onResponse(new PutRepositoryResponse(response.isAcknowledged())); + listener.onResponse(new AcknowledgedResponse(response.isAcknowledged())); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotAction.java index ac04ea6690562..64f4e60fb2d0e 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotAction.java @@ -20,11 +20,12 @@ package org.elasticsearch.action.admin.cluster.snapshots.delete; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; /** * Delete snapshot action */ -public class DeleteSnapshotAction extends Action { +public class DeleteSnapshotAction extends Action { public static final DeleteSnapshotAction INSTANCE = new DeleteSnapshotAction(); public static final String NAME = "cluster:admin/snapshot/delete"; @@ -34,8 +35,8 @@ private DeleteSnapshotAction() { } @Override - public DeleteSnapshotResponse newResponse() { - return new DeleteSnapshotResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotRequestBuilder.java index 2a3f8a0889abe..9b723de0e6caa 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotRequestBuilder.java @@ -19,13 +19,14 @@ package org.elasticsearch.action.admin.cluster.snapshots.delete; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.client.ElasticsearchClient; /** * Delete snapshot request builder */ -public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder { +public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder { /** * Constructs delete snapshot request builder diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotResponse.java deleted file mode 100644 index ac6e74d39702c..0000000000000 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotResponse.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.cluster.snapshots.delete; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.xcontent.XContentParser; - -/** - * Delete snapshot response - */ -public class DeleteSnapshotResponse extends AcknowledgedResponse { - - DeleteSnapshotResponse() { - } - - DeleteSnapshotResponse(boolean acknowledged) { - super(acknowledged); - } - - public static DeleteSnapshotResponse fromXContent(XContentParser parser) { - return new DeleteSnapshotResponse(parseAcknowledged(parser)); - } - -} diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/TransportDeleteSnapshotAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/TransportDeleteSnapshotAction.java index 916e2f945ec18..b3c9f089e6301 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/TransportDeleteSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/TransportDeleteSnapshotAction.java @@ -21,6 +21,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; @@ -36,7 +37,7 @@ /** * Transport action for delete snapshot operation */ -public class TransportDeleteSnapshotAction extends TransportMasterNodeAction { +public class TransportDeleteSnapshotAction extends TransportMasterNodeAction { private final SnapshotsService snapshotsService; @Inject @@ -53,8 +54,8 @@ protected String executor() { } @Override - protected DeleteSnapshotResponse newResponse() { - return new DeleteSnapshotResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override @@ -64,11 +65,11 @@ protected ClusterBlockException checkBlock(DeleteSnapshotRequest request, Cluste } @Override - protected void masterOperation(final DeleteSnapshotRequest request, ClusterState state, final ActionListener listener) { + protected void masterOperation(final DeleteSnapshotRequest request, ClusterState state, final ActionListener listener) { snapshotsService.deleteSnapshot(request.repository(), request.snapshot(), new SnapshotsService.DeleteSnapshotListener() { @Override public void onResponse() { - listener.onResponse(new DeleteSnapshotResponse(true)); + listener.onResponse(new AcknowledgedResponse(true)); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptAction.java index 070d8d055ea89..7ba8ee0754fed 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptAction.java @@ -20,8 +20,9 @@ package org.elasticsearch.action.admin.cluster.storedscripts; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; -public class DeleteStoredScriptAction extends Action { +public class DeleteStoredScriptAction extends Action { public static final DeleteStoredScriptAction INSTANCE = new DeleteStoredScriptAction(); public static final String NAME = "cluster:admin/script/delete"; @@ -31,7 +32,7 @@ private DeleteStoredScriptAction() { } @Override - public DeleteStoredScriptResponse newResponse() { - return new DeleteStoredScriptResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptRequestBuilder.java index 1b48a45be3c69..132f9dc08a330 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptRequestBuilder.java @@ -20,10 +20,11 @@ package org.elasticsearch.action.admin.cluster.storedscripts; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; public class DeleteStoredScriptRequestBuilder extends AcknowledgedRequestBuilder { + AcknowledgedResponse, DeleteStoredScriptRequestBuilder> { public DeleteStoredScriptRequestBuilder(ElasticsearchClient client, DeleteStoredScriptAction action) { super(client, action, new DeleteStoredScriptRequest()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptResponse.java deleted file mode 100644 index 741c105866f46..0000000000000 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.cluster.storedscripts; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.xcontent.XContentParser; - -public class DeleteStoredScriptResponse extends AcknowledgedResponse { - - DeleteStoredScriptResponse() { - } - - public DeleteStoredScriptResponse(boolean acknowledged) { - super(acknowledged); - } - - public static DeleteStoredScriptResponse fromXContent(XContentParser parser) { - return new DeleteStoredScriptResponse(parseAcknowledged(parser)); - } -} diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptAction.java index 41c345fd00733..8e5475283c2bc 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptAction.java @@ -20,9 +20,10 @@ package org.elasticsearch.action.admin.cluster.storedscripts; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; -public class PutStoredScriptAction extends Action { +public class PutStoredScriptAction extends Action { public static final PutStoredScriptAction INSTANCE = new PutStoredScriptAction(); public static final String NAME = "cluster:admin/script/put"; @@ -34,7 +35,7 @@ private PutStoredScriptAction() { @Override - public PutStoredScriptResponse newResponse() { - return new PutStoredScriptResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptRequestBuilder.java index e98f7c7e3e6de..dc505596607b7 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptRequestBuilder.java @@ -20,12 +20,13 @@ package org.elasticsearch.action.admin.cluster.storedscripts; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.XContentType; public class PutStoredScriptRequestBuilder extends AcknowledgedRequestBuilder { + AcknowledgedResponse, PutStoredScriptRequestBuilder> { public PutStoredScriptRequestBuilder(ElasticsearchClient client, PutStoredScriptAction action) { super(client, action, new PutStoredScriptRequest()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptResponse.java deleted file mode 100644 index a511c7dd47e99..0000000000000 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptResponse.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.cluster.storedscripts; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; - -public class PutStoredScriptResponse extends AcknowledgedResponse { - - PutStoredScriptResponse() { - } - - public PutStoredScriptResponse(boolean acknowledged) { - super(acknowledged); - } - -} diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/TransportDeleteStoredScriptAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/TransportDeleteStoredScriptAction.java index b7ae06dbdbb7c..c351ae4a6706d 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/TransportDeleteStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/TransportDeleteStoredScriptAction.java @@ -21,6 +21,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; @@ -33,8 +34,7 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -public class TransportDeleteStoredScriptAction extends TransportMasterNodeAction { +public class TransportDeleteStoredScriptAction extends TransportMasterNodeAction { private final ScriptService scriptService; @@ -53,13 +53,13 @@ protected String executor() { } @Override - protected DeleteStoredScriptResponse newResponse() { - return new DeleteStoredScriptResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override protected void masterOperation(DeleteStoredScriptRequest request, ClusterState state, - ActionListener listener) throws Exception { + ActionListener listener) throws Exception { scriptService.deleteStoredScript(clusterService, request, listener); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/TransportPutStoredScriptAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/TransportPutStoredScriptAction.java index 8b4079aee7379..abeb5327c1af5 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/TransportPutStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/TransportPutStoredScriptAction.java @@ -21,6 +21,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; @@ -33,7 +34,7 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -public class TransportPutStoredScriptAction extends TransportMasterNodeAction { +public class TransportPutStoredScriptAction extends TransportMasterNodeAction { private final ScriptService scriptService; @@ -52,13 +53,13 @@ protected String executor() { } @Override - protected PutStoredScriptResponse newResponse() { - return new PutStoredScriptResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override protected void masterOperation(PutStoredScriptRequest request, ClusterState state, - ActionListener listener) throws Exception { + ActionListener listener) throws Exception { scriptService.putStoredScript(clusterService, request, listener); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesAction.java index 378e017855a13..7f7743f81730a 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesAction.java @@ -20,8 +20,9 @@ package org.elasticsearch.action.admin.indices.alias; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; -public class IndicesAliasesAction extends Action { +public class IndicesAliasesAction extends Action { public static final IndicesAliasesAction INSTANCE = new IndicesAliasesAction(); public static final String NAME = "indices:admin/aliases"; @@ -31,7 +32,7 @@ private IndicesAliasesAction() { } @Override - public IndicesAliasesResponse newResponse() { - return new IndicesAliasesResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequestBuilder.java index 3a74c349e78fa..6608da9189bdc 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequestBuilder.java @@ -21,6 +21,7 @@ import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.index.query.QueryBuilder; @@ -30,7 +31,7 @@ * Builder for request to modify many aliases at once. */ public class IndicesAliasesRequestBuilder - extends AcknowledgedRequestBuilder { + extends AcknowledgedRequestBuilder { public IndicesAliasesRequestBuilder(ElasticsearchClient client, IndicesAliasesAction action) { super(client, action, new IndicesAliasesRequest()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesResponse.java deleted file mode 100644 index 31ebcbf0f0a07..0000000000000 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesResponse.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.indices.alias; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.xcontent.ConstructingObjectParser; -import org.elasticsearch.common.xcontent.XContentParser; - -/** - * A response for a add/remove alias action. - */ -public class IndicesAliasesResponse extends AcknowledgedResponse { - - private static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>("indices_aliases", - true, args -> new IndicesAliasesResponse((boolean) args[0])); - static { - declareAcknowledgedField(PARSER); - } - - IndicesAliasesResponse() { - } - - IndicesAliasesResponse(boolean acknowledged) { - super(acknowledged); - } - - public static IndicesAliasesResponse fromXContent(XContentParser parser) { - return new IndicesAliasesResponse(parseAcknowledged(parser)); - } -} \ No newline at end of file diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java index d137665c19738..d6ecaf8b2c9f3 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java @@ -23,6 +23,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse; @@ -52,7 +53,7 @@ /** * Add/remove aliases action */ -public class TransportIndicesAliasesAction extends TransportMasterNodeAction { +public class TransportIndicesAliasesAction extends TransportMasterNodeAction { private final MetaDataIndexAliasesService indexAliasesService; @@ -71,8 +72,8 @@ protected String executor() { } @Override - protected IndicesAliasesResponse newResponse() { - return new IndicesAliasesResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override @@ -85,7 +86,7 @@ protected ClusterBlockException checkBlock(IndicesAliasesRequest request, Cluste } @Override - protected void masterOperation(final IndicesAliasesRequest request, final ClusterState state, final ActionListener listener) { + protected void masterOperation(final IndicesAliasesRequest request, final ClusterState state, final ActionListener listener) { //Expand the indices names List actions = request.aliasActions(); @@ -127,7 +128,7 @@ protected void masterOperation(final IndicesAliasesRequest request, final Cluste indexAliasesService.indicesAliases(updateRequest, new ActionListener() { @Override public void onResponse(ClusterStateUpdateResponse response) { - listener.onResponse(new IndicesAliasesResponse(response.isAcknowledged())); + listener.onResponse(new AcknowledgedResponse(response.isAcknowledged())); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexAction.java index 5c3d60dd44013..68a911ff58627 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexAction.java @@ -20,8 +20,9 @@ package org.elasticsearch.action.admin.indices.close; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; -public class CloseIndexAction extends Action { +public class CloseIndexAction extends Action { public static final CloseIndexAction INSTANCE = new CloseIndexAction(); public static final String NAME = "indices:admin/close"; @@ -31,7 +32,7 @@ private CloseIndexAction() { } @Override - public CloseIndexResponse newResponse() { - return new CloseIndexResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequestBuilder.java index a45e8d38f04bc..e69c6fed87dcd 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequestBuilder.java @@ -21,12 +21,14 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; /** * Builder for close index request */ -public class CloseIndexRequestBuilder extends AcknowledgedRequestBuilder { +public class CloseIndexRequestBuilder + extends AcknowledgedRequestBuilder { public CloseIndexRequestBuilder(ElasticsearchClient client, CloseIndexAction action) { super(client, action, new CloseIndexRequest()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexResponse.java deleted file mode 100644 index 96a3e150af16d..0000000000000 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexResponse.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.indices.close; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.xcontent.XContentParser; - -/** - * A response for a close index action. - */ -public class CloseIndexResponse extends AcknowledgedResponse { - CloseIndexResponse() { - } - - CloseIndexResponse(boolean acknowledged) { - super(acknowledged); - } - - public static CloseIndexResponse fromXContent(XContentParser parser) { - return new CloseIndexResponse(parseAcknowledged(parser)); - } -} diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java index 0bd6370e88a57..f2e284656e590 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java @@ -23,6 +23,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.DestructiveOperations; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse; @@ -44,7 +45,7 @@ /** * Close index action */ -public class TransportCloseIndexAction extends TransportMasterNodeAction { +public class TransportCloseIndexAction extends TransportMasterNodeAction { private final MetaDataIndexStateService indexStateService; private final DestructiveOperations destructiveOperations; @@ -75,12 +76,12 @@ protected String executor() { } @Override - protected CloseIndexResponse newResponse() { - return new CloseIndexResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override - protected void doExecute(Task task, CloseIndexRequest request, ActionListener listener) { + protected void doExecute(Task task, CloseIndexRequest request, ActionListener listener) { destructiveOperations.failDestructive(request.indices()); if (closeIndexEnabled == false) { throw new IllegalStateException("closing indices is disabled - set [" + CLUSTER_INDICES_CLOSE_ENABLE_SETTING.getKey() + ": true] to enable it. NOTE: closed indices still consume a significant amount of diskspace"); @@ -94,10 +95,10 @@ protected ClusterBlockException checkBlock(CloseIndexRequest request, ClusterSta } @Override - protected void masterOperation(final CloseIndexRequest request, final ClusterState state, final ActionListener listener) { + protected void masterOperation(final CloseIndexRequest request, final ClusterState state, final ActionListener listener) { final Index[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, request); if (concreteIndices == null || concreteIndices.length == 0) { - listener.onResponse(new CloseIndexResponse(true)); + listener.onResponse(new AcknowledgedResponse(true)); return; } CloseIndexClusterStateUpdateRequest updateRequest = new CloseIndexClusterStateUpdateRequest() @@ -108,7 +109,7 @@ protected void masterOperation(final CloseIndexRequest request, final ClusterSta @Override public void onResponse(ClusterStateUpdateResponse response) { - listener.onResponse(new CloseIndexResponse(response.isAcknowledged())); + listener.onResponse(new AcknowledgedResponse(response.isAcknowledged())); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexAction.java index 680501af3b761..6fde9089cef62 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexAction.java @@ -20,8 +20,9 @@ package org.elasticsearch.action.admin.indices.delete; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; -public class DeleteIndexAction extends Action { +public class DeleteIndexAction extends Action { public static final DeleteIndexAction INSTANCE = new DeleteIndexAction(); public static final String NAME = "indices:admin/delete"; @@ -31,7 +32,7 @@ private DeleteIndexAction() { } @Override - public DeleteIndexResponse newResponse() { - return new DeleteIndexResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexRequestBuilder.java index 2fd31d9a3ab7d..376a115b19627 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexRequestBuilder.java @@ -21,9 +21,10 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; -public class DeleteIndexRequestBuilder extends AcknowledgedRequestBuilder { +public class DeleteIndexRequestBuilder extends AcknowledgedRequestBuilder { public DeleteIndexRequestBuilder(ElasticsearchClient client, DeleteIndexAction action, String... indices) { super(client, action, new DeleteIndexRequest(indices)); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponse.java deleted file mode 100644 index b86549f536d21..0000000000000 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponse.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.indices.delete; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.xcontent.XContentParser; - -/** - * A response for a delete index action. - */ -public class DeleteIndexResponse extends AcknowledgedResponse { - - DeleteIndexResponse() { - } - - DeleteIndexResponse(boolean acknowledged) { - super(acknowledged); - } - - public static DeleteIndexResponse fromXContent(XContentParser parser) { - return new DeleteIndexResponse(parseAcknowledged(parser)); - } -} diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java index e51046f85be90..62421da891608 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java @@ -23,6 +23,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.DestructiveOperations; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse; @@ -44,7 +45,7 @@ /** * Delete index action. */ -public class TransportDeleteIndexAction extends TransportMasterNodeAction { +public class TransportDeleteIndexAction extends TransportMasterNodeAction { private final MetaDataDeleteIndexService deleteIndexService; private final DestructiveOperations destructiveOperations; @@ -64,12 +65,12 @@ protected String executor() { } @Override - protected DeleteIndexResponse newResponse() { - return new DeleteIndexResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override - protected void doExecute(Task task, DeleteIndexRequest request, ActionListener listener) { + protected void doExecute(Task task, DeleteIndexRequest request, ActionListener listener) { destructiveOperations.failDestructive(request.indices()); super.doExecute(task, request, listener); } @@ -80,10 +81,10 @@ protected ClusterBlockException checkBlock(DeleteIndexRequest request, ClusterSt } @Override - protected void masterOperation(final DeleteIndexRequest request, final ClusterState state, final ActionListener listener) { + protected void masterOperation(final DeleteIndexRequest request, final ClusterState state, final ActionListener listener) { final Set concreteIndices = new HashSet<>(Arrays.asList(indexNameExpressionResolver.concreteIndices(state, request))); if (concreteIndices.isEmpty()) { - listener.onResponse(new DeleteIndexResponse(true)); + listener.onResponse(new AcknowledgedResponse(true)); return; } @@ -95,7 +96,7 @@ protected void masterOperation(final DeleteIndexRequest request, final ClusterSt @Override public void onResponse(ClusterStateUpdateResponse response) { - listener.onResponse(new DeleteIndexResponse(response.isAcknowledged())); + listener.onResponse(new AcknowledgedResponse(response.isAcknowledged())); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingAction.java index 63ab198f816bf..ac845e6644c7b 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingAction.java @@ -20,8 +20,9 @@ package org.elasticsearch.action.admin.indices.mapping.put; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; -public class PutMappingAction extends Action { +public class PutMappingAction extends Action { public static final PutMappingAction INSTANCE = new PutMappingAction(); public static final String NAME = "indices:admin/mapping/put"; @@ -31,7 +32,7 @@ private PutMappingAction() { } @Override - public PutMappingResponse newResponse() { - return new PutMappingResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java index 3429b35073ca2..1556ee2341d27 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java @@ -27,6 +27,7 @@ import org.elasticsearch.action.IndicesRequest; import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.master.AcknowledgedRequest; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; @@ -57,7 +58,7 @@ * * @see org.elasticsearch.client.Requests#putMappingRequest(String...) * @see org.elasticsearch.client.IndicesAdminClient#putMapping(PutMappingRequest) - * @see PutMappingResponse + * @see AcknowledgedResponse */ public class PutMappingRequest extends AcknowledgedRequest implements IndicesRequest.Replaceable, ToXContentObject { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequestBuilder.java index 7baba39d96a29..f0f39303c241d 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequestBuilder.java @@ -21,6 +21,7 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentType; @@ -31,7 +32,8 @@ /** * Builder for a put mapping request */ -public class PutMappingRequestBuilder extends AcknowledgedRequestBuilder { +public class PutMappingRequestBuilder + extends AcknowledgedRequestBuilder { public PutMappingRequestBuilder(ElasticsearchClient client, PutMappingAction action) { super(client, action, new PutMappingRequest()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponse.java deleted file mode 100644 index 4b2eac95c3ac6..0000000000000 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponse.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.indices.mapping.put; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.xcontent.XContentParser; - -/** - * The response of put mapping operation. - */ -public class PutMappingResponse extends AcknowledgedResponse { - - protected PutMappingResponse() { - } - - protected PutMappingResponse(boolean acknowledged) { - super(acknowledged); - } - - public static PutMappingResponse fromXContent(XContentParser parser) { - return new PutMappingResponse(parseAcknowledged(parser)); - } -} diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java index 38cd5efe13ac0..9f29ffe4883bc 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java @@ -22,6 +22,7 @@ import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse; @@ -40,7 +41,7 @@ /** * Put mapping action. */ -public class TransportPutMappingAction extends TransportMasterNodeAction { +public class TransportPutMappingAction extends TransportMasterNodeAction { private final MetaDataMappingService metaDataMappingService; @@ -59,8 +60,8 @@ protected String executor() { } @Override - protected PutMappingResponse newResponse() { - return new PutMappingResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override @@ -75,7 +76,7 @@ protected ClusterBlockException checkBlock(PutMappingRequest request, ClusterSta } @Override - protected void masterOperation(final PutMappingRequest request, final ClusterState state, final ActionListener listener) { + protected void masterOperation(final PutMappingRequest request, final ClusterState state, final ActionListener listener) { try { final Index[] concreteIndices = request.getConcreteIndex() == null ? indexNameExpressionResolver.concreteIndices(state, request) : new Index[] {request.getConcreteIndex()}; PutMappingClusterStateUpdateRequest updateRequest = new PutMappingClusterStateUpdateRequest() @@ -87,7 +88,7 @@ protected void masterOperation(final PutMappingRequest request, final ClusterSta @Override public void onResponse(ClusterStateUpdateResponse response) { - listener.onResponse(new PutMappingResponse(response.isAcknowledged())); + listener.onResponse(new AcknowledgedResponse(response.isAcknowledged())); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/TransportUpdateSettingsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/TransportUpdateSettingsAction.java index 83eca83310339..953129b5a37dc 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/TransportUpdateSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/TransportUpdateSettingsAction.java @@ -22,6 +22,7 @@ import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse; @@ -37,7 +38,7 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -public class TransportUpdateSettingsAction extends TransportMasterNodeAction { +public class TransportUpdateSettingsAction extends TransportMasterNodeAction { private final MetaDataUpdateSettingsService updateSettingsService; @@ -71,12 +72,12 @@ protected ClusterBlockException checkBlock(UpdateSettingsRequest request, Cluste } @Override - protected UpdateSettingsResponse newResponse() { - return new UpdateSettingsResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override - protected void masterOperation(final UpdateSettingsRequest request, final ClusterState state, final ActionListener listener) { + protected void masterOperation(final UpdateSettingsRequest request, final ClusterState state, final ActionListener listener) { final Index[] concreteIndices = indexNameExpressionResolver.concreteIndices(state, request); UpdateSettingsClusterStateUpdateRequest clusterStateUpdateRequest = new UpdateSettingsClusterStateUpdateRequest() .indices(concreteIndices) @@ -88,7 +89,7 @@ protected void masterOperation(final UpdateSettingsRequest request, final Cluste updateSettingsService.updateSettings(clusterStateUpdateRequest, new ActionListener() { @Override public void onResponse(ClusterStateUpdateResponse response) { - listener.onResponse(new UpdateSettingsResponse(response.isAcknowledged())); + listener.onResponse(new AcknowledgedResponse(response.isAcknowledged())); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsAction.java index 7f82c8f29e750..eb6574fb53094 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsAction.java @@ -20,8 +20,9 @@ package org.elasticsearch.action.admin.indices.settings.put; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; -public class UpdateSettingsAction extends Action { +public class UpdateSettingsAction extends Action { public static final UpdateSettingsAction INSTANCE = new UpdateSettingsAction(); public static final String NAME = "indices:admin/settings/update"; @@ -31,7 +32,7 @@ private UpdateSettingsAction() { } @Override - public UpdateSettingsResponse newResponse() { - return new UpdateSettingsResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestBuilder.java index 8cf86fadc1673..834f3ba30148e 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestBuilder.java @@ -21,6 +21,7 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentType; @@ -30,7 +31,7 @@ /** * Builder for an update index settings request */ -public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder { +public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder { public UpdateSettingsRequestBuilder(ElasticsearchClient client, UpdateSettingsAction action, String... indices) { super(client, action, new UpdateSettingsRequest(indices)); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsResponse.java deleted file mode 100644 index 6792d1859260d..0000000000000 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsResponse.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.indices.settings.put; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.xcontent.XContentParser; - -/** - * A response for an update index settings action - */ -public class UpdateSettingsResponse extends AcknowledgedResponse { - - UpdateSettingsResponse() { - } - - UpdateSettingsResponse(boolean acknowledged) { - super(acknowledged); - } - - public static UpdateSettingsResponse fromXContent(XContentParser parser) { - return new UpdateSettingsResponse(parseAcknowledged(parser)); - } -} diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateAction.java index 47f37b9e6cfee..a8614277b409d 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateAction.java @@ -20,8 +20,9 @@ package org.elasticsearch.action.admin.indices.template.delete; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; -public class DeleteIndexTemplateAction extends Action { +public class DeleteIndexTemplateAction extends Action { public static final DeleteIndexTemplateAction INSTANCE = new DeleteIndexTemplateAction(); public static final String NAME = "indices:admin/template/delete"; @@ -31,7 +32,7 @@ private DeleteIndexTemplateAction() { } @Override - public DeleteIndexTemplateResponse newResponse() { - return new DeleteIndexTemplateResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateRequestBuilder.java index 620c432fe9892..5f1119f0f0db1 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateRequestBuilder.java @@ -18,10 +18,11 @@ */ package org.elasticsearch.action.admin.indices.template.delete; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.client.ElasticsearchClient; -public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder { +public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder { public DeleteIndexTemplateRequestBuilder(ElasticsearchClient client, DeleteIndexTemplateAction action) { super(client, action, new DeleteIndexTemplateRequest()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateResponse.java deleted file mode 100644 index a95f18bf13de0..0000000000000 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/DeleteIndexTemplateResponse.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.elasticsearch.action.admin.indices.template.delete; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; - -/** - * A response for a delete index template. - */ -public class DeleteIndexTemplateResponse extends AcknowledgedResponse { - - DeleteIndexTemplateResponse() { - } - - protected DeleteIndexTemplateResponse(boolean acknowledged) { - super(acknowledged); - } -} diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/TransportDeleteIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/TransportDeleteIndexTemplateAction.java index db5ddd326d736..7f9fc03210675 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/TransportDeleteIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/delete/TransportDeleteIndexTemplateAction.java @@ -21,6 +21,7 @@ import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; @@ -36,7 +37,7 @@ /** * Delete index action. */ -public class TransportDeleteIndexTemplateAction extends TransportMasterNodeAction { +public class TransportDeleteIndexTemplateAction extends TransportMasterNodeAction { private final MetaDataIndexTemplateService indexTemplateService; @@ -55,8 +56,8 @@ protected String executor() { } @Override - protected DeleteIndexTemplateResponse newResponse() { - return new DeleteIndexTemplateResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override @@ -65,11 +66,11 @@ protected ClusterBlockException checkBlock(DeleteIndexTemplateRequest request, C } @Override - protected void masterOperation(final DeleteIndexTemplateRequest request, final ClusterState state, final ActionListener listener) { + protected void masterOperation(final DeleteIndexTemplateRequest request, final ClusterState state, final ActionListener listener) { indexTemplateService.removeTemplates(new MetaDataIndexTemplateService.RemoveRequest(request.name()).masterTimeout(request.masterNodeTimeout()), new MetaDataIndexTemplateService.RemoveListener() { @Override public void onResponse(MetaDataIndexTemplateService.RemoveResponse response) { - listener.onResponse(new DeleteIndexTemplateResponse(response.acknowledged())); + listener.onResponse(new AcknowledgedResponse(response.acknowledged())); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateAction.java index 399170eaeced9..1edc49e991453 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateAction.java @@ -20,8 +20,9 @@ package org.elasticsearch.action.admin.indices.template.put; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; -public class PutIndexTemplateAction extends Action { +public class PutIndexTemplateAction extends Action { public static final PutIndexTemplateAction INSTANCE = new PutIndexTemplateAction(); public static final String NAME = "indices:admin/template/put"; @@ -31,7 +32,7 @@ private PutIndexTemplateAction() { } @Override - public PutIndexTemplateResponse newResponse() { - return new PutIndexTemplateResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java index 3c14b1ab18f99..c10df6aafa557 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequestBuilder.java @@ -19,6 +19,7 @@ package org.elasticsearch.action.admin.indices.template.put; import org.elasticsearch.action.admin.indices.alias.Alias; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.common.bytes.BytesReference; @@ -31,7 +32,7 @@ import java.util.Map; public class PutIndexTemplateRequestBuilder - extends MasterNodeOperationRequestBuilder { + extends MasterNodeOperationRequestBuilder { public PutIndexTemplateRequestBuilder(ElasticsearchClient client, PutIndexTemplateAction action) { super(client, action, new PutIndexTemplateRequest()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateResponse.java deleted file mode 100644 index b2dab55a3d9d3..0000000000000 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateResponse.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.elasticsearch.action.admin.indices.template.put; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.xcontent.XContentParser; - -/** - * A response for a put index template action. - */ -public class PutIndexTemplateResponse extends AcknowledgedResponse { - - protected PutIndexTemplateResponse() { - } - - protected PutIndexTemplateResponse(boolean acknowledged) { - super(acknowledged); - } - - public static PutIndexTemplateResponse fromXContent(XContentParser parser) { - return new PutIndexTemplateResponse(parseAcknowledged(parser)); - } -} diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/TransportPutIndexTemplateAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/TransportPutIndexTemplateAction.java index 7b46dc602d0ce..bd8621a1a7d6f 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/TransportPutIndexTemplateAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/put/TransportPutIndexTemplateAction.java @@ -21,6 +21,7 @@ import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; @@ -38,7 +39,7 @@ /** * Put index template action. */ -public class TransportPutIndexTemplateAction extends TransportMasterNodeAction { +public class TransportPutIndexTemplateAction extends TransportMasterNodeAction { private final MetaDataIndexTemplateService indexTemplateService; private final IndexScopedSettings indexScopedSettings; @@ -59,8 +60,8 @@ protected String executor() { } @Override - protected PutIndexTemplateResponse newResponse() { - return new PutIndexTemplateResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override @@ -69,7 +70,7 @@ protected ClusterBlockException checkBlock(PutIndexTemplateRequest request, Clus } @Override - protected void masterOperation(final PutIndexTemplateRequest request, final ClusterState state, final ActionListener listener) { + protected void masterOperation(final PutIndexTemplateRequest request, final ClusterState state, final ActionListener listener) { String cause = request.cause(); if (cause.length() == 0) { cause = "api"; @@ -91,7 +92,7 @@ protected void masterOperation(final PutIndexTemplateRequest request, final Clus new MetaDataIndexTemplateService.PutListener() { @Override public void onResponse(MetaDataIndexTemplateService.PutResponse response) { - listener.onResponse(new PutIndexTemplateResponse(response.acknowledged())); + listener.onResponse(new AcknowledgedResponse(response.acknowledged())); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeAction.java index dda4a5203ff68..918b8a06056d2 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeAction.java @@ -25,6 +25,7 @@ import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.DefaultShardOperationFailedException; import org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; @@ -205,9 +206,9 @@ public void onFailure(Exception e) { private void updateSettings(final UpgradeResponse upgradeResponse, final ActionListener listener) { UpgradeSettingsRequest upgradeSettingsRequest = new UpgradeSettingsRequest(upgradeResponse.versions()); - client.executeLocally(UpgradeSettingsAction.INSTANCE, upgradeSettingsRequest, new ActionListener() { + client.executeLocally(UpgradeSettingsAction.INSTANCE, upgradeSettingsRequest, new ActionListener() { @Override - public void onResponse(UpgradeSettingsResponse updateSettingsResponse) { + public void onResponse(AcknowledgedResponse updateSettingsResponse) { listener.onResponse(upgradeResponse); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeSettingsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeSettingsAction.java index 2e428e85efc23..7c4aa406b2101 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/TransportUpgradeSettingsAction.java @@ -22,6 +22,7 @@ import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse; @@ -35,7 +36,7 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -public class TransportUpgradeSettingsAction extends TransportMasterNodeAction { +public class TransportUpgradeSettingsAction extends TransportMasterNodeAction { private final MetaDataUpdateSettingsService updateSettingsService; @@ -58,12 +59,12 @@ protected ClusterBlockException checkBlock(UpgradeSettingsRequest request, Clust } @Override - protected UpgradeSettingsResponse newResponse() { - return new UpgradeSettingsResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override - protected void masterOperation(final UpgradeSettingsRequest request, final ClusterState state, final ActionListener listener) { + protected void masterOperation(final UpgradeSettingsRequest request, final ClusterState state, final ActionListener listener) { UpgradeSettingsClusterStateUpdateRequest clusterStateUpdateRequest = new UpgradeSettingsClusterStateUpdateRequest() .ackTimeout(request.timeout()) .versions(request.versions()) @@ -72,7 +73,7 @@ protected void masterOperation(final UpgradeSettingsRequest request, final Clust updateSettingsService.upgradeIndexSettings(clusterStateUpdateRequest, new ActionListener() { @Override public void onResponse(ClusterStateUpdateResponse response) { - listener.onResponse(new UpgradeSettingsResponse(response.isAcknowledged())); + listener.onResponse(new AcknowledgedResponse(response.isAcknowledged())); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeSettingsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeSettingsAction.java index 5f1ee88e34e8b..9b1ff0f616a54 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeSettingsAction.java @@ -20,8 +20,9 @@ package org.elasticsearch.action.admin.indices.upgrade.post; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; -public class UpgradeSettingsAction extends Action { +public class UpgradeSettingsAction extends Action { public static final UpgradeSettingsAction INSTANCE = new UpgradeSettingsAction(); public static final String NAME = "internal:indices/admin/upgrade"; @@ -31,7 +32,7 @@ private UpgradeSettingsAction() { } @Override - public UpgradeSettingsResponse newResponse() { - return new UpgradeSettingsResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeSettingsRequestBuilder.java b/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeSettingsRequestBuilder.java index 9ce5aeb2d2d69..e3a48066bbfe0 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeSettingsRequestBuilder.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeSettingsRequestBuilder.java @@ -21,6 +21,7 @@ import org.elasticsearch.Version; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.common.collect.Tuple; @@ -29,7 +30,7 @@ /** * Builder for an update index settings request */ -public class UpgradeSettingsRequestBuilder extends AcknowledgedRequestBuilder { +public class UpgradeSettingsRequestBuilder extends AcknowledgedRequestBuilder { public UpgradeSettingsRequestBuilder(ElasticsearchClient client, UpgradeSettingsAction action) { super(client, action, new UpgradeSettingsRequest()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeSettingsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeSettingsResponse.java deleted file mode 100644 index 0d3ac16a6fe14..0000000000000 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/upgrade/post/UpgradeSettingsResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.indices.upgrade.post; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; - -/** - * A response for an update index settings action - */ -public class UpgradeSettingsResponse extends AcknowledgedResponse { - - UpgradeSettingsResponse() { - } - - UpgradeSettingsResponse(boolean acknowledged) { - super(acknowledged); - } -} diff --git a/server/src/main/java/org/elasticsearch/action/support/master/AcknowledgedResponse.java b/server/src/main/java/org/elasticsearch/action/support/master/AcknowledgedResponse.java index 654b398e79cd4..21a0d3f21a804 100644 --- a/server/src/main/java/org/elasticsearch/action/support/master/AcknowledgedResponse.java +++ b/server/src/main/java/org/elasticsearch/action/support/master/AcknowledgedResponse.java @@ -98,11 +98,6 @@ protected void addCustomFields(XContentBuilder builder, Params params) throws IO ObjectParser.ValueType.BOOLEAN); } - @Deprecated - public static boolean parseAcknowledged(XContentParser parser) { - return ACKNOWLEDGED_FLAG_PARSER.apply(parser, null); - } - public static AcknowledgedResponse fromXContent(XContentParser parser) throws IOException { return new AcknowledgedResponse(ACKNOWLEDGED_FLAG_PARSER.apply(parser, null)); } diff --git a/server/src/main/java/org/elasticsearch/client/ClusterAdminClient.java b/server/src/main/java/org/elasticsearch/client/ClusterAdminClient.java index f6c71c90f9d14..624c79996371a 100644 --- a/server/src/main/java/org/elasticsearch/client/ClusterAdminClient.java +++ b/server/src/main/java/org/elasticsearch/client/ClusterAdminClient.java @@ -51,13 +51,11 @@ import org.elasticsearch.action.admin.cluster.node.usage.NodesUsageResponse; import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest; import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequestBuilder; -import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequestBuilder; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequestBuilder; -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequestBuilder; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse; @@ -75,7 +73,6 @@ import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequestBuilder; -import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequestBuilder; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse; @@ -93,13 +90,11 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse; import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest; import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequestBuilder; -import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptResponse; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequestBuilder; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptResponse; import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest; import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequestBuilder; -import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptResponse; import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest; import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequestBuilder; import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse; @@ -416,12 +411,12 @@ public interface ClusterAdminClient extends ElasticsearchClient { /** * Registers a snapshot repository. */ - ActionFuture putRepository(PutRepositoryRequest request); + ActionFuture putRepository(PutRepositoryRequest request); /** * Registers a snapshot repository. */ - void putRepository(PutRepositoryRequest request, ActionListener listener); + void putRepository(PutRepositoryRequest request, ActionListener listener); /** * Registers a snapshot repository. @@ -431,12 +426,12 @@ public interface ClusterAdminClient extends ElasticsearchClient { /** * Unregisters a repository. */ - ActionFuture deleteRepository(DeleteRepositoryRequest request); + ActionFuture deleteRepository(DeleteRepositoryRequest request); /** * Unregisters a repository. */ - void deleteRepository(DeleteRepositoryRequest request, ActionListener listener); + void deleteRepository(DeleteRepositoryRequest request, ActionListener listener); /** * Unregisters a repository. @@ -506,12 +501,12 @@ public interface ClusterAdminClient extends ElasticsearchClient { /** * Delete snapshot. */ - ActionFuture deleteSnapshot(DeleteSnapshotRequest request); + ActionFuture deleteSnapshot(DeleteSnapshotRequest request); /** * Delete snapshot. */ - void deleteSnapshot(DeleteSnapshotRequest request, ActionListener listener); + void deleteSnapshot(DeleteSnapshotRequest request, ActionListener listener); /** * Delete snapshot. @@ -672,12 +667,12 @@ public interface ClusterAdminClient extends ElasticsearchClient { /** * Delete a script from the cluster state */ - void deleteStoredScript(DeleteStoredScriptRequest request, ActionListener listener); + void deleteStoredScript(DeleteStoredScriptRequest request, ActionListener listener); /** * Delete a script from the cluster state */ - ActionFuture deleteStoredScript(DeleteStoredScriptRequest request); + ActionFuture deleteStoredScript(DeleteStoredScriptRequest request); /** * Delete a script from the cluster state @@ -692,12 +687,12 @@ public interface ClusterAdminClient extends ElasticsearchClient { /** * Store a script in the cluster state */ - void putStoredScript(PutStoredScriptRequest request, ActionListener listener); + void putStoredScript(PutStoredScriptRequest request, ActionListener listener); /** * Store a script in the cluster state */ - ActionFuture putStoredScript(PutStoredScriptRequest request); + ActionFuture putStoredScript(PutStoredScriptRequest request); /** * Get a script from the cluster state diff --git a/server/src/main/java/org/elasticsearch/client/IndicesAdminClient.java b/server/src/main/java/org/elasticsearch/client/IndicesAdminClient.java index 81de57f91afee..60e9334c87d91 100644 --- a/server/src/main/java/org/elasticsearch/client/IndicesAdminClient.java +++ b/server/src/main/java/org/elasticsearch/client/IndicesAdminClient.java @@ -23,7 +23,6 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder; -import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistRequestBuilder; import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse; import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest; @@ -37,13 +36,11 @@ import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse; import org.elasticsearch.action.admin.indices.close.CloseIndexRequest; import org.elasticsearch.action.admin.indices.close.CloseIndexRequestBuilder; -import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder; -import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse; @@ -70,7 +67,6 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.admin.indices.open.OpenIndexRequest; import org.elasticsearch.action.admin.indices.open.OpenIndexRequestBuilder; import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; @@ -91,7 +87,6 @@ import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse; import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest; import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequestBuilder; -import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse; import org.elasticsearch.action.admin.indices.shards.IndicesShardStoreRequestBuilder; import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresRequest; import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresResponse; @@ -103,13 +98,11 @@ import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse; import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest; import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequestBuilder; -import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequestBuilder; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequestBuilder; -import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusRequest; import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusRequestBuilder; import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusResponse; @@ -119,6 +112,7 @@ import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest; import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequestBuilder; import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.Nullable; /** @@ -281,7 +275,7 @@ public interface IndicesAdminClient extends ElasticsearchClient { * @return The result future * @see org.elasticsearch.client.Requests#deleteIndexRequest(String) */ - ActionFuture delete(DeleteIndexRequest request); + ActionFuture delete(DeleteIndexRequest request); /** * Deletes an index based on the index name. @@ -290,7 +284,7 @@ public interface IndicesAdminClient extends ElasticsearchClient { * @param listener A listener to be notified with a result * @see org.elasticsearch.client.Requests#deleteIndexRequest(String) */ - void delete(DeleteIndexRequest request, ActionListener listener); + void delete(DeleteIndexRequest request, ActionListener listener); /** * Deletes an index based on the index name. @@ -306,7 +300,7 @@ public interface IndicesAdminClient extends ElasticsearchClient { * @return The result future * @see org.elasticsearch.client.Requests#closeIndexRequest(String) */ - ActionFuture close(CloseIndexRequest request); + ActionFuture close(CloseIndexRequest request); /** * Closes an index based on the index name. @@ -315,7 +309,7 @@ public interface IndicesAdminClient extends ElasticsearchClient { * @param listener A listener to be notified with a result * @see org.elasticsearch.client.Requests#closeIndexRequest(String) */ - void close(CloseIndexRequest request, ActionListener listener); + void close(CloseIndexRequest request, ActionListener listener); /** * Closes one or more indices based on their index name. @@ -524,7 +518,7 @@ public interface IndicesAdminClient extends ElasticsearchClient { * @return A result future * @see org.elasticsearch.client.Requests#putMappingRequest(String...) */ - ActionFuture putMapping(PutMappingRequest request); + ActionFuture putMapping(PutMappingRequest request); /** * Add mapping definition for a type into one or more indices. @@ -533,7 +527,7 @@ public interface IndicesAdminClient extends ElasticsearchClient { * @param listener A listener to be notified with a result * @see org.elasticsearch.client.Requests#putMappingRequest(String...) */ - void putMapping(PutMappingRequest request, ActionListener listener); + void putMapping(PutMappingRequest request, ActionListener listener); /** * Add mapping definition for a type into one or more indices. @@ -547,7 +541,7 @@ public interface IndicesAdminClient extends ElasticsearchClient { * @return The result future * @see Requests#indexAliasesRequest() */ - ActionFuture aliases(IndicesAliasesRequest request); + ActionFuture aliases(IndicesAliasesRequest request); /** * Allows to add/remove aliases from indices. @@ -556,7 +550,7 @@ public interface IndicesAdminClient extends ElasticsearchClient { * @param listener A listener to be notified with a result * @see Requests#indexAliasesRequest() */ - void aliases(IndicesAliasesRequest request, ActionListener listener); + void aliases(IndicesAliasesRequest request, ActionListener listener); /** * Allows to add/remove aliases from indices. @@ -652,7 +646,7 @@ public interface IndicesAdminClient extends ElasticsearchClient { * @param request the update settings request * @return The result future */ - ActionFuture updateSettings(UpdateSettingsRequest request); + ActionFuture updateSettings(UpdateSettingsRequest request); /** * Updates settings of one or more indices. @@ -660,7 +654,7 @@ public interface IndicesAdminClient extends ElasticsearchClient { * @param request the update settings request * @param listener A listener to be notified with the response */ - void updateSettings(UpdateSettingsRequest request, ActionListener listener); + void updateSettings(UpdateSettingsRequest request, ActionListener listener); /** * Update indices settings. @@ -701,12 +695,12 @@ public interface IndicesAdminClient extends ElasticsearchClient { /** * Puts an index template. */ - ActionFuture putTemplate(PutIndexTemplateRequest request); + ActionFuture putTemplate(PutIndexTemplateRequest request); /** * Puts an index template. */ - void putTemplate(PutIndexTemplateRequest request, ActionListener listener); + void putTemplate(PutIndexTemplateRequest request, ActionListener listener); /** * Puts an index template. @@ -718,12 +712,12 @@ public interface IndicesAdminClient extends ElasticsearchClient { /** * Deletes index template. */ - ActionFuture deleteTemplate(DeleteIndexTemplateRequest request); + ActionFuture deleteTemplate(DeleteIndexTemplateRequest request); /** * Deletes an index template. */ - void deleteTemplate(DeleteIndexTemplateRequest request, ActionListener listener); + void deleteTemplate(DeleteIndexTemplateRequest request, ActionListener listener); /** * Deletes an index template. diff --git a/server/src/main/java/org/elasticsearch/client/support/AbstractClient.java b/server/src/main/java/org/elasticsearch/client/support/AbstractClient.java index 3d508a3d9ba82..86d9d2c445f3f 100644 --- a/server/src/main/java/org/elasticsearch/client/support/AbstractClient.java +++ b/server/src/main/java/org/elasticsearch/client/support/AbstractClient.java @@ -65,7 +65,6 @@ import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryAction; import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest; import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequestBuilder; -import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesAction; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequestBuilder; @@ -73,7 +72,6 @@ import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryAction; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequestBuilder; -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryAction; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequestBuilder; @@ -97,7 +95,6 @@ import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotAction; import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequestBuilder; -import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsAction; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequestBuilder; @@ -121,7 +118,6 @@ import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptAction; import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest; import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequestBuilder; -import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptResponse; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptAction; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequestBuilder; @@ -129,7 +125,6 @@ import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptAction; import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest; import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequestBuilder; -import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptResponse; import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksAction; import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest; import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequestBuilder; @@ -137,7 +132,6 @@ import org.elasticsearch.action.admin.indices.alias.IndicesAliasesAction; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder; -import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistAction; import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistRequestBuilder; import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse; @@ -156,7 +150,6 @@ import org.elasticsearch.action.admin.indices.close.CloseIndexAction; import org.elasticsearch.action.admin.indices.close.CloseIndexRequest; import org.elasticsearch.action.admin.indices.close.CloseIndexRequestBuilder; -import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexAction; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; @@ -164,7 +157,6 @@ import org.elasticsearch.action.admin.indices.delete.DeleteIndexAction; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder; -import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsAction; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder; @@ -200,7 +192,6 @@ import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.admin.indices.open.OpenIndexAction; import org.elasticsearch.action.admin.indices.open.OpenIndexRequest; import org.elasticsearch.action.admin.indices.open.OpenIndexRequestBuilder; @@ -228,7 +219,6 @@ import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsAction; import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest; import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequestBuilder; -import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse; import org.elasticsearch.action.admin.indices.shards.IndicesShardStoreRequestBuilder; import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresAction; import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresRequest; @@ -244,7 +234,6 @@ import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateAction; import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest; import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequestBuilder; -import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesAction; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequestBuilder; @@ -252,7 +241,6 @@ import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateAction; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequestBuilder; -import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusAction; import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusRequest; import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusRequestBuilder; @@ -939,12 +927,12 @@ public void pendingClusterTasks(PendingClusterTasksRequest request, ActionListen } @Override - public ActionFuture putRepository(PutRepositoryRequest request) { + public ActionFuture putRepository(PutRepositoryRequest request) { return execute(PutRepositoryAction.INSTANCE, request); } @Override - public void putRepository(PutRepositoryRequest request, ActionListener listener) { + public void putRepository(PutRepositoryRequest request, ActionListener listener) { execute(PutRepositoryAction.INSTANCE, request, listener); } @@ -985,12 +973,12 @@ public GetSnapshotsRequestBuilder prepareGetSnapshots(String repository) { @Override - public ActionFuture deleteSnapshot(DeleteSnapshotRequest request) { + public ActionFuture deleteSnapshot(DeleteSnapshotRequest request) { return execute(DeleteSnapshotAction.INSTANCE, request); } @Override - public void deleteSnapshot(DeleteSnapshotRequest request, ActionListener listener) { + public void deleteSnapshot(DeleteSnapshotRequest request, ActionListener listener) { execute(DeleteSnapshotAction.INSTANCE, request, listener); } @@ -1001,12 +989,12 @@ public DeleteSnapshotRequestBuilder prepareDeleteSnapshot(String repository, Str @Override - public ActionFuture deleteRepository(DeleteRepositoryRequest request) { + public ActionFuture deleteRepository(DeleteRepositoryRequest request) { return execute(DeleteRepositoryAction.INSTANCE, request); } @Override - public void deleteRepository(DeleteRepositoryRequest request, ActionListener listener) { + public void deleteRepository(DeleteRepositoryRequest request, ActionListener listener) { execute(DeleteRepositoryAction.INSTANCE, request, listener); } @@ -1197,23 +1185,23 @@ public PutStoredScriptRequestBuilder preparePutStoredScript() { } @Override - public void putStoredScript(final PutStoredScriptRequest request, ActionListener listener){ + public void putStoredScript(final PutStoredScriptRequest request, ActionListener listener){ execute(PutStoredScriptAction.INSTANCE, request, listener); } @Override - public ActionFuture putStoredScript(final PutStoredScriptRequest request){ + public ActionFuture putStoredScript(final PutStoredScriptRequest request){ return execute(PutStoredScriptAction.INSTANCE, request); } @Override - public void deleteStoredScript(DeleteStoredScriptRequest request, ActionListener listener){ + public void deleteStoredScript(DeleteStoredScriptRequest request, ActionListener listener){ execute(DeleteStoredScriptAction.INSTANCE, request, listener); } @Override - public ActionFuture deleteStoredScript(DeleteStoredScriptRequest request){ + public ActionFuture deleteStoredScript(DeleteStoredScriptRequest request){ return execute(DeleteStoredScriptAction.INSTANCE, request); } @@ -1284,12 +1272,12 @@ public TypesExistsRequestBuilder prepareTypesExists(String... index) { } @Override - public ActionFuture aliases(final IndicesAliasesRequest request) { + public ActionFuture aliases(final IndicesAliasesRequest request) { return execute(IndicesAliasesAction.INSTANCE, request); } @Override - public void aliases(final IndicesAliasesRequest request, final ActionListener listener) { + public void aliases(final IndicesAliasesRequest request, final ActionListener listener) { execute(IndicesAliasesAction.INSTANCE, request, listener); } @@ -1374,12 +1362,12 @@ public CreateIndexRequestBuilder prepareCreate(String index) { } @Override - public ActionFuture delete(final DeleteIndexRequest request) { + public ActionFuture delete(final DeleteIndexRequest request) { return execute(DeleteIndexAction.INSTANCE, request); } @Override - public void delete(final DeleteIndexRequest request, final ActionListener listener) { + public void delete(final DeleteIndexRequest request, final ActionListener listener) { execute(DeleteIndexAction.INSTANCE, request, listener); } @@ -1389,12 +1377,12 @@ public DeleteIndexRequestBuilder prepareDelete(String... indices) { } @Override - public ActionFuture close(final CloseIndexRequest request) { + public ActionFuture close(final CloseIndexRequest request) { return execute(CloseIndexAction.INSTANCE, request); } @Override - public void close(final CloseIndexRequest request, final ActionListener listener) { + public void close(final CloseIndexRequest request, final ActionListener listener) { execute(CloseIndexAction.INSTANCE, request, listener); } @@ -1479,12 +1467,12 @@ public ActionFuture getFieldMappings(GetFieldMappingsR } @Override - public ActionFuture putMapping(final PutMappingRequest request) { + public ActionFuture putMapping(final PutMappingRequest request) { return execute(PutMappingAction.INSTANCE, request); } @Override - public void putMapping(final PutMappingRequest request, final ActionListener listener) { + public void putMapping(final PutMappingRequest request, final ActionListener listener) { execute(PutMappingAction.INSTANCE, request, listener); } @@ -1614,12 +1602,12 @@ public IndicesShardStoreRequestBuilder prepareShardStores(String... indices) { } @Override - public ActionFuture updateSettings(final UpdateSettingsRequest request) { + public ActionFuture updateSettings(final UpdateSettingsRequest request) { return execute(UpdateSettingsAction.INSTANCE, request); } @Override - public void updateSettings(final UpdateSettingsRequest request, final ActionListener listener) { + public void updateSettings(final UpdateSettingsRequest request, final ActionListener listener) { execute(UpdateSettingsAction.INSTANCE, request, listener); } @@ -1654,12 +1642,12 @@ public AnalyzeRequestBuilder prepareAnalyze() { } @Override - public ActionFuture putTemplate(final PutIndexTemplateRequest request) { + public ActionFuture putTemplate(final PutIndexTemplateRequest request) { return execute(PutIndexTemplateAction.INSTANCE, request); } @Override - public void putTemplate(final PutIndexTemplateRequest request, final ActionListener listener) { + public void putTemplate(final PutIndexTemplateRequest request, final ActionListener listener) { execute(PutIndexTemplateAction.INSTANCE, request, listener); } @@ -1684,12 +1672,12 @@ public GetIndexTemplatesRequestBuilder prepareGetTemplates(String... names) { } @Override - public ActionFuture deleteTemplate(final DeleteIndexTemplateRequest request) { + public ActionFuture deleteTemplate(final DeleteIndexTemplateRequest request) { return execute(DeleteIndexTemplateAction.INSTANCE, request); } @Override - public void deleteTemplate(final DeleteIndexTemplateRequest request, final ActionListener listener) { + public void deleteTemplate(final DeleteIndexTemplateRequest request, final ActionListener listener) { execute(DeleteIndexTemplateAction.INSTANCE, request, listener); } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/TemplateUpgradeService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/TemplateUpgradeService.java index 024cc44dd6a8e..af8289d03c197 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/TemplateUpgradeService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/TemplateUpgradeService.java @@ -24,9 +24,8 @@ import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest; -import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; -import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterState; @@ -147,9 +146,9 @@ void upgradeTemplates(Map changes, Set deletions PutIndexTemplateRequest request = new PutIndexTemplateRequest(change.getKey()).source(change.getValue(), XContentType.JSON); request.masterNodeTimeout(TimeValue.timeValueMinutes(1)); - client.admin().indices().putTemplate(request, new ActionListener() { + client.admin().indices().putTemplate(request, new ActionListener() { @Override - public void onResponse(PutIndexTemplateResponse response) { + public void onResponse(AcknowledgedResponse response) { if (response.isAcknowledged() == false) { anyUpgradeFailed.set(true); logger.warn("Error updating template [{}], request was not acknowledged", change.getKey()); @@ -169,9 +168,9 @@ public void onFailure(Exception e) { for (String template : deletions) { DeleteIndexTemplateRequest request = new DeleteIndexTemplateRequest(template); request.masterNodeTimeout(TimeValue.timeValueMinutes(1)); - client.admin().indices().deleteTemplate(request, new ActionListener() { + client.admin().indices().deleteTemplate(request, new ActionListener() { @Override - public void onResponse(DeleteIndexTemplateResponse response) { + public void onResponse(AcknowledgedResponse response) { if (response.isAcknowledged() == false) { anyUpgradeFailed.set(true); logger.warn("Error deleting template [{}], request was not acknowledged", template); diff --git a/server/src/main/java/org/elasticsearch/script/ScriptService.java b/server/src/main/java/org/elasticsearch/script/ScriptService.java index 9768547b89819..d37cefb3a0103 100644 --- a/server/src/main/java/org/elasticsearch/script/ScriptService.java +++ b/server/src/main/java/org/elasticsearch/script/ScriptService.java @@ -19,14 +19,12 @@ package org.elasticsearch.script; -import org.elasticsearch.core.internal.io.IOUtils; import org.elasticsearch.ResourceNotFoundException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest; -import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptResponse; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest; import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest; -import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.cluster.AckedClusterStateUpdateTask; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterState; @@ -46,6 +44,7 @@ import org.elasticsearch.common.settings.Setting.Property; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; +import org.elasticsearch.core.internal.io.IOUtils; import java.io.Closeable; import java.io.IOException; @@ -417,7 +416,7 @@ StoredScriptSource getScriptFromClusterState(String id) { } public void putStoredScript(ClusterService clusterService, PutStoredScriptRequest request, - ActionListener listener) { + ActionListener listener) { int max = SCRIPT_MAX_SIZE_IN_BYTES.get(settings); if (request.content().length() > max) { @@ -454,11 +453,11 @@ public void putStoredScript(ClusterService clusterService, PutStoredScriptReques } clusterService.submitStateUpdateTask("put-script-" + request.id(), - new AckedClusterStateUpdateTask(request, listener) { + new AckedClusterStateUpdateTask(request, listener) { @Override - protected PutStoredScriptResponse newResponse(boolean acknowledged) { - return new PutStoredScriptResponse(acknowledged); + protected AcknowledgedResponse newResponse(boolean acknowledged) { + return new AcknowledgedResponse(acknowledged); } @Override @@ -473,13 +472,13 @@ public ClusterState execute(ClusterState currentState) throws Exception { } public void deleteStoredScript(ClusterService clusterService, DeleteStoredScriptRequest request, - ActionListener listener) { + ActionListener listener) { clusterService.submitStateUpdateTask("delete-script-" + request.id(), - new AckedClusterStateUpdateTask(request, listener) { + new AckedClusterStateUpdateTask(request, listener) { @Override - protected DeleteStoredScriptResponse newResponse(boolean acknowledged) { - return new DeleteStoredScriptResponse(acknowledged); + protected AcknowledgedResponse newResponse(boolean acknowledged) { + return new AcknowledgedResponse(acknowledged); } @Override diff --git a/server/src/main/java/org/elasticsearch/tasks/TaskResultsService.java b/server/src/main/java/org/elasticsearch/tasks/TaskResultsService.java index b94902132fea2..1a837f7d6d923 100644 --- a/server/src/main/java/org/elasticsearch/tasks/TaskResultsService.java +++ b/server/src/main/java/org/elasticsearch/tasks/TaskResultsService.java @@ -25,9 +25,9 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.index.IndexResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.client.Requests; import org.elasticsearch.cluster.ClusterState; @@ -113,9 +113,9 @@ public void onFailure(Exception e) { // The index already exists but doesn't have our mapping client.admin().indices().preparePutMapping(TASK_INDEX).setType(TASK_TYPE) .setSource(taskResultIndexMapping(), XContentType.JSON) - .execute(new ActionListener() { + .execute(new ActionListener() { @Override - public void onResponse(PutMappingResponse putMappingResponse) { + public void onResponse(AcknowledgedResponse putMappingResponse) { doStoreResult(taskResult, listener); } diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryResponseTests.java deleted file mode 100644 index fe97e778dadb8..0000000000000 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryResponseTests.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.elasticsearch.action.admin.cluster.repositories.delete; - -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; - -public class DeleteRepositoryResponseTests extends AbstractStreamableXContentTestCase { - - @Override - protected DeleteRepositoryResponse doParseInstance(XContentParser parser) { - return DeleteRepositoryResponse.fromXContent(parser); - } - - @Override - protected DeleteRepositoryResponse createBlankInstance() { - return new DeleteRepositoryResponse(); - } - - @Override - protected DeleteRepositoryResponse createTestInstance() { - return new DeleteRepositoryResponse(randomBoolean()); - } -} diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryResponseTests.java deleted file mode 100644 index a4dbc6a9d9b2d..0000000000000 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryResponseTests.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.elasticsearch.action.admin.cluster.repositories.put; - -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; - -import java.io.IOException; - -import static org.elasticsearch.test.ESTestCase.randomBoolean; - -public class PutRepositoryResponseTests extends AbstractStreamableXContentTestCase { - - @Override - protected PutRepositoryResponse doParseInstance(XContentParser parser) throws IOException { - return PutRepositoryResponse.fromXContent(parser); - } - - @Override - protected PutRepositoryResponse createBlankInstance() { - return new PutRepositoryResponse(); - } - - @Override - protected PutRepositoryResponse createTestInstance() { - return new PutRepositoryResponse(randomBoolean()); - } -} diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotResponseTests.java deleted file mode 100644 index d77dadfb81edb..0000000000000 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotResponseTests.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.cluster.snapshots.delete; - -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; - -public class DeleteSnapshotResponseTests extends AbstractStreamableXContentTestCase { - - @Override - protected DeleteSnapshotResponse doParseInstance(XContentParser parser) { - return DeleteSnapshotResponse.fromXContent(parser); - } - - @Override - protected DeleteSnapshotResponse createBlankInstance() { - return new DeleteSnapshotResponse(); - } - - @Override - protected DeleteSnapshotResponse createTestInstance() { - return new DeleteSnapshotResponse(randomBoolean()); - } -} diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptResponseTests.java deleted file mode 100644 index 375a672263060..0000000000000 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/storedscripts/DeleteStoredScriptResponseTests.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.elasticsearch.action.admin.cluster.storedscripts;/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; - -import java.io.IOException; - -public class DeleteStoredScriptResponseTests extends AbstractStreamableXContentTestCase { - - @Override - protected DeleteStoredScriptResponse doParseInstance(XContentParser parser) throws IOException { - return DeleteStoredScriptResponse.fromXContent(parser); - } - - @Override - protected DeleteStoredScriptResponse createBlankInstance() { - return new DeleteStoredScriptResponse(); - } - - @Override - protected DeleteStoredScriptResponse createTestInstance() { - return new DeleteStoredScriptResponse(randomBoolean()); - } - - @Override - protected DeleteStoredScriptResponse mutateInstance(DeleteStoredScriptResponse instance) throws IOException { - return new DeleteStoredScriptResponse(instance.isAcknowledged() == false); - } -} diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesResponseTests.java deleted file mode 100644 index b3eb9c81e8f96..0000000000000 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesResponseTests.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.indices.alias; - -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; - -public class IndicesAliasesResponseTests extends AbstractStreamableXContentTestCase { - - @Override - protected IndicesAliasesResponse doParseInstance(XContentParser parser) { - return IndicesAliasesResponse.fromXContent(parser); - } - - @Override - protected IndicesAliasesResponse createTestInstance() { - return new IndicesAliasesResponse(randomBoolean()); - } - - @Override - protected IndicesAliasesResponse createBlankInstance() { - return new IndicesAliasesResponse(); - } - - @Override - protected IndicesAliasesResponse mutateInstance(IndicesAliasesResponse response) { - return new IndicesAliasesResponse(response.isAcknowledged() == false); - } -} diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/close/CloseIndexResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/close/CloseIndexResponseTests.java deleted file mode 100644 index 3dd4f1e68ce51..0000000000000 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/close/CloseIndexResponseTests.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.indices.close; - -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; - -public class CloseIndexResponseTests extends AbstractStreamableXContentTestCase { - - @Override - protected CloseIndexResponse doParseInstance(XContentParser parser) { - return CloseIndexResponse.fromXContent(parser); - } - - @Override - protected CloseIndexResponse createTestInstance() { - return new CloseIndexResponse(randomBoolean()); - } - - @Override - protected CloseIndexResponse createBlankInstance() { - return new CloseIndexResponse(); - } - - @Override - protected CloseIndexResponse mutateInstance(CloseIndexResponse response) { - return new CloseIndexResponse(response.isAcknowledged() == false); - } -} diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/create/CreateIndexIT.java b/server/src/test/java/org/elasticsearch/action/admin/indices/create/CreateIndexIT.java index c27d9ef65b231..ee49486eab063 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/create/CreateIndexIT.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/create/CreateIndexIT.java @@ -24,10 +24,10 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.UnavailableShardsException; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; -import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.action.support.IndicesOptions; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; @@ -207,9 +207,9 @@ public void testCreateAndDeleteIndexConcurrently() throws InterruptedException { synchronized (indexVersionLock) { // not necessarily needed here but for completeness we lock here too indexVersion.incrementAndGet(); } - client().admin().indices().prepareDelete("test").execute(new ActionListener() { // this happens async!!! + client().admin().indices().prepareDelete("test").execute(new ActionListener() { // this happens async!!! @Override - public void onResponse(DeleteIndexResponse deleteIndexResponse) { + public void onResponse(AcknowledgedResponse deleteIndexResponse) { Thread thread = new Thread() { @Override public void run() { diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponseTests.java deleted file mode 100644 index 4f3313e3d6b74..0000000000000 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/delete/DeleteIndexResponseTests.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.indices.delete; - -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; - -public class DeleteIndexResponseTests extends AbstractStreamableXContentTestCase { - - public void testToXContent() { - DeleteIndexResponse response = new DeleteIndexResponse(true); - String output = Strings.toString(response); - assertEquals("{\"acknowledged\":true}", output); - } - - @Override - protected DeleteIndexResponse doParseInstance(XContentParser parser) { - return DeleteIndexResponse.fromXContent(parser); - } - - @Override - protected DeleteIndexResponse createTestInstance() { - return new DeleteIndexResponse(randomBoolean()); - } - - @Override - protected DeleteIndexResponse createBlankInstance() { - return new DeleteIndexResponse(); - } - - @Override - protected DeleteIndexResponse mutateInstance(DeleteIndexResponse response) { - return new DeleteIndexResponse(response.isAcknowledged() == false); - } -} diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponseTests.java deleted file mode 100644 index d687b251e3432..0000000000000 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingResponseTests.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.indices.mapping.put; - -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; - -public class PutMappingResponseTests extends AbstractStreamableXContentTestCase { - - public void testToXContent() { - PutMappingResponse response = new PutMappingResponse(true); - String output = Strings.toString(response); - assertEquals("{\"acknowledged\":true}", output); - } - - @Override - protected PutMappingResponse doParseInstance(XContentParser parser) { - return PutMappingResponse.fromXContent(parser); - } - - @Override - protected PutMappingResponse createTestInstance() { - return new PutMappingResponse(randomBoolean()); - } - - @Override - protected PutMappingResponse createBlankInstance() { - return new PutMappingResponse(); - } - - @Override - protected PutMappingResponse mutateInstance(PutMappingResponse response) { - return new PutMappingResponse(response.isAcknowledged() == false); - } -} diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsResponseTests.java deleted file mode 100644 index a3fb484f02e88..0000000000000 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsResponseTests.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.indices.settings.put; - -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; - -public class UpdateSettingsResponseTests extends AbstractStreamableXContentTestCase { - - @Override - protected UpdateSettingsResponse doParseInstance(XContentParser parser) { - return UpdateSettingsResponse.fromXContent(parser); - } - - @Override - protected UpdateSettingsResponse createTestInstance() { - return new UpdateSettingsResponse(randomBoolean()); - } - - @Override - protected UpdateSettingsResponse createBlankInstance() { - return new UpdateSettingsResponse(); - } - - @Override - protected UpdateSettingsResponse mutateInstance(UpdateSettingsResponse response) { - return new UpdateSettingsResponse(response.isAcknowledged() == false); - } -} diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateResponseTests.java deleted file mode 100644 index 096d62bf2bb5b..0000000000000 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateResponseTests.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.admin.indices.template.put; - -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; - -public class PutIndexTemplateResponseTests extends AbstractStreamableXContentTestCase { - @Override - protected PutIndexTemplateResponse doParseInstance(XContentParser parser) { - return PutIndexTemplateResponse.fromXContent(parser); - } - - @Override - protected PutIndexTemplateResponse createTestInstance() { - return new PutIndexTemplateResponse(randomBoolean()); - } - - @Override - protected PutIndexTemplateResponse createBlankInstance() { - return new PutIndexTemplateResponse(); - } - - @Override - protected PutIndexTemplateResponse mutateInstance(PutIndexTemplateResponse response) { - return new PutIndexTemplateResponse(response.isAcknowledged() == false); - } -} diff --git a/server/src/test/java/org/elasticsearch/blocks/SimpleBlocksIT.java b/server/src/test/java/org/elasticsearch/blocks/SimpleBlocksIT.java index 699b919cf0533..9009b3592f895 100644 --- a/server/src/test/java/org/elasticsearch/blocks/SimpleBlocksIT.java +++ b/server/src/test/java/org/elasticsearch/blocks/SimpleBlocksIT.java @@ -22,9 +22,9 @@ import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse; import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequestBuilder; -import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.index.IndexResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; @@ -147,7 +147,7 @@ private void setIndexReadOnly(String index, Object value) { UpdateSettingsRequestBuilder settingsRequest = client().admin().indices().prepareUpdateSettings(index); settingsRequest.setSettings(newSettings); - UpdateSettingsResponse settingsResponse = settingsRequest.execute().actionGet(); + AcknowledgedResponse settingsResponse = settingsRequest.execute().actionGet(); assertThat(settingsResponse, notNullValue()); } } diff --git a/server/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsIT.java b/server/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsIT.java index a11ceddf28788..274c48748fe6a 100644 --- a/server/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsIT.java +++ b/server/src/test/java/org/elasticsearch/cluster/ack/AckClusterUpdateSettingsIT.java @@ -22,9 +22,9 @@ import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse; -import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.routing.IndexRoutingTable; @@ -163,7 +163,7 @@ public void testOpenIndexNoAcknowledgement() { createIndex("test"); ensureGreen(); removePublishTimeout(); - CloseIndexResponse closeIndexResponse = client().admin().indices().prepareClose("test").execute().actionGet(); + AcknowledgedResponse closeIndexResponse = client().admin().indices().prepareClose("test").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); OpenIndexResponse openIndexResponse = client().admin().indices().prepareOpen("test").setTimeout("0s").get(); diff --git a/server/src/test/java/org/elasticsearch/cluster/ack/AckIT.java b/server/src/test/java/org/elasticsearch/cluster/ack/AckIT.java index f51a4f11ae1b6..2cd8a2c27c714 100644 --- a/server/src/test/java/org/elasticsearch/cluster/ack/AckIT.java +++ b/server/src/test/java/org/elasticsearch/cluster/ack/AckIT.java @@ -21,11 +21,8 @@ import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteResponse; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; -import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; -import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; -import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.AliasMetaData; @@ -79,7 +76,7 @@ public void testUpdateSettingsAcknowledgement() { public void testUpdateSettingsNoAcknowledgement() { createIndex("test"); - UpdateSettingsResponse updateSettingsResponse = client().admin().indices().prepareUpdateSettings("test").setTimeout("0s") + AcknowledgedResponse updateSettingsResponse = client().admin().indices().prepareUpdateSettings("test").setTimeout("0s") .setSettings(Settings.builder().put("refresh_interval", 9999, TimeUnit.MILLISECONDS)).get(); assertThat(updateSettingsResponse.isAcknowledged(), equalTo(false)); } @@ -229,7 +226,7 @@ public void testIndicesAliasesAcknowledgement() { public void testIndicesAliasesNoAcknowledgement() { createIndex("test"); - IndicesAliasesResponse indicesAliasesResponse = client().admin().indices().prepareAliases().addAlias("test", "alias").setTimeout("0s").get(); + AcknowledgedResponse indicesAliasesResponse = client().admin().indices().prepareAliases().addAlias("test", "alias").setTimeout("0s").get(); assertThat(indicesAliasesResponse.isAcknowledged(), equalTo(false)); } @@ -249,7 +246,7 @@ public void testCloseIndexNoAcknowledgement() { createIndex("test"); ensureGreen(); - CloseIndexResponse closeIndexResponse = client().admin().indices().prepareClose("test").setTimeout("0s").get(); + AcknowledgedResponse closeIndexResponse = client().admin().indices().prepareClose("test").setTimeout("0s").get(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(false)); } @@ -282,7 +279,7 @@ public void testPutMappingNoAcknowledgement() { createIndex("test"); ensureGreen(); - PutMappingResponse putMappingResponse = client().admin().indices().preparePutMapping("test").setType("test").setSource("field", "type=keyword").setTimeout("0s").get(); + AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping("test").setType("test").setSource("field", "type=keyword").setTimeout("0s").get(); assertThat(putMappingResponse.isAcknowledged(), equalTo(false)); } diff --git a/server/src/test/java/org/elasticsearch/cluster/metadata/TemplateUpgradeServiceTests.java b/server/src/test/java/org/elasticsearch/cluster/metadata/TemplateUpgradeServiceTests.java index 069dafa97546c..776a0a158aeb4 100644 --- a/server/src/test/java/org/elasticsearch/cluster/metadata/TemplateUpgradeServiceTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/metadata/TemplateUpgradeServiceTests.java @@ -22,9 +22,8 @@ import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest; -import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; -import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.AdminClient; import org.elasticsearch.client.Client; import org.elasticsearch.client.IndicesAdminClient; @@ -171,8 +170,8 @@ public void testUpdateTemplates() { int additionsCount = randomIntBetween(0, 5); int deletionsCount = randomIntBetween(0, 3); - List> putTemplateListeners = new ArrayList<>(); - List> deleteTemplateListeners = new ArrayList<>(); + List> putTemplateListeners = new ArrayList<>(); + List> deleteTemplateListeners = new ArrayList<>(); Client mockClient = mock(Client.class); AdminClient mockAdminClient = mock(AdminClient.class); @@ -227,7 +226,7 @@ public void testUpdateTemplates() { if (randomBoolean()) { putTemplateListeners.get(i).onFailure(new RuntimeException("test - ignore")); } else { - putTemplateListeners.get(i).onResponse(new PutIndexTemplateResponse(randomBoolean()) { + putTemplateListeners.get(i).onResponse(new AcknowledgedResponse(randomBoolean()) { }); } @@ -240,7 +239,7 @@ public void testUpdateTemplates() { assertThat(prevUpdatesInProgress - service.upgradesInProgress.get(), equalTo(1)); } else { int prevUpdatesInProgress = service.upgradesInProgress.get(); - deleteTemplateListeners.get(i).onResponse(new DeleteIndexTemplateResponse(randomBoolean()) { + deleteTemplateListeners.get(i).onResponse(new AcknowledgedResponse(randomBoolean()) { }); assertThat(prevUpdatesInProgress - service.upgradesInProgress.get(), equalTo(1)); @@ -256,9 +255,9 @@ public void testUpdateTemplates() { @SuppressWarnings("unchecked") public void testClusterStateUpdate() throws InterruptedException { - final AtomicReference> addedListener = new AtomicReference<>(); - final AtomicReference> changedListener = new AtomicReference<>(); - final AtomicReference> removedListener = new AtomicReference<>(); + final AtomicReference> addedListener = new AtomicReference<>(); + final AtomicReference> changedListener = new AtomicReference<>(); + final AtomicReference> removedListener = new AtomicReference<>(); final Semaphore updateInvocation = new Semaphore(0); final Semaphore calculateInvocation = new Semaphore(0); final Semaphore changedInvocation = new Semaphore(0); @@ -373,11 +372,11 @@ public void clusterChanged(ClusterChangedEvent event) { assertThat(updateInvocation.availablePermits(), equalTo(0)); assertThat(finishInvocation.availablePermits(), equalTo(0)); - addedListener.getAndSet(null).onResponse(new PutIndexTemplateResponse(true) { + addedListener.getAndSet(null).onResponse(new AcknowledgedResponse(true) { }); - changedListener.getAndSet(null).onResponse(new PutIndexTemplateResponse(true) { + changedListener.getAndSet(null).onResponse(new AcknowledgedResponse(true) { }); - removedListener.getAndSet(null).onResponse(new DeleteIndexTemplateResponse(true) { + removedListener.getAndSet(null).onResponse(new AcknowledgedResponse(true) { }); // 3 upgrades should be completed, in addition to the final calculate diff --git a/server/src/test/java/org/elasticsearch/indexlifecycle/IndexLifecycleActionIT.java b/server/src/test/java/org/elasticsearch/indexlifecycle/IndexLifecycleActionIT.java index 5278a6c01d779..f4db4925da439 100644 --- a/server/src/test/java/org/elasticsearch/indexlifecycle/IndexLifecycleActionIT.java +++ b/server/src/test/java/org/elasticsearch/indexlifecycle/IndexLifecycleActionIT.java @@ -21,7 +21,7 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.cluster.routing.RoutingNode; @@ -191,7 +191,7 @@ public void testIndexLifecycleActionsWith11Shards1Backup() throws Exception { logger.info("Deleting index [test]"); // last, lets delete the index - DeleteIndexResponse deleteIndexResponse = client().admin().indices().prepareDelete("test").execute().actionGet(); + AcknowledgedResponse deleteIndexResponse = client().admin().indices().prepareDelete("test").execute().actionGet(); assertThat(deleteIndexResponse.isAcknowledged(), equalTo(true)); clusterState = client().admin().cluster().prepareState().get().getState(); diff --git a/server/src/test/java/org/elasticsearch/indices/IndicesOptionsIntegrationIT.java b/server/src/test/java/org/elasticsearch/indices/IndicesOptionsIntegrationIT.java index 5f9ce852e2a49..0a03343cc1d28 100644 --- a/server/src/test/java/org/elasticsearch/indices/IndicesOptionsIntegrationIT.java +++ b/server/src/test/java/org/elasticsearch/indices/IndicesOptionsIntegrationIT.java @@ -19,7 +19,6 @@ package org.elasticsearch.indices; import org.elasticsearch.action.ActionRequestBuilder; -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequestBuilder; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequestBuilder; import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistRequestBuilder; @@ -41,6 +40,7 @@ import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.support.IndicesOptions; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting.Property; @@ -269,7 +269,7 @@ public void testSpecifiedIndexUnavailableSnapshotRestore() throws Exception { ensureGreen("test1"); waitForRelocation(); - PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("dummy-repo") + AcknowledgedResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("dummy-repo") .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath())).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); client().admin().cluster().prepareCreateSnapshot("dummy-repo", "snap1").setWaitForCompletion(true).get(); @@ -394,7 +394,7 @@ public void testWildcardBehaviourSnapshotRestore() throws Exception { ensureGreen("foobar"); waitForRelocation(); - PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("dummy-repo") + AcknowledgedResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("dummy-repo") .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath())).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); client().admin().cluster().prepareCreateSnapshot("dummy-repo", "snap1").setWaitForCompletion(true).get(); diff --git a/server/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationIT.java b/server/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationIT.java index 094cf83186ccf..f28d253087d03 100644 --- a/server/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationIT.java +++ b/server/src/test/java/org/elasticsearch/indices/mapping/UpdateMappingIntegrationIT.java @@ -21,10 +21,10 @@ import org.elasticsearch.Version; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.admin.indices.refresh.RefreshResponse; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MappingMetaData; @@ -115,7 +115,7 @@ public void testUpdateMappingWithoutType() { .execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); - PutMappingResponse putMappingResponse = client().admin().indices().preparePutMapping("test").setType("_doc") + AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping("test").setType("_doc") .setSource("{\"properties\":{\"date\":{\"type\":\"integer\"}}}", XContentType.JSON) .execute().actionGet(); @@ -135,7 +135,7 @@ public void testUpdateMappingWithoutTypeMultiObjects() { ).execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); - PutMappingResponse putMappingResponse = client().admin().indices().preparePutMapping("test").setType("_doc") + AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping("test").setType("_doc") .setSource("{\"properties\":{\"date\":{\"type\":\"integer\"}}}", XContentType.JSON) .execute().actionGet(); @@ -192,7 +192,7 @@ public void testUpdateMappingNoChanges() { .execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); - PutMappingResponse putMappingResponse = client().admin().indices().preparePutMapping("test").setType("type") + AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping("test").setType("type") .setSource("{\"type\":{\"properties\":{\"body\":{\"type\":\"text\"}}}}", XContentType.JSON) .execute().actionGet(); @@ -218,7 +218,7 @@ public void testUpdateDefaultMappingSettings() throws Exception { logger.info("Emptying _default_ mappings"); // now remove it - PutMappingResponse putResponse = client().admin().indices().preparePutMapping("test").setType(MapperService.DEFAULT_MAPPING).setSource( + AcknowledgedResponse putResponse = client().admin().indices().preparePutMapping("test").setType(MapperService.DEFAULT_MAPPING).setSource( JsonXContent.contentBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING) .endObject().endObject() ).get(); @@ -291,7 +291,7 @@ public void testUpdateMappingConcurrently() throws Throwable { String typeName = "type"; String fieldName = Thread.currentThread().getName() + "_" + i; - PutMappingResponse response = client1.admin().indices().preparePutMapping(indexName).setType(typeName).setSource( + AcknowledgedResponse response = client1.admin().indices().preparePutMapping(indexName).setType(typeName).setSource( JsonXContent.contentBuilder().startObject().startObject(typeName) .startObject("properties").startObject(fieldName).field("type", "text").endObject().endObject() .endObject().endObject() diff --git a/server/src/test/java/org/elasticsearch/indices/state/OpenCloseIndexIT.java b/server/src/test/java/org/elasticsearch/indices/state/OpenCloseIndexIT.java index 2a867915b0fe6..96bb9ab8a1ce7 100644 --- a/server/src/test/java/org/elasticsearch/indices/state/OpenCloseIndexIT.java +++ b/server/src/test/java/org/elasticsearch/indices/state/OpenCloseIndexIT.java @@ -22,12 +22,11 @@ import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; -import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; -import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.support.IndicesOptions; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.Strings; @@ -63,7 +62,7 @@ public void testSimpleCloseOpen() { ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); - CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test1").execute().actionGet(); + AcknowledgedResponse closeIndexResponse = client.admin().indices().prepareClose("test1").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1"); @@ -102,7 +101,7 @@ public void testCloseOneMissingIndexIgnoreMissing() { createIndex("test1"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); - CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test1", "test2") + AcknowledgedResponse closeIndexResponse = client.admin().indices().prepareClose("test1", "test2") .setIndicesOptions(IndicesOptions.lenientExpandOpen()).execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1"); @@ -136,9 +135,9 @@ public void testCloseOpenMultipleIndices() { ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); - CloseIndexResponse closeIndexResponse1 = client.admin().indices().prepareClose("test1").execute().actionGet(); + AcknowledgedResponse closeIndexResponse1 = client.admin().indices().prepareClose("test1").execute().actionGet(); assertThat(closeIndexResponse1.isAcknowledged(), equalTo(true)); - CloseIndexResponse closeIndexResponse2 = client.admin().indices().prepareClose("test2").execute().actionGet(); + AcknowledgedResponse closeIndexResponse2 = client.admin().indices().prepareClose("test2").execute().actionGet(); assertThat(closeIndexResponse2.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1", "test2"); assertIndexIsOpened("test3"); @@ -158,7 +157,7 @@ public void testCloseOpenWildcard() { ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); - CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test*").execute().actionGet(); + AcknowledgedResponse closeIndexResponse = client.admin().indices().prepareClose("test*").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1", "test2"); assertIndexIsOpened("a"); @@ -175,7 +174,7 @@ public void testCloseOpenAll() { ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); - CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("_all").execute().actionGet(); + AcknowledgedResponse closeIndexResponse = client.admin().indices().prepareClose("_all").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1", "test2", "test3"); @@ -191,7 +190,7 @@ public void testCloseOpenAllWildcard() { ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); - CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("*").execute().actionGet(); + AcknowledgedResponse closeIndexResponse = client.admin().indices().prepareClose("*").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1", "test2", "test3"); @@ -249,7 +248,7 @@ public void testCloseAlreadyClosedIndex() { assertThat(healthResponse.isTimedOut(), equalTo(false)); //closing the index - CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test1").execute().actionGet(); + AcknowledgedResponse closeIndexResponse = client.admin().indices().prepareClose("test1").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1"); @@ -265,10 +264,10 @@ public void testSimpleCloseOpenAlias() { ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); - IndicesAliasesResponse aliasesResponse = client.admin().indices().prepareAliases().addAlias("test1", "test1-alias").execute().actionGet(); + AcknowledgedResponse aliasesResponse = client.admin().indices().prepareAliases().addAlias("test1", "test1-alias").execute().actionGet(); assertThat(aliasesResponse.isAcknowledged(), equalTo(true)); - CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test1-alias").execute().actionGet(); + AcknowledgedResponse closeIndexResponse = client.admin().indices().prepareClose("test1-alias").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1"); @@ -284,12 +283,12 @@ public void testCloseOpenAliasMultipleIndices() { ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); - IndicesAliasesResponse aliasesResponse1 = client.admin().indices().prepareAliases().addAlias("test1", "test-alias").execute().actionGet(); + AcknowledgedResponse aliasesResponse1 = client.admin().indices().prepareAliases().addAlias("test1", "test-alias").execute().actionGet(); assertThat(aliasesResponse1.isAcknowledged(), equalTo(true)); - IndicesAliasesResponse aliasesResponse2 = client.admin().indices().prepareAliases().addAlias("test2", "test-alias").execute().actionGet(); + AcknowledgedResponse aliasesResponse2 = client.admin().indices().prepareAliases().addAlias("test2", "test-alias").execute().actionGet(); assertThat(aliasesResponse2.isAcknowledged(), equalTo(true)); - CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test-alias").execute().actionGet(); + AcknowledgedResponse closeIndexResponse = client.admin().indices().prepareClose("test-alias").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1", "test2"); @@ -380,7 +379,7 @@ public void testOpenCloseIndexWithBlocks() { enableIndexBlock("test", blockSetting); // Closing an index is not blocked - CloseIndexResponse closeIndexResponse = client().admin().indices().prepareClose("test").execute().actionGet(); + AcknowledgedResponse closeIndexResponse = client().admin().indices().prepareClose("test").execute().actionGet(); assertAcked(closeIndexResponse); assertIndexIsClosed("test"); @@ -405,7 +404,7 @@ public void testOpenCloseIndexWithBlocks() { } } - CloseIndexResponse closeIndexResponse = client().admin().indices().prepareClose("test").execute().actionGet(); + AcknowledgedResponse closeIndexResponse = client().admin().indices().prepareClose("test").execute().actionGet(); assertAcked(closeIndexResponse); assertIndexIsClosed("test"); diff --git a/server/src/test/java/org/elasticsearch/indices/state/RareClusterStateIT.java b/server/src/test/java/org/elasticsearch/indices/state/RareClusterStateIT.java index d25120c8733d9..df22e81aa6a26 100644 --- a/server/src/test/java/org/elasticsearch/indices/state/RareClusterStateIT.java +++ b/server/src/test/java/org/elasticsearch/indices/state/RareClusterStateIT.java @@ -22,8 +22,8 @@ import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.index.IndexResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateUpdateTask; import org.elasticsearch.cluster.block.ClusterBlocks; @@ -235,9 +235,9 @@ public void testDelayedMappingPropagationOnPrimary() throws Exception { // Add a new mapping... final AtomicReference putMappingResponse = new AtomicReference<>(); - client().admin().indices().preparePutMapping("index").setType("type").setSource("field", "type=long").execute(new ActionListener() { + client().admin().indices().preparePutMapping("index").setType("type").setSource("field", "type=long").execute(new ActionListener() { @Override - public void onResponse(PutMappingResponse response) { + public void onResponse(AcknowledgedResponse response) { putMappingResponse.set(response); } @@ -286,8 +286,8 @@ public void onFailure(Exception e) { // Now make sure the indexing request finishes successfully disruption.stopDisrupting(); assertBusy(() -> { - assertThat(putMappingResponse.get(), instanceOf(PutMappingResponse.class)); - PutMappingResponse resp = (PutMappingResponse) putMappingResponse.get(); + assertThat(putMappingResponse.get(), instanceOf(AcknowledgedResponse.class)); + AcknowledgedResponse resp = (AcknowledgedResponse) putMappingResponse.get(); assertTrue(resp.isAcknowledged()); assertThat(docIndexResponse.get(), instanceOf(IndexResponse.class)); IndexResponse docResp = (IndexResponse) docIndexResponse.get(); @@ -349,9 +349,9 @@ public void testDelayedMappingPropagationOnReplica() throws Exception { internalCluster().setDisruptionScheme(disruption); disruption.startDisrupting(); final AtomicReference putMappingResponse = new AtomicReference<>(); - client().admin().indices().preparePutMapping("index").setType("type").setSource("field", "type=long").execute(new ActionListener() { + client().admin().indices().preparePutMapping("index").setType("type").setSource("field", "type=long").execute(new ActionListener() { @Override - public void onResponse(PutMappingResponse response) { + public void onResponse(AcknowledgedResponse response) { putMappingResponse.set(response); } @@ -397,8 +397,8 @@ public void onFailure(Exception e) { // Now make sure the indexing request finishes successfully disruption.stopDisrupting(); assertBusy(() -> { - assertThat(putMappingResponse.get(), instanceOf(PutMappingResponse.class)); - PutMappingResponse resp = (PutMappingResponse) putMappingResponse.get(); + assertThat(putMappingResponse.get(), instanceOf(AcknowledgedResponse.class)); + AcknowledgedResponse resp = (AcknowledgedResponse) putMappingResponse.get(); assertTrue(resp.isAcknowledged()); assertThat(docIndexResponse.get(), instanceOf(IndexResponse.class)); IndexResponse docResp = (IndexResponse) docIndexResponse.get(); diff --git a/server/src/test/java/org/elasticsearch/indices/state/SimpleIndexStateIT.java b/server/src/test/java/org/elasticsearch/indices/state/SimpleIndexStateIT.java index 5ec6d82117af4..2b3f507270838 100644 --- a/server/src/test/java/org/elasticsearch/indices/state/SimpleIndexStateIT.java +++ b/server/src/test/java/org/elasticsearch/indices/state/SimpleIndexStateIT.java @@ -22,10 +22,10 @@ import org.apache.logging.log4j.Logger; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; -import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; import org.elasticsearch.action.support.ActiveShardCount; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.routing.ShardRoutingState; @@ -61,7 +61,7 @@ public void testSimpleOpenClose() { client().prepareIndex("test", "type1", "1").setSource("field1", "value1").get(); logger.info("--> closing test index..."); - CloseIndexResponse closeIndexResponse = client().admin().indices().prepareClose("test").get(); + AcknowledgedResponse closeIndexResponse = client().admin().indices().prepareClose("test").get(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); stateResponse = client().admin().cluster().prepareState().get(); diff --git a/server/src/test/java/org/elasticsearch/repositories/blobstore/BlobStoreRepositoryTests.java b/server/src/test/java/org/elasticsearch/repositories/blobstore/BlobStoreRepositoryTests.java index 0137f136d3ecf..871e5071ec7b7 100644 --- a/server/src/test/java/org/elasticsearch/repositories/blobstore/BlobStoreRepositoryTests.java +++ b/server/src/test/java/org/elasticsearch/repositories/blobstore/BlobStoreRepositoryTests.java @@ -19,8 +19,8 @@ package org.elasticsearch.repositories.blobstore; -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.common.UUIDs; import org.elasticsearch.common.settings.Settings; @@ -85,7 +85,7 @@ public void testRetrieveSnapshots() throws Exception { final String repositoryName = "test-repo"; logger.info("--> creating repository"); - PutRepositoryResponse putRepositoryResponse = + AcknowledgedResponse putRepositoryResponse = client.admin().cluster().preparePutRepository(repositoryName) .setType(REPO_TYPE) .setSettings(Settings.builder().put(node().settings()).put("location", location)) @@ -237,7 +237,7 @@ private BlobStoreRepository setupRepo() { final Path location = ESIntegTestCase.randomRepoPath(node().settings()); final String repositoryName = "test-repo"; - PutRepositoryResponse putRepositoryResponse = + AcknowledgedResponse putRepositoryResponse = client.admin().cluster().preparePutRepository(repositoryName) .setType(REPO_TYPE) .setSettings(Settings.builder().put(node().settings()).put("location", location)) diff --git a/server/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchIT.java b/server/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchIT.java index 0c4c6e510ebf9..58b2b86396317 100644 --- a/server/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchIT.java +++ b/server/src/test/java/org/elasticsearch/search/suggest/CompletionSuggestSearchIT.java @@ -23,13 +23,13 @@ import org.apache.lucene.search.suggest.document.ContextSuggestField; import org.apache.lucene.util.LuceneTestCase.SuppressCodecs; import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.admin.indices.segments.IndexShardSegments; import org.elasticsearch.action.admin.indices.segments.ShardSegments; import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.FieldMemoryStats; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; @@ -562,7 +562,7 @@ public void testThatUpgradeToMultiFieldsWorks() throws Exception { .setSource(jsonBuilder().startObject().field(FIELD, "Foo Fighters").endObject()).get(); ensureGreen(INDEX); - PutMappingResponse putMappingResponse = client().admin().indices().preparePutMapping(INDEX).setType(TYPE).setSource(jsonBuilder().startObject() + AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping(INDEX).setType(TYPE).setSource(jsonBuilder().startObject() .startObject(TYPE).startObject("properties") .startObject(FIELD) .field("type", "text") @@ -742,7 +742,7 @@ public void testThatStatsAreWorking() throws Exception { .setSettings(Settings.builder().put("index.number_of_replicas", 0).put("index.number_of_shards", 2)) .execute().actionGet(); ensureGreen(); - PutMappingResponse putMappingResponse = client().admin().indices().preparePutMapping(INDEX).setType(TYPE).setSource(jsonBuilder().startObject() + AcknowledgedResponse putMappingResponse = client().admin().indices().preparePutMapping(INDEX).setType(TYPE).setSource(jsonBuilder().startObject() .startObject(TYPE).startObject("properties") .startObject(FIELD) .field("type", "completion").field("analyzer", "simple") diff --git a/server/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java b/server/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java index a008846e2d325..7f008d8721a9e 100644 --- a/server/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java +++ b/server/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java @@ -23,9 +23,7 @@ import com.carrotsearch.hppc.IntSet; import org.elasticsearch.Version; import org.elasticsearch.action.ActionFuture; -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; -import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotStats; @@ -33,6 +31,7 @@ import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.support.ActiveShardCount; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.AdminClient; import org.elasticsearch.client.Client; import org.elasticsearch.client.node.NodeClient; @@ -180,7 +179,7 @@ public void testRestorePersistentSettings() throws Exception { .getMetaData().persistentSettings().getAsInt(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(), -1), equalTo(2)); logger.info("--> create repository"); - PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") + AcknowledgedResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath())).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); @@ -235,7 +234,7 @@ public void testRestoreCustomMetadata() throws Exception { }); logger.info("--> create repository"); - PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") + AcknowledgedResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("fs").setSettings(Settings.builder().put("location", tempDir)).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); @@ -351,7 +350,7 @@ public void testSnapshotDuringNodeShutdown() throws Exception { logger.info("--> create repository"); logger.info("--> creating repository"); - PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") + AcknowledgedResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("mock").setSettings( Settings.builder() .put("location", randomRepoPath()) @@ -399,7 +398,7 @@ public void testSnapshotWithStuckNode() throws Exception { logger.info("--> creating repository"); Path repo = randomRepoPath(); - PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") + AcknowledgedResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("mock").setSettings( Settings.builder() .put("location", repo) @@ -422,14 +421,14 @@ public void testSnapshotWithStuckNode() throws Exception { logger.info("--> execution was blocked on node [{}], aborting snapshot", blockedNode); - ActionFuture deleteSnapshotResponseFuture = internalCluster().client(nodes.get(0)).admin().cluster().prepareDeleteSnapshot("test-repo", "test-snap").execute(); + ActionFuture deleteSnapshotResponseFuture = internalCluster().client(nodes.get(0)).admin().cluster().prepareDeleteSnapshot("test-repo", "test-snap").execute(); // Make sure that abort makes some progress Thread.sleep(100); unblockNode("test-repo", blockedNode); logger.info("--> stopping node [{}]", blockedNode); stopNode(blockedNode); try { - DeleteSnapshotResponse deleteSnapshotResponse = deleteSnapshotResponseFuture.actionGet(); + AcknowledgedResponse deleteSnapshotResponse = deleteSnapshotResponseFuture.actionGet(); assertThat(deleteSnapshotResponse.isAcknowledged(), equalTo(true)); } catch (SnapshotMissingException ex) { // When master node is closed during this test, it sometime manages to delete the snapshot files before @@ -496,7 +495,7 @@ public void testRestoreIndexWithMissingShards() throws Exception { assertTrue(client().admin().indices().prepareExists("test-idx-none").get().isExists()); logger.info("--> creating repository"); - PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo") + AcknowledgedResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo") .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath())).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); @@ -603,7 +602,7 @@ public void testRestoreIndexWithShardsMissingInLocalGateway() throws Exception { cluster().wipeIndices("_all"); logger.info("--> create repository"); - PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo") + AcknowledgedResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo") .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath())).execute().actionGet(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); int numberOfShards = 6; diff --git a/server/src/test/java/org/elasticsearch/snapshots/MinThreadsSnapshotRestoreIT.java b/server/src/test/java/org/elasticsearch/snapshots/MinThreadsSnapshotRestoreIT.java index 6279ed2890343..885baa883ed63 100644 --- a/server/src/test/java/org/elasticsearch/snapshots/MinThreadsSnapshotRestoreIT.java +++ b/server/src/test/java/org/elasticsearch/snapshots/MinThreadsSnapshotRestoreIT.java @@ -20,7 +20,7 @@ package org.elasticsearch.snapshots; import org.elasticsearch.action.ActionFuture; -import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.plugins.Plugin; @@ -83,7 +83,7 @@ public void testConcurrentSnapshotDeletionsNotAllowed() throws Exception { String blockedNode = internalCluster().getMasterName(); ((MockRepository)internalCluster().getInstance(RepositoriesService.class, blockedNode).repository(repo)).blockOnDataFiles(true); logger.info("--> start deletion of first snapshot"); - ActionFuture future = + ActionFuture future = client().admin().cluster().prepareDeleteSnapshot(repo, snapshot2).execute(); logger.info("--> waiting for block to kick in on node [{}]", blockedNode); waitForBlock(blockedNode, repo, TimeValue.timeValueSeconds(10)); @@ -129,7 +129,7 @@ public void testSnapshottingWithInProgressDeletionNotAllowed() throws Exception String blockedNode = internalCluster().getMasterName(); ((MockRepository)internalCluster().getInstance(RepositoriesService.class, blockedNode).repository(repo)).blockOnDataFiles(true); logger.info("--> start deletion of snapshot"); - ActionFuture future = client().admin().cluster().prepareDeleteSnapshot(repo, snapshot1).execute(); + ActionFuture future = client().admin().cluster().prepareDeleteSnapshot(repo, snapshot1).execute(); logger.info("--> waiting for block to kick in on node [{}]", blockedNode); waitForBlock(blockedNode, repo, TimeValue.timeValueSeconds(10)); @@ -184,7 +184,7 @@ public void testRestoreWithInProgressDeletionsNotAllowed() throws Exception { String blockedNode = internalCluster().getMasterName(); ((MockRepository)internalCluster().getInstance(RepositoriesService.class, blockedNode).repository(repo)).blockOnDataFiles(true); logger.info("--> start deletion of snapshot"); - ActionFuture future = client().admin().cluster().prepareDeleteSnapshot(repo, snapshot2).execute(); + ActionFuture future = client().admin().cluster().prepareDeleteSnapshot(repo, snapshot2).execute(); logger.info("--> waiting for block to kick in on node [{}]", blockedNode); waitForBlock(blockedNode, repo, TimeValue.timeValueSeconds(10)); diff --git a/server/src/test/java/org/elasticsearch/snapshots/RepositoriesIT.java b/server/src/test/java/org/elasticsearch/snapshots/RepositoriesIT.java index d39d33b9d3e5e..903948c158dbe 100644 --- a/server/src/test/java/org/elasticsearch/snapshots/RepositoriesIT.java +++ b/server/src/test/java/org/elasticsearch/snapshots/RepositoriesIT.java @@ -18,11 +18,10 @@ */ package org.elasticsearch.snapshots; -import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse; -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryResponse; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.metadata.RepositoriesMetaData; @@ -51,7 +50,7 @@ public void testRepositoryCreation() throws Exception { Path location = randomRepoPath(); logger.info("--> creating repository"); - PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo-1") + AcknowledgedResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo-1") .setType("fs").setSettings(Settings.builder() .put("location", location) ).get(); @@ -145,7 +144,7 @@ public void testMisconfiguredRepository() throws Exception { public void testRepositoryAckTimeout() throws Exception { logger.info("--> creating repository test-repo-1 with 0s timeout - shouldn't ack"); - PutRepositoryResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo-1") + AcknowledgedResponse putRepositoryResponse = client().admin().cluster().preparePutRepository("test-repo-1") .setType("fs").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("compress", randomBoolean()) @@ -164,7 +163,7 @@ public void testRepositoryAckTimeout() throws Exception { assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); logger.info("--> deleting repository test-repo-2 with 0s timeout - shouldn't ack"); - DeleteRepositoryResponse deleteRepositoryResponse = client().admin().cluster().prepareDeleteRepository("test-repo-2") + AcknowledgedResponse deleteRepositoryResponse = client().admin().cluster().prepareDeleteRepository("test-repo-2") .setTimeout("0s").get(); assertThat(deleteRepositoryResponse.isAcknowledged(), equalTo(false)); diff --git a/server/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java b/server/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java index d2954a4c128ba..1230d594b98a2 100644 --- a/server/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java +++ b/server/src/test/java/org/elasticsearch/snapshots/SharedClusterSnapshotRestoreIT.java @@ -23,9 +23,7 @@ import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.Version; import org.elasticsearch.action.ActionFuture; -import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; -import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotIndexShardStage; @@ -45,6 +43,7 @@ import org.elasticsearch.action.ingest.GetPipelineResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.support.ActiveShardCount; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateListener; @@ -432,7 +431,7 @@ public void testEmptySnapshot() throws Exception { Client client = client(); logger.info("--> creating repository"); - PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") + AcknowledgedResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("fs").setSettings(Settings.builder().put("location", randomRepoPath())).get(); assertThat(putRepositoryResponse.isAcknowledged(), equalTo(true)); @@ -1692,7 +1691,7 @@ public void testDeleteRepositoryWhileSnapshotting() throws Exception { Client client = client(); Path repositoryLocation = randomRepoPath(); logger.info("--> creating repository"); - PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") + AcknowledgedResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("mock").setSettings( Settings.builder() .put("location", repositoryLocation) @@ -1889,7 +1888,7 @@ public void testSnapshotStatus() throws Exception { Client client = client(); Path repositoryLocation = randomRepoPath(); logger.info("--> creating repository"); - PutRepositoryResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") + AcknowledgedResponse putRepositoryResponse = client.admin().cluster().preparePutRepository("test-repo") .setType("mock").setSettings( Settings.builder() .put("location", repositoryLocation) @@ -3062,7 +3061,7 @@ public void testSnapshotCanceledOnRemovedShard() throws Exception { refresh(); logger.info("--> creating repository"); - PutRepositoryResponse putRepositoryResponse = + AcknowledgedResponse putRepositoryResponse = client().admin().cluster().preparePutRepository(repo).setType("mock").setSettings(Settings.builder() .put("location", randomRepoPath()) .put("random", randomAlphaOfLength(10)) @@ -3423,7 +3422,7 @@ public void testAbortedSnapshotDuringInitDoesNotStart() throws Exception { internalCluster().getInstances(ClusterService.class).forEach(clusterService -> clusterService.addListener(listener)); // Delete the snapshot while it is being initialized - ActionFuture delete = client.admin().cluster().prepareDeleteSnapshot("repository", "snap").execute(); + ActionFuture delete = client.admin().cluster().prepareDeleteSnapshot("repository", "snap").execute(); // The deletion must set the snapshot in the ABORTED state assertBusy(() -> { diff --git a/test/framework/src/main/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java b/test/framework/src/main/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java index 48fc798207493..418f4ea7b3645 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java +++ b/test/framework/src/main/java/org/elasticsearch/test/hamcrest/ElasticsearchAssertions.java @@ -30,7 +30,6 @@ import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder; -import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.get.GetResponse; @@ -112,10 +111,6 @@ public static void assertAcked(DeleteIndexRequestBuilder builder) { assertAcked(builder.get()); } - public static void assertAcked(DeleteIndexResponse response) { - assertThat("Delete Index failed - not acked", response.isAcknowledged(), equalTo(true)); - } - /** * Assert that an index creation was fully acknowledged, meaning that both the index creation cluster * state update was successful and that the requisite number of shard copies were started before returning. diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/DeleteLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/DeleteLicenseAction.java index e8d5b3f3f5709..c0dbb02aed719 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/DeleteLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/DeleteLicenseAction.java @@ -6,9 +6,9 @@ package org.elasticsearch.license; import org.elasticsearch.action.Action; -import org.elasticsearch.protocol.xpack.license.DeleteLicenseResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; -public class DeleteLicenseAction extends Action { +public class DeleteLicenseAction extends Action { public static final DeleteLicenseAction INSTANCE = new DeleteLicenseAction(); public static final String NAME = "cluster:admin/xpack/license/delete"; @@ -18,7 +18,7 @@ private DeleteLicenseAction() { } @Override - public DeleteLicenseResponse newResponse() { - return new DeleteLicenseResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/DeleteLicenseRequestBuilder.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/DeleteLicenseRequestBuilder.java index ad58cd3e1a5b9..1aaa246dbe68f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/DeleteLicenseRequestBuilder.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/DeleteLicenseRequestBuilder.java @@ -6,11 +6,11 @@ package org.elasticsearch.license; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.protocol.xpack.license.DeleteLicenseRequest; -import org.elasticsearch.protocol.xpack.license.DeleteLicenseResponse; -public class DeleteLicenseRequestBuilder extends AcknowledgedRequestBuilder { public DeleteLicenseRequestBuilder(ElasticsearchClient client) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/LicensingClient.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/LicensingClient.java index dfccd1d419054..80d1fb68f0e2a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/LicensingClient.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/LicensingClient.java @@ -6,9 +6,9 @@ package org.elasticsearch.license; import org.elasticsearch.action.ActionListener; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.protocol.xpack.license.DeleteLicenseRequest; -import org.elasticsearch.protocol.xpack.license.DeleteLicenseResponse; import org.elasticsearch.protocol.xpack.license.GetLicenseRequest; import org.elasticsearch.protocol.xpack.license.PutLicenseResponse; @@ -40,7 +40,7 @@ public DeleteLicenseRequestBuilder prepareDeleteLicense() { return new DeleteLicenseRequestBuilder(client); } - public void deleteLicense(DeleteLicenseRequest request, ActionListener listener) { + public void deleteLicense(DeleteLicenseRequest request, ActionListener listener) { client.execute(DeleteLicenseAction.INSTANCE, request, listener); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/TransportDeleteLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/TransportDeleteLicenseAction.java index 4a6b5e0116f6f..d1230808bd84c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/TransportDeleteLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/TransportDeleteLicenseAction.java @@ -8,21 +8,21 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; -import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ack.ClusterStateUpdateResponse; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; +import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.protocol.xpack.license.DeleteLicenseRequest; -import org.elasticsearch.protocol.xpack.license.DeleteLicenseResponse; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -public class TransportDeleteLicenseAction extends TransportMasterNodeAction { +public class TransportDeleteLicenseAction extends TransportMasterNodeAction { private final LicenseService licenseService; @@ -41,8 +41,8 @@ protected String executor() { } @Override - protected DeleteLicenseResponse newResponse() { - return new DeleteLicenseResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override @@ -51,12 +51,12 @@ protected ClusterBlockException checkBlock(DeleteLicenseRequest request, Cluster } @Override - protected void masterOperation(final DeleteLicenseRequest request, ClusterState state, final ActionListener + protected void masterOperation(final DeleteLicenseRequest request, ClusterState state, final ActionListener listener) throws ElasticsearchException { licenseService.removeLicense(request, new ActionListener() { @Override public void onResponse(ClusterStateUpdateResponse clusterStateUpdateResponse) { - listener.onResponse(new DeleteLicenseResponse(clusterStateUpdateResponse.isAcknowledged())); + listener.onResponse(new AcknowledgedResponse(clusterStateUpdateResponse.isAcknowledged())); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarAction.java index a6e5f8da88cd7..da0756157b0ba 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarAction.java @@ -19,7 +19,7 @@ import java.io.IOException; import java.util.Objects; -public class DeleteCalendarAction extends Action { +public class DeleteCalendarAction extends Action { public static final DeleteCalendarAction INSTANCE = new DeleteCalendarAction(); public static final String NAME = "cluster:admin/xpack/ml/calendars/delete"; @@ -29,8 +29,8 @@ private DeleteCalendarAction() { } @Override - public Response newResponse() { - return new Response(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } public static class Request extends AcknowledgedRequest { @@ -82,19 +82,10 @@ public boolean equals(Object obj) { } } - public static class RequestBuilder extends ActionRequestBuilder { + public static class RequestBuilder extends ActionRequestBuilder { public RequestBuilder(ElasticsearchClient client, DeleteCalendarAction action) { super(client, action, new Request()); } } - - public static class Response extends AcknowledgedResponse { - - public Response(boolean acknowledged) { - super(acknowledged); - } - - public Response() {} - } } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarEventAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarEventAction.java index 24fc55f59ccb7..3e64a54293924 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarEventAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarEventAction.java @@ -20,7 +20,7 @@ import java.io.IOException; import java.util.Objects; -public class DeleteCalendarEventAction extends Action { +public class DeleteCalendarEventAction extends Action { public static final DeleteCalendarEventAction INSTANCE = new DeleteCalendarEventAction(); public static final String NAME = "cluster:admin/xpack/ml/calendars/events/delete"; @@ -30,8 +30,8 @@ private DeleteCalendarEventAction() { } @Override - public Response newResponse() { - return new Response(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } public static class Request extends AcknowledgedRequest { @@ -89,19 +89,10 @@ public boolean equals(Object obj) { } } - public static class RequestBuilder extends ActionRequestBuilder { + public static class RequestBuilder extends ActionRequestBuilder { public RequestBuilder(ElasticsearchClient client, DeleteCalendarEventAction action) { super(client, action, new Request()); } } - - public static class Response extends AcknowledgedResponse { - - public Response(boolean acknowledged) { - super(acknowledged); - } - - private Response() {} - } } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteDatafeedAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteDatafeedAction.java index fba0fe4cf1f6c..fb3ac55cda027 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteDatafeedAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteDatafeedAction.java @@ -23,7 +23,7 @@ import java.io.IOException; import java.util.Objects; -public class DeleteDatafeedAction extends Action { +public class DeleteDatafeedAction extends Action { public static final DeleteDatafeedAction INSTANCE = new DeleteDatafeedAction(); public static final String NAME = "cluster:admin/xpack/ml/datafeeds/delete"; @@ -33,8 +33,8 @@ private DeleteDatafeedAction() { } @Override - public Response newResponse() { - return new Response(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } public static class Request extends AcknowledgedRequest implements ToXContentFragment { @@ -106,21 +106,10 @@ public int hashCode() { } } - public static class RequestBuilder extends MasterNodeOperationRequestBuilder { + public static class RequestBuilder extends MasterNodeOperationRequestBuilder { public RequestBuilder(ElasticsearchClient client, DeleteDatafeedAction action) { super(client, action, new Request()); } } - - public static class Response extends AcknowledgedResponse { - - public Response() { - } - - public Response(boolean acknowledged) { - super(acknowledged); - } - } - } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteFilterAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteFilterAction.java index b271c6fbdf02e..3870ad79555ca 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteFilterAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteFilterAction.java @@ -20,7 +20,7 @@ import java.util.Objects; -public class DeleteFilterAction extends Action { +public class DeleteFilterAction extends Action { public static final DeleteFilterAction INSTANCE = new DeleteFilterAction(); public static final String NAME = "cluster:admin/xpack/ml/filters/delete"; @@ -30,8 +30,8 @@ private DeleteFilterAction() { } @Override - public Response newResponse() { - return new Response(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } public static class Request extends AcknowledgedRequest { @@ -84,21 +84,11 @@ public boolean equals(Object obj) { } } - public static class RequestBuilder extends MasterNodeOperationRequestBuilder { + public static class RequestBuilder extends MasterNodeOperationRequestBuilder { public RequestBuilder(ElasticsearchClient client, DeleteFilterAction action) { super(client, action, new Request()); } } - - public static class Response extends AcknowledgedResponse { - - public Response(boolean acknowledged) { - super(acknowledged); - } - - public Response() {} - } - } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteJobAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteJobAction.java index 71e5f8fad71d7..933e98b80ff80 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteJobAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteJobAction.java @@ -24,7 +24,7 @@ import java.util.Map; import java.util.Objects; -public class DeleteJobAction extends Action { +public class DeleteJobAction extends Action { public static final DeleteJobAction INSTANCE = new DeleteJobAction(); public static final String NAME = "cluster:admin/xpack/ml/job/delete"; @@ -34,8 +34,8 @@ private DeleteJobAction() { } @Override - public Response newResponse() { - return new Response(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } public static class Request extends AcknowledgedRequest { @@ -111,20 +111,10 @@ public boolean equals(Object obj) { } } - static class RequestBuilder extends MasterNodeOperationRequestBuilder { + static class RequestBuilder extends MasterNodeOperationRequestBuilder { RequestBuilder(ElasticsearchClient client, DeleteJobAction action) { super(client, action, new Request()); } } - - public static class Response extends AcknowledgedResponse { - - public Response(boolean acknowledged) { - super(acknowledged); - } - - public Response() {} - } - -} \ No newline at end of file +} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteModelSnapshotAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteModelSnapshotAction.java index a80fbc7863825..4bc079b387c0a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteModelSnapshotAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteModelSnapshotAction.java @@ -19,7 +19,7 @@ import java.io.IOException; -public class DeleteModelSnapshotAction extends Action { +public class DeleteModelSnapshotAction extends Action { public static final DeleteModelSnapshotAction INSTANCE = new DeleteModelSnapshotAction(); public static final String NAME = "cluster:admin/xpack/ml/job/model_snapshots/delete"; @@ -29,8 +29,8 @@ private DeleteModelSnapshotAction() { } @Override - public DeleteModelSnapshotAction.Response newResponse() { - return new Response(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } public static class Request extends ActionRequest { @@ -74,16 +74,7 @@ public void writeTo(StreamOutput out) throws IOException { } } - public static class Response extends AcknowledgedResponse { - - public Response(boolean acknowledged) { - super(acknowledged); - } - - public Response() {} - } - - public static class RequestBuilder extends ActionRequestBuilder { + public static class RequestBuilder extends ActionRequestBuilder { public RequestBuilder(ElasticsearchClient client, DeleteModelSnapshotAction action) { super(client, action, new Request()); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/FinalizeJobExecutionAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/FinalizeJobExecutionAction.java index 558d25f62de32..9121ce1b75d9f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/FinalizeJobExecutionAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/FinalizeJobExecutionAction.java @@ -16,7 +16,7 @@ import java.io.IOException; -public class FinalizeJobExecutionAction extends Action { +public class FinalizeJobExecutionAction extends Action { public static final FinalizeJobExecutionAction INSTANCE = new FinalizeJobExecutionAction(); public static final String NAME = "cluster:internal/xpack/ml/job/finalize_job_execution"; @@ -26,8 +26,8 @@ private FinalizeJobExecutionAction() { } @Override - public Response newResponse() { - return new Response(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } public static class Request extends MasterNodeRequest { @@ -64,21 +64,10 @@ public ActionRequestValidationException validate() { } public static class RequestBuilder - extends MasterNodeOperationRequestBuilder { + extends MasterNodeOperationRequestBuilder { public RequestBuilder(ElasticsearchClient client, FinalizeJobExecutionAction action) { super(client, action, new Request()); } } - - public static class Response extends AcknowledgedResponse { - - public Response(boolean acknowledged) { - super(acknowledged); - } - - public Response() { - } - } - } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/OpenJobAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/OpenJobAction.java index 0c7380349bde1..c108a983aa17b 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/OpenJobAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/OpenJobAction.java @@ -31,7 +31,7 @@ import java.io.IOException; import java.util.Objects; -public class OpenJobAction extends Action { +public class OpenJobAction extends Action { public static final OpenJobAction INSTANCE = new OpenJobAction(); public static final String NAME = "cluster:admin/xpack/ml/job/open"; @@ -42,8 +42,8 @@ private OpenJobAction() { } @Override - public Response newResponse() { - return new Response(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } public static class Request extends MasterNodeRequest implements ToXContentObject { @@ -244,30 +244,6 @@ public Version getMinimalSupportedVersion() { } } - public static class Response extends AcknowledgedResponse { - public Response() { - super(); - } - - public Response(boolean acknowledged) { - super(acknowledged); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - AcknowledgedResponse that = (AcknowledgedResponse) o; - return isAcknowledged() == that.isAcknowledged(); - } - - @Override - public int hashCode() { - return Objects.hash(isAcknowledged()); - } - - } - public interface JobTaskMatcher { static boolean match(Task task, String expectedJobId) { @@ -276,7 +252,7 @@ static boolean match(Task task, String expectedJobId) { } } - static class RequestBuilder extends ActionRequestBuilder { + static class RequestBuilder extends ActionRequestBuilder { RequestBuilder(ElasticsearchClient client, OpenJobAction action) { super(client, action, new Request()); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/StartDatafeedAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/StartDatafeedAction.java index 5c45d33e744d6..9c4a67ec61f78 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/StartDatafeedAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/StartDatafeedAction.java @@ -34,7 +34,7 @@ import java.util.Objects; import java.util.function.LongSupplier; -public class StartDatafeedAction extends Action { +public class StartDatafeedAction extends Action { public static final ParseField START_TIME = new ParseField("start"); public static final ParseField END_TIME = new ParseField("end"); @@ -49,8 +49,8 @@ private StartDatafeedAction() { } @Override - public Response newResponse() { - return new Response(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } public static class Request extends MasterNodeRequest implements ToXContentObject { @@ -279,31 +279,7 @@ public boolean equals(Object obj) { } } - public static class Response extends AcknowledgedResponse { - public Response() { - super(); - } - - public Response(boolean acknowledged) { - super(acknowledged); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - AcknowledgedResponse that = (AcknowledgedResponse) o; - return isAcknowledged() == that.isAcknowledged(); - } - - @Override - public int hashCode() { - return Objects.hash(isAcknowledged()); - } - - } - - static class RequestBuilder extends ActionRequestBuilder { + static class RequestBuilder extends ActionRequestBuilder { RequestBuilder(ElasticsearchClient client, StartDatafeedAction action) { super(client, action, new Request()); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ValidateDetectorAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ValidateDetectorAction.java index 15dd8721f069b..e0d6b8acd849c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ValidateDetectorAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ValidateDetectorAction.java @@ -21,7 +21,7 @@ import java.io.IOException; import java.util.Objects; -public class ValidateDetectorAction extends Action { +public class ValidateDetectorAction extends Action { public static final ValidateDetectorAction INSTANCE = new ValidateDetectorAction(); public static final String NAME = "cluster:admin/xpack/ml/job/validate/detector"; @@ -31,11 +31,11 @@ protected ValidateDetectorAction() { } @Override - public Response newResponse() { - return new Response(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } - public static class RequestBuilder extends ActionRequestBuilder { + public static class RequestBuilder extends ActionRequestBuilder { protected RequestBuilder(ElasticsearchClient client, ValidateDetectorAction action) { super(client, action, new Request()); @@ -105,16 +105,4 @@ public boolean equals(Object obj) { } } - - public static class Response extends AcknowledgedResponse { - - public Response() { - super(); - } - - public Response(boolean acknowledged) { - super(acknowledged); - } - } - } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ValidateJobConfigAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ValidateJobConfigAction.java index 4e77882c1fca1..8854aa38c8fa2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ValidateJobConfigAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ValidateJobConfigAction.java @@ -22,7 +22,7 @@ import java.util.List; import java.util.Objects; -public class ValidateJobConfigAction extends Action { +public class ValidateJobConfigAction extends Action { public static final ValidateJobConfigAction INSTANCE = new ValidateJobConfigAction(); public static final String NAME = "cluster:admin/xpack/ml/job/validate"; @@ -32,11 +32,11 @@ protected ValidateJobConfigAction() { } @Override - public Response newResponse() { - return new Response(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } - public static class RequestBuilder extends ActionRequestBuilder { + public static class RequestBuilder extends ActionRequestBuilder { protected RequestBuilder(ElasticsearchClient client, ValidateJobConfigAction action) { super(client, action, new Request()); @@ -111,16 +111,4 @@ public boolean equals(Object obj) { } } - - public static class Response extends AcknowledgedResponse { - - public Response() { - super(); - } - - public Response(boolean acknowledged) { - super(acknowledged); - } - } - } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/client/MachineLearningClient.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/client/MachineLearningClient.java index 3308d6891e2c4..af2f3ad08fd1a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/client/MachineLearningClient.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/client/MachineLearningClient.java @@ -8,6 +8,7 @@ import org.elasticsearch.action.ActionFuture; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.PlainActionFuture; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.xpack.core.ml.action.CloseJobAction; import org.elasticsearch.xpack.core.ml.action.DeleteDatafeedAction; @@ -59,48 +60,48 @@ public ActionFuture closeJob(CloseJobAction.Request req } public void deleteDatafeed(DeleteDatafeedAction.Request request, - ActionListener listener) { + ActionListener listener) { client.execute(DeleteDatafeedAction.INSTANCE, request, listener); } - public ActionFuture deleteDatafeed( + public ActionFuture deleteDatafeed( DeleteDatafeedAction.Request request) { - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); client.execute(DeleteDatafeedAction.INSTANCE, request, listener); return listener; } public void deleteFilter(DeleteFilterAction.Request request, - ActionListener listener) { + ActionListener listener) { client.execute(DeleteFilterAction.INSTANCE, request, listener); } - public ActionFuture deleteFilter( + public ActionFuture deleteFilter( DeleteFilterAction.Request request) { - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); client.execute(DeleteFilterAction.INSTANCE, request, listener); return listener; } public void deleteJob(DeleteJobAction.Request request, - ActionListener listener) { + ActionListener listener) { client.execute(DeleteJobAction.INSTANCE, request, listener); } - public ActionFuture deleteJob(DeleteJobAction.Request request) { - PlainActionFuture listener = PlainActionFuture.newFuture(); + public ActionFuture deleteJob(DeleteJobAction.Request request) { + PlainActionFuture listener = PlainActionFuture.newFuture(); client.execute(DeleteJobAction.INSTANCE, request, listener); return listener; } public void deleteModelSnapshot(DeleteModelSnapshotAction.Request request, - ActionListener listener) { + ActionListener listener) { client.execute(DeleteModelSnapshotAction.INSTANCE, request, listener); } - public ActionFuture deleteModelSnapshot( + public ActionFuture deleteModelSnapshot( DeleteModelSnapshotAction.Request request) { - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); client.execute(DeleteModelSnapshotAction.INSTANCE, request, listener); return listener; } @@ -233,12 +234,12 @@ public ActionFuture getRecords(GetRecordsAction.Reque } public void openJob(OpenJobAction.Request request, - ActionListener listener) { + ActionListener listener) { client.execute(OpenJobAction.INSTANCE, request, listener); } - public ActionFuture openJob(OpenJobAction.Request request) { - PlainActionFuture listener = PlainActionFuture.newFuture(); + public ActionFuture openJob(OpenJobAction.Request request) { + PlainActionFuture listener = PlainActionFuture.newFuture(); client.execute(OpenJobAction.INSTANCE, request, listener); return listener; } @@ -300,13 +301,13 @@ public ActionFuture revertModelSnapshot( } public void startDatafeed(StartDatafeedAction.Request request, - ActionListener listener) { + ActionListener listener) { client.execute(StartDatafeedAction.INSTANCE, request, listener); } - public ActionFuture startDatafeed( + public ActionFuture startDatafeed( StartDatafeedAction.Request request) { - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); client.execute(StartDatafeedAction.INSTANCE, request, listener); return listener; } @@ -359,25 +360,25 @@ public ActionFuture updateModelSnapshot( } public void validateDetector(ValidateDetectorAction.Request request, - ActionListener listener) { + ActionListener listener) { client.execute(ValidateDetectorAction.INSTANCE, request, listener); } - public ActionFuture validateDetector( + public ActionFuture validateDetector( ValidateDetectorAction.Request request) { - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); client.execute(ValidateDetectorAction.INSTANCE, request, listener); return listener; } public void validateJobConfig(ValidateJobConfigAction.Request request, - ActionListener listener) { + ActionListener listener) { client.execute(ValidateJobConfigAction.INSTANCE, request, listener); } - public ActionFuture validateJobConfig( + public ActionFuture validateJobConfig( ValidateJobConfigAction.Request request) { - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); client.execute(ValidateJobConfigAction.INSTANCE, request, listener); return listener; } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/persistence/JobStorageDeletionTask.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/persistence/JobStorageDeletionTask.java index 54faafb8ee584..19cb42a220ed2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/persistence/JobStorageDeletionTask.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/persistence/JobStorageDeletionTask.java @@ -9,13 +9,13 @@ import org.apache.logging.log4j.Logger; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; -import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest; import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; import org.elasticsearch.action.bulk.BulkItemResponse; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.support.IndicesOptions; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.AliasMetaData; @@ -213,7 +213,7 @@ private void deleteAliases(String jobId, Client client, ActionListener return; } executeAsyncWithOrigin(client.threadPool().getThreadContext(), ML_ORIGIN, removeRequest, - ActionListener.wrap(removeResponse -> finishedHandler.onResponse(true), + ActionListener.wrap(removeResponse -> finishedHandler.onResponse(true), finishedHandler::onFailure), client.admin().indices()::aliases); }, diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/DeleteRollupJobAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/DeleteRollupJobAction.java index e59c6738d86b1..df2c70c76539e 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/DeleteRollupJobAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/DeleteRollupJobAction.java @@ -22,7 +22,7 @@ import java.io.IOException; import java.util.Objects; -public class DeleteRollupJobAction extends Action { +public class DeleteRollupJobAction extends Action { public static final DeleteRollupJobAction INSTANCE = new DeleteRollupJobAction(); public static final String NAME = "cluster:admin/xpack/rollup/delete"; @@ -32,8 +32,8 @@ private DeleteRollupJobAction() { } @Override - public Response newResponse() { - return new Response(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } public static class Request extends AcknowledgedRequest implements ToXContent { @@ -90,21 +90,10 @@ public boolean equals(Object obj) { } } - public static class RequestBuilder extends MasterNodeOperationRequestBuilder { + public static class RequestBuilder extends MasterNodeOperationRequestBuilder { protected RequestBuilder(ElasticsearchClient client, DeleteRollupJobAction action) { super(client, action, new Request()); } } - - public static class Response extends AcknowledgedResponse { - - public Response() { - super(); - } - - public Response(boolean acknowledged) { - super(acknowledged); - } - } } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/PutRollupJobAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/PutRollupJobAction.java index 962f4cceb6af5..6c56e7f6f1f4b 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/PutRollupJobAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/PutRollupJobAction.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Objects; -public class PutRollupJobAction extends Action { +public class PutRollupJobAction extends Action { public static final PutRollupJobAction INSTANCE = new PutRollupJobAction(); public static final String NAME = "cluster:admin/xpack/rollup/put"; @@ -35,8 +35,8 @@ private PutRollupJobAction() { } @Override - public Response newResponse() { - return new Response(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } public static class Request extends AcknowledgedRequest implements IndicesRequest, ToXContentObject { @@ -127,21 +127,10 @@ public boolean equals(Object obj) { } } - public static class RequestBuilder extends MasterNodeOperationRequestBuilder { + public static class RequestBuilder extends MasterNodeOperationRequestBuilder { protected RequestBuilder(ElasticsearchClient client, PutRollupJobAction action) { super(client, action, new Request()); } } - - public static class Response extends AcknowledgedResponse { - - public Response() { - super(); - } - - public Response(boolean acknowledged) { - super(acknowledged); - } - } } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/client/WatcherClient.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/client/WatcherClient.java index b9458c23ddc74..39dea2298aa1b 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/client/WatcherClient.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/client/WatcherClient.java @@ -7,7 +7,10 @@ import org.elasticsearch.action.ActionFuture; import org.elasticsearch.action.ActionListener; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; +import org.elasticsearch.protocol.xpack.watcher.DeleteWatchRequest; +import org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse; import org.elasticsearch.protocol.xpack.watcher.PutWatchRequest; import org.elasticsearch.protocol.xpack.watcher.PutWatchResponse; import org.elasticsearch.xpack.core.watcher.transport.actions.ack.AckWatchAction; @@ -19,9 +22,7 @@ import org.elasticsearch.xpack.core.watcher.transport.actions.activate.ActivateWatchRequestBuilder; import org.elasticsearch.xpack.core.watcher.transport.actions.activate.ActivateWatchResponse; import org.elasticsearch.xpack.core.watcher.transport.actions.delete.DeleteWatchAction; -import org.elasticsearch.protocol.xpack.watcher.DeleteWatchRequest; import org.elasticsearch.xpack.core.watcher.transport.actions.delete.DeleteWatchRequestBuilder; -import org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse; import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchAction; import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchRequest; import org.elasticsearch.xpack.core.watcher.transport.actions.execute.ExecuteWatchRequestBuilder; @@ -35,7 +36,6 @@ import org.elasticsearch.xpack.core.watcher.transport.actions.service.WatcherServiceAction; import org.elasticsearch.xpack.core.watcher.transport.actions.service.WatcherServiceRequest; import org.elasticsearch.xpack.core.watcher.transport.actions.service.WatcherServiceRequestBuilder; -import org.elasticsearch.xpack.core.watcher.transport.actions.service.WatcherServiceResponse; import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsAction; import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsRequest; import org.elasticsearch.xpack.core.watcher.transport.actions.stats.WatcherStatsRequestBuilder; @@ -268,14 +268,14 @@ public WatcherServiceRequestBuilder prepareWatchService() { /** * Perform an watcher service request to either start, stop or restart the service. */ - public void watcherService(WatcherServiceRequest request, ActionListener listener) { + public void watcherService(WatcherServiceRequest request, ActionListener listener) { client.execute(WatcherServiceAction.INSTANCE, request, listener); } /** * Perform an watcher service request to either start, stop or restart the service. */ - public ActionFuture watcherService(WatcherServiceRequest request) { + public ActionFuture watcherService(WatcherServiceRequest request) { return client.execute(WatcherServiceAction.INSTANCE, request); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/service/WatcherServiceAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/service/WatcherServiceAction.java index 0846bd10a80ff..30b0b54725b5f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/service/WatcherServiceAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/service/WatcherServiceAction.java @@ -6,9 +6,10 @@ package org.elasticsearch.xpack.core.watcher.transport.actions.service; import org.elasticsearch.action.Action; +import org.elasticsearch.action.support.master.AcknowledgedResponse; -public class WatcherServiceAction extends Action { +public class WatcherServiceAction extends Action { public static final WatcherServiceAction INSTANCE = new WatcherServiceAction(); public static final String NAME = "cluster:admin/xpack/watcher/service"; @@ -18,7 +19,7 @@ private WatcherServiceAction() { } @Override - public WatcherServiceResponse newResponse() { - return new WatcherServiceResponse(); + public AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/service/WatcherServiceRequestBuilder.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/service/WatcherServiceRequestBuilder.java index b43d02aac83f8..1ee4258a5a46a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/service/WatcherServiceRequestBuilder.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/service/WatcherServiceRequestBuilder.java @@ -5,10 +5,11 @@ */ package org.elasticsearch.xpack.core.watcher.transport.actions.service; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.client.ElasticsearchClient; -public class WatcherServiceRequestBuilder extends MasterNodeOperationRequestBuilder { public WatcherServiceRequestBuilder(ElasticsearchClient client) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/service/WatcherServiceResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/service/WatcherServiceResponse.java deleted file mode 100644 index 7df144e45d37e..0000000000000 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/watcher/transport/actions/service/WatcherServiceResponse.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -package org.elasticsearch.xpack.core.watcher.transport.actions.service; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; - -public class WatcherServiceResponse extends AcknowledgedResponse { - - public WatcherServiceResponse() { - } - - public WatcherServiceResponse(boolean acknowledged) { - super(acknowledged); - } -} diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/LicensesTransportTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/LicensesTransportTests.java index 82fde59a8ae6b..abaa7e1c5d36e 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/LicensesTransportTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/LicensesTransportTests.java @@ -6,13 +6,13 @@ package org.elasticsearch.license; import org.elasticsearch.action.ActionFuture; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.node.Node; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.protocol.xpack.license.DeleteLicenseResponse; import org.elasticsearch.protocol.xpack.license.LicensesStatus; import org.elasticsearch.protocol.xpack.license.PutLicenseResponse; import org.elasticsearch.test.ESSingleNodeTestCase; @@ -183,7 +183,7 @@ public void testRemoveLicensesSimple() throws Exception { // delete all licenses DeleteLicenseRequestBuilder deleteLicenseRequestBuilder = new DeleteLicenseRequestBuilder(client().admin().cluster(), DeleteLicenseAction.INSTANCE); - DeleteLicenseResponse deleteLicenseResponse = deleteLicenseRequestBuilder.get(); + AcknowledgedResponse deleteLicenseResponse = deleteLicenseRequestBuilder.get(); assertThat(deleteLicenseResponse.isAcknowledged(), equalTo(true)); // get licenses (expected no licenses) getLicenseResponse = new GetLicenseRequestBuilder(client().admin().cluster(), GetLicenseAction.INSTANCE).get(); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteCalendarAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteCalendarAction.java index c171acd71b59b..2facfd4678e10 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteCalendarAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteCalendarAction.java @@ -10,6 +10,7 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; @@ -31,7 +32,7 @@ import static org.elasticsearch.xpack.core.ClientHelper.ML_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; -public class TransportDeleteCalendarAction extends HandledTransportAction { +public class TransportDeleteCalendarAction extends HandledTransportAction { private final Client client; private final JobManager jobManager; @@ -49,7 +50,7 @@ public TransportDeleteCalendarAction(Settings settings, TransportService transpo } @Override - protected void doExecute(Task task, DeleteCalendarAction.Request request, ActionListener listener) { + protected void doExecute(Task task, DeleteCalendarAction.Request request, ActionListener listener) { final String calendarId = request.getCalendarId(); @@ -64,7 +65,7 @@ protected void doExecute(Task task, DeleteCalendarAction.Request request, Action return; } jobManager.updateProcessOnCalendarChanged(calendar.getJobIds()); - listener.onResponse(new DeleteCalendarAction.Response(true)); + listener.onResponse(new AcknowledgedResponse(true)); }, listener::onFailure)); }, diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteCalendarEventAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteCalendarEventAction.java index c52f144923e08..854ff19e16f41 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteCalendarEventAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteCalendarEventAction.java @@ -15,6 +15,7 @@ import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; import org.elasticsearch.action.support.WriteRequest; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; @@ -33,8 +34,7 @@ import static org.elasticsearch.xpack.core.ClientHelper.ML_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; -public class TransportDeleteCalendarEventAction extends HandledTransportAction { +public class TransportDeleteCalendarEventAction extends HandledTransportAction { private final Client client; private final JobResultsProvider jobResultsProvider; @@ -52,7 +52,7 @@ public TransportDeleteCalendarEventAction(Settings settings, TransportService tr @Override protected void doExecute(Task task, DeleteCalendarEventAction.Request request, - ActionListener listener) { + ActionListener listener) { final String eventId = request.getEventId(); ActionListener calendarListener = ActionListener.wrap( @@ -90,7 +90,7 @@ protected void doExecute(Task task, DeleteCalendarEventAction.Request request, jobResultsProvider.calendar(request.getCalendarId(), calendarListener); } - private void deleteEvent(String eventId, Calendar calendar, ActionListener listener) { + private void deleteEvent(String eventId, Calendar calendar, ActionListener listener) { DeleteRequest deleteRequest = new DeleteRequest(MlMetaIndex.INDEX_NAME, MlMetaIndex.TYPE, eventId); deleteRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE); @@ -103,7 +103,7 @@ public void onResponse(DeleteResponse response) { listener.onFailure(new ResourceNotFoundException("No event with id [" + eventId + "]")); } else { jobManager.updateProcessOnCalendarChanged(calendar.getJobIds()); - listener.onResponse(new DeleteCalendarEventAction.Response(true)); + listener.onResponse(new AcknowledgedResponse(true)); } } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteDatafeedAction.java index 2582cb0082e51..37210ce3c6ca2 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteDatafeedAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.ResourceNotFoundException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.AckedClusterStateUpdateTask; @@ -19,6 +20,8 @@ import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.persistent.PersistentTasksCustomMetaData; +import org.elasticsearch.persistent.PersistentTasksService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.core.XPackPlugin; @@ -26,13 +29,11 @@ import org.elasticsearch.xpack.core.ml.MlTasks; import org.elasticsearch.xpack.core.ml.action.DeleteDatafeedAction; import org.elasticsearch.xpack.core.ml.action.IsolateDatafeedAction; -import org.elasticsearch.persistent.PersistentTasksCustomMetaData; -import org.elasticsearch.persistent.PersistentTasksService; import static org.elasticsearch.xpack.core.ClientHelper.ML_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; -public class TransportDeleteDatafeedAction extends TransportMasterNodeAction { +public class TransportDeleteDatafeedAction extends TransportMasterNodeAction { private Client client; private PersistentTasksService persistentTasksService; @@ -54,13 +55,13 @@ protected String executor() { } @Override - protected DeleteDatafeedAction.Response newResponse() { - return new DeleteDatafeedAction.Response(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override protected void masterOperation(DeleteDatafeedAction.Request request, ClusterState state, - ActionListener listener) throws Exception { + ActionListener listener) throws Exception { if (request.isForce()) { forceDeleteDatafeed(request, state, listener); } else { @@ -69,7 +70,7 @@ protected void masterOperation(DeleteDatafeedAction.Request request, ClusterStat } private void forceDeleteDatafeed(DeleteDatafeedAction.Request request, ClusterState state, - ActionListener listener) { + ActionListener listener) { ActionListener finalListener = ActionListener.wrap( response -> deleteDatafeedFromMetadata(request, listener), listener::onFailure @@ -110,13 +111,13 @@ public void onFailure(Exception e) { } } - private void deleteDatafeedFromMetadata(DeleteDatafeedAction.Request request, ActionListener listener) { + private void deleteDatafeedFromMetadata(DeleteDatafeedAction.Request request, ActionListener listener) { clusterService.submitStateUpdateTask("delete-datafeed-" + request.getDatafeedId(), - new AckedClusterStateUpdateTask(request, listener) { + new AckedClusterStateUpdateTask(request, listener) { @Override - protected DeleteDatafeedAction.Response newResponse(boolean acknowledged) { - return new DeleteDatafeedAction.Response(acknowledged); + protected AcknowledgedResponse newResponse(boolean acknowledged) { + return new AcknowledgedResponse(acknowledged); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteFilterAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteFilterAction.java index c7d3d64c58cea..54acdf3712c7c 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteFilterAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteFilterAction.java @@ -14,6 +14,7 @@ import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; import org.elasticsearch.action.support.WriteRequest; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.service.ClusterService; @@ -38,7 +39,7 @@ import static org.elasticsearch.xpack.core.ClientHelper.ML_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; -public class TransportDeleteFilterAction extends HandledTransportAction { +public class TransportDeleteFilterAction extends HandledTransportAction { private final Client client; private final ClusterService clusterService; @@ -53,7 +54,7 @@ public TransportDeleteFilterAction(Settings settings, TransportService transport } @Override - protected void doExecute(Task task, DeleteFilterAction.Request request, ActionListener listener) { + protected void doExecute(Task task, DeleteFilterAction.Request request, ActionListener listener) { final String filterId = request.getFilterId(); ClusterState state = clusterService.state(); @@ -85,7 +86,7 @@ public void onResponse(BulkResponse bulkResponse) { listener.onFailure(new ResourceNotFoundException("Could not delete filter with ID [" + filterId + "] because it does not exist")); } else { - listener.onResponse(new DeleteFilterAction.Response(true)); + listener.onResponse(new AcknowledgedResponse(true)); } } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteJobAction.java index ad0d4068592dc..a74d1498f106d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteJobAction.java @@ -9,6 +9,7 @@ import org.elasticsearch.ResourceNotFoundException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; @@ -23,6 +24,8 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.node.NodeClosedException; +import org.elasticsearch.persistent.PersistentTasksCustomMetaData; +import org.elasticsearch.persistent.PersistentTasksService; import org.elasticsearch.tasks.Task; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; @@ -32,8 +35,6 @@ import org.elasticsearch.xpack.core.ml.action.DeleteJobAction; import org.elasticsearch.xpack.core.ml.action.KillProcessAction; import org.elasticsearch.xpack.core.ml.job.persistence.JobStorageDeletionTask; -import org.elasticsearch.persistent.PersistentTasksCustomMetaData; -import org.elasticsearch.persistent.PersistentTasksService; import org.elasticsearch.xpack.ml.job.JobManager; import java.util.concurrent.TimeoutException; @@ -41,7 +42,7 @@ import static org.elasticsearch.xpack.core.ClientHelper.ML_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; -public class TransportDeleteJobAction extends TransportMasterNodeAction { +public class TransportDeleteJobAction extends TransportMasterNodeAction { private final Client client; private final JobManager jobManager; @@ -65,13 +66,13 @@ protected String executor() { } @Override - protected DeleteJobAction.Response newResponse() { - return new DeleteJobAction.Response(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override protected void masterOperation(Task task, DeleteJobAction.Request request, ClusterState state, - ActionListener listener) throws Exception { + ActionListener listener) throws Exception { ActionListener markAsDeletingListener = ActionListener.wrap( response -> { @@ -110,7 +111,7 @@ protected void masterOperation(Task task, DeleteJobAction.Request request, Clust @Override protected void masterOperation(DeleteJobAction.Request request, ClusterState state, - ActionListener listener) throws Exception { + ActionListener listener) throws Exception { throw new UnsupportedOperationException("the Task parameter is required"); } @@ -120,12 +121,12 @@ protected ClusterBlockException checkBlock(DeleteJobAction.Request request, Clus } private void normalDeleteJob(DeleteJobAction.Request request, JobStorageDeletionTask task, - ActionListener listener) { + ActionListener listener) { jobManager.deleteJob(request, task, listener); } private void forceDeleteJob(DeleteJobAction.Request request, JobStorageDeletionTask task, - ActionListener listener) { + ActionListener listener) { final ClusterState state = clusterService.state(); final String jobId = request.getJobId(); @@ -219,17 +220,17 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS }); } - void waitForDeletingJob(String jobId, TimeValue timeout, ActionListener listener) { + void waitForDeletingJob(String jobId, TimeValue timeout, ActionListener listener) { ClusterStateObserver stateObserver = new ClusterStateObserver(clusterService, timeout, logger, threadPool.getThreadContext()); ClusterState clusterState = stateObserver.setAndGetObservedState(); if (jobIsDeletedFromState(jobId, clusterState)) { - listener.onResponse(new DeleteJobAction.Response(true)); + listener.onResponse(new AcknowledgedResponse(true)); } else { stateObserver.waitForNextChange(new ClusterStateObserver.Listener() { @Override public void onNewClusterState(ClusterState state) { - listener.onResponse(new DeleteJobAction.Response(true)); + listener.onResponse(new AcknowledgedResponse(true)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteModelSnapshotAction.java index 398b9930f7d45..b880bf6fa0c41 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteModelSnapshotAction.java @@ -10,6 +10,7 @@ import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; @@ -29,7 +30,7 @@ import java.util.List; public class TransportDeleteModelSnapshotAction extends HandledTransportAction { + AcknowledgedResponse> { private final Client client; private final JobResultsProvider jobResultsProvider; @@ -50,7 +51,7 @@ public TransportDeleteModelSnapshotAction(Settings settings, TransportService tr @Override protected void doExecute(Task task, DeleteModelSnapshotAction.Request request, - ActionListener listener) { + ActionListener listener) { // Verify the snapshot exists jobResultsProvider.modelSnapshots( request.getJobId(), 0, 1, null, null, null, true, request.getSnapshotId(), @@ -86,7 +87,7 @@ public void onResponse(BulkResponse bulkResponse) { auditor.info(request.getJobId(), msg); logger.debug("[{}] {}", request.getJobId(), msg); // We don't care about the bulk response, just that it succeeded - listener.onResponse(new DeleteModelSnapshotAction.Response(true)); + listener.onResponse(new AcknowledgedResponse(true)); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportFinalizeJobExecutionAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportFinalizeJobExecutionAction.java index ff611f9220250..fb56e61983973 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportFinalizeJobExecutionAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportFinalizeJobExecutionAction.java @@ -7,6 +7,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateUpdateTask; @@ -20,14 +21,14 @@ import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.core.XPackPlugin; -import org.elasticsearch.xpack.core.ml.action.FinalizeJobExecutionAction; import org.elasticsearch.xpack.core.ml.MlMetadata; +import org.elasticsearch.xpack.core.ml.action.FinalizeJobExecutionAction; import org.elasticsearch.xpack.core.ml.job.config.Job; import java.util.Date; public class TransportFinalizeJobExecutionAction extends TransportMasterNodeAction { + AcknowledgedResponse> { @Inject public TransportFinalizeJobExecutionAction(Settings settings, TransportService transportService, @@ -44,13 +45,13 @@ protected String executor() { } @Override - protected FinalizeJobExecutionAction.Response newResponse() { - return new FinalizeJobExecutionAction.Response(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override protected void masterOperation(FinalizeJobExecutionAction.Request request, ClusterState state, - ActionListener listener) throws Exception { + ActionListener listener) throws Exception { String jobIdString = String.join(",", request.getJobIds()); String source = "finalize_job_execution [" + jobIdString + "]"; logger.debug("finalizing jobs [{}]", jobIdString); @@ -82,7 +83,7 @@ public void onFailure(String source, Exception e) { public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) { logger.debug("finalized job [{}]", jobIdString); - listener.onResponse(new FinalizeJobExecutionAction.Response(true)); + listener.onResponse(new AcknowledgedResponse(true)); } }); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportOpenJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportOpenJobAction.java index c4e5793b45171..56d03dd1aacc6 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportOpenJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportOpenJobAction.java @@ -15,6 +15,7 @@ import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; @@ -92,7 +93,7 @@ To ensure that a subsequent close job call will see that same task status (and s In case of instability persistent tasks checks may fail and that is ok, in that case all bets are off. The open job api is a low through put api, so the fact that we redirect to elected master node shouldn't be an issue. */ -public class TransportOpenJobAction extends TransportMasterNodeAction { +public class TransportOpenJobAction extends TransportMasterNodeAction { private final XPackLicenseState licenseState; private final PersistentTasksService persistentTasksService; @@ -457,8 +458,8 @@ protected String executor() { } @Override - protected OpenJobAction.Response newResponse() { - return new OpenJobAction.Response(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override @@ -470,12 +471,12 @@ protected ClusterBlockException checkBlock(OpenJobAction.Request request, Cluste } @Override - protected void masterOperation(OpenJobAction.Request request, ClusterState state, ActionListener listener) { + protected void masterOperation(OpenJobAction.Request request, ClusterState state, ActionListener listener) { OpenJobAction.JobParams jobParams = request.getJobParams(); if (licenseState.isMachineLearningAllowed()) { // Step 6. Clear job finished time once the job is started and respond - ActionListener clearJobFinishTime = ActionListener.wrap( + ActionListener clearJobFinishTime = ActionListener.wrap( response -> { if (response.isAcknowledged()) { clearJobFinishedTime(jobParams.getJobId(), listener); @@ -557,7 +558,7 @@ public void onFailure(Exception e) { } } - private void waitForJobStarted(String taskId, OpenJobAction.JobParams jobParams, ActionListener listener) { + private void waitForJobStarted(String taskId, OpenJobAction.JobParams jobParams, ActionListener listener) { JobPredicate predicate = new JobPredicate(); persistentTasksService.waitForPersistentTaskCondition(taskId, predicate, jobParams.getTimeout(), new PersistentTasksService.WaitForPersistentTaskListener() { @@ -572,7 +573,7 @@ public void onResponse(PersistentTasksCustomMetaData.PersistentTask listener) { + private void clearJobFinishedTime(String jobId, ActionListener listener) { clusterService.submitStateUpdateTask("clearing-job-finish-time-for-" + jobId, new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { @@ -608,18 +609,18 @@ public ClusterState execute(ClusterState currentState) { @Override public void onFailure(String source, Exception e) { logger.error("[" + jobId + "] Failed to clear finished_time; source [" + source + "]", e); - listener.onResponse(new OpenJobAction.Response(true)); + listener.onResponse(new AcknowledgedResponse(true)); } @Override public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) { - listener.onResponse(new OpenJobAction.Response(true)); + listener.onResponse(new AcknowledgedResponse(true)); } }); } private void cancelJobStart(PersistentTasksCustomMetaData.PersistentTask persistentTask, Exception exception, - ActionListener listener) { + ActionListener listener) { persistentTasksService.sendRemoveRequest(persistentTask.getId(), new ActionListener>() { @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStartDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStartDatafeedAction.java index fced681612874..0ea9eb7764803 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStartDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStartDatafeedAction.java @@ -10,6 +10,7 @@ import org.elasticsearch.ResourceAlreadyExistsException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; @@ -23,7 +24,11 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.license.LicenseUtils; import org.elasticsearch.license.XPackLicenseState; +import org.elasticsearch.persistent.AllocatedPersistentTask; import org.elasticsearch.persistent.PersistentTaskState; +import org.elasticsearch.persistent.PersistentTasksCustomMetaData; +import org.elasticsearch.persistent.PersistentTasksExecutor; +import org.elasticsearch.persistent.PersistentTasksService; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.tasks.TaskId; import org.elasticsearch.threadpool.ThreadPool; @@ -38,14 +43,10 @@ import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.core.ml.job.config.JobState; import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper; -import org.elasticsearch.persistent.AllocatedPersistentTask; -import org.elasticsearch.persistent.PersistentTasksCustomMetaData; -import org.elasticsearch.persistent.PersistentTasksExecutor; -import org.elasticsearch.persistent.PersistentTasksService; import org.elasticsearch.xpack.ml.MachineLearning; -import org.elasticsearch.xpack.ml.datafeed.MlRemoteLicenseChecker; import org.elasticsearch.xpack.ml.datafeed.DatafeedManager; import org.elasticsearch.xpack.ml.datafeed.DatafeedNodeSelector; +import org.elasticsearch.xpack.ml.datafeed.MlRemoteLicenseChecker; import org.elasticsearch.xpack.ml.datafeed.extractor.DataExtractorFactory; import java.util.List; @@ -60,7 +61,7 @@ To ensure that a subsequent stop datafeed call will see that same task status (a In case of instability persistent tasks checks may fail and that is ok, in that case all bets are off. The start datafeed api is a low through put api, so the fact that we redirect to elected master node shouldn't be an issue. */ -public class TransportStartDatafeedAction extends TransportMasterNodeAction { +public class TransportStartDatafeedAction extends TransportMasterNodeAction { private final Client client; private final XPackLicenseState licenseState; @@ -104,13 +105,13 @@ protected String executor() { } @Override - protected StartDatafeedAction.Response newResponse() { - return new StartDatafeedAction.Response(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override protected void masterOperation(StartDatafeedAction.Request request, ClusterState state, - ActionListener listener) { + ActionListener listener) { StartDatafeedAction.DatafeedParams params = request.getParams(); if (licenseState.isMachineLearningAllowed()) { @@ -181,7 +182,7 @@ protected ClusterBlockException checkBlock(StartDatafeedAction.Request request, } private void waitForDatafeedStarted(String taskId, StartDatafeedAction.DatafeedParams params, - ActionListener listener) { + ActionListener listener) { DatafeedPredicate predicate = new DatafeedPredicate(); persistentTasksService.waitForPersistentTaskCondition(taskId, predicate, params.getTimeout(), new PersistentTasksService.WaitForPersistentTaskListener() { @@ -193,7 +194,7 @@ public void onResponse(PersistentTasksCustomMetaData.PersistentTask persistentTask, - Exception exception, ActionListener listener) { + Exception exception, ActionListener listener) { persistentTasksService.sendRemoveRequest(persistentTask.getId(), new ActionListener>() { @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportValidateDetectorAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportValidateDetectorAction.java index c2e89dc78c28e..71b8ca5d6dc57 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportValidateDetectorAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportValidateDetectorAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.tasks.Task; @@ -16,8 +17,7 @@ import java.util.function.Supplier; -public class TransportValidateDetectorAction extends HandledTransportAction { +public class TransportValidateDetectorAction extends HandledTransportAction { @Inject public TransportValidateDetectorAction(Settings settings, TransportService transportService, ActionFilters actionFilters) { @@ -26,8 +26,8 @@ public TransportValidateDetectorAction(Settings settings, TransportService trans } @Override - protected void doExecute(Task task, ValidateDetectorAction.Request request, ActionListener listener) { - listener.onResponse(new ValidateDetectorAction.Response(true)); + protected void doExecute(Task task, ValidateDetectorAction.Request request, ActionListener listener) { + listener.onResponse(new AcknowledgedResponse(true)); } } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportValidateJobConfigAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportValidateJobConfigAction.java index b644bc1d47067..c0347aa27d1d6 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportValidateJobConfigAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportValidateJobConfigAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.tasks.Task; @@ -16,8 +17,7 @@ import java.util.function.Supplier; -public class TransportValidateJobConfigAction extends HandledTransportAction { +public class TransportValidateJobConfigAction extends HandledTransportAction { @Inject public TransportValidateJobConfigAction(Settings settings, TransportService transportService, ActionFilters actionFilters) { @@ -27,8 +27,8 @@ public TransportValidateJobConfigAction(Settings settings, TransportService tran @Override protected void doExecute(Task task, ValidateJobConfigAction.Request request, - ActionListener listener) { - listener.onResponse(new ValidateJobConfigAction.Response(true)); + ActionListener listener) { + listener.onResponse(new AcknowledgedResponse(true)); } } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/JobManager.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/JobManager.java index c18c2c940a4c6..d361bb21112dd 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/JobManager.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/JobManager.java @@ -9,6 +9,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.support.WriteRequest; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.AckedClusterStateUpdateTask; import org.elasticsearch.cluster.ClusterState; @@ -52,8 +53,8 @@ import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper; import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.ml.job.categorization.CategorizationAnalyzer; -import org.elasticsearch.xpack.ml.job.persistence.JobResultsProvider; import org.elasticsearch.xpack.ml.job.persistence.JobResultsPersister; +import org.elasticsearch.xpack.ml.job.persistence.JobResultsProvider; import org.elasticsearch.xpack.ml.job.process.autodetect.UpdateParams; import org.elasticsearch.xpack.ml.notifications.Auditor; import org.elasticsearch.xpack.ml.utils.ChainTaskExecutor; @@ -489,7 +490,7 @@ public void updateProcessOnCalendarChanged(List calendarJobIds) { } public void deleteJob(DeleteJobAction.Request request, JobStorageDeletionTask task, - ActionListener actionListener) { + ActionListener actionListener) { String jobId = request.getJobId(); logger.debug("Deleting job '" + jobId + "'"); @@ -500,9 +501,9 @@ public void deleteJob(DeleteJobAction.Request request, JobStorageDeletionTask ta if (jobDeleted) { logger.info("Job [" + jobId + "] deleted"); auditor.info(jobId, Messages.getMessage(Messages.JOB_AUDIT_DELETED)); - actionListener.onResponse(new DeleteJobAction.Response(true)); + actionListener.onResponse(new AcknowledgedResponse(true)); } else { - actionListener.onResponse(new DeleteJobAction.Response(false)); + actionListener.onResponse(new AcknowledgedResponse(false)); } }; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsProvider.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsProvider.java index e850d737d3183..b9d7322b1ad14 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsProvider.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsProvider.java @@ -13,11 +13,9 @@ import org.elasticsearch.ResourceNotFoundException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; -import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.bulk.BulkAction; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; @@ -31,6 +29,7 @@ import org.elasticsearch.action.search.ShardSearchFailure; import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.WriteRequest; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.update.UpdateRequest; import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.client.Client; @@ -260,7 +259,7 @@ public void createJobResultIndex(Job job, ClusterState state, final ActionListen .addAlias(indexName, readAliasName, QueryBuilders.termQuery(Job.ID.getPreferredName(), job.getId())) .addAlias(indexName, writeAliasName).request(); executeAsyncWithOrigin(client.threadPool().getThreadContext(), ML_ORIGIN, request, - ActionListener.wrap(r -> finalListener.onResponse(true), finalListener::onFailure), + ActionListener.wrap(r -> finalListener.onResponse(true), finalListener::onFailure), client.admin().indices()::aliases); }, finalListener::onFailure); @@ -340,9 +339,9 @@ private void updateIndexMappingWithTermFields(String indexName, Collection() { + executeAsyncWithOrigin(client.threadPool().getThreadContext(), ML_ORIGIN, request, new ActionListener() { @Override - public void onResponse(PutMappingResponse putMappingResponse) { + public void onResponse(AcknowledgedResponse putMappingResponse) { listener.onResponse(putMappingResponse.isAcknowledged()); } @@ -1164,7 +1163,7 @@ public void getForecastStats(String jobId, Consumer handler, Cons }, errorHandler), client::search); } - + public void updateCalendar(String calendarId, Set jobIdsToAdd, Set jobIdsToRemove, Consumer handler, Consumer errorHandler) { diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/retention/ExpiredModelSnapshotsRemover.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/retention/ExpiredModelSnapshotsRemover.java index 0f1501c66891e..47a10a8aea381 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/retention/ExpiredModelSnapshotsRemover.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/retention/ExpiredModelSnapshotsRemover.java @@ -12,6 +12,7 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.support.ThreadedActionListener; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.logging.Loggers; @@ -123,9 +124,9 @@ private void deleteModelSnapshots(Iterator modelSnapshotIterator, ModelSnapshot modelSnapshot = modelSnapshotIterator.next(); DeleteModelSnapshotAction.Request deleteSnapshotRequest = new DeleteModelSnapshotAction.Request( modelSnapshot.getJobId(), modelSnapshot.getSnapshotId()); - client.execute(DeleteModelSnapshotAction.INSTANCE, deleteSnapshotRequest, new ActionListener() { + client.execute(DeleteModelSnapshotAction.INSTANCE, deleteSnapshotRequest, new ActionListener() { @Override - public void onResponse(DeleteModelSnapshotAction.Response response) { + public void onResponse(AcknowledgedResponse response) { try { deleteModelSnapshots(modelSnapshotIterator, listener); } catch (Exception e) { diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java index cb4cab14dda03..07906a49c280f 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java @@ -5,6 +5,7 @@ */ package org.elasticsearch.xpack.ml.rest.datafeeds; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; @@ -17,9 +18,9 @@ import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; -import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.core.ml.action.StartDatafeedAction; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; +import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; @@ -60,10 +61,10 @@ protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient } return channel -> { client.execute(StartDatafeedAction.INSTANCE, jobDatafeedRequest, - new RestBuilderListener(channel) { + new RestBuilderListener(channel) { @Override - public RestResponse buildResponse(StartDatafeedAction.Response r, XContentBuilder builder) throws Exception { + public RestResponse buildResponse(AcknowledgedResponse r, XContentBuilder builder) throws Exception { builder.startObject(); builder.field("started", r.isAcknowledged()); builder.endObject(); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java index 80e00eb1a4757..4da4e540307b3 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java @@ -5,6 +5,7 @@ */ package org.elasticsearch.xpack.ml.rest.job; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; @@ -16,9 +17,9 @@ import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.RestBuilderListener; -import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.core.ml.action.OpenJobAction; import org.elasticsearch.xpack.core.ml.job.config.Job; +import org.elasticsearch.xpack.ml.MachineLearning; import java.io.IOException; @@ -50,9 +51,9 @@ protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient request = new OpenJobAction.Request(jobParams); } return channel -> { - client.execute(OpenJobAction.INSTANCE, request, new RestBuilderListener(channel) { + client.execute(OpenJobAction.INSTANCE, request, new RestBuilderListener(channel) { @Override - public RestResponse buildResponse(OpenJobAction.Response r, XContentBuilder builder) throws Exception { + public RestResponse buildResponse(AcknowledgedResponse r, XContentBuilder builder) throws Exception { builder.startObject(); builder.field("opened", r.isAcknowledged()); builder.endObject(); diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/license/MachineLearningLicensingTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/license/MachineLearningLicensingTests.java index 57a9764179146..e8ac4285b6b33 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/license/MachineLearningLicensingTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/license/MachineLearningLicensingTests.java @@ -7,12 +7,14 @@ import org.elasticsearch.ElasticsearchSecurityException; import org.elasticsearch.action.support.PlainActionFuture; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.license.License.OperationMode; +import org.elasticsearch.persistent.PersistentTasksCustomMetaData; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.test.junit.annotations.TestLogging; import org.elasticsearch.transport.Transport; @@ -31,7 +33,6 @@ import org.elasticsearch.xpack.core.ml.client.MachineLearningClient; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedState; import org.elasticsearch.xpack.core.ml.job.config.JobState; -import org.elasticsearch.persistent.PersistentTasksCustomMetaData; import org.elasticsearch.xpack.ml.LocalStateMachineLearning; import org.elasticsearch.xpack.ml.support.BaseMlIntegTestCase; import org.junit.Before; @@ -107,7 +108,7 @@ public void testMachineLearningOpenJobActionRestricted() throws Exception { // test that license restricted apis do not work try (TransportClient client = new TestXPackTransportClient(settings, LocalStateMachineLearning.class)) { client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress()); - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); new MachineLearningClient(client).openJob(new OpenJobAction.Request(jobId), listener); listener.actionGet(); fail("open job action should not be enabled!"); @@ -131,9 +132,9 @@ public void testMachineLearningOpenJobActionRestricted() throws Exception { // test that license restricted apis do now work try (TransportClient client = new TestXPackTransportClient(settings, LocalStateMachineLearning.class)) { client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress()); - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); new MachineLearningClient(client).openJob(new OpenJobAction.Request(jobId), listener); - OpenJobAction.Response response = listener.actionGet(); + AcknowledgedResponse response = listener.actionGet(); assertNotNull(response); } } @@ -208,12 +209,12 @@ public void testAutoCloseJobWithDatafeed() throws Exception { PutDatafeedAction.Response putDatafeedResponse = putDatafeedListener.actionGet(); assertNotNull(putDatafeedResponse); // open job - PlainActionFuture openJobListener = PlainActionFuture.newFuture(); + PlainActionFuture openJobListener = PlainActionFuture.newFuture(); new MachineLearningClient(client).openJob(new OpenJobAction.Request(jobId), openJobListener); - OpenJobAction.Response openJobResponse = openJobListener.actionGet(); + AcknowledgedResponse openJobResponse = openJobListener.actionGet(); assertNotNull(openJobResponse); // start datafeed - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); new MachineLearningClient(client).startDatafeed(new StartDatafeedAction.Request(datafeedId, 0L), listener); listener.actionGet(); } @@ -244,12 +245,12 @@ public void testAutoCloseJobWithDatafeed() throws Exception { try (TransportClient client = new TestXPackTransportClient(settings, LocalStateMachineLearning.class)) { client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress()); // open job - PlainActionFuture openJobListener = PlainActionFuture.newFuture(); + PlainActionFuture openJobListener = PlainActionFuture.newFuture(); new MachineLearningClient(client).openJob(new OpenJobAction.Request(jobId), openJobListener); - OpenJobAction.Response openJobResponse = openJobListener.actionGet(); + AcknowledgedResponse openJobResponse = openJobListener.actionGet(); assertNotNull(openJobResponse); // start datafeed - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); new MachineLearningClient(client).startDatafeed(new StartDatafeedAction.Request(datafeedId, 0L), listener); listener.actionGet(); } @@ -308,9 +309,9 @@ public void testMachineLearningStartDatafeedActionRestricted() throws Exception Collections.singletonList(datafeedIndex))), putDatafeedListener); PutDatafeedAction.Response putDatafeedResponse = putDatafeedListener.actionGet(); assertNotNull(putDatafeedResponse); - PlainActionFuture openJobListener = PlainActionFuture.newFuture(); + PlainActionFuture openJobListener = PlainActionFuture.newFuture(); new MachineLearningClient(client).openJob(new OpenJobAction.Request(jobId), openJobListener); - OpenJobAction.Response openJobResponse = openJobListener.actionGet(); + AcknowledgedResponse openJobResponse = openJobListener.actionGet(); assertNotNull(openJobResponse); } @@ -331,7 +332,7 @@ public void testMachineLearningStartDatafeedActionRestricted() throws Exception // test that license restricted apis do not work try (TransportClient client = new TestXPackTransportClient(settings, LocalStateMachineLearning.class)) { client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress()); - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); new MachineLearningClient(client).startDatafeed(new StartDatafeedAction.Request(datafeedId, 0L), listener); listener.actionGet(); fail("start datafeed action should not be enabled!"); @@ -349,14 +350,14 @@ public void testMachineLearningStartDatafeedActionRestricted() throws Exception try (TransportClient client = new TestXPackTransportClient(settings, LocalStateMachineLearning.class)) { client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress()); // re-open job now that the license is valid again - PlainActionFuture openJobListener = PlainActionFuture.newFuture(); + PlainActionFuture openJobListener = PlainActionFuture.newFuture(); new MachineLearningClient(client).openJob(new OpenJobAction.Request(jobId), openJobListener); - OpenJobAction.Response openJobResponse = openJobListener.actionGet(); + AcknowledgedResponse openJobResponse = openJobListener.actionGet(); assertNotNull(openJobResponse); - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); new MachineLearningClient(client).startDatafeed(new StartDatafeedAction.Request(datafeedId, 0L), listener); - StartDatafeedAction.Response response = listener.actionGet(); + AcknowledgedResponse response = listener.actionGet(); assertNotNull(response); } } @@ -382,14 +383,14 @@ public void testMachineLearningStopDatafeedActionNotRestricted() throws Exceptio Collections.singletonList(datafeedIndex))), putDatafeedListener); PutDatafeedAction.Response putDatafeedResponse = putDatafeedListener.actionGet(); assertNotNull(putDatafeedResponse); - PlainActionFuture openJobListener = PlainActionFuture.newFuture(); + PlainActionFuture openJobListener = PlainActionFuture.newFuture(); new MachineLearningClient(client).openJob(new OpenJobAction.Request(jobId), openJobListener); - OpenJobAction.Response openJobResponse = openJobListener.actionGet(); + AcknowledgedResponse openJobResponse = openJobListener.actionGet(); assertNotNull(openJobResponse); - PlainActionFuture startDatafeedListener = PlainActionFuture.newFuture(); + PlainActionFuture startDatafeedListener = PlainActionFuture.newFuture(); new MachineLearningClient(client).startDatafeed( new StartDatafeedAction.Request(datafeedId, 0L), startDatafeedListener); - StartDatafeedAction.Response startDatafeedResponse = startDatafeedListener.actionGet(); + AcknowledgedResponse startDatafeedResponse = startDatafeedListener.actionGet(); assertNotNull(startDatafeedResponse); } @@ -438,9 +439,9 @@ public void testMachineLearningCloseJobActionNotRestricted() throws Exception { new MachineLearningClient(client).putJob(new PutJobAction.Request(createJob(jobId)), putJobListener); PutJobAction.Response putJobResponse = putJobListener.actionGet(); assertNotNull(putJobResponse); - PlainActionFuture openJobListener = PlainActionFuture.newFuture(); + PlainActionFuture openJobListener = PlainActionFuture.newFuture(); new MachineLearningClient(client).openJob(new OpenJobAction.Request(jobId), openJobListener); - OpenJobAction.Response openJobResponse = openJobListener.actionGet(); + AcknowledgedResponse openJobResponse = openJobListener.actionGet(); assertNotNull(openJobResponse); } @@ -489,7 +490,7 @@ public void testMachineLearningDeleteJobActionNotRestricted() throws Exception { try (TransportClient client = new TestXPackTransportClient(settings, LocalStateMachineLearning.class)) { client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress()); - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); new MachineLearningClient(client).deleteJob(new DeleteJobAction.Request(jobId), listener); listener.actionGet(); } @@ -521,7 +522,7 @@ public void testMachineLearningDeleteDatafeedActionNotRestricted() throws Except try (TransportClient client = new TestXPackTransportClient(settings, LocalStateMachineLearning.class)) { client.addTransportAddress(internalCluster().getDataNodeInstance(Transport.class).boundAddress().publishAddress()); - PlainActionFuture listener = PlainActionFuture.newFuture(); + PlainActionFuture listener = PlainActionFuture.newFuture(); new MachineLearningClient(client).deleteDatafeed(new DeleteDatafeedAction.Request(datafeedId), listener); listener.actionGet(); } diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/AutodetectResultProcessorIT.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/AutodetectResultProcessorIT.java index 8f6005a216115..756eeb8626dc6 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/AutodetectResultProcessorIT.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/AutodetectResultProcessorIT.java @@ -5,6 +5,7 @@ */ package org.elasticsearch.xpack.ml.integration; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.common.io.stream.Writeable; @@ -36,8 +37,8 @@ import org.elasticsearch.xpack.ml.MlSingleNodeTestCase; import org.elasticsearch.xpack.ml.job.persistence.BucketsQueryBuilder; import org.elasticsearch.xpack.ml.job.persistence.InfluencersQueryBuilder; -import org.elasticsearch.xpack.ml.job.persistence.JobResultsProvider; import org.elasticsearch.xpack.ml.job.persistence.JobResultsPersister; +import org.elasticsearch.xpack.ml.job.persistence.JobResultsProvider; import org.elasticsearch.xpack.ml.job.persistence.RecordsQueryBuilder; import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcess; import org.elasticsearch.xpack.ml.job.process.autodetect.output.AutoDetectResultProcessor; @@ -115,7 +116,7 @@ protected void updateModelSnapshotOnJob(ModelSnapshot modelSnapshot) { @After public void deleteJob() throws Exception { DeleteJobAction.Request request = new DeleteJobAction.Request(JOB_ID); - DeleteJobAction.Response response = client().execute(DeleteJobAction.INSTANCE, request).actionGet(); + AcknowledgedResponse response = client().execute(DeleteJobAction.INSTANCE, request).actionGet(); assertTrue(response.isAcknowledged()); } diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java index f389bc4b74913..ed23a5328aec1 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java @@ -6,14 +6,15 @@ package org.elasticsearch.xpack.ml.integration; import org.elasticsearch.action.ActionListener; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateUpdateTask; import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.persistent.PersistentTasksCustomMetaData; import org.elasticsearch.xpack.core.ml.MlMetadata; import org.elasticsearch.xpack.core.ml.action.DeleteJobAction; import org.elasticsearch.xpack.core.ml.action.PutJobAction; import org.elasticsearch.xpack.core.ml.job.config.Job; -import org.elasticsearch.persistent.PersistentTasksCustomMetaData; import org.elasticsearch.xpack.ml.support.BaseMlIntegTestCase; import java.util.concurrent.CountDownLatch; @@ -56,9 +57,9 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS // Job is marked as deleting so now a delete request should wait for it. AtomicBoolean isDeleted = new AtomicBoolean(false); AtomicReference deleteFailure = new AtomicReference<>(); - ActionListener deleteListener = new ActionListener() { + ActionListener deleteListener = new ActionListener() { @Override - public void onResponse(DeleteJobAction.Response response) { + public void onResponse(AcknowledgedResponse response) { isDeleted.compareAndSet(false, response.isAcknowledged()); } diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/NetworkDisruptionIT.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/NetworkDisruptionIT.java index 27a827992df1a..67138cde5bd85 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/NetworkDisruptionIT.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/NetworkDisruptionIT.java @@ -7,6 +7,7 @@ import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.support.IndicesOptions; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; import org.elasticsearch.common.unit.ByteSizeValue; @@ -62,7 +63,7 @@ public void testJobRelocation() throws Exception { ensureGreen(); OpenJobAction.Request openJobRequest = new OpenJobAction.Request(job.getId()); - OpenJobAction.Response openJobResponse = client().execute(OpenJobAction.INSTANCE, openJobRequest).actionGet(); + AcknowledgedResponse openJobResponse = client().execute(OpenJobAction.INSTANCE, openJobRequest).actionGet(); assertTrue(openJobResponse.isAcknowledged()); // Record which node the job starts off on diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsProviderTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsProviderTests.java index 2c0681c33f22a..929961a33fc91 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsProviderTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsProviderTests.java @@ -10,12 +10,12 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.search.MultiSearchRequest; import org.elasticsearch.action.search.MultiSearchResponse; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.AckedClusterStateUpdateTask; import org.elasticsearch.cluster.ClusterName; @@ -128,7 +128,7 @@ public void testCreateJobWithExistingIndex() { MockClientBuilder clientBuilder = new MockClientBuilder(CLUSTER_NAME); clientBuilder.prepareAlias(AnomalyDetectorsIndex.jobResultsAliasedName("foo"), AnomalyDetectorsIndex.jobResultsAliasedName("foo123"), jobFilter); - clientBuilder.preparePutMapping(mock(PutMappingResponse.class), Result.TYPE.getPreferredName()); + clientBuilder.preparePutMapping(mock(AcknowledgedResponse.class), Result.TYPE.getPreferredName()); GetMappingsResponse getMappingsResponse = mock(GetMappingsResponse.class); ImmutableOpenMap typeMappings = ImmutableOpenMap.of(); @@ -197,7 +197,7 @@ public void testCreateJobRelatedIndicies_createsAliasBecauseIndexNameIsSet() { clientBuilder.createIndexRequest(captor, indexName); clientBuilder.prepareAlias(indexName, readAliasName, jobFilter); clientBuilder.prepareAlias(indexName, writeAliasName); - clientBuilder.preparePutMapping(mock(PutMappingResponse.class), Result.TYPE.getPreferredName()); + clientBuilder.preparePutMapping(mock(AcknowledgedResponse.class), Result.TYPE.getPreferredName()); Job.Builder job = buildJobBuilder("foo"); job.setResultsIndexName("bar"); diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/persistence/MockClientBuilder.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/persistence/MockClientBuilder.java index 61fc73d1641e1..7dbe3bbf1ffd8 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/persistence/MockClientBuilder.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/persistence/MockClientBuilder.java @@ -11,21 +11,17 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder; -import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.delete.DeleteIndexAction; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; -import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequestBuilder; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; -import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; import org.elasticsearch.action.bulk.BulkRequest; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; @@ -38,6 +34,7 @@ import org.elasticsearch.action.search.SearchScrollRequestBuilder; import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.action.support.WriteRequest.RefreshPolicy; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.AdminClient; import org.elasticsearch.client.Client; import org.elasticsearch.client.ClusterAdminClient; @@ -50,7 +47,6 @@ import org.elasticsearch.search.sort.SortBuilder; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.xpack.core.ml.action.DeleteJobAction; import org.mockito.ArgumentCaptor; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; @@ -138,8 +134,8 @@ public MockClientBuilder addIndicesExistsResponse(String index, boolean exists) @SuppressWarnings({ "unchecked" }) public MockClientBuilder addIndicesDeleteResponse(String index, boolean exists, boolean exception, - ActionListener actionListener) throws InterruptedException, ExecutionException, IOException { - DeleteIndexResponse response = DeleteIndexAction.INSTANCE.newResponse(); + ActionListener actionListener) throws InterruptedException, ExecutionException, IOException { + AcknowledgedResponse response = DeleteIndexAction.INSTANCE.newResponse(); StreamInput si = mock(StreamInput.class); // this looks complicated but Mockito can't mock the final method // DeleteIndexResponse.isAcknowledged() and the only way to create @@ -153,7 +149,7 @@ public MockClientBuilder addIndicesDeleteResponse(String index, boolean exists, if (exception) { actionListener.onFailure(new InterruptedException()); } else { - actionListener.onResponse(new DeleteJobAction.Response(true)); + actionListener.onResponse(new AcknowledgedResponse(true)); } return null; }).when(indicesAdminClient).delete(any(DeleteIndexRequest.class), any(ActionListener.class)); @@ -294,9 +290,9 @@ public MockClientBuilder prepareAlias(String indexName, String alias, QueryBuild doAnswer(new Answer() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { - ActionListener listener = - (ActionListener) invocationOnMock.getArguments()[0]; - listener.onResponse(mock(IndicesAliasesResponse.class)); + ActionListener listener = + (ActionListener) invocationOnMock.getArguments()[0]; + listener.onResponse(mock(AcknowledgedResponse.class)); return null; } }).when(aliasesRequestBuilder).execute(any()); @@ -310,9 +306,9 @@ public MockClientBuilder prepareAlias(String indexName, String alias) { doAnswer(new Answer() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { - ActionListener listener = - (ActionListener) invocationOnMock.getArguments()[1]; - listener.onResponse(mock(IndicesAliasesResponse.class)); + ActionListener listener = + (ActionListener) invocationOnMock.getArguments()[1]; + listener.onResponse(mock(AcknowledgedResponse.class)); return null; } }).when(indicesAdminClient).aliases(any(IndicesAliasesRequest.class), any(ActionListener.class)); @@ -337,15 +333,15 @@ public MockClientBuilder bulk(BulkResponse response) { return this; } - public MockClientBuilder preparePutMapping(PutMappingResponse response, String type) { + public MockClientBuilder preparePutMapping(AcknowledgedResponse response, String type) { PutMappingRequestBuilder requestBuilder = mock(PutMappingRequestBuilder.class); when(requestBuilder.setType(eq(type))).thenReturn(requestBuilder); when(requestBuilder.setSource(any(XContentBuilder.class))).thenReturn(requestBuilder); doAnswer(new Answer() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { - ActionListener listener = - (ActionListener) invocationOnMock.getArguments()[0]; + ActionListener listener = + (ActionListener) invocationOnMock.getArguments()[0]; listener.onResponse(response); return null; } @@ -376,9 +372,9 @@ public MockClientBuilder putTemplate(ArgumentCaptor req doAnswer(new Answer() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { - ActionListener listener = - (ActionListener) invocationOnMock.getArguments()[1]; - listener.onResponse(mock(PutIndexTemplateResponse.class)); + ActionListener listener = + (ActionListener) invocationOnMock.getArguments()[1]; + listener.onResponse(mock(AcknowledgedResponse.class)); return null; } }).when(indicesAdminClient).putTemplate(requestCaptor.capture(), any(ActionListener.class)); diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/retention/ExpiredModelSnapshotsRemoverTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/retention/ExpiredModelSnapshotsRemoverTests.java index 4195e93439d60..9f056e91854c3 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/retention/ExpiredModelSnapshotsRemoverTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/retention/ExpiredModelSnapshotsRemoverTests.java @@ -9,6 +9,7 @@ import org.elasticsearch.action.search.SearchAction; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.MetaData; @@ -270,8 +271,8 @@ public Void answer(InvocationOnMock invocationOnMock) { @Override public Void answer(InvocationOnMock invocationOnMock) { capturedDeleteModelSnapshotRequests.add((DeleteModelSnapshotAction.Request) invocationOnMock.getArguments()[1]); - ActionListener listener = - (ActionListener) invocationOnMock.getArguments()[2]; + ActionListener listener = + (ActionListener) invocationOnMock.getArguments()[2]; if (shouldDeleteSnapshotRequestsSucceed) { listener.onResponse(null); } else { @@ -307,4 +308,4 @@ public void waitToCompletion() { } } -} \ No newline at end of file +} diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java index 7a1ca6a00f46c..3c07db3a9abd2 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java @@ -12,6 +12,7 @@ import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.support.WriteRequest; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.analysis.common.CommonAnalysisPlugin; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; @@ -27,19 +28,17 @@ import org.elasticsearch.test.MockHttpTransport; import org.elasticsearch.test.discovery.TestZenDiscovery; import org.elasticsearch.xpack.core.XPackSettings; -import org.elasticsearch.xpack.core.ml.action.GetDatafeedsAction; -import org.elasticsearch.xpack.core.ml.action.GetJobsAction; -import org.elasticsearch.xpack.core.ml.action.util.QueryPage; -import org.elasticsearch.xpack.core.ml.client.MachineLearningClient; -import org.elasticsearch.xpack.ml.LocalStateMachineLearning; -import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.core.ml.MachineLearningField; import org.elasticsearch.xpack.core.ml.action.CloseJobAction; import org.elasticsearch.xpack.core.ml.action.DeleteDatafeedAction; import org.elasticsearch.xpack.core.ml.action.DeleteJobAction; +import org.elasticsearch.xpack.core.ml.action.GetDatafeedsAction; import org.elasticsearch.xpack.core.ml.action.GetDatafeedsStatsAction; +import org.elasticsearch.xpack.core.ml.action.GetJobsAction; import org.elasticsearch.xpack.core.ml.action.GetJobsStatsAction; import org.elasticsearch.xpack.core.ml.action.StopDatafeedAction; +import org.elasticsearch.xpack.core.ml.action.util.QueryPage; +import org.elasticsearch.xpack.core.ml.client.MachineLearningClient; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedState; import org.elasticsearch.xpack.core.ml.job.config.AnalysisConfig; @@ -49,6 +48,8 @@ import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.core.ml.job.config.JobState; import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.LocalStateMachineLearning; +import org.elasticsearch.xpack.ml.MachineLearning; import org.junit.After; import org.junit.Before; @@ -306,7 +307,7 @@ public static void deleteAllDatafeeds(Logger logger, Client client) throws Excep throw new RuntimeException(e); } }); - DeleteDatafeedAction.Response deleteResponse = + AcknowledgedResponse deleteResponse = client.execute(DeleteDatafeedAction.INSTANCE, new DeleteDatafeedAction.Request(datafeed.getId())).get(); assertTrue(deleteResponse.isAcknowledged()); } @@ -344,7 +345,7 @@ public static void deleteAllJobs(Logger logger, Client client) throws Exception client().execute(GetJobsStatsAction.INSTANCE, new GetJobsStatsAction.Request(job.getId())).actionGet(); assertEquals(JobState.CLOSED, statsResponse.getResponse().results().get(0).getState()); }); - DeleteJobAction.Response response = + AcknowledgedResponse response = client.execute(DeleteJobAction.INSTANCE, new DeleteJobAction.Request(job.getId())).get(); assertTrue(response.isAcknowledged()); } diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java index d4375af4e553a..6962d91c9be62 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java @@ -11,9 +11,7 @@ import org.apache.logging.log4j.util.Supplier; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; -import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; -import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; import org.elasticsearch.action.ingest.PutPipelineRequest; import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; @@ -402,7 +400,7 @@ private boolean hasTemplate(final ClusterState clusterState, final String templa } // FIXME this should use the IndexTemplateMetaDataUpgrader - private void putTemplate(String template, String source, ActionListener listener) { + private void putTemplate(String template, String source, ActionListener listener) { logger.debug("installing template [{}]", template); PutIndexTemplateRequest request = new PutIndexTemplateRequest(template).source(source, XContentType.JSON); @@ -547,9 +545,9 @@ private void deleteIndices(Set indices) { logger.trace("deleting {} indices: [{}]", indices.size(), collectionToCommaDelimitedString(indices)); final DeleteIndexRequest request = new DeleteIndexRequest(indices.toArray(new String[indices.size()])); executeAsyncWithOrigin(client.threadPool().getThreadContext(), MONITORING_ORIGIN, request, - new ActionListener() { + new ActionListener() { @Override - public void onResponse(DeleteIndexResponse response) { + public void onResponse(AcknowledgedResponse response) { if (response.isAcknowledged()) { logger.debug("{} indices deleted", indices.size()); } else { diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportDeleteRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportDeleteRollupJobAction.java index 03df531e73771..97b4483b1ff03 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportDeleteRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportDeleteRollupJobAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; @@ -28,7 +29,7 @@ import java.util.concurrent.TimeUnit; public class TransportDeleteRollupJobAction - extends TransportMasterNodeAction { + extends TransportMasterNodeAction { private final PersistentTasksService persistentTasksService; @@ -47,13 +48,13 @@ protected String executor() { } @Override - protected DeleteRollupJobAction.Response newResponse() { - return new DeleteRollupJobAction.Response(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override protected void masterOperation(DeleteRollupJobAction.Request request, ClusterState state, - ActionListener listener) throws Exception { + ActionListener listener) throws Exception { String jobId = request.getId(); TimeValue timeout = new TimeValue(60, TimeUnit.SECONDS); // TODO make this a config option @@ -70,7 +71,7 @@ public void onResponse(PersistentTasksCustomMetaData.PersistentTask persisten @Override public void onResponse(PersistentTasksCustomMetaData.PersistentTask task) { logger.debug("Task for Rollup job [" + jobId + "] successfully canceled."); - listener.onResponse(new DeleteRollupJobAction.Response(true)); + listener.onResponse(new AcknowledgedResponse(true)); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportPutRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportPutRollupJobAction.java index 889dfa3ac8efc..9f20fba8e92da 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportPutRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportPutRollupJobAction.java @@ -21,6 +21,7 @@ import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest; import org.elasticsearch.action.fieldcaps.FieldCapabilitiesResponse; import org.elasticsearch.action.support.ActionFilters; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; @@ -53,7 +54,7 @@ import java.util.Objects; import java.util.stream.Collectors; -public class TransportPutRollupJobAction extends TransportMasterNodeAction { +public class TransportPutRollupJobAction extends TransportMasterNodeAction { private final XPackLicenseState licenseState; private final PersistentTasksService persistentTasksService; private final Client client; @@ -76,13 +77,13 @@ protected String executor() { } @Override - protected PutRollupJobAction.Response newResponse() { - return new PutRollupJobAction.Response(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override protected void masterOperation(PutRollupJobAction.Request request, ClusterState clusterState, - ActionListener listener) { + ActionListener listener) { if (!licenseState.isRollupAllowed()) { listener.onFailure(LicenseUtils.newComplianceException(XPackField.ROLLUP)); @@ -123,7 +124,7 @@ private static RollupJob createRollupJob(RollupJobConfig config, ThreadPool thre return new RollupJob(config, filteredHeaders); } - static void createIndex(RollupJob job, ActionListener listener, + static void createIndex(RollupJob job, ActionListener listener, PersistentTasksService persistentTasksService, Client client, Logger logger) { String jobMetadata = "\"" + job.getConfig().getId() + "\":" + job.getConfig().toJSONString(); @@ -148,7 +149,7 @@ static void createIndex(RollupJob job, ActionListener listener, + static void updateMapping(RollupJob job, ActionListener listener, PersistentTasksService persistentTasksService, Client client, Logger logger) { final String indexName = job.getConfig().getRollupIndex(); @@ -210,7 +211,7 @@ static void updateMapping(RollupJob job, ActionListener listener, + static void startPersistentTask(RollupJob job, ActionListener listener, PersistentTasksService persistentTasksService) { persistentTasksService.sendStartRequest(job.getConfig().getId(), RollupField.TASK_NAME, job, @@ -226,13 +227,13 @@ static void startPersistentTask(RollupJob job, ActionListener listener, + private static void waitForRollupStarted(RollupJob job, ActionListener listener, PersistentTasksService persistentTasksService) { persistentTasksService.waitForPersistentTaskCondition(job.getConfig().getId(), Objects::nonNull, job.getConfig().getTimeout(), new PersistentTasksService.WaitForPersistentTaskListener() { @Override public void onResponse(PersistentTasksCustomMetaData.PersistentTask task) { - listener.onResponse(new PutRollupJobAction.Response(true)); + listener.onResponse(new AcknowledgedResponse(true)); } @Override diff --git a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/action/PutJobStateMachineTests.java b/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/action/PutJobStateMachineTests.java index d9caad5147d41..5599c50321cf1 100644 --- a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/action/PutJobStateMachineTests.java +++ b/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/action/PutJobStateMachineTests.java @@ -17,17 +17,17 @@ import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.persistent.PersistentTasksCustomMetaData; import org.elasticsearch.persistent.PersistentTasksService; import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.xpack.core.rollup.ConfigTestHelpers; import org.elasticsearch.xpack.core.rollup.RollupField; -import org.elasticsearch.xpack.core.rollup.action.PutRollupJobAction; import org.elasticsearch.xpack.core.rollup.job.RollupJob; import org.elasticsearch.xpack.core.rollup.job.RollupJobConfig; -import org.elasticsearch.xpack.core.rollup.ConfigTestHelpers; import org.elasticsearch.xpack.rollup.Rollup; import org.mockito.ArgumentCaptor; @@ -52,7 +52,7 @@ public class PutJobStateMachineTests extends ESTestCase { public void testCreateIndexException() { RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random(), "foo"), Collections.emptyMap()); - ActionListener testListener = ActionListener.wrap(response -> { + ActionListener testListener = ActionListener.wrap(response -> { fail("Listener success should not have been triggered."); }, e -> { assertThat(e.getMessage(), equalTo("Could not create index for rollup job [foo]")); @@ -78,7 +78,7 @@ public void testCreateIndexException() { public void testIndexAlreadyExists() { RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap()); - ActionListener testListener = ActionListener.wrap(response -> { + ActionListener testListener = ActionListener.wrap(response -> { fail("Listener success should not have been triggered."); }, e -> { assertThat(e.getCause().getMessage(), equalTo("Ending")); @@ -110,7 +110,7 @@ public void testIndexAlreadyExists() { public void testIndexMetaData() throws InterruptedException { RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap()); - ActionListener testListener = ActionListener.wrap(response -> { + ActionListener testListener = ActionListener.wrap(response -> { fail("Listener success should not have been triggered."); }, e -> { assertThat(e.getCause().getMessage(), equalTo("Ending")); @@ -153,7 +153,7 @@ public void testIndexMetaData() throws InterruptedException { public void testGetMappingFails() { RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random(), "foo"), Collections.emptyMap()); - ActionListener testListener = ActionListener.wrap(response -> { + ActionListener testListener = ActionListener.wrap(response -> { fail("Listener success should not have been triggered."); }, e -> { assertThat(e.getMessage(), equalTo("Could not update mappings for rollup job [foo]")); @@ -177,7 +177,7 @@ public void testGetMappingFails() { public void testNoMetadataInMapping() { RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap()); - ActionListener testListener = ActionListener.wrap(response -> { + ActionListener testListener = ActionListener.wrap(response -> { fail("Listener success should not have been triggered."); }, e -> { assertThat(e.getMessage(), equalTo("Expected to find _meta key in mapping of rollup index [" @@ -210,7 +210,7 @@ public void testNoMetadataInMapping() { public void testNoMappingVersion() { RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap()); - ActionListener testListener = ActionListener.wrap(response -> { + ActionListener testListener = ActionListener.wrap(response -> { fail("Listener success should not have been triggered."); }, e -> { assertThat(e.getMessage(), equalTo("Could not determine version of existing rollup metadata for index [" @@ -247,7 +247,7 @@ public void testNoMappingVersion() { public void testJobAlreadyInMapping() { RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random(), "foo"), Collections.emptyMap()); - ActionListener testListener = ActionListener.wrap(response -> { + ActionListener testListener = ActionListener.wrap(response -> { fail("Listener success should not have been triggered."); }, e -> { assertThat(e.getMessage(), equalTo("Cannot create rollup job [foo] because job was previously created (existing metadata).")); @@ -288,7 +288,7 @@ public void testAddJobToMapping() { final RollupJobConfig config = ConfigTestHelpers.randomRollupJobConfig(random(), ESTestCase.randomAlphaOfLength(10), "foo", "rollup_index_foo"); RollupJob job = new RollupJob(config, Collections.emptyMap()); - ActionListener testListener = ActionListener.wrap(response -> { + ActionListener testListener = ActionListener.wrap(response -> { fail("Listener success should not have been triggered."); }, e -> { assertThat(e.getMessage(), equalTo("Ending")); @@ -333,7 +333,7 @@ public void testAddJobToMapping() { public void testTaskAlreadyExists() { RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random(), "foo"), Collections.emptyMap()); - ActionListener testListener = ActionListener.wrap(response -> { + ActionListener testListener = ActionListener.wrap(response -> { fail("Listener success should not have been triggered."); }, e -> { assertThat(e.getMessage(), equalTo("Cannot create job [foo] because it has already been created (task exists)")); @@ -356,7 +356,7 @@ public void testTaskAlreadyExists() { public void testStartTask() { RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap()); - ActionListener testListener = ActionListener.wrap(response -> { + ActionListener testListener = ActionListener.wrap(response -> { fail("Listener success should not have been triggered."); }, e -> { assertThat(e.getMessage(), equalTo("Ending")); diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityIndexManager.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityIndexManager.java index 45c55c633d923..d02b569a7440e 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityIndexManager.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityIndexManager.java @@ -17,9 +17,9 @@ import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; import org.elasticsearch.action.support.ActiveShardCount; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterState; @@ -299,7 +299,7 @@ public void onFailure(Exception e) { .source(loadMappingAndSettingsSourceFromTemplate().v1(), XContentType.JSON) .type("doc"); executeAsyncWithOrigin(client.threadPool().getThreadContext(), SECURITY_ORIGIN, request, - ActionListener.wrap(putMappingResponse -> { + ActionListener.wrap(putMappingResponse -> { if (putMappingResponse.isAcknowledged()) { andThen.run(); } else { diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/DateMathExpressionIntegTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/DateMathExpressionIntegTests.java index 5ec9f8fbe06ad..2238c12cfb446 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/DateMathExpressionIntegTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/DateMathExpressionIntegTests.java @@ -7,12 +7,12 @@ import org.elasticsearch.action.DocWriteResponse; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.get.MultiGetResponse; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.search.MultiSearchResponse; import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.client.Client; import org.elasticsearch.client.Requests; @@ -111,7 +111,7 @@ public void testDateMathExpressionsCanBeAuthorized() throws Exception { assertEquals(expectedIndexName, multiGetResponse.getResponses()[0].getResponse().getIndex()); - DeleteIndexResponse deleteIndexResponse = client.admin().indices().prepareDelete(expression).get(); + AcknowledgedResponse deleteIndexResponse = client.admin().indices().prepareDelete(expression).get(); assertThat(deleteIndexResponse.isAcknowledged(), is(true)); } diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/PermissionPrecedenceTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/PermissionPrecedenceTests.java index f3fea81e20127..24ef13c0b07f7 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/PermissionPrecedenceTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/integration/PermissionPrecedenceTests.java @@ -8,7 +8,7 @@ import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesAction; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateAction; -import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; import org.elasticsearch.common.settings.SecureString; @@ -87,7 +87,7 @@ public void testDifferentCombinationsOfIndices() throws Exception { // first lets try with "admin"... all should work - PutIndexTemplateResponse putResponse = client + AcknowledgedResponse putResponse = client .filterWithHeader(Collections.singletonMap(UsernamePasswordToken.BASIC_AUTH_HEADER, basicAuthHeaderValue(transportClientUsername(), transportClientPassword()))) .admin().indices().preparePutTemplate("template1") diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/TemplateUpgraderTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/TemplateUpgraderTests.java index 7c254723868c1..2d891afea8cdd 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/TemplateUpgraderTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/TemplateUpgraderTests.java @@ -6,7 +6,7 @@ package org.elasticsearch.xpack.security; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; -import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; @@ -48,7 +48,7 @@ public void testTemplatesWorkAsExpected() throws Exception { return map; }; - PutIndexTemplateResponse putIndexTemplateResponse = client().admin().indices().preparePutTemplate("removed-template") + AcknowledgedResponse putIndexTemplateResponse = client().admin().indices().preparePutTemplate("removed-template") .setOrder(1) .setPatterns(Collections.singletonList(randomAlphaOfLength(10))) .get(); diff --git a/x-pack/plugin/upgrade/src/main/java/org/elasticsearch/xpack/upgrade/InternalIndexReindexer.java b/x-pack/plugin/upgrade/src/main/java/org/elasticsearch/xpack/upgrade/InternalIndexReindexer.java index 7e1e31919b1fc..82208f1f5ceb1 100644 --- a/x-pack/plugin/upgrade/src/main/java/org/elasticsearch/xpack/upgrade/InternalIndexReindexer.java +++ b/x-pack/plugin/upgrade/src/main/java/org/elasticsearch/xpack/upgrade/InternalIndexReindexer.java @@ -6,9 +6,9 @@ package org.elasticsearch.xpack.upgrade; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.search.SearchRequest; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.client.ParentTaskAssigningClient; import org.elasticsearch.cluster.ClusterState; @@ -109,7 +109,7 @@ private void checkMasterAndDataNodeVersion(ClusterState clusterState) { } private void removeReadOnlyBlock(ParentTaskAssigningClient parentAwareClient, String index, - ActionListener listener) { + ActionListener listener) { Settings settings = Settings.builder().put(IndexMetaData.INDEX_READ_ONLY_SETTING.getKey(), false).build(); parentAwareClient.admin().indices().prepareUpdateSettings(index).setSettings(settings).execute(listener); } diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistry.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistry.java index 6e1fb85928431..36ec856beddff 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistry.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistry.java @@ -8,7 +8,7 @@ import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; -import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterState; @@ -21,8 +21,8 @@ import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.gateway.GatewayService; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.xpack.core.watcher.support.WatcherIndexTemplateRegistryField; import org.elasticsearch.xpack.core.template.TemplateUtils; +import org.elasticsearch.xpack.core.watcher.support.WatcherIndexTemplateRegistryField; import java.nio.charset.StandardCharsets; import java.util.concurrent.ConcurrentHashMap; @@ -108,9 +108,9 @@ private void putTemplate(final TemplateConfig config, final AtomicBoolean creati PutIndexTemplateRequest request = new PutIndexTemplateRequest(templateName).source(config.load(), XContentType.JSON); request.masterNodeTimeout(TimeValue.timeValueMinutes(1)); executeAsyncWithOrigin(client.threadPool().getThreadContext(), WATCHER_ORIGIN, request, - new ActionListener() { + new ActionListener() { @Override - public void onResponse(PutIndexTemplateResponse response) { + public void onResponse(AcknowledgedResponse response) { creationCheck.set(false); if (response.isAcknowledged() == false) { logger.error("Error adding watcher template [{}], request was not acknowledged", templateName); diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/service/TransportWatcherServiceAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/service/TransportWatcherServiceAction.java index 6b2bb26ef45f0..f4fd443abe15b 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/service/TransportWatcherServiceAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/transport/actions/service/TransportWatcherServiceAction.java @@ -9,6 +9,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.master.AcknowledgedRequest; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.AckedClusterStateUpdateTask; import org.elasticsearch.cluster.ClusterState; @@ -27,9 +28,8 @@ import org.elasticsearch.xpack.core.watcher.WatcherMetaData; import org.elasticsearch.xpack.core.watcher.transport.actions.service.WatcherServiceAction; import org.elasticsearch.xpack.core.watcher.transport.actions.service.WatcherServiceRequest; -import org.elasticsearch.xpack.core.watcher.transport.actions.service.WatcherServiceResponse; -public class TransportWatcherServiceAction extends TransportMasterNodeAction { +public class TransportWatcherServiceAction extends TransportMasterNodeAction { private AckedRequest ackedRequest = new AckedRequest() { @Override @@ -57,13 +57,13 @@ protected String executor() { } @Override - protected WatcherServiceResponse newResponse() { - return new WatcherServiceResponse(); + protected AcknowledgedResponse newResponse() { + return new AcknowledgedResponse(); } @Override protected void masterOperation(WatcherServiceRequest request, ClusterState state, - ActionListener listener) { + ActionListener listener) { switch (request.getCommand()) { case STOP: setWatcherMetaDataAndWait(true, listener); @@ -74,15 +74,15 @@ protected void masterOperation(WatcherServiceRequest request, ClusterState state } } - private void setWatcherMetaDataAndWait(boolean manuallyStopped, final ActionListener listener) { + private void setWatcherMetaDataAndWait(boolean manuallyStopped, final ActionListener listener) { String source = manuallyStopped ? "update_watcher_manually_stopped" : "update_watcher_manually_started"; clusterService.submitStateUpdateTask(source, - new AckedClusterStateUpdateTask(ackedRequest, listener) { + new AckedClusterStateUpdateTask(ackedRequest, listener) { @Override - protected WatcherServiceResponse newResponse(boolean acknowledged) { - return new WatcherServiceResponse(acknowledged); + protected AcknowledgedResponse newResponse(boolean acknowledged) { + return new AcknowledgedResponse(acknowledged); } @Override diff --git a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistryTests.java b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistryTests.java index 4388b20f520c8..3201a69b486d3 100644 --- a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistryTests.java +++ b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistryTests.java @@ -8,7 +8,7 @@ import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; -import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.AdminClient; import org.elasticsearch.client.Client; import org.elasticsearch.client.IndicesAdminClient; @@ -65,8 +65,8 @@ public void createRegistryAndClient() { when(adminClient.indices()).thenReturn(indicesAdminClient); when(client.admin()).thenReturn(adminClient); doAnswer(invocationOnMock -> { - ActionListener listener = - (ActionListener) invocationOnMock.getArguments()[1]; + ActionListener listener = + (ActionListener) invocationOnMock.getArguments()[1]; listener.onResponse(new TestPutIndexTemplateResponse(true)); return null; }).when(indicesAdminClient).putTemplate(any(PutIndexTemplateRequest.class), any(ActionListener.class)); @@ -173,7 +173,7 @@ private ClusterState createClusterState(String ... existingTemplates) { return ClusterState.builder(new ClusterName("foo")).metaData(metaDataBuilder.build()).build(); } - private static class TestPutIndexTemplateResponse extends PutIndexTemplateResponse { + private static class TestPutIndexTemplateResponse extends AcknowledgedResponse { TestPutIndexTemplateResponse(boolean acknowledged) { super(acknowledged); } diff --git a/x-pack/protocol/src/main/java/org/elasticsearch/protocol/xpack/license/DeleteLicenseResponse.java b/x-pack/protocol/src/main/java/org/elasticsearch/protocol/xpack/license/DeleteLicenseResponse.java deleted file mode 100644 index 596af7f2f90e4..0000000000000 --- a/x-pack/protocol/src/main/java/org/elasticsearch/protocol/xpack/license/DeleteLicenseResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.elasticsearch.protocol.xpack.license; - -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.xcontent.XContentParser; - -public class DeleteLicenseResponse extends AcknowledgedResponse { - - public DeleteLicenseResponse() { - } - - public DeleteLicenseResponse(boolean acknowledged) { - super(acknowledged); - } - - public static DeleteLicenseResponse fromXContent(XContentParser parser) { - return new DeleteLicenseResponse(parseAcknowledged(parser)); - } -} diff --git a/x-pack/protocol/src/test/java/org/elasticsearch/protocol/xpack/license/DeleteLicenseResponseTests.java b/x-pack/protocol/src/test/java/org/elasticsearch/protocol/xpack/license/DeleteLicenseResponseTests.java deleted file mode 100644 index f4caa1f42421d..0000000000000 --- a/x-pack/protocol/src/test/java/org/elasticsearch/protocol/xpack/license/DeleteLicenseResponseTests.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.elasticsearch.protocol.xpack.license; - -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; - -public class DeleteLicenseResponseTests extends AbstractStreamableXContentTestCase { - - @Override - protected boolean supportsUnknownFields() { - return true; - } - - @Override - protected DeleteLicenseResponse createTestInstance() { - return new DeleteLicenseResponse(randomBoolean()); - } - - @Override - protected DeleteLicenseResponse doParseInstance(XContentParser parser) { - return DeleteLicenseResponse.fromXContent(parser); - } - - @Override - protected DeleteLicenseResponse createBlankInstance() { - return new DeleteLicenseResponse(); - } - - @Override - protected DeleteLicenseResponse mutateInstance(DeleteLicenseResponse response) { - return new DeleteLicenseResponse(!response.isAcknowledged()); - } -} diff --git a/x-pack/qa/audit-tests/src/test/java/org/elasticsearch/xpack/security/audit/IndexAuditIT.java b/x-pack/qa/audit-tests/src/test/java/org/elasticsearch/xpack/security/audit/IndexAuditIT.java index a8155b785b33e..c0111e57c7448 100644 --- a/x-pack/qa/audit-tests/src/test/java/org/elasticsearch/xpack/security/audit/IndexAuditIT.java +++ b/x-pack/qa/audit-tests/src/test/java/org/elasticsearch/xpack/security/audit/IndexAuditIT.java @@ -7,9 +7,9 @@ import com.carrotsearch.hppc.cursors.ObjectCursor; import org.apache.http.message.BasicHeader; -import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.client.Request; import org.elasticsearch.client.RequestOptions; @@ -28,8 +28,8 @@ import org.elasticsearch.test.TestCluster; import org.elasticsearch.xpack.core.XPackClientPlugin; import org.elasticsearch.xpack.core.security.SecurityField; -import org.elasticsearch.xpack.security.audit.index.IndexAuditTrail; import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken; +import org.elasticsearch.xpack.security.audit.index.IndexAuditTrail; import java.io.IOException; import java.net.InetSocketAddress; @@ -132,7 +132,7 @@ public void testAuditTrailTemplateIsRecreatedAfterDelete() throws Exception { awaitIndexTemplateCreation(); // delete the template - DeleteIndexTemplateResponse deleteResponse = client().admin().indices() + AcknowledgedResponse deleteResponse = client().admin().indices() .prepareDeleteTemplate(IndexAuditTrail.INDEX_TEMPLATE_NAME).execute().actionGet(); assertThat(deleteResponse.isAcknowledged(), is(true)); awaitIndexTemplateCreation(); diff --git a/x-pack/qa/ml-native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java b/x-pack/qa/ml-native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java index 23bd9dc849561..ccef7c3f2e181 100644 --- a/x-pack/qa/ml-native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java +++ b/x-pack/qa/ml-native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java @@ -9,6 +9,7 @@ import org.elasticsearch.Version; import org.elasticsearch.action.admin.cluster.node.hotthreads.NodeHotThreads; import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.common.util.concurrent.ConcurrentMapLong; @@ -186,7 +187,7 @@ public void testRealtime_givenSimultaneousStopAndForceDelete() throws Throwable try { DeleteDatafeedAction.Request request = new DeleteDatafeedAction.Request(datafeedId); request.setForce(true); - DeleteDatafeedAction.Response response = client().execute(DeleteDatafeedAction.INSTANCE, request).actionGet(); + AcknowledgedResponse response = client().execute(DeleteDatafeedAction.INSTANCE, request).actionGet(); if (response.isAcknowledged()) { GetDatafeedsStatsAction.Request statsRequest = new GetDatafeedsStatsAction.Request(datafeedId); expectThrows(ResourceNotFoundException.class, diff --git a/x-pack/qa/ml-native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java b/x-pack/qa/ml-native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java index 74a026ed5adb4..1fd0eddf41ced 100644 --- a/x-pack/qa/ml-native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java +++ b/x-pack/qa/ml-native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlNativeAutodetectIntegTestCase.java @@ -8,6 +8,7 @@ import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterModule; import org.elasticsearch.cluster.ClusterState; @@ -213,7 +214,7 @@ protected PutJobAction.Response putJob(Job.Builder job) { return client().execute(PutJobAction.INSTANCE, request).actionGet(); } - protected OpenJobAction.Response openJob(String jobId) { + protected AcknowledgedResponse openJob(String jobId) { OpenJobAction.Request request = new OpenJobAction.Request(jobId); return client().execute(OpenJobAction.INSTANCE, request).actionGet(); } @@ -234,7 +235,7 @@ protected PutJobAction.Response updateJob(String jobId, JobUpdate update) { return client().execute(UpdateJobAction.INSTANCE, request).actionGet(); } - protected DeleteJobAction.Response deleteJob(String jobId) { + protected AcknowledgedResponse deleteJob(String jobId) { DeleteJobAction.Request request = new DeleteJobAction.Request(jobId); return client().execute(DeleteJobAction.INSTANCE, request).actionGet(); } @@ -249,12 +250,12 @@ protected StopDatafeedAction.Response stopDatafeed(String datafeedId) { return client().execute(StopDatafeedAction.INSTANCE, request).actionGet(); } - protected DeleteDatafeedAction.Response deleteDatafeed(String datafeedId) { + protected AcknowledgedResponse deleteDatafeed(String datafeedId) { DeleteDatafeedAction.Request request = new DeleteDatafeedAction.Request(datafeedId); return client().execute(DeleteDatafeedAction.INSTANCE, request).actionGet(); } - protected StartDatafeedAction.Response startDatafeed(String datafeedId, long start, Long end) { + protected AcknowledgedResponse startDatafeed(String datafeedId, long start, Long end) { StartDatafeedAction.Request request = new StartDatafeedAction.Request(datafeedId, start); request.getParams().setEndTime(end); return client().execute(StartDatafeedAction.INSTANCE, request).actionGet(); diff --git a/x-pack/qa/transport-client-tests/src/test/java/org/elasticsearch/xpack/ml/client/MLTransportClientIT.java b/x-pack/qa/transport-client-tests/src/test/java/org/elasticsearch/xpack/ml/client/MLTransportClientIT.java index 406b354e57439..dceb2d1398ab9 100644 --- a/x-pack/qa/transport-client-tests/src/test/java/org/elasticsearch/xpack/ml/client/MLTransportClientIT.java +++ b/x-pack/qa/transport-client-tests/src/test/java/org/elasticsearch/xpack/ml/client/MLTransportClientIT.java @@ -5,6 +5,7 @@ */ package org.elasticsearch.xpack.ml.client; +import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.Client; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.unit.TimeValue; @@ -62,7 +63,7 @@ public void testMLTransportClient_JobActions() { assertThat(getJobResponse.getResponse().count(), equalTo(1L)); // Open job POST data, flush, close and check a result - OpenJobAction.Response openJobResponse = mlClient.openJob(new OpenJobAction.Request(jobId)).actionGet(); + AcknowledgedResponse openJobResponse = mlClient.openJob(new OpenJobAction.Request(jobId)).actionGet(); assertThat(openJobResponse.isAcknowledged(), equalTo(true)); String content = "{\"time\":1000, \"msg\": \"some categorical message\"}\n" + @@ -97,7 +98,7 @@ public void testMLTransportClient_JobActions() { assertThat(updateModelSnapshotResponse.getModel().getDescription(), equalTo("Changed description")); // and delete the job - DeleteJobAction.Response deleteJobResponse = mlClient.deleteJob(new DeleteJobAction.Request(jobId)).actionGet(); + AcknowledgedResponse deleteJobResponse = mlClient.deleteJob(new DeleteJobAction.Request(jobId)).actionGet(); assertThat(deleteJobResponse, notNullValue()); assertThat(deleteJobResponse.isAcknowledged(), equalTo(true)); } @@ -110,12 +111,12 @@ public void testMLTransportClient_ValidateActions() { Detector.Builder detector = new Detector.Builder(); detector.setFunction("count"); ValidateDetectorAction.Request validateDetectorRequest = new ValidateDetectorAction.Request(detector.build()); - ValidateDetectorAction.Response validateDetectorResponse = mlClient.validateDetector(validateDetectorRequest).actionGet(); + AcknowledgedResponse validateDetectorResponse = mlClient.validateDetector(validateDetectorRequest).actionGet(); assertThat(validateDetectorResponse.isAcknowledged(), equalTo(true)); Job.Builder job = createJob("ml-transport-client-it-validate-job"); ValidateJobConfigAction.Request validateJobRequest = new ValidateJobConfigAction.Request(job.build(new Date())); - ValidateJobConfigAction.Response validateJobResponse = mlClient.validateJobConfig(validateJobRequest).actionGet(); + AcknowledgedResponse validateJobResponse = mlClient.validateJobConfig(validateJobRequest).actionGet(); assertThat(validateJobResponse.isAcknowledged(), equalTo(true)); } @@ -144,7 +145,7 @@ public void testMLTransportClient_DateFeedActions() { assertThat(getDatafeedResponse.getResponse(), notNullValue()); // Open job before starting the datafeed - OpenJobAction.Response openJobResponse = mlClient.openJob(new OpenJobAction.Request(jobId)).actionGet(); + AcknowledgedResponse openJobResponse = mlClient.openJob(new OpenJobAction.Request(jobId)).actionGet(); assertThat(openJobResponse.isAcknowledged(), equalTo(true)); // create the index for the data feed @@ -154,7 +155,7 @@ public void testMLTransportClient_DateFeedActions() { client.prepareIndex(datafeedIndex, datatype).setSource(source).get(); StartDatafeedAction.Request startDatafeedRequest = new StartDatafeedAction.Request(datafeedId, new Date().getTime()); - StartDatafeedAction.Response startDataFeedResponse = mlClient.startDatafeed(startDatafeedRequest).actionGet(); + AcknowledgedResponse startDataFeedResponse = mlClient.startDatafeed(startDatafeedRequest).actionGet(); assertThat(startDataFeedResponse.isAcknowledged(), equalTo(true)); StopDatafeedAction.Response stopDataFeedResponse = mlClient.stopDatafeed(new StopDatafeedAction.Request(datafeedId)).actionGet();