From c3ef7c3f40f6aa4a14a98301ae12bfa11b1a12c3 Mon Sep 17 00:00:00 2001 From: Srivahni Date: Thu, 29 Aug 2019 12:06:51 -0700 Subject: Visualization operator - update/delete datasource Added support in the visualization operator to update or delete an existing grafana datasource dynamically. Issue-ID: ONAPARC-393 Signed-off-by: Srivahni Change-Id: I814cca8e5b4f7f5832a948449cf545cecd25b1f9 --- .../pkg/controller/utils/visualizationutils.go | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 vnfs/DAaaS/microservices/visualization-operator/pkg/controller/utils/visualizationutils.go (limited to 'vnfs/DAaaS/microservices/visualization-operator/pkg/controller/utils') diff --git a/vnfs/DAaaS/microservices/visualization-operator/pkg/controller/utils/visualizationutils.go b/vnfs/DAaaS/microservices/visualization-operator/pkg/controller/utils/visualizationutils.go new file mode 100644 index 00000000..dc7e1f1b --- /dev/null +++ b/vnfs/DAaaS/microservices/visualization-operator/pkg/controller/utils/visualizationutils.go @@ -0,0 +1,26 @@ +package visualizationutils + +// Define the GrafanaDatasource finalizer for handling deletion +const ( + VisualizationFinalizer = "finalizer.visualization.onap.org" +) + +// Contains checks if a string is contained in a list of strings +func Contains(list []string, s string) bool { + for _, v := range list { + if v == s { + return true + } + } + return false +} + +// Remove checks and removes a string from a list of strings +func Remove(list []string, s string) []string { + for i, v := range list { + if v == s { + list = append(list[:i], list[i+1:]...) + } + } + return list +} -- cgit