aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api/instancehandler.go
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2019-07-23 07:30:16 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-23 07:30:16 +0000
commitf83526881ac7758638b1e7e0e1bcf2ab8cd13133 (patch)
tree83e38d253bf746e39b38d026fd9ba0717f626cad /src/k8splugin/api/instancehandler.go
parent40014c64df3250db72b41e05da3dd40746d3d6d3 (diff)
parente04fd6fa1f0abe6b18787b192e01164db1db06db (diff)
Merge "Add a list api for instances"
Diffstat (limited to 'src/k8splugin/api/instancehandler.go')
-rw-r--r--src/k8splugin/api/instancehandler.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/k8splugin/api/instancehandler.go b/src/k8splugin/api/instancehandler.go
index 42f3b212..3ec055bc 100644
--- a/src/k8splugin/api/instancehandler.go
+++ b/src/k8splugin/api/instancehandler.go
@@ -106,6 +106,24 @@ func (i instanceHandler) getHandler(w http.ResponseWriter, r *http.Request) {
}
}
+// getHandler retrieves information about an instance via the ID
+func (i instanceHandler) listHandler(w http.ResponseWriter, r *http.Request) {
+
+ resp, err := i.client.List()
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(http.StatusOK)
+ err = json.NewEncoder(w).Encode(resp)
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+}
+
// deleteHandler method terminates an instance via the ID
func (i instanceHandler) deleteHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)