iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139165973


##########
solr/core/src/java/org/apache/solr/handler/admin/api/GetClusterStatus.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.apache.solr.handler.admin.api;
+
+import static 
org.apache.solr.security.PermissionNameProvider.Name.COLL_READ_PERM;
+
+import jakarta.inject.Inject;
+import java.util.Map;
+import org.apache.solr.client.api.endpoint.GetClusterStatusApi;
+import org.apache.solr.client.api.model.GetClusterStatusResponse;
+import 
org.apache.solr.client.api.model.GetClusterStatusResponse.CollectionState;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.params.ShardParams;
+import org.apache.solr.common.util.CollectionUtil;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.handler.admin.ClusterStatus;
+import org.apache.solr.jersey.PermissionName;
+import org.apache.solr.jersey.SolrJacksonMapper;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.response.SolrQueryResponse;
+
+/**
+ * V2 API for the collections, shards, and replicas tree.
+ *
+ * <p>{@code GET /api/cluster} returns that tree and nothing else hanging off 
the cluster object.
+ * Live nodes, aliases, and cluster properties stay on their own endpoints. v1 
{@code CLUSTERSTATUS}
+ * is unchanged.
+ */
+public class GetClusterStatus extends AdminAPIBase implements 
GetClusterStatusApi {
+
+  @Inject
+  public GetClusterStatus(
+      CoreContainer coreContainer, SolrQueryRequest req, SolrQueryResponse 
rsp) {
+    super(coreContainer, req, rsp);
+  }
+
+  @Override
+  @PermissionName(COLL_READ_PERM)
+  public GetClusterStatusResponse getClusterStatus(
+      String collection, String shard, String routeKey, Boolean prs) throws 
Exception {
+    final GetClusterStatusResponse response =
+        instantiateJerseyResponse(GetClusterStatusResponse.class);
+    validateZooKeeperAwareCoreContainer(coreContainer);
+    if (collection != null) {
+      recordCollectionForLogAndTracing(collection, solrQueryRequest);
+    }
+
+    // Only the parameters this API documents. includeAll, liveNodes, aliases, 
and

Review Comment:
   > I wish we returned HTTP 400 for all unknown / unsupported params. Since a 
caller asking for live_nodes won’t get them, so fail fast.
   
   i’d like that too as a broader jersey/v2 convention :) but i’m leaving it 
out of this PR. we already walked back a bare-GET 400 because solr-operator and 
the admin UI both need the full tree with no selector. rejecting the old v1 
knobs here would be a one-off, and random undeclared query params are ignored 
by jersey today the same way. happy to do a follow-up that fails unknown params 
more widely if we want that policy :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to