noblepaul commented on a change in pull request #1996:
URL: https://github.com/apache/lucene-solr/pull/1996#discussion_r507004619



##########
File path: solr/core/src/java/org/apache/solr/handler/ClusterAPI.java
##########
@@ -133,6 +134,62 @@ public void create(PayloadObj<CreateConfigInfo> obj) 
throws Exception {
 
   }
 
+  @EndPoint(method = POST,
+      path =   "/cluster/configs/{name}",
+      permission = CONFIG_EDIT_PERM
+  )
+  public void uploadConfigSet(SolrQueryRequest req, SolrQueryResponse rsp) 
throws Exception {
+    req = wrapParams(req,
+            "action", ConfigSetParams.ConfigSetAction.UPLOAD.toString(),
+            CommonParams.NAME, req.getPathTemplateValues().get("name"));
+    configSetsHandler.handleRequestBody(req, rsp);
+  }
+
+  @EndPoint(method = PUT,
+      path =   "/cluster/configs/{name}",
+      permission = CONFIG_EDIT_PERM
+  )
+  public void uploadConfigSetWithOverwrite(SolrQueryRequest req, 
SolrQueryResponse rsp) throws Exception {
+    req = wrapParams(req,
+            "action", ConfigSetParams.ConfigSetAction.UPLOAD.toString(),
+            CommonParams.NAME, req.getPathTemplateValues().get("name"),
+            ConfigSetParams.OVERWRITE, true,
+            ConfigSetParams.CLEANUP, 
req.getParams().getBool(ConfigSetParams.CLEANUP, false));
+    configSetsHandler.handleRequestBody(req, rsp);
+  }
+
+  @EndPoint(method = POST,

Review comment:
       Let's use a proper REST mechanism here
   
   `path ="/cluster/configs/{configname}/*`

##########
File path: solr/core/src/java/org/apache/solr/handler/ClusterAPI.java
##########
@@ -133,6 +134,62 @@ public void create(PayloadObj<CreateConfigInfo> obj) 
throws Exception {
 
   }
 
+  @EndPoint(method = POST,
+      path =   "/cluster/configs/{name}",
+      permission = CONFIG_EDIT_PERM
+  )
+  public void uploadConfigSet(SolrQueryRequest req, SolrQueryResponse rsp) 
throws Exception {
+    req = wrapParams(req,
+            "action", ConfigSetParams.ConfigSetAction.UPLOAD.toString(),
+            CommonParams.NAME, req.getPathTemplateValues().get("name"));
+    configSetsHandler.handleRequestBody(req, rsp);
+  }
+
+  @EndPoint(method = PUT,
+      path =   "/cluster/configs/{name}",
+      permission = CONFIG_EDIT_PERM
+  )
+  public void uploadConfigSetWithOverwrite(SolrQueryRequest req, 
SolrQueryResponse rsp) throws Exception {
+    req = wrapParams(req,
+            "action", ConfigSetParams.ConfigSetAction.UPLOAD.toString(),
+            CommonParams.NAME, req.getPathTemplateValues().get("name"),
+            ConfigSetParams.OVERWRITE, true,
+            ConfigSetParams.CLEANUP, 
req.getParams().getBool(ConfigSetParams.CLEANUP, false));
+    configSetsHandler.handleRequestBody(req, rsp);
+  }
+
+  @EndPoint(method = POST,
+      path =   "/cluster/configs/{name}/file",
+      permission = CONFIG_EDIT_PERM
+  )
+  public void insertIntoConfigSet(SolrQueryRequest req, SolrQueryResponse rsp) 
throws Exception {
+    String path = req.getParams().get(ConfigSetParams.PATH);
+    if (path == null || path.isBlank()) {
+      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "In order 
to insert a file into a configSet, a valid 'path' parameter must be provided.");
+    }
+    req = wrapParams(req,
+            "action", ConfigSetParams.ConfigSetAction.UPLOAD.toString(),
+            CommonParams.NAME, req.getPathTemplateValues().get("name"));
+    configSetsHandler.handleRequestBody(req, rsp);
+  }
+
+  @EndPoint(method = PUT,
+      path =   "/cluster/configs/{name}/file",

Review comment:
       same as above




----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to