aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api/api.go
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2021-08-01 21:01:44 +0200
committerLukasz Rajewski <lukasz.rajewski@orange.com>2021-08-02 22:48:48 +0200
commit5e27642926c9967a26eef5d4625aba2f1eee2c8c (patch)
tree9689affa97005d0eceb026432f6872744fcdc282 /src/k8splugin/api/api.go
parente42203ee6c170eebb9466ee82baa97f83e88955c (diff)
Add suport for query api on root level
Add suport for query api on root level. Instance query handler and root query handler merged. Issue-ID: MULTICLOUD-1379 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com> Change-Id: I1dc95c7aca0e734edf5794e7c36143dc12070f2b
Diffstat (limited to 'src/k8splugin/api/api.go')
-rw-r--r--src/k8splugin/api/api.go20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/k8splugin/api/api.go b/src/k8splugin/api/api.go
index 4a196ae2..56e6db6a 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,
@@ -56,8 +59,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