mirror of https://github.com/apache/lucene.git
refactor /cluster/aliases V2 API to use annotations
This commit is contained in:
parent
4d7b2aebfe
commit
d1a5b9df02
|
@ -72,6 +72,13 @@ public class ClusterAPI {
|
|||
this.configSetsHandler = configSetsHandler;
|
||||
}
|
||||
|
||||
@EndPoint(method = GET,
|
||||
path = "/cluster/aliases",
|
||||
permission = COLL_READ_PERM)
|
||||
public void aliases(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
|
||||
CollectionsHandler.CollectionOperation.LISTALIASES_OP.execute(req, rsp, getCoreContainer().getCollectionsHandler());
|
||||
}
|
||||
|
||||
@EndPoint(method = GET,
|
||||
path = "/cluster/overseer",
|
||||
permission = COLL_READ_PERM)
|
||||
|
|
|
@ -18,13 +18,6 @@
|
|||
package org.apache.solr.client.solrj.request;
|
||||
|
||||
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.request.beans.V2ApiConstants;
|
||||
import org.apache.solr.common.params.CollectionParams.CollectionAction;
|
||||
import org.apache.solr.common.util.CommandOperation;
|
||||
import org.apache.solr.common.util.Pair;
|
||||
import org.apache.solr.common.util.Utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
@ -34,10 +27,36 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.request.beans.V2ApiConstants;
|
||||
import org.apache.solr.common.params.CollectionParams.CollectionAction;
|
||||
import org.apache.solr.common.util.CommandOperation;
|
||||
import org.apache.solr.common.util.Pair;
|
||||
import org.apache.solr.common.util.Utils;
|
||||
|
||||
import static org.apache.solr.client.solrj.SolrRequest.METHOD.DELETE;
|
||||
import static org.apache.solr.client.solrj.SolrRequest.METHOD.*;
|
||||
import static org.apache.solr.client.solrj.request.CollectionApiMapping.EndPoint.*;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.*;
|
||||
import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;
|
||||
import static org.apache.solr.client.solrj.SolrRequest.METHOD.POST;
|
||||
import static org.apache.solr.client.solrj.request.CollectionApiMapping.EndPoint.COLLECTION_STATE;
|
||||
import static org.apache.solr.client.solrj.request.CollectionApiMapping.EndPoint.PER_COLLECTION;
|
||||
import static org.apache.solr.client.solrj.request.CollectionApiMapping.EndPoint.PER_COLLECTION_PER_SHARD_COMMANDS;
|
||||
import static org.apache.solr.client.solrj.request.CollectionApiMapping.EndPoint.PER_COLLECTION_PER_SHARD_DELETE;
|
||||
import static org.apache.solr.client.solrj.request.CollectionApiMapping.EndPoint.PER_COLLECTION_PER_SHARD_PER_REPLICA_DELETE;
|
||||
import static org.apache.solr.client.solrj.request.CollectionApiMapping.EndPoint.PER_COLLECTION_SHARDS_COMMANDS;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.ADDREPLICA;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.BALANCESHARDUNIQUE;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.CLUSTERSTATUS;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.COLLECTIONPROP;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.CREATESHARD;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.DELETEREPLICA;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.DELETEREPLICAPROP;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.DELETESHARD;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.MIGRATE;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.MODIFYCOLLECTION;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.MOVEREPLICA;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.REBALANCELEADERS;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.RELOAD;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.SPLITSHARD;
|
||||
import static org.apache.solr.common.params.CommonParams.NAME;
|
||||
|
||||
/**
|
||||
|
@ -48,7 +67,6 @@ public class CollectionApiMapping {
|
|||
|
||||
public enum Meta implements CommandMeta {
|
||||
GET_A_COLLECTION(COLLECTION_STATE, GET, CLUSTERSTATUS),
|
||||
LIST_ALIASES(CLUSTER_ALIASES, GET, LISTALIASES),
|
||||
RELOAD_COLL(PER_COLLECTION,
|
||||
POST,
|
||||
RELOAD,
|
||||
|
@ -250,7 +268,6 @@ public class CollectionApiMapping {
|
|||
}
|
||||
|
||||
public enum EndPoint implements V2EndPoint {
|
||||
CLUSTER_ALIASES("cluster.aliases"),
|
||||
COLLECTION_STATE("collections.collection"),
|
||||
PER_COLLECTION("collections.collection.Commands"),
|
||||
PER_COLLECTION_SHARDS_COMMANDS("collections.collection.shards.Commands"),
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"documentation": "https://lucene.apache.org/solr/guide/collection-aliasing.html",
|
||||
"description": "Provides list of collection aliases.",
|
||||
"methods": [
|
||||
"GET"
|
||||
],
|
||||
"url": {
|
||||
"paths": [
|
||||
"/cluster/aliases"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -57,6 +57,11 @@ public class TestV2Request extends SolrCloudTestCase {
|
|||
List l = (List) rsp._get("nodes",null);
|
||||
assertNotNull(l);
|
||||
assertFalse(l.isEmpty());
|
||||
rsp = new V2Request.Builder("/cluster/aliases")
|
||||
.forceV2(true)
|
||||
.withMethod(SolrRequest.METHOD.GET).build()
|
||||
.process(cluster.getSolrClient());
|
||||
assertTrue(rsp.getResponse().indexOf("aliases", 0) > -1);
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
Loading…
Reference in New Issue