diff options
author | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2022-02-15 22:39:37 +0100 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2022-03-02 22:46:03 +0100 |
commit | 5b18db4fc784763402e0898bf5e996886279347e (patch) | |
tree | 984a315638e1ef87841144fbb6a7e56484ffd12c /src/k8splugin/api/api.go | |
parent | a73b42b9c3877f1a34939d85941482f7f5c44db9 (diff) |
Implementation of status notification mechanism0.10.0
- Subscription CRUD endpoints
- Subscription notifu executor
- Cleanup of subscriptions on instance delete
- Sending notification to the specified callback
Issue-ID: MULTICLOUD-1445
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com>
Change-Id: I5b867a348e916f6c2c471bcc5326c831d832f45e
Diffstat (limited to 'src/k8splugin/api/api.go')
-rw-r--r-- | src/k8splugin/api/api.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/k8splugin/api/api.go b/src/k8splugin/api/api.go index 64c83e03..64959f5e 100644 --- a/src/k8splugin/api/api.go +++ b/src/k8splugin/api/api.go @@ -1,7 +1,7 @@ /* Copyright 2018 Intel Corporation. Copyright © 2021 Samsung Electronics -Copyright © 2021 Orange +Copyright © 2022 Orange Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ func NewRouter(defClient rb.DefinitionManager, configClient app.ConfigManager, connectionClient connection.ConnectionManager, templateClient rb.ConfigTemplateManager, + subscriptionClient app.InstanceStatusSubManager, healthcheckClient healthcheck.InstanceHCManager) *mux.Router { router := mux.NewRouter() @@ -52,7 +53,6 @@ func NewRouter(defClient rb.DefinitionManager, "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}/upgrade", instHandler.upgradeHandler).Methods("POST") instRouter.HandleFunc("/instance/{instID}/query", instHandler.queryHandler).Methods("GET") instRouter.HandleFunc("/instance/{instID}/query", instHandler.queryHandler). @@ -62,6 +62,19 @@ func NewRouter(defClient rb.DefinitionManager, "Labels", "{Labels}").Methods("GET") instRouter.HandleFunc("/instance/{instID}", instHandler.deleteHandler).Methods("DELETE") + // Status handler routes + if subscriptionClient == nil { + subscriptionClient = app.NewInstanceStatusSubClient() + subscriptionClient.RestoreWatchers() + } + instanceStatusSubHandler := instanceStatusSubHandler{client: subscriptionClient} + instRouter.HandleFunc("/instance/{instID}/status", instHandler.statusHandler).Methods("GET") + instRouter.HandleFunc("/instance/{instID}/status/subscription", instanceStatusSubHandler.listHandler).Methods("GET") + instRouter.HandleFunc("/instance/{instID}/status/subscription", instanceStatusSubHandler.createHandler).Methods("POST") + instRouter.HandleFunc("/instance/{instID}/status/subscription/{subID}", instanceStatusSubHandler.getHandler).Methods("GET") + instRouter.HandleFunc("/instance/{instID}/status/subscription/{subID}", instanceStatusSubHandler.updateHandler).Methods("PUT") + instRouter.HandleFunc("/instance/{instID}/status/subscription/{subID}", instanceStatusSubHandler.deleteHandler).Methods("DELETE") + // Query handler routes if queryClient == nil { queryClient = app.NewQueryClient() |