aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api/api.go
diff options
context:
space:
mode:
authorKiran Kamineni <kiran.k.kamineni@intel.com>2019-08-07 15:45:54 -0700
committerKiran Kamineni <kiran.k.kamineni@intel.com>2019-08-13 12:48:48 -0700
commitf22ab29dff2b69aaadd748c34c259f25dacec52d (patch)
tree1790140cbc7baa5e73f3acf862852f5001e9c0a0 /src/k8splugin/api/api.go
parent845cdd2aa5d790e57b0b2999180df4abc6724bf1 (diff)
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 <kiran.k.kamineni@intel.com>
Diffstat (limited to 'src/k8splugin/api/api.go')
-rw-r--r--src/k8splugin/api/api.go6
1 files changed, 6 insertions, 0 deletions
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