import java.io.IOException;
import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
import java.util.List;
import org.onap.portalsdk.core.restful.domain.EcompUser;
+import org.oransc.ric.portal.dashboard.AppStatsManager;
import org.oransc.ric.portal.dashboard.DashboardApplication;
import org.oransc.ric.portal.dashboard.DashboardConstants;
import org.oransc.ric.portal.dashboard.DashboardUserManager;
-import org.oransc.ric.portal.dashboard.AppStatsManager;
import org.oransc.ric.portal.dashboard.exception.StatsManagerException;
+import org.oransc.ric.portal.dashboard.model.AppStats;
import org.oransc.ric.portal.dashboard.model.IDashboardResponse;
-import org.oransc.ric.portal.dashboard.model.StatsDetailsTransport;
import org.oransc.ric.portal.dashboard.model.RicRegion;
import org.oransc.ric.portal.dashboard.model.RicRegionList;
import org.oransc.ric.portal.dashboard.model.RicRegionTransport;
-import org.oransc.ric.portal.dashboard.model.AppStats;
+import org.oransc.ric.portal.dashboard.model.StatsDetailsTransport;
import org.oransc.ric.portal.dashboard.model.SuccessTransport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.annotation.Secured;
+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;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
public static final String XAPPMETRICS_METHOD = "metrics";
public static final String STATAPPMETRIC_METHOD = "appmetric";
- @Value("${metrics.url.ml}")
- private String mlAppMetricsUrl;
-
@Autowired
private DashboardUserManager dashboardUserManager;
+ STATAPPMETRIC_METHOD)
@Secured({ DashboardConstants.ROLE_ADMIN })
public IDashboardResponse createStats(@PathVariable(DashboardConstants.RIC_INSTANCE_KEY) String instanceKey,
- @RequestBody StatsDetailsTransport statsSetupRequest) throws StatsManagerException, IOException {
+ @Validated @RequestBody StatsDetailsTransport statsSetupRequest) throws StatsManagerException, IOException {
logger.debug("createStats with instance {} request {}", instanceKey, statsSetupRequest);
return appStatsManager.createStats(instanceKey, statsSetupRequest);
}
@PutMapping(DashboardConstants.RIC_INSTANCE_KEY + "/{" + DashboardConstants.RIC_INSTANCE_KEY + "}/"
+ STATAPPMETRIC_METHOD)
@Secured({ DashboardConstants.ROLE_ADMIN })
- public ResponseEntity<String> updateStats(@PathVariable(DashboardConstants.RIC_INSTANCE_KEY) String instanceKey,
- @RequestBody StatsDetailsTransport statsSetupRequest) throws StatsManagerException, IOException {
+ public void updateStats(@PathVariable(DashboardConstants.RIC_INSTANCE_KEY) String instanceKey,
+ @Validated @RequestBody StatsDetailsTransport statsSetupRequest) throws StatsManagerException, IOException {
logger.debug("updateStats for instance {} request {}", instanceKey, statsSetupRequest);
appStatsManager.updateStats(instanceKey, statsSetupRequest);
- return ResponseEntity.ok(null);
}
@ApiOperation(value = "Deletes xApp metric status.")