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 }
func (a Apps) Run(w http.ResponseWriter, r *http.Request) { render := &api.Render{r, w} session := configuration.Session{} if err := json.NewDecoder(r.Body).Decode(&session); err != nil { http.Error(w, err.Error(), http.StatusBadRequest) } config := configuration.GetConfig(session) space, err := a.spaceRepo.GetSummary(config) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) } apps := space.Applications log.Printf("List of all apps: %+v", apps) render.JSON(apps) }