summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/k8splugin/api/api.go')
-rw-r--r--src/k8splugin/api/api.go22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/k8splugin/api/api.go b/src/k8splugin/api/api.go
index 4a196ae2..94fb9b34 100644
--- a/src/k8splugin/api/api.go
+++ b/src/k8splugin/api/api.go
@@ -1,6 +1,8 @@
/*
Copyright 2018 Intel Corporation.
Copyright © 2021 Samsung Electronics
+Copyright © 2021 Orange
+
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
@@ -27,6 +29,7 @@ import (
func NewRouter(defClient rb.DefinitionManager,
profileClient rb.ProfileManager,
instClient app.InstanceManager,
+ queryClient app.QueryManager,
configClient app.ConfigManager,
connectionClient connection.ConnectionManager,
templateClient rb.ConfigTemplateManager,
@@ -47,6 +50,7 @@ func NewRouter(defClient rb.DefinitionManager,
Queries("rb-name", "{rb-name}",
"rb-version", "{rb-version}",
"profile-name", "{profile-name}").Methods("GET")
+ //Want to get full Data -> add query param: /install/{instID}?full=true
instRouter.HandleFunc("/instance/{instID}", instHandler.getHandler).Methods("GET")
instRouter.HandleFunc("/instance/{instID}/status", instHandler.statusHandler).Methods("GET")
instRouter.HandleFunc("/instance/{instID}/query", instHandler.queryHandler).Methods("GET")
@@ -56,8 +60,21 @@ func NewRouter(defClient rb.DefinitionManager,
"Name", "{Name}",
"Labels", "{Labels}").Methods("GET")
instRouter.HandleFunc("/instance/{instID}", instHandler.deleteHandler).Methods("DELETE")
- // (TODO): Fix update method
- // instRouter.HandleFunc("/{vnfInstanceId}", UpdateHandler).Methods("PUT")
+
+ // Query handler routes
+ if queryClient == nil {
+ queryClient = app.NewQueryClient()
+ }
+ queryHandler := queryHandler{client: queryClient}
+ queryRouter := router.PathPrefix("/v1").Subrouter()
+ queryRouter.HandleFunc("/query", queryHandler.queryHandler).Methods("GET")
+ queryRouter.HandleFunc("/query", queryHandler.queryHandler).
+ Queries("Namespace", "{Namespace}",
+ "CloudRegion", "{CloudRegion}",
+ "ApiVersion", "{ApiVersion}",
+ "Kind", "{Kind}",
+ "Name", "{Name}",
+ "Labels", "{Labels}").Methods("GET")
//Setup the broker handler here
//Use the base router without any path prefixes
@@ -116,6 +133,7 @@ func NewRouter(defClient rb.DefinitionManager,
}
configHandler := rbConfigHandler{client: configClient}
instRouter.HandleFunc("/instance/{instID}/config", configHandler.createHandler).Methods("POST")
+ instRouter.HandleFunc("/instance/{instID}/config", configHandler.listHandler).Methods("GET")
instRouter.HandleFunc("/instance/{instID}/config/{cfgname}", configHandler.getHandler).Methods("GET")
instRouter.HandleFunc("/instance/{instID}/config/{cfgname}", configHandler.updateHandler).Methods("PUT")
instRouter.HandleFunc("/instance/{instID}/config/{cfgname}", configHandler.deleteHandler).Methods("DELETE")