func (s *daemon) doRequestUUID(version string, w http.ResponseWriter, r *http.Request, objs map[string]string) error { var err error key, err := util.GetName(r, api.KEY_NAME, true, err) if err != nil { return err } var uuid string resp := &api.UUIDResponse{} if util.ValidateName(key) { // It's probably a name uuid = s.NameUUIDIndex.Get(key) } if uuid == "" { // No luck with name, let's try uuid index uuid, _ = s.UUIDIndex.Get(key) } if uuid != "" { resp.UUID = uuid } return writeResponseOutput(w, resp) }
func doBackupList(c *cli.Context) error { var err error destURL, err := util.GetFlag(c, "", true, err) volumeName, err := util.GetName(c, "volume-name", false, err) if err != nil { return err } request := &api.BackupListRequest{ URL: destURL, VolumeName: volumeName, } url := "/backups/list" return sendRequestAndPrint("GET", url, request) }
func doBackupList(c *cli.Context) error { var err error destURL, err := util.GetFlag(c, "", true, err) volumeName, err := util.GetName(c, "volume", false, err) if err != nil { return err } list, err := objectstore.List(volumeName, destURL, DRIVERNAME) if err != nil { return err } fmt.Println(list) return nil }
func doSnapshotCreate(c *cli.Context) error { var err error volumeName, err := getName(c, "", true) snapshotName, err := util.GetName(c, "name", false, err) if err != nil { return err } request := &api.SnapshotCreateRequest{ Name: snapshotName, VolumeName: volumeName, Verbose: c.GlobalBool(verboseFlag), } url := "/snapshots/create" return sendRequestAndPrint("POST", url, request) }