mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(backup): return the deleted plan's id, ARN, version and deletion date from DeleteBackupPlan (#7276)
This commit is contained in:
1 parent
3cc7551613
commit
1f0b4cffca
3 files changed
+32
-6
No files matched your search
@@ -310,8 +310,13 @@ public class BackupController {
|
||||
@DELETE
|
||||
@Path("/backup/plans/{backupPlanId}")
|
||||
public Response deleteBackupPlan(@PathParam("backupPlanId") String planId) {
|
||||
service.deleteBackupPlan(planId);
|
||||
return Response.noContent().build();
|
||||
BackupPlan plan = service.deleteBackupPlan(planId);
|
||||
ObjectNode out = objectMapper.createObjectNode();
|
||||
out.put("BackupPlanId", plan.getBackupPlanId());
|
||||
out.put("BackupPlanArn", plan.getBackupPlanArn());
|
||||
out.put("DeletionDate", plan.getDeletionDate());
|
||||
out.put("VersionId", plan.getVersionId());
|
||||
return Response.ok(out).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
|
||||
@@ -678,9 +678,9 @@ public class BackupService {
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteBackupPlan(String planId) {
|
||||
public BackupPlan deleteBackupPlan(String planId) {
|
||||
synchronized (lockFor(planLockKey(planId))) {
|
||||
getBackupPlan(planId);
|
||||
BackupPlan plan = getBackupPlan(planId);
|
||||
long selectionCount = selectionStore.scan(k -> true).stream()
|
||||
.filter(s -> planId.equals(s.getBackupPlanId()))
|
||||
.count();
|
||||
@@ -689,6 +689,8 @@ public class BackupService {
|
||||
"Backup plan has active selections and cannot be deleted", 400);
|
||||
}
|
||||
planStore.delete(planId);
|
||||
plan.setDeletionDate(Instant.now().getEpochSecond());
|
||||
return plan;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user