1 package org.edgegallery.example_app.service;
3 import java.util.ArrayList;
5 import org.edgegallery.example_app.model.EALTEdgeBackup;
6 import org.edgegallery.example_app.model.EALTEdgeRestore;
7 import org.edgegallery.example_app.util.ShellCommand;
8 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Service;
12 public class restoreService {
15 ShellCommand shellCommand;
17 public String create_restore(String restorename, String backupname) {
18 String command = "velero restore create " + restorename + " --from-backup " + backupname;
20 String output = shellCommand.executeCommand(command);
22 System.out.println(output);
26 public List<EALTEdgeRestore> getRestoreTables() {
27 EALTEdgeRestore restoreDetails = new EALTEdgeRestore();
28 String command = "velero get restores";
30 String output = shellCommand.executeCommand(command);
32 //System.out.println(output);
33 List<EALTEdgeRestore> restoresList = new ArrayList<EALTEdgeRestore>();
35 String list = shellCommand.parseResult(output);
37 //TODO: after parse the result, need to fill info in backup node in list
38 restoreDetails.setName("restore1");
40 restoresList.add(restoreDetails);