You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "gerlowskija (via GitHub)" <gi...@apache.org> on 2023/02/10 20:06:35 UTC

[GitHub] [solr] gerlowskija commented on a diff in pull request #1332: SOLR-16393 Cosmetic, REST-fulness improvements to v2 alias, alias-prop

gerlowskija commented on code in PR #1332:
URL: https://github.com/apache/solr/pull/1332#discussion_r1103164492


##########
solr/core/src/java/org/apache/solr/handler/admin/api/GetAliasesAPI.java:
##########
@@ -0,0 +1,99 @@
+/*
+ * 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.client.solrj.impl.BinaryResponseParser.BINARY_CONTENT_TYPE_V2;
+import static org.apache.solr.security.PermissionNameProvider.Name.COLL_READ_PERM;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import javax.inject.Inject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import org.apache.solr.common.cloud.Aliases;
+import org.apache.solr.common.cloud.ZkStateReader;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.jersey.PermissionName;
+import org.apache.solr.jersey.SolrJerseyResponse;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.response.SolrQueryResponse;
+
+/**
+ * V2 APIs for listing aliases
+ *
+ * <p>This API <code>GET /api/aliases</code> is analogous to the v1 <code>GET /api/cluster/aliases
+ * </code> API.
+ */
+@Path("/aliases")
+public class GetAliasesAPI extends AdminAPIBase {

Review Comment:
   [0] Nitpick that you can def ignore, but I'd prefer the name `ListAliasesAPI` for this class instead.  Right now Solr has no API to fetch information about a single alias, but it'd be a reasonable API to add at some point.  And if that ever happens, it'd be hard for a reader to distinguish between GetAliasesAPI and GetAliasAPI without a double-take 😆 



##########
solr/core/src/java/org/apache/solr/jersey/SolrRequestAuthorizer.java:
##########
@@ -66,7 +67,9 @@ public void filter(ContainerRequestContext requestContext) throws IOException {
         (AuthorizationContext.RequestType)
             requestContext.getProperty(RequestContextKeys.REQUEST_TYPE);
     final List<String> collectionNames =
-        (List<String>) requestContext.getProperty(RequestContextKeys.COLLECTION_LIST);
+        Objects.requireNonNullElse(

Review Comment:
   [Q] This seems like a reasonable change, but I'm curious how its related to the rest of the PR.  Did you run into an NPE while writing the tests, or did it come up some other way?



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org