func Scale(client *api.Client, jobID, groupID string, scale, min, max int) (string, int, error) {
	job, _, err := client.Jobs().Info(jobID, &api.QueryOptions{})
	if err != nil {
		return "", 0, err
	}
	oldCount := *job.TaskGroups[0].Count
	newCount := oldCount + scale
	if newCount < min || newCount > max {
		return "", oldCount, errors.New("the new group count (" + strconv.Itoa(newCount) + ") is outside of the configured range (" + strconv.Itoa(min) + "-" + strconv.Itoa(max) + ")")
	}
	job.TaskGroups[0].Count = &newCount
	resp, _, _ := client.Jobs().Register(job, &api.WriteOptions{})
	return resp.EvalID, newCount, nil
}
// Scale increases or decreases the count of a task group
Scale increases or decreases the count of a task group
// Scale increases or decreases the count of a task group
func Scale(client *api.Client, jobID, groupID string, scale, min, max int) (string, int, error) {
	job, _, err := client.Jobs().Info(jobID, &api.QueryOptions{})
	if err != nil {
		return "", 0, err
	}
	oldCount := *job.TaskGroups[0].Count
	newCount := oldCount + scale
	if newCount < min || newCount > max {
		return "", oldCount, errors.New("the new group count (" + strconv.Itoa(newCount) + ") is outside of the configured range (" + strconv.Itoa(min) + "-" + strconv.Itoa(max) + ")")
	}
	job.TaskGroups[0].Count = &newCount
	resp, _, _ := client.Jobs().Register(job, &api.WriteOptions{})
	return resp.EvalID, newCount, nil
}
func Scale ( client * api . Client , jobID , groupID string , scale , min , max int ) ( string , int , error ) { job , _ , err := client . Jobs ( ) . Info ( jobID , & api . QueryOptions { } ) if err != nil { return " " , 0 , err } oldCount := * job . TaskGroups [ 0 ] . Count newCount := oldCount + scale if newCount < min || newCount > max { return " " , oldCount , errors . New ( " " + strconv . Itoa ( newCount ) + " " + strconv . Itoa ( min ) + " " + strconv . Itoa ( max ) + " " ) } job . TaskGroups [ 0 ] . Count = & newCount resp , _ , _ := client . Jobs ( ) . Register ( job , & api . WriteOptions { } ) return resp . EvalID , newCount , nil }
Scale increases or decreases the count of a task group
Scale increases or decreases the count of a task group