From f22ab29dff2b69aaadd748c34c259f25dacec52d Mon Sep 17 00:00:00 2001 From: Kiran Kamineni Date: Wed, 7 Aug 2019 15:45:54 -0700 Subject: Add query parameters support to instance API Add support for query parameters to find instances with rb-name, rb-version, profile-name as query parameters eg: curl IP:PORT/v1/instance?rb-name=test&rb-version=v1 Issue-ID: MULTICLOUD-662 Change-Id: If68c87885c8b8dd097cbb3860e8c7320310a6ef7 Signed-off-by: Kiran Kamineni --- src/k8splugin/api/api.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/k8splugin/api/api.go') diff --git a/src/k8splugin/api/api.go b/src/k8splugin/api/api.go index 4308db4f..726bd116 100644 --- a/src/k8splugin/api/api.go +++ b/src/k8splugin/api/api.go @@ -39,6 +39,12 @@ func NewRouter(defClient rb.DefinitionManager, instRouter := router.PathPrefix("/v1").Subrouter() instRouter.HandleFunc("/instance", instHandler.createHandler).Methods("POST") instRouter.HandleFunc("/instance", instHandler.listHandler).Methods("GET") + // Match rb-names, versions or profiles + instRouter.HandleFunc("/instance", instHandler.listHandler). + Queries("rb-name", "{rb-name}", + "rb-version", "{rb-version}", + "profile-name", "{profile-name}").Methods("GET") + instRouter.HandleFunc("/instance/{instID}", instHandler.getHandler).Methods("GET") instRouter.HandleFunc("/instance/{instID}", instHandler.deleteHandler).Methods("DELETE") // (TODO): Fix update method -- cgit 1.2.3-korg