asfgit closed pull request #1350: DRILL-4580: Support for exporting storage 
plugin configurations
URL: https://github.com/apache/drill/pull/1350
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java
index ca108606ca..b6f839ba8f 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java
@@ -35,6 +35,7 @@
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
 import javax.ws.rs.core.SecurityContext;
 import javax.xml.bind.annotation.XmlRootElement;
 
@@ -134,6 +135,15 @@ public JsonResult enablePlugin(@PathParam("name") String 
name, @PathParam("val")
     }
   }
 
+  @GET
+  @Path("/storage/{name}/export")
+  @Produces(MediaType.APPLICATION_JSON)
+  public Response exportPlugin(@PathParam("name") String name) {
+    Response.ResponseBuilder response = 
Response.ok(getStoragePluginJSON(name));
+    response.header("Content-Disposition", 
String.format("attachment;filename=\"%s.json\"", name));
+    return response.build();
+  }
+
   @DELETE
   @Path("/storage/{name}.json")
   @Produces(MediaType.APPLICATION_JSON)
diff --git a/exec/java-exec/src/main/resources/rest/storage/list.ftl 
b/exec/java-exec/src/main/resources/rest/storage/list.ftl
index ca20063835..7dfcf2591a 100644
--- a/exec/java-exec/src/main/resources/rest/storage/list.ftl
+++ b/exec/java-exec/src/main/resources/rest/storage/list.ftl
@@ -38,6 +38,7 @@
               <td style="border:none;">
                 <a class="btn btn-primary" 
href="/storage/${plugin.getName()}">Update</a>
                 <a class="btn btn-default" 
onclick="doEnable('${plugin.getName()}', false)">Disable</a>
+                <a class="btn btn-default" 
href="/storage/${plugin.getName()}/export"">Export</a>
               </td>
             </tr>
           </#if>
diff --git a/exec/java-exec/src/main/resources/rest/storage/update.ftl 
b/exec/java-exec/src/main/resources/rest/storage/update.ftl
index a15cc98652..a30b65ee7e 100644
--- a/exec/java-exec/src/main/resources/rest/storage/update.ftl
+++ b/exec/java-exec/src/main/resources/rest/storage/update.ftl
@@ -48,6 +48,7 @@
       <#else>
         <a id="enabled" class="btn btn-primary">Enable</a>
       </#if>
+      <a class="btn btn-default" 
href="/storage/${model.getName()}/export"">Export</a>
       <a id="del" class="btn btn-danger" onclick="deleteFunction()">Delete</a>
     </#if>
   </form>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

Reply via email to