示例#1
0
文件: app.go 项目: bardusco/tsuru
func RemoveUnitsHandler(w http.ResponseWriter, r *http.Request, u *auth.User) error {
	n, err := numberOfUnitsOrError(r)
	if err != nil {
		return err
	}
	appName := r.URL.Query().Get(":name")
	app, err := getApp(appName, u)
	if err != nil {
		return err
	}
	return app.RemoveUnits(uint(n))
}
示例#2
0
文件: app.go 项目: kaiquewdev/tsuru
func removeUnits(w http.ResponseWriter, r *http.Request, t *auth.Token) error {
	n, err := numberOfUnits(r)
	if err != nil {
		return err
	}
	u, err := t.User()
	if err != nil {
		return err
	}
	appName := r.URL.Query().Get(":app")
	app, err := getApp(appName, u)
	if err != nil {
		return err
	}
	return app.RemoveUnits(uint(n))
}
示例#3
0
文件: app.go 项目: nemx/tsuru
func removeUnits(w http.ResponseWriter, r *http.Request, t *auth.Token) error {
	n, err := numberOfUnits(r)
	if err != nil {
		return err
	}
	u, err := t.User()
	if err != nil {
		return err
	}
	appName := r.URL.Query().Get(":app")
	rec.Log(u.Email, "remove-units", "app="+appName, fmt.Sprintf("units=%d", n))
	app, err := getApp(appName, u)
	if err != nil {
		return err
	}
	return app.RemoveUnits(uint(n))
}