get approvals endpoint

pull/99/head
Karolis Rusenas 2017-08-28 20:07:34 +01:00
parent f7532b50a2
commit b43bc13828
2 changed files with 5 additions and 3 deletions

View File

@ -4,13 +4,11 @@ import (
"encoding/json"
"fmt"
"net/http"
"github.com/rusenask/keel/types"
)
func (s *TriggerServer) approvalsHandler(resp http.ResponseWriter, req *http.Request) {
// unknown lists all
approvals, err := s.approvalsManager.List(types.ProviderTypeUnknown)
approvals, err := s.approvalsManager.List()
if err != nil {
fmt.Fprintf(resp, "%s", err)
resp.WriteHeader(http.StatusInternalServerError)

View File

@ -79,6 +79,10 @@ func (s *TriggerServer) registerRoutes(mux *mux.Router) {
mux.HandleFunc("/healthz", s.healthHandler).Methods("GET", "OPTIONS")
// version handler
mux.HandleFunc("/version", s.versionHandler).Methods("GET", "OPTIONS")
//
mux.HandleFunc("/v1/approvals", s.approvalsHandler).Methods("GET", "OPTIONS")
// native webhooks handler
mux.HandleFunc("/v1/webhooks/native", s.nativeHandler).Methods("POST", "OPTIONS")