예제 #1
0
파일: volume.go 프로젝트: aruneli/convoy
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)
}
예제 #2
0
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)
}
예제 #3
0
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
}
예제 #4
0
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)
}