summaryrefslogtreecommitdiffstats
path: root/src/orchestrator/api/api.go
diff options
context:
space:
mode:
authorSrivahni Chivukula <srivahni.chivukula@intel.com>2020-02-21 10:08:04 -0800
committerSrivahni Chivukula <srivahni.chivukula@intel.com>2020-03-12 19:01:25 +0000
commitdef02dfebada38bde91dc98db85eff3d8923a923 (patch)
tree8888dc51acadb7c42fcfd0dedc2dbd6674802446 /src/orchestrator/api/api.go
parentaf34fbc0e67668723eb69a800165f6bfb5100dbf (diff)
Add apps under composite app API
Implemented create, get and delete handlers for the apps under composite app. Added unit tests Added remove function to mockdb Handled multipart POST request to upload file along with app data. Issue-ID: MULTICLOUD-998 Signed-off-by: Srivahni Chivukula <srivahni.chivukula@intel.com> Change-Id: I25c1faba1212c0cc881c2cd599e8e66a7b93033e
Diffstat (limited to 'src/orchestrator/api/api.go')
-rw-r--r--src/orchestrator/api/api.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/orchestrator/api/api.go b/src/orchestrator/api/api.go
index 9b33daf2..70b40d96 100644
--- a/src/orchestrator/api/api.go
+++ b/src/orchestrator/api/api.go
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package api
import (
@@ -25,6 +26,7 @@ var moduleClient *moduleLib.Client
// NewRouter creates a router that registers the various urls that are supported
func NewRouter(projectClient moduleLib.ProjectManager,
compositeAppClient moduleLib.CompositeAppManager,
+ appClient moduleLib.AppManager,
ControllerClient moduleLib.ControllerManager,
clusterClient moduleLib.ClusterManager,
genericPlacementIntentClient moduleLib.GenericPlacementIntentManager,
@@ -73,6 +75,17 @@ func NewRouter(projectClient moduleLib.ProjectManager,
router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{version}", compAppHandler.getHandler).Methods("GET")
router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{version}", compAppHandler.deleteHandler).Methods("DELETE")
+ if appClient == nil {
+ appClient = moduleClient.App
+ }
+ appHandler := appHandler{
+ client: appClient,
+ }
+
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{version}/apps", appHandler.createAppHandler).Methods("POST")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{version}/apps/{app-name}", appHandler.getAppHandler).Methods("GET")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{version}/apps/{app-name}", appHandler.deleteAppHandler).Methods("DELETE")
+
if compositeProfileClient == nil {
compositeProfileClient = moduleClient.CompositeProfile
}