@GET @Path("/clusters/{clusterId}/services/storm/topologies") @Timed public Response getTopologiesByClusterId(@PathParam("clusterId") Long clusterId, @Context SecurityContext securityContext) { SecurityUtil.checkPermissions(authorizer, securityContext, Cluster.NAMESPACE, clusterId, READ); try { StormMetadataService stormMetadataService = new StormMetadataService .Builder(environmentService, clusterId, securityContext, subject).build(); return WSUtils.respondEntity(stormMetadataService.getTopologies(), OK); } catch (EntityNotFoundException | IOException | PrivilegedActionException ex) { throw com.hortonworks.streamline.common.exception.service.exception.request.EntityNotFoundException.byId(ex.getMessage()); } }
@GET @Path("/clusters/{clusterId}/services/storm/mainpage/url") @Timed public Response getMainPageByClusterId(@PathParam("clusterId") Long clusterId, @Context SecurityContext securityContext) { SecurityUtil.checkPermissions(authorizer, securityContext, Cluster.NAMESPACE, clusterId, READ); try { StormMetadataService stormMetadataService = new StormMetadataService .Builder(environmentService, clusterId, securityContext, subject).build(); return WSUtils.respondEntity(Collections.singletonMap("url", stormMetadataService.getMainPageUrl()), OK); } catch (EntityNotFoundException ex) { throw com.hortonworks.streamline.common.exception.service.exception.request.EntityNotFoundException.byId(ex.getMessage()); } } }
@Override public Security getSecurity(Cluster cluster, SecurityContext securityContext, Subject subject) { try { StormMetadataService sms = new StormMetadataService .Builder(environmentService, cluster.getId(), securityContext, subject).build(); return sms.getSecurity(); } catch (Exception e) { throw new RuntimeException(e); } }