diff options
author | Rajamohan Raj <rajamohan.raj@intel.com> | 2020-02-26 02:07:34 +0000 |
---|---|---|
committer | Rajamohan Raj <rajamohan.raj@intel.com> | 2020-03-04 23:43:43 +0000 |
commit | ff03456548dac309461f402738ac344046de8057 (patch) | |
tree | 479b113227ba2d67636aa68a165cb5e484071d72 /src/orchestrator/api/api.go | |
parent | 37aed9b7a0db62b9931d89c614ff6291cc4608cc (diff) |
Add DeploymentIntentGroup APIs
Implemented the routes for creation,
deletion and getting DeploymentIntentGroup.
Added routes for adding, getting and deleting intents.
Issue-ID: MULTICLOUD-1002
Signed-off-by: Rajamohan Raj <rajamohan.raj@intel.com>
Change-Id: I07ba3744107bcf30aa30ed89caa21bf474c0d92a
Diffstat (limited to 'src/orchestrator/api/api.go')
-rw-r--r-- | src/orchestrator/api/api.go | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/orchestrator/api/api.go b/src/orchestrator/api/api.go index f4381e6c..f3e3b177 100644 --- a/src/orchestrator/api/api.go +++ b/src/orchestrator/api/api.go @@ -28,7 +28,9 @@ func NewRouter(projectClient moduleLib.ProjectManager, ControllerClient moduleLib.ControllerManager, clusterClient moduleLib.ClusterManager, genericPlacementIntentClient moduleLib.GenericPlacementIntentManager, - appIntentClient moduleLib.AppIntentManager) *mux.Router { + appIntentClient moduleLib.AppIntentManager, + deploymentIntentGrpClient moduleLib.DeploymentIntentGroupManager, + intentClient moduleLib.IntentManager) *mux.Router { router := mux.NewRouter().PathPrefix("/v2").Subrouter() @@ -114,5 +116,30 @@ func NewRouter(projectClient moduleLib.ProjectManager, router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}/app-intents/{app-intent-name}", appIntentHandler.getAppIntentHandler).Methods("GET") router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}/app-intents/{app-intent-name}", appIntentHandler.deleteAppIntentHandler).Methods("DELETE") + //setting routes for deploymentIntentGroup + if deploymentIntentGrpClient == nil { + deploymentIntentGrpClient = moduleClient.DeploymentIntentGroup + } + + deploymentIntentGrpHandler := deploymentIntentGroupHandler{ + client: deploymentIntentGrpClient, + } + router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups", deploymentIntentGrpHandler.createDeploymentIntentGroupHandler).Methods("POST") + router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}", deploymentIntentGrpHandler.getDeploymentIntentGroupHandler).Methods("GET") + router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}", deploymentIntentGrpHandler.deleteDeploymentIntentGroupHandler).Methods("DELETE") + + // setting routes for AddingIntents + if intentClient == nil { + intentClient = moduleClient.Intent + } + + intentHandler := intentHandler{ + client: intentClient, + } + + router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/intents", intentHandler.addIntentHandler).Methods("POST") + router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/intents/{intent-name}", intentHandler.getIntentHandler).Methods("GET") + router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/intents/{intent-name}", intentHandler.deleteIntentHandler).Methods("DELETE") + return router } |