summaryrefslogtreecommitdiffstats
path: root/src/orchestrator/api/api.go
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2020-02-19 16:19:18 -0800
committerEric Multanen <eric.w.multanen@intel.com>2020-03-05 16:29:23 -0800
commit65f9bc3b632a012429cd94aa2e6160b44fe633a7 (patch)
treee9e49dc5b1aa78cd07f8c96c3a90b2d27b566815 /src/orchestrator/api/api.go
parent8e0c4c63e5a014c95805f16d30a64cd53ddc7385 (diff)
Add API support to handle App Profiles
Add support for profiles per App under composite profiles. See: https://wiki.onap.org/display/DW/V2+API+Specification#V2APISpecification-Addingprofileperapplication Issue-ID: MULTICLOUD-997 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com> Change-Id: I8569066d903327d640e315d0de835605ca1779c0
Diffstat (limited to 'src/orchestrator/api/api.go')
-rw-r--r--src/orchestrator/api/api.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/orchestrator/api/api.go b/src/orchestrator/api/api.go
index 7c540dd3..9b33daf2 100644
--- a/src/orchestrator/api/api.go
+++ b/src/orchestrator/api/api.go
@@ -31,7 +31,8 @@ func NewRouter(projectClient moduleLib.ProjectManager,
appIntentClient moduleLib.AppIntentManager,
deploymentIntentGrpClient moduleLib.DeploymentIntentGroupManager,
intentClient moduleLib.IntentManager,
- compositeProfileClient moduleLib.CompositeProfileManager) *mux.Router {
+ compositeProfileClient moduleLib.CompositeProfileManager,
+ appProfileClient moduleLib.AppProfileManager) *mux.Router {
router := mux.NewRouter().PathPrefix("/v2").Subrouter()
@@ -78,11 +79,28 @@ func NewRouter(projectClient moduleLib.ProjectManager,
compProfilepHandler := compositeProfileHandler{
client: compositeProfileClient,
}
+ if appProfileClient == nil {
+ appProfileClient = moduleClient.AppProfile
+ }
+ appProfileHandler := appProfileHandler{
+ client: appProfileClient,
+ }
router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles", compProfilepHandler.createHandler).Methods("POST")
router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles", compProfilepHandler.getHandler).Methods("GET")
router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles/{composite-profile-name}", compProfilepHandler.getHandler).Methods("GET")
router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles/{composite-profile-name}", compProfilepHandler.deleteHandler).Methods("DELETE")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles/{composite-profile-name}/profiles", appProfileHandler.createAppProfileHandler).Methods("POST")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles/{composite-profile-name}/profiles", appProfileHandler.getAppProfileHandler).Methods("GET")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles/{composite-profile-name}/profiles", appProfileHandler.getAppProfileHandler).Queries("app-name", "{app-name}")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles/{composite-profile-name}/profiles/{app-profile}", appProfileHandler.getAppProfileHandler).Methods("GET")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles/{composite-profile-name}/profiles/{app-profile}", appProfileHandler.deleteAppProfileHandler).Methods("DELETE")
+
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles/{composite-profile-name}/profiles", appProfileHandler.createAppProfileHandler).Methods("POST")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles/{composite-profile-name}/profiles", appProfileHandler.getAppProfileHandler).Methods("GET")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles/{composite-profile-name}/profiles", appProfileHandler.getAppProfileHandler).Queries("app-name", "{app-name}")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles/{composite-profile-name}/profiles/{app-profile}", appProfileHandler.getAppProfileHandler).Methods("GET")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/composite-profiles/{composite-profile-name}/profiles/{app-profile}", appProfileHandler.deleteAppProfileHandler).Methods("DELETE")
router.HandleFunc("/controllers", controlHandler.createHandler).Methods("POST")
router.HandleFunc("/controllers", controlHandler.createHandler).Methods("PUT")