1 package org.edgegallery.example_app.service;
3 import java.util.ArrayList;
4 import java.util.Arrays;
5 import java.util.LinkedList;
7 import java.util.StringTokenizer;
9 import org.apache.commons.lang.StringUtils;
10 import org.edgegallery.example_app.common.Constants;
11 import org.edgegallery.example_app.model.EALTEdgeBackup;
12 import org.edgegallery.example_app.model.EALTEdgeRestore;
13 import org.edgegallery.example_app.util.ShellCommand;
14 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.stereotype.Service;
18 public class restoreService {
21 ShellCommand shellCommand;
23 public String create_restore(String restorename, String backupname) {
24 String command = "velero restore create " + restorename + " --from-backup " + backupname;
26 String output = shellCommand.executeCommand(command);
28 System.out.println(output);
33 * get restore table and parse
36 public List<EALTEdgeRestore> getRestoreTables() {
37 String ip = System.getenv("HOSTIP");
38 String command = "sshpass ssh root@" + ip + " velero get restores";
40 List<EALTEdgeRestore> restoresList = new ArrayList<EALTEdgeRestore>();
41 restoresList = shellCommand.executeRestoreCommand(command);