use of alien4cloud.exception.ApplicationVersionNotFoundException in project alien4cloud by alien4cloud.
the class ApplicationEnvironmentController method getTopologyId.
@Deprecated
@ApiOperation(value = "Deprecated: Get the id of the topology linked to the environment", notes = "Application role required [ APPLICATION_MANAGER | APPLICATION_DEVOPS ]")
@RequestMapping(value = "/{applicationEnvironmentId:.+}/topology", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("isAuthenticated()")
public RestResponse<String> getTopologyId(@PathVariable String applicationId, @PathVariable String applicationEnvironmentId) {
Application application = applicationService.getOrFail(applicationId);
ApplicationEnvironment environment = applicationEnvironmentService.getOrFail(applicationEnvironmentId);
AuthorizationUtil.checkAuthorizationForEnvironment(application, environment, ApplicationEnvironmentRole.values());
String topologyId = applicationEnvironmentService.getTopologyId(applicationEnvironmentId);
if (topologyId == null) {
throw new ApplicationVersionNotFoundException("An application version is required by an application environment.");
}
return RestResponseBuilder.<String>builder().data(topologyId).build();
}
Aggregations