コード例 #1
0
func (a *AppEvents) GetRequirements(reqFactory requirements.Factory, w http.ResponseWriter, r *http.Request) (reqs []Requirement, config *configuration.Configuration, err error) {
	config = configuration.GetDefaultConfig()
	if err := json.NewDecoder(r.Body).Decode(&config); err != nil {
		http.Error(w, err.Error(), http.StatusBadRequest)
	}

	a.config = config

	appName := r.URL.Query().Get("appname")
	a.appReq = reqFactory.NewApplicationRequirement(appName)

	reqs = []Requirement{&a.appReq}
	return
}
コード例 #2
0
ファイル: stop_an_app.go プロジェクト: diatmpravin/gagan
func (s *Stop) GetRequirements(reqFactory requirements.Factory, w http.ResponseWriter, r *http.Request) (reqs []Requirement, config *configuration.Configuration, err error) {
	session := configuration.Session{}

	if err := json.NewDecoder(r.Body).Decode(&session); err != nil {
		http.Error(w, err.Error(), http.StatusBadRequest)
	}

	config = configuration.GetConfig(session)
	s.config = config

	appName := r.URL.Query().Get("appname")
	s.appReq = reqFactory.NewApplicationRequirement(appName)

	reqs = []Requirement{&s.appReq}
	return
}