use of com.hortonworks.streamline.streams.catalog.Topology in project streamline by hortonworks.
the class TopologyActionResource method validateTopologyVersion.
@POST
@Path("/topologies/{topologyId}/versions/{versionId}/actions/validate")
@Timed
public Response validateTopologyVersion(@PathParam("topologyId") Long topologyId, @PathParam("versionId") Long versionId, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, NAMESPACE, topologyId, READ, EXECUTE);
Topology result = catalogService.getTopology(topologyId, versionId);
if (result != null) {
// catalogService.validateTopology(SCHEMA, topologyId);
return WSUtils.respondEntity(result, OK);
}
throw EntityNotFoundException.byVersion(topologyId.toString(), versionId.toString());
}
use of com.hortonworks.streamline.streams.catalog.Topology in project streamline by hortonworks.
the class TopologyActionResource method killTopology.
@POST
@Path("/topologies/{topologyId}/actions/kill")
@Timed
public Response killTopology(@PathParam("topologyId") Long topologyId, @Context SecurityContext securityContext) throws Exception {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, NAMESPACE, topologyId, READ, EXECUTE);
Topology result = catalogService.getTopology(topologyId);
if (result != null) {
actionsService.killTopology(result, WSUtils.getUserFromSecurityContext(securityContext));
return WSUtils.respondEntity(result, OK);
}
throw EntityNotFoundException.byId(topologyId.toString());
}
use of com.hortonworks.streamline.streams.catalog.Topology in project streamline by hortonworks.
the class TopologyActionResource method suspendTopology.
@POST
@Path("/topologies/{topologyId}/actions/suspend")
@Timed
public Response suspendTopology(@PathParam("topologyId") Long topologyId, @Context SecurityContext securityContext) throws Exception {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, NAMESPACE, topologyId, READ, EXECUTE);
Topology result = catalogService.getTopology(topologyId);
if (result != null) {
actionsService.suspendTopology(result, WSUtils.getUserFromSecurityContext(securityContext));
return WSUtils.respondEntity(result, OK);
}
throw EntityNotFoundException.byId(topologyId.toString());
}
use of com.hortonworks.streamline.streams.catalog.Topology in project streamline by hortonworks.
the class TopologyActionResource method killTopologyVersion.
@POST
@Path("/topologies/{topologyId}/versions/{versionId}/actions/kill")
@Timed
public Response killTopologyVersion(@PathParam("topologyId") Long topologyId, @PathParam("versionId") Long versionId, @Context SecurityContext securityContext) throws Exception {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, NAMESPACE, topologyId, READ, EXECUTE);
Topology result = catalogService.getTopology(topologyId, versionId);
if (result != null) {
actionsService.killTopology(result, WSUtils.getUserFromSecurityContext(securityContext));
return WSUtils.respondEntity(result, OK);
}
throw EntityNotFoundException.byVersion(topologyId.toString(), versionId.toString());
}
use of com.hortonworks.streamline.streams.catalog.Topology in project streamline by hortonworks.
the class TopologyLoggingResource method configureLogLevel.
@POST
@Path("/topologies/{topologyId}/logconfig")
@Timed
public Response configureLogLevel(@PathParam("topologyId") Long topologyId, @QueryParam("targetLogLevel") TopologyActions.LogLevel targetLogLevel, @QueryParam("durationSecs") int durationSecs, @Context SecurityContext securityContext) throws Exception {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, NAMESPACE, topologyId, READ);
Topology topology = catalogService.getTopology(topologyId);
if (topology != null) {
TopologyActions.LogLevelInformation logInfo = actionsService.configureLogLevel(topology, targetLogLevel, durationSecs, WSUtils.getUserFromSecurityContext(securityContext));
LogLevelResponse response;
if (logInfo != null) {
response = LogLevelResponse.succeed().of(logInfo).build();
} else {
response = LogLevelResponse.fail().build();
}
return WSUtils.respondEntity(response, OK);
}
throw EntityNotFoundException.byId(topologyId.toString());
}
Aggregations