Rename /_x-pack/monitoring/* to /_xpack/monitoring/*

This PR just drops the - in the existing REST API name by changing the base MonitoringRestHandler to extend
XPackRestHandler instead of BaseRestHandler directly, and using its URI_BASE.

Original commit: elastic/x-pack-elasticsearch@1bed2dba31
This commit is contained in:
Chris Earle 2016-05-17 18:23:27 -04:00
parent 5bf3b7054c
commit ecf4c30979
4 changed files with 9 additions and 22 deletions

View File

@ -7,26 +7,13 @@ package org.elasticsearch.marvel.rest;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.marvel.client.MonitoringClient;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.xpack.XPackPlugin;
import org.elasticsearch.xpack.rest.XPackRestHandler;
import java.util.Locale;
public abstract class MonitoringRestHandler extends XPackRestHandler {
public abstract class MonitoringRestHandler extends BaseRestHandler {
protected static String URI_BASE = String.format(Locale.ROOT, "/_%s/monitoring", XPackPlugin.NAME);
protected static String URI_BASE = XPackRestHandler.URI_BASE + "/monitoring";
public MonitoringRestHandler(Settings settings, Client client) {
super(settings, client);
}
@Override
protected final void handleRequest(RestRequest request, RestChannel channel, Client client) throws Exception {
handleRequest(request, channel, new MonitoringClient(client));
}
protected abstract void handleRequest(RestRequest request, RestChannel channel, MonitoringClient client) throws Exception;
}

View File

@ -13,7 +13,6 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.marvel.action.MonitoringBulkRequestBuilder;
import org.elasticsearch.marvel.action.MonitoringBulkResponse;
import org.elasticsearch.marvel.client.MonitoringClient;
import org.elasticsearch.marvel.rest.MonitoringRestHandler;
import org.elasticsearch.rest.BytesRestResponse;
import org.elasticsearch.rest.RestChannel;
@ -22,6 +21,7 @@ import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.action.support.RestActions;
import org.elasticsearch.rest.action.support.RestBuilderListener;
import org.elasticsearch.xpack.XPackClient;
import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.rest.RestRequest.Method.PUT;
@ -41,7 +41,7 @@ public class RestMonitoringBulkAction extends MonitoringRestHandler {
}
@Override
protected void handleRequest(RestRequest request, RestChannel channel, MonitoringClient client) throws Exception {
protected void handleRequest(RestRequest request, RestChannel channel, XPackClient client) throws Exception {
String defaultType = request.param("type");
String id = request.param(MONITORING_ID);
@ -57,7 +57,7 @@ public class RestMonitoringBulkAction extends MonitoringRestHandler {
throw new ElasticsearchParseException("no body content for monitoring bulk request");
}
MonitoringBulkRequestBuilder requestBuilder = client.prepareMonitoringBulk();
MonitoringBulkRequestBuilder requestBuilder = client.monitoring().prepareMonitoringBulk();
requestBuilder.add(request.content(), id, version, defaultType);
requestBuilder.execute(new RestBuilderListener<MonitoringBulkResponse>(channel) {
@Override

View File

@ -3,8 +3,8 @@
"documentation": "http://www.elastic.co/guide/en/marvel/current/appendix-api-bulk.html",
"methods": ["POST", "PUT"],
"url": {
"path": "/_x-pack/monitoring/_bulk",
"paths": ["/_x-pack/monitoring/_bulk", "/_x-pack/monitoring/{type}/_bulk"],
"path": "/_xpack/monitoring/_bulk",
"paths": ["/_xpack/monitoring/_bulk", "/_xpack/monitoring/{type}/_bulk"],
"parts": {
"type": {
"type" : "string",

View File

@ -17,7 +17,7 @@ import org.elasticsearch.xpack.XPackClient;
*/
public abstract class XPackRestHandler extends BaseRestHandler {
protected static String URI_BASE = "_xpack";
protected static String URI_BASE = "/_xpack";
public XPackRestHandler(Settings settings, Client client) {
super(settings, client);