-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapiserver.go
32 lines (29 loc) · 1.44 KB
/
apiserver.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
log "github.com/Sirupsen/logrus"
"github.com/crunchydata/kraken/apiserver/backupservice"
"github.com/crunchydata/kraken/apiserver/cloneservice"
"github.com/crunchydata/kraken/apiserver/clusterservice"
"github.com/crunchydata/kraken/apiserver/policyservice"
"github.com/crunchydata/kraken/apiserver/upgradeservice"
"github.com/gorilla/mux"
"net/http"
)
func main() {
log.Infoln("restserver starts")
r := mux.NewRouter()
r.HandleFunc("/clones", cloneservice.CreateCloneHandler)
r.HandleFunc("/policies", policyservice.CreatePolicyHandler)
//r.HandleFunc("/policies/{name}", policyservice.ShowPolicyHandler).
//Queries("selector", "{selector}").Methods("GET", "DELETE")
r.HandleFunc("/policies/{name}", policyservice.ShowPolicyHandler).Methods("GET", "DELETE")
r.HandleFunc("/policies/apply/{name}", policyservice.ApplyPolicyHandler)
r.HandleFunc("/upgrades", upgradeservice.CreateUpgradeHandler)
r.HandleFunc("/upgrades/{name}", upgradeservice.ShowUpgradeHandler).Methods("GET", "DELETE")
r.HandleFunc("/clusters", clusterservice.CreateClusterHandler)
r.HandleFunc("/clusters/{name}", clusterservice.ShowClusterHandler).Methods("GET", "DELETE")
r.HandleFunc("/clusters/test/{name}", clusterservice.TestClusterHandler)
r.HandleFunc("/clusters/scale/{name}", clusterservice.ScaleClusterHandler)
r.HandleFunc("/backups/{name}", backupservice.ShowBackupHandler).Methods("GET", "DELETE")
log.Fatal(http.ListenAndServe(":8080", r))
}