X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=dashboard%2Fwebapp-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fric%2Fportal%2Fdashboard%2Fcontroller%2FAppManagerController.java;h=47e68686eb0dfd7e0416f54b8703fa9d013f0d24;hb=0dce3bd452fd7e735d830a7d659e6b95a12514f9;hp=b9695f5b17de16b6f8520496d04454c204a14f67;hpb=e0adfb63c5c6eb10bcea3bdf0d080e48aea38a51;p=portal%2Fric-dashboard.git diff --git a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AppManagerController.java b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AppManagerController.java index b9695f5b..47e68686 100644 --- a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AppManagerController.java +++ b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AppManagerController.java @@ -21,21 +21,21 @@ package org.oransc.ric.portal.dashboard.controller; import java.lang.invoke.MethodHandles; -import org.oransc.ric.plt.appmgr.client.api.HealthApi; -import org.oransc.ric.plt.appmgr.client.api.XappApi; -import org.oransc.ric.plt.appmgr.client.model.AllDeployableXapps; -import org.oransc.ric.plt.appmgr.client.model.AllDeployedXapps; -import org.oransc.ric.plt.appmgr.client.model.AllXappConfig; -import org.oransc.ric.plt.appmgr.client.model.ConfigValidationErrors; -import org.oransc.ric.plt.appmgr.client.model.XAppConfig; -import org.oransc.ric.plt.appmgr.client.model.Xapp; -import org.oransc.ric.plt.appmgr.client.model.XappDescriptor; import org.oransc.ric.portal.dashboard.DashboardApplication; import org.oransc.ric.portal.dashboard.DashboardConstants; import org.oransc.ric.portal.dashboard.config.AppManagerApiBuilder; import org.oransc.ric.portal.dashboard.model.AppTransport; import org.oransc.ric.portal.dashboard.model.DashboardDeployableXapps; import org.oransc.ric.portal.dashboard.model.SuccessTransport; +import org.oransc.ricplt.appmgr.client.api.HealthApi; +import org.oransc.ricplt.appmgr.client.api.XappApi; +import org.oransc.ricplt.appmgr.client.model.AllDeployableXapps; +import org.oransc.ricplt.appmgr.client.model.AllDeployedXapps; +import org.oransc.ricplt.appmgr.client.model.AllXappConfig; +import org.oransc.ricplt.appmgr.client.model.ConfigValidationErrors; +import org.oransc.ricplt.appmgr.client.model.XAppConfig; +import org.oransc.ricplt.appmgr.client.model.Xapp; +import org.oransc.ricplt.appmgr.client.model.XappDescriptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -44,6 +44,7 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.security.access.annotation.Secured; import org.springframework.util.Assert; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -58,10 +59,9 @@ import io.swagger.annotations.ApiOperation; /** * Proxies calls from the front end to the App Manager API. * - * If a method throws RestClientResponseException, it is handled by - * {@link CustomResponseEntityExceptionHandler#handleProxyMethodException(Exception, org.springframework.web.context.request.WebRequest)} - * which returns status 502. All other exceptions are handled by Spring which - * returns status 500. + * If a method throws RestClientResponseException, it is handled by a method in + * {@link CustomResponseEntityExceptionHandler} which returns status 502. All + * other exceptions are handled by Spring which returns status 500. */ @Configuration @RestController @@ -138,7 +138,8 @@ public class AppManagerController { @PutMapping(CONFIG_METHOD_PATH) @Secured({ DashboardConstants.ROLE_ADMIN }) public ConfigValidationErrors modifyXappConfig( - @PathVariable(DashboardConstants.RIC_INSTANCE_KEY) String instanceKey, @RequestBody XAppConfig xAppConfig) { + @PathVariable(DashboardConstants.RIC_INSTANCE_KEY) String instanceKey, // + @Validated @RequestBody XAppConfig xAppConfig) { logger.debug("modifyXappConfig instance {} config {}", instanceKey, xAppConfig); return appManagerApiBuilder.getXappApi(instanceKey).modifyXappConfig(xAppConfig); } @@ -180,8 +181,8 @@ public class AppManagerController { @ApiOperation(value = "Deploy a xapp.", response = Xapp.class) @PostMapping(XAPPS_METHOD_PATH) @Secured({ DashboardConstants.ROLE_ADMIN }) - public Xapp deployXapp(@PathVariable(DashboardConstants.RIC_INSTANCE_KEY) String instanceKey, - @RequestBody XappDescriptor appDescriptor) { + public Xapp deployXapp(@PathVariable(DashboardConstants.RIC_INSTANCE_KEY) String instanceKey, // + @Validated @RequestBody XappDescriptor appDescriptor) { logger.debug("deployXapp instance {} descriptor {}", instanceKey, appDescriptor); return appManagerApiBuilder.getXappApi(instanceKey).deployXapp(appDescriptor); }