james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [james-project] 07/11: JAMES-2711 Add document for DeleteAPI of DMVRoutes
Date Thu, 18 Apr 2019 07:00:22 GMT
This is an automated email from the ASF dual-hosted git repository.

aduprat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit b8a1afec83db928ef20970d330d303ccbcd340dd
Author: datph <dphamhoang@linagora.com>
AuthorDate: Tue Apr 9 15:45:25 2019 +0700

    JAMES-2711 Add document for DeleteAPI of DMVRoutes
---
 .../vault/routes/DeletedMessagesVaultRoutes.java   | 15 +++++-----
 src/site/markdown/server/manage-webadmin.md        | 34 +++++++++++++++++++---
 2 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRoutes.java
b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRoutes.java
index e2faa4c..37acd23 100644
--- a/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRoutes.java
+++ b/server/protocols/webadmin/webadmin-mailbox-deleted-message-vault/src/main/java/org/apache/james/webadmin/vault/routes/DeletedMessagesVaultRoutes.java
@@ -140,12 +140,11 @@ public class DeletedMessagesVaultRoutes implements Routes {
 
     public static final String ROOT_PATH = "deletedMessages";
     public static final String USERS = "users";
-    public static final String USER_PATH = ROOT_PATH + SEPARATOR + USERS;
     private static final String USER_PATH_PARAM = ":user";
     static final String MESSAGE_PATH_PARAM = "messages";
     private static final String MESSAGE_ID_PARAM = ":messageId";
-    private static final String RESTORE_PATH = USER_PATH + SEPARATOR + USER_PATH_PARAM;
-    private static final String DELETE_PATH = USER_PATH + SEPARATOR + USER_PATH_PARAM + SEPARATOR
+ MESSAGE_PATH_PARAM + SEPARATOR + MESSAGE_ID_PARAM;
+    static final String USER_PATH = ROOT_PATH + SEPARATOR + USERS + SEPARATOR + USER_PATH_PARAM;
+    private static final String DELETE_PATH = ROOT_PATH + SEPARATOR + USERS + SEPARATOR +
USER_PATH_PARAM + SEPARATOR + MESSAGE_PATH_PARAM + SEPARATOR + MESSAGE_ID_PARAM;
     private static final String SCOPE_QUERY_PARAM = "scope";
     private static final String ACTION_QUERY_PARAM = "action";
     private static final String EXPORT_TO_QUERY_PARAM = "exportTo";
@@ -183,14 +182,15 @@ public class DeletedMessagesVaultRoutes implements Routes {
 
     @Override
     public void define(Service service) {
-        service.post(RESTORE_PATH, this::userActions, jsonTransformer);
+        service.post(USER_PATH, this::userActions, jsonTransformer);
         service.delete(ROOT_PATH, this::deleteWithScope, jsonTransformer);
         service.delete(DELETE_PATH, this::deleteMessage, jsonTransformer);
     }
 
     @POST
-    @Path(USER_PATH)
-    @ApiOperation(value = "Restore deleted emails from a specified user to his new restore
mailbox")
+    @Path("users/{user}")
+    @ApiOperation(value = "Restore deleted emails from a specified user to his new restore
mailbox" +
+        " or export their content to a destination mail address")
     @ApiImplicitParams({
         @ApiImplicitParam(
             required = true,
@@ -231,7 +231,6 @@ public class DeletedMessagesVaultRoutes implements Routes {
     }
 
     @DELETE
-    @Path(ROOT_PATH)
     @ApiOperation(value = "Purge all expired messages based on retentionPeriod of deletedMessageVault
configuration")
     @ApiImplicitParams({
         @ApiImplicitParam(
@@ -254,7 +253,7 @@ public class DeletedMessagesVaultRoutes implements Routes {
     }
 
     @DELETE
-    @Path(DELETE_PATH)
+    @Path("users/{user}/messages/{messageId}")
     @ApiOperation(value = "Delete message with messageId")
     @ApiImplicitParams({
         @ApiImplicitParam(
diff --git a/src/site/markdown/server/manage-webadmin.md b/src/site/markdown/server/manage-webadmin.md
index 98ef7fb..a1b9a4a 100644
--- a/src/site/markdown/server/manage-webadmin.md
+++ b/src/site/markdown/server/manage-webadmin.md
@@ -2644,6 +2644,7 @@ Here are the following actions available on the 'Deleted Messages Vault'
  - [Restore Deleted Messages](#Restore_deleted_messages)
  - [Export Deleted Messages](#Export_deleted_messages)
  - [Purge Deleted Messages](#Purge_deleted_messages)
+ - [Permanently remove Deleted Message](#Permanently_remove_deleted_message) 
 
  Note that the 'Deleted Messages Vault' feature is only supported on top of Cassandra-Guice.
 
@@ -2820,9 +2821,9 @@ while:
  
 ### Purge Deleted Messages
  
-You can overwrite 'retentionPeriod' configuration in deletedMessageVault or use default value
is 1 year.
+You can overwrite 'retentionPeriod' configuration in 'deletedMessageVault' configuration
file or use default value is 1 year.
 
-Delete all expired deleted messages with 'retentionPeriod' configured.
+Purge all deleted messages older than configured 'retentionPeriod'
 
 ```
 curl -XDEL http://ip:port/deletedMessages?scope=expired
@@ -2835,12 +2836,37 @@ Response code:
    - action query param is not present
    - action query param is not a valid action
 
-You may want to call this endpoint on a regular basis. Example:
+You may want to call this endpoint on a regular basis.
+
+### Permanently remove Deleted Message
+
+Delete a Deleted Message with MessageId
 
 ```
-0 0 * * * /usr/bin/curl --request POST http://ip:port/deletedMessages?action=purge >/dev/null
2>&1
+curl -XDEL http://ip:port/deletedMessages/users/user@domain.ext/messages/3294a976-ce63-491e-bd52-1b6f465ed7a2
 ```
 
+Response code:
+
+ - 201: Task for deleting message has been created
+ - 400: Bad request: 
+   - user parameter is invalid
+   - messageId parameter is invalid
+ - 404: User not found
+ 
+ The scheduled task will have the following type `deletedMessages/delete` and the following
`additionalInformation`:
+ 
+ ```
+ {
+   "user": "user@domain.ext",
+   "deleteMessageId": "3294a976-ce63-491e-bd52-1b6f465ed7a2"
+ }
+ ```
+ 
+while:
+ - user: delete deleted messages from this user
+ - deleteMessageId: messageId of deleted messages will be delete
+
 ## Task management
 
 Some webadmin features schedules tasks. The task management API allow to monitor and manage
the execution of the following tasks.


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message