diff options
Diffstat (limited to 'src/orchestrator/api/api.go')
-rw-r--r-- | src/orchestrator/api/api.go | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/orchestrator/api/api.go b/src/orchestrator/api/api.go index f0342433..5e05b31b 100644 --- a/src/orchestrator/api/api.go +++ b/src/orchestrator/api/api.go @@ -22,8 +22,7 @@ import ( var moduleClient *moduleLib.Client // NewRouter creates a router that registers the various urls that are supported - -func NewRouter(projectClient moduleLib.ProjectManager, compositeAppClient moduleLib.CompositeAppManager, ControllerClient moduleLib.ControllerManager) *mux.Router { +func NewRouter(projectClient moduleLib.ProjectManager, compositeAppClient moduleLib.CompositeAppManager, ControllerClient moduleLib.ControllerManager, clusterClient moduleLib.ClusterManager) *mux.Router { router := mux.NewRouter().PathPrefix("/v2").Subrouter() moduleClient = moduleLib.NewClient() @@ -39,6 +38,12 @@ func NewRouter(projectClient moduleLib.ProjectManager, compositeAppClient module controlHandler := controllerHandler{ client: ControllerClient, } + if clusterClient == nil { + clusterClient = moduleClient.Cluster + } + clusterHandler := clusterHandler{ + client: clusterClient, + } router.HandleFunc("/projects", projHandler.createHandler).Methods("POST") router.HandleFunc("/projects/{project-name}", projHandler.getHandler).Methods("GET") router.HandleFunc("/projects/{project-name}", projHandler.deleteHandler).Methods("DELETE") @@ -58,5 +63,22 @@ func NewRouter(projectClient moduleLib.ProjectManager, compositeAppClient module router.HandleFunc("/controllers", controlHandler.createHandler).Methods("PUT") router.HandleFunc("/controllers/{controller-name}", controlHandler.getHandler).Methods("GET") router.HandleFunc("/controllers/{controller-name}", controlHandler.deleteHandler).Methods("DELETE") + router.HandleFunc("/cluster-providers", clusterHandler.createClusterProviderHandler).Methods("POST") + router.HandleFunc("/cluster-providers", clusterHandler.getClusterProviderHandler).Methods("GET") + router.HandleFunc("/cluster-providers/{name}", clusterHandler.getClusterProviderHandler).Methods("GET") + router.HandleFunc("/cluster-providers/{name}", clusterHandler.deleteClusterProviderHandler).Methods("DELETE") + router.HandleFunc("/cluster-providers/{provider-name}/clusters", clusterHandler.createClusterHandler).Methods("POST") + router.HandleFunc("/cluster-providers/{provider-name}/clusters", clusterHandler.getClusterHandler).Methods("GET") + router.HandleFunc("/cluster-providers/{provider-name}/clusters/{name}", clusterHandler.getClusterHandler).Methods("GET") + router.HandleFunc("/cluster-providers/{provider-name}/clusters/{name}", clusterHandler.deleteClusterHandler).Methods("DELETE") + router.HandleFunc("/cluster-providers/{provider-name}/clusters/{cluster-name}/labels", clusterHandler.createClusterLabelHandler).Methods("POST") + router.HandleFunc("/cluster-providers/{provider-name}/clusters/{cluster-name}/labels", clusterHandler.getClusterLabelHandler).Methods("GET") + router.HandleFunc("/cluster-providers/{provider-name}/clusters/{cluster-name}/labels/{label}", clusterHandler.getClusterLabelHandler).Methods("GET") + router.HandleFunc("/cluster-providers/{provider-name}/clusters/{cluster-name}/labels/{label}", clusterHandler.deleteClusterLabelHandler).Methods("DELETE") + router.HandleFunc("/cluster-providers/{provider-name}/clusters/{cluster-name}/kv-pairs", clusterHandler.createClusterKvPairsHandler).Methods("POST") + router.HandleFunc("/cluster-providers/{provider-name}/clusters/{cluster-name}/kv-pairs", clusterHandler.getClusterKvPairsHandler).Methods("GET") + router.HandleFunc("/cluster-providers/{provider-name}/clusters/{cluster-name}/kv-pairs/{kvpair}", clusterHandler.getClusterKvPairsHandler).Methods("GET") + router.HandleFunc("/cluster-providers/{provider-name}/clusters/{cluster-name}/kv-pairs/{kvpair}", clusterHandler.deleteClusterKvPairsHandler).Methods("DELETE") + return router } |